Cannot use BottomSheets navigation without AnimatedNavigator

See original GitHub issue

Example how I’d expect it work:

@Composable
fun DefaultNavHost() {
    val bottomSheetNavigator = rememberBottomSheetNavigator()
    val navController = rememberNavController(bottomSheetNavigator)
    ModalBottomSheetLayout(
        bottomSheetNavigator = bottomSheetNavigator,
        sheetShape = defaultSheetShape,
        sheetBackgroundColor = BgDefault
    ) {
        DestinationsNavHost(
            navController = navController,
            navGraph = NavGraphs.root,
            dependenciesContainerBuilder = {
                val onboardingViewModel: OnboardingViewModel = get()
                dependency(onboardingViewModel)
            }
        )
    }
}

I would like to avoid using animations-lib in my project because they change default animation that I need. The code above gives error:

FATAL EXCEPTION: main
java.lang.IllegalStateException: You need to use 'rememberAnimatedNavHostEngine' to get an engine that can use BottomSheet and pass that into the 'DestinationsNavHost'

OK, I add this line engine = rememberAnimatedNavHostEngine(), Now error is:

FATAL EXCEPTION: main
java.lang.IllegalStateException: Could not find Navigator with name "animatedComposable". You must call NavController.addNavigator() for each navigation type.

so I assume it’s impossible to use BottomSheets without animation. However, that is possible with pure Compose navigation. Can this be fixed? Or what I’m doing wrong

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
raamcostacommented, Oct 11, 2022

The reason is to disable transactions right? If I have some time today I’ll look into it. It should be similar to what you did, I’ll let you know 🙂

1reaction
raamcostacommented, Oct 11, 2022

NavGraphs.root.nestedGraphs() or something similar to get nested graphs 😁

Creating your own engine is something you definitely shouldn’t need to do though. Disabling animations should be easy. I’ve done it in the past similar to what you did, but I cannot remember from top of my head 🤔

Read more comments on GitHub >

github_iconTop Results From Across the Web

37. Bottom sheets with Accompanist Nav - with Jossi Wolf
Two Italian coders live-stream their sweary, mostly unsuccessful attempts at coding stuff and learning Jetpack Compose.
Read more >
Use bottomsheet's action to open another dialogfragment ...
I want to be able to choose an action from B, dismiss B to go back to A, then use the navigation livedata...
Read more >
[Idea] Add ability to fully expanded BottomSheetNavigator by ...
I'm trying to migrate some bottom sheets from "ScafoldBottomSheet" to the new Navigation Compose Material, however, I cannot find a way to start...
Read more >
Sheets: bottom - Material Design
Indirect navigation between items, such as videos in a playlist. Expanding bottom sheets are recommended for use on mobile and tablet.
Read more >
Introducing Navigation-Material 🎨️ | by Jossi Wolf - Medium
Navigating. You can navigate to bottom sheets just like any other destination: You can navigate away from bottom sheet destinations as usual, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found