Skip to content

Commit

Permalink
fix(navigation): use proper transition direction
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommy-Geenexus committed Nov 3, 2024
1 parent 2a8527f commit a3e9ea3
Showing 1 changed file with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ fun NavGraph(
) {
composable<NavDestinations.Setup>(
enterTransition = {
materialSharedAxisXIn(forward = true, slideDistance = slideDistance)
materialSharedAxisXIn(forward = false, slideDistance = slideDistance)
},
exitTransition = {
materialSharedAxisXOut(forward = false, slideDistance = slideDistance)
materialSharedAxisXOut(forward = true, slideDistance = slideDistance)
}
) {
SetupScreen(
Expand All @@ -82,11 +82,19 @@ fun NavGraph(
) {
materialSharedAxisXIn(forward = true, slideDistance = slideDistance)
} else {
materialSharedAxisZIn(forward = true)
materialSharedAxisZIn(forward = false)
}
},
exitTransition = {
materialSharedAxisZOut(forward = false)
if (initialState
.destination
.route
?.endsWith(NavDestinations.Setup.toString()) == true
) {
materialSharedAxisXOut(forward = false, slideDistance = slideDistance)
} else {
materialSharedAxisZOut(forward = true)
}
}
) {
ControlScreen(
Expand All @@ -97,7 +105,14 @@ fun NavGraph(
navController.navigate(NavDestinations.Settings)
},
onNavigateToSetup = {
navController.navigate(NavDestinations.Setup)
navController.navigate(
route = NavDestinations.Setup,
navOptions = navOptions {
popUpTo(route = NavDestinations.Control) {
inclusive = true
}
}
)
}
)
}
Expand Down

0 comments on commit a3e9ea3

Please sign in to comment.