Currently I am using Jetpack compose and use ModalBottomSheetLayout to display the bottom sheet.
How to hide sheetState when back pressed?
You can use BackHandler ..
Something like this .
val modalBottomSheetState = rememberModalBottomSheetState(initialValue = ModalBottomSheetValue.Hidden)
ModalBottomSheetLayout() {
Scaffold() { innerPadding ->
// Content goes here
BackHandler(enabled = modalBottomSheetState.isVisible) {
coroutineScope.launch {
modalBottomSheetState.hide()
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With