https://kotlinlang.org logo
#compose
Title
# compose
j

james

02/04/2022, 6:00 AM
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

Ian Lake

02/04/2022, 7:12 AM
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

Colton Idle

02/04/2022, 3:56 PM
The analysis paralysis I have when trying to decide whether to use a modalBottomSheet or a new bottomSheet destination... 😅
4 Views