Be a bit smarter about choosing our anchor to animate to.

This commit is contained in:
Alex Hart
2025-11-10 13:19:05 -04:00
parent 62b0e21f67
commit 7d4da76895

View File

@@ -387,9 +387,16 @@ class MainActivity : PassphraseRequiredActivity(), VoiceNoteMediaControllerOwner
}
LaunchedEffect(windowSizeClass) {
val anchor = anchors[paneAnchorIndex]
val index = when {
paneAnchorIndex < 0 -> 1
paneAnchorIndex > anchors.lastIndex -> anchors.lastIndex
else -> paneAnchorIndex
}
paneExpansionState.animateTo(anchor)
if (index in anchors.indices) {
val anchor = anchors[index]
paneExpansionState.animateTo(anchor)
}
}
val chatNavGraphState = ChatNavGraphState.remember(windowSizeClass)