10

I know that a normal bottom sheet can be setup like this

rememberModalBottomSheetState(
  initialValue = ModalBottomSheetValue.Hidden, 
  confirmStateChange = { it != ModalBottomSheetValue.HalfExpanded },
)

So that it will never be half expanded. But what if I want to do the same in Accompanist navigation with bottomsheets?

mama
  • 2,046
  • 1
  • 7
  • 24

1 Answers1

14

I figured out how to do it.

val sheetState = rememberModalBottomSheetState(
    initialValue = ModalBottomSheetValue.Hidden,
    skipHalfExpanded = true
)
val bottomSheetNavigator = remember { BottomSheetNavigator(sheetState) }
val navController = rememberAnimatedNavController(bottomSheetNavigator)

Instead of using rememberBottomSheetNavigator() you can just use the constructor of BottomSheetNavigator which takes a sheetstate which can be set with a simple boolean. :)

mama
  • 2,046
  • 1
  • 7
  • 24