when using `ModalBottomSheetLayout`, is there a st...
# compose
j
when using `ModalBottomSheetLayout`*,* is there a straightforward way to catch a press of the back button and just dismiss the bottom sheet, rather than navigating back entirely? at the moment when I hit back, the entire screen behind the
ModalBottomSheetLayout
is popped too, and I'm trying to avoid that behaviour
1
actually I've just figured this out. if you don't want to go as far as pushing things up through your navigation layer, you can simply use a
BackHandler
and tie its enabled state to your ModalBottomSheetLayout's state (visible or not) seems to work well
@Colton Idle I see you +1'd my question - I hope my own answer might be helpful to you?
👍 1
i
Yep, either use a BackHandler or use Accompanist Navigation Material and have your bottom sheet be a destination in your Navigation graph: https://google.github.io/accompanist/navigation-material/
c
The analysis paralysis I have when trying to decide whether to use a modalBottomSheet or a new bottomSheet destination... 😅