accompanist
accompanist copied to clipboard
[Navigation Material] Bottom sheet navigation
Hi,
I started using navigation-material library for creating navigations for bottom sheet in my app. Version : com.google.accompanist:accompanist-navigation-material:0.26.4-beta
One thing that bothers me while creating a route for my bottom sheet is the ability to tell the properties of my sheet to the navigator. (e.g. ModalBottomSheetState ability to have my sheet non dismissible from outside click).
Current implementation of NavGraphBuilder.bottomSheet doesn't have that a parameter for ModalBottomSheetState.
While if we look for NavGraphBuilder.dialog:
we have dialogProperties: DialogProperties = DialogProperties(),
where user can set properties for dismissOnBackPress & dismissOnClickOutside.
So when can we have something same for NavGraphBuilder.bottomSheet ?
Reassigning to @jossiwolf , I believe this is navigation material related, not system ui controller.
Thanks, Alex!
@hsaddique, what features are you looking for specifically? We are not going to make the ModalBottomSheetState
accessible as we rely on its configuration to be correct for things to work, but we can take feature requests.
Hi @jossiwolf, Thanks for your reply. Like if we have 2 sheets and we want to make one sheet dismissable on outside click and other undismissable, we cannot do that. Moreover if want to change the scrim color of on sheet separate from the other currently we can't. So just like, dialog composable have DialogProperties can we have BottomSheetProperties or BottomSheetState for bottomsheet composable as well?
Hi @jossiwolf any update on this ?
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
We will think about ways to address this when adding support for skipHalfExpanded
. We are currently landing important changes upstream and will work on these issue after.
Hi @jossiwolf, Any update on this ?
I saw another issue related to bottom sheet navigation. Whenever I open a bottom sheet and call navController.popbackstack() to close it, it closes fine but the scrim color of that sheet still shows on the screen thus user has to click on screen again to dismiss that scrim color (which i think is the Surface composable)
@hsaddique I also faced a weird behavior when using NavGraphBuilder.bottomSheet(..), especially when closing it.
When you tap outside of the bottom sheet, you will find that modalBottomSheetState.hide()
is called internally.
So, when you want to dismiss the bottom sheet when tapping on a button, try to call modalBottomSheetState.hide()
instead of navController.popbackstack()
.
I tried that, and it works for me.
With the release of Compose Material 1.7.0-alpha04, the Material team has added a new artifact: androidx.compose.material:material-navigation
, which fully replaces Accompanist Navigation Material.
As such, we are closing all issues here on Accompanist and will be fully deprecating Accompanist Navigation Material in an upcoming release.
A number of issues were fixed as part of the migration, but if you're still seeing an issue, please file an issue with a sample project that reproduces your issue and the Material team will take a look.