Skip to content

Instantly share code, notes, and snippets.

@KaustubhPatange
Last active June 3, 2022 05:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KaustubhPatange/e8386467a5f5e1c9a62f78ef89246798 to your computer and use it in GitHub Desktop.
Save KaustubhPatange/e8386467a5f5e1c9a62f78ef89246798 to your computer and use it in GitHub Desktop.
// Consider destinations First, Second, Third
@Composable
fun Main() {
...
AnimatedNavHost(navController = rememberNavController(), startDestination = "") {
composable(
route = "First",
enterTransition = {
when(initialState.destination.route) {
"Second" -> fadeIn() + slideIn(initialOffset = { IntOffset(-it.width, 0) })
else -> fadeIn()
}
},
exitTransition = { fadeOut() + slideOut(targetOffset = { IntOffset(-it.width, 0)}) }
) {
// content...
}
composable(
route = "Second",
...
)
composable(
route = "Third",
...
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment