Provide a method to make the bottom sheet non-cancellable for some use-cases.
See original GitHub issueDescribe the bug
Provide a method to make the bottom sheet non-cancellable for some use-cases.
Expected behaviour
When a user clicks the back button or the outside content of the bottom sheet, then it dismisses. However, there should be a way to control that behaviour based on a flag that the bottom sheet should not dismiss. It should only dismiss via calling navGraph.navigateBack()
.
Environment:
- Android OS version: [Android 11.0]
- Device: [Samsung M20]
- Accompanist version: [0.17.0]
Issue Analytics
- State:
- Created 2 years ago
- Reactions:10
- Comments:12
Top Results From Across the Web
Make your BottomSheetDialog noncancelable - beta - Medium
Here's a workaround to make your bottom sheet dialog noncancelable. Let's find out what makes our bottom sheets canceled first. As mentioned above...
Read more >Prevent dismissal of BottomSheetDialogFragment on touch ...
According to the BottomSheet specification bottom sheets can be dismissed by touching outside of the bottom sheet, therefore what are my options ...
Read more >How to Create a Bottom Sheet With Jetpack Compose
Bottom sheets are UI sheets that the user can drag up and down to show or reveal UI components. Very useful! ⭐ Get...
Read more >Modal Bottom Sheets - Material Design
Using bottom sheets. Before you can use Material bottom sheets, you need to add a dependency to the Material Components for Android library....
Read more >Basel III: Finalising post-crisis reforms
banks incorporated in jurisdictions that do not allow the use of external ... In case of off-balance sheet claims, the gross amount would...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@dilraj-singh1997 Thanks for the feature request. The bottom sheet will always be dismissed when the associated destination is popped of the back stack (such as is the case when going back). I will look into exposing a flag that mirrors
ModalBottomSheetLayout'
sgesturesEnabled
flag to disable dismissal by touching outside of the sheet.@ravitejasc Please don’t do this -
BottomSheetNavigator
relies on implementation details ofModalBottomSheetState
to work. OverridingconfirmStateChange
does not guarantee this to work and is a good way to get the navigator out of sync. This constructor ofBottomSheetNavigator
might be madeinternal
in the future.@dimitriz09 As a workaround, I returned false in
confirmStateChange
ofrememberModalBottomSheetState
and it worked for me.