Compare commits

...

1 Commits

Author SHA1 Message Date
Samuel Newman a03106cc57 fix bottom sheet keyboard expansion with preventExpansion on android
When preventExpansion is true, the maxHeight cap prevented the sheet
from expanding when the keyboard opened. Lift the cap temporarily when
the keyboard appears (updateLayout restores it on dismiss). Also
broadened the state check to handle SETTLING state during rapid
keyboard open/close.

Fixes #9943

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-01 18:57:42 +02:00
@@ -254,8 +254,16 @@ class BottomSheetView(
val wasKeyboardVisible = isKeyboardVisible
isKeyboardVisible = imeVisible
if (imeVisible && behavior?.state == BottomSheetBehavior.STATE_HALF_EXPANDED) {
behavior.state = BottomSheetBehavior.STATE_EXPANDED
if (imeVisible && behavior != null && bottomSheet != null && behavior.state != BottomSheetBehavior.STATE_EXPANDED && behavior.state != BottomSheetBehavior.STATE_HIDDEN) {
if (preventExpansion) {
behavior.maxHeight = (screenHeight - getStatusBarHeight()).toInt()
bottomSheet.requestLayout()
bottomSheet.post {
behavior.state = BottomSheetBehavior.STATE_EXPANDED
}
} else {
behavior.state = BottomSheetBehavior.STATE_EXPANDED
}
} else if (!imeVisible && wasKeyboardVisible) {
updateLayout()
}