Disable NavHost animation

Viewed 541

Is there any option to disable the CrossFade animation when navigating in Jetpack Compose?

In the source code, I see that the CrossFade is simply hardcoded, and in AnimatedNavHost from "accompanist" I can't locate such an option.

1 Answers

After digging i found the following solution:

In the AnimatedNavHost composable, we need to specify 'empty' transitions.

 AnimatedNavHost(
                    navController = navController,
                    startDestination = "main",
                    enterTransition = { _, _ -> EnterTransition.None},
                    exitTransition = { _, _ -> ExitTransition.None}
                ) 
Related