'How can I make an accompanist navigation BottomSheet fully expanded?

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?



Solution 1:[1]

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. :)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mama