Simplifying a question I asked earlier: I need a ...
# compose
c
Simplifying a question I asked earlier: I need a modal bottom sheet that is only ever HIDDEN or EXPANDED. I never want it to be in a half-expanded state. Is that possible when using
ModalBottomSheetLayout
?
t
I think you can use
confirmStateChange
and reject if the status change to
HalfExpanded
. Once you do that the user have to swipe longer distance to close the bottom sheet. Another way is to extend the
ModalBottomSheetState
and set is
isHalfExpandedEnabled
to false
c
This might be a dumb question... but by "extend" ModalBottomSheetState, how would you do that?
I tried this too for your first suggestion, but not really sure how to use that api.
Copy code
val bottomSheetState =
    rememberModalBottomSheetState(initialValue = ModalBottomSheetValue.Hidden, 
        confirmStateChange = {modalBottomSheetValue: ModalBottomSheetValue ->
        false
    })
Going to look up more docs/source now
Ah sweet. This worked
Copy code
rememberModalBottomSheetState(ModalBottomSheetValue.Hidden, confirmStateChange = {
    it != ModalBottomSheetValue.HalfExpanded
})
Thanks @Tin Tran
🙌 1
t
Cool! You're welcome