How to turn off screen transitions Kotlin Multiplatform

In this article we will find answers to the following questions:

  • turn off screen animation Kotlin Multiplatform
  • turn off screen transition Multiplatofmr
  • change screen transition
  • screen animation Jetpack Compose
  • change screen transition

Suppose we have the following navigation host:

NavHost(navController = navController, startDestination = Screen.FirstScreen.route) {
    composable(Screen.FirstScreen.route) {
        FirstScreen(navController)
    }
    composable(Screen.SecondScreen.route) {
        SecondScreen(navController)
    }
}

All we need to do is to set up value for enterTransition and exitTransition. If needed, you may want to look at popEnterTransition and popExitTransition as well.

In this example we just turn off the transitions:

NavHost(navController = navController, startDestination = Screen.FirstScreen.route) {
    composable(
        route = Screen.FirstScreen.route,
        enterTransition = { EnterTransition.None },
        exitTransition = { ExitTransition.None },
    ) {
        LoginScreen(navController)
    }
    composable(
        route = Screen.SecondScreen.route,
        enterTransition = { EnterTransition.None },
        exitTransition = { ExitTransition.None }
    ) {
        SecondScreen(navController)
    }
}

Telegram channel

If you still have any questions, feel free to ask me in the comments under this article or write me at promark33@gmail.com.

If I saved your day, you can support me 🤝