Problem
On Android (reproduced on 3.11.11 and still present in 3.11.12), open a sheet with a TextInput, focus it so the keyboard shows, then drag the sheet. The keyboard hides but the sheet stays at the keyboard-inflated height, leaving an empty gap at the bottom.
Cause
handleDragBegin sets detentIndexBeforeKeyboard = -1 (commits the inflated height). keyboardDidHide then calls setupSheetDetents(applyState = false), so BottomSheetBehavior never snaps back to the non-keyboard detent.
Fix
In keyboardDidHide, re-apply state when the pre-keyboard detent was already committed:
val shouldReapplyState = detentIndexBeforeKeyboard < 0
detentIndexBeforeKeyboard = -1
isKeyboardDismissProgrammatic = false
setupSheetDetents(applyState = shouldReapplyState)
Still broken on latest stable 3.11.12.
Problem
On Android (reproduced on 3.11.11 and still present in 3.11.12), open a sheet with a TextInput, focus it so the keyboard shows, then drag the sheet. The keyboard hides but the sheet stays at the keyboard-inflated height, leaving an empty gap at the bottom.
Cause
handleDragBeginsetsdetentIndexBeforeKeyboard = -1(commits the inflated height).keyboardDidHidethen callssetupSheetDetents(applyState = false), so BottomSheetBehavior never snaps back to the non-keyboard detent.Fix
In
keyboardDidHide, re-apply state when the pre-keyboard detent was already committed: