Open captainhaddockfr35 opened 2 years ago
Hey 👋
yeah this is a known issue with accompanist bottom sheet. There is not much to be done I believe other than opening an issue on accompanist to pressure them to implement the functionality.
You can always just use the bottom sheet from material of course. The difference is that it won’t be registered as a destination in the navigation host, but as long as you have a state saved like on SavedStateHandle, you should be fine, to resume the bottom sheet for a given screen. Of course it won’t be as standalone thing, but you can make it work for sure 🙂
Here is a workaround if you are using ModalBottomSheet.
val sheetState = rememberModalBottomSheetState(
initialValue = ModalBottomSheetValue.Hidden,
skipHalfExpanded = true,
confirmStateChange = { false }
)
val bottomSheetNavigator = remember { BottomSheetNavigator(sheetState) }
navController.navigatorProvider += bottomSheetNavigator
Just a note - for "confirmStateChange = { false }" it is better to return "true" as otherwise you'll be unable to close the bottom sheet by swiping it down
Here is a workaround if you are using ModalBottomSheet.
val sheetState = rememberModalBottomSheetState( initialValue = ModalBottomSheetValue.Hidden, skipHalfExpanded = true, confirmStateChange = { false } ) val bottomSheetNavigator = remember { BottomSheetNavigator(sheetState) } navController.navigatorProvider += bottomSheetNavigator
I believe, not possible for MT3
Hi,
I would like to use the BottomSheet Style. It works but I would like the sheet to open in expanded state, as is possible with androidx.compose.material.ModalBottomSheetLayout but not with accompanist. If I use com.google.accompanist.navigation.material.ModalBottomSheetLayout, the BottomSheet opens fine, but I can't open it in full screen (Expanded). If I use androidx.compose.material.ModalBottomSheetLayout I can tell it to open as Expanded but the bottomSheet does not open.
Did you have an idea ?