I am trying to add bottom sheet destinations using...
# compose
y
I am trying to add bottom sheet destinations using the material navigation accompanist but it keeps throwing this exception:
java.lang.IllegalStateException: Could not find Navigator with name "BottomSheetNavigator". You must call NavController.addNavigator() for each navigation type.
This is my code:
Copy code
val navController = rememberAnimatedNavController()
val bottomSheetNavigator = rememberBottomSheetNavigator()

ModalBottomSheetLayout(bottomSheetNavigator) {
        AnimatedNavHost(
            navController = navController,
            startDestination = startDestination,
            enterTransition = { _, _ ->
                fadeIn()
            },
            popEnterTransition = { _, _ ->
                fadeIn()
            },
            exitTransition = { _, _ ->
                fadeOut()
            },
            popExitTransition = { _, _ ->
                fadeOut()
            },
        ) {
 // Destinations
i
The error tells you what is wrong: you didn't add the navigator to the NavController. As per the Navigation Material docs , you should be doing:
Copy code
val bottomSheetNavigator = rememberBottomSheetNavigator()
val navController = rememberNavController(bottomSheetNavigator)
🙌 1
y
uh... I missed that param. I feel dumb. Thanks
403 Views