PreCompose
PreCompose copied to clipboard
[BUG] `NavTransition::createTransition` and `destroyTransition ` not used when navigating
I have defined the following NavTransition:
val slideEnterFromLeftTowardsRight: (width: Int) -> Int = { width -> -width }
val slideExitTowardsLeft: (width: Int) -> Int = { width -> -width }
val slideExitTowardsRight: (width: Int) -> Int = { width -> width }
val slideEnterFromRightTowardsLeft: (width: Int) -> Int = { width -> width }
val defaultNavTransition = NavTransition(
createTransition = slideInHorizontally(
initialOffsetX = slideEnterFromRightTowardsLeft,
),
destroyTransition = slideOutHorizontally(
targetOffsetX = slideExitTowardsRight,
),
pauseTransition = slideOutHorizontally(
targetOffsetX = slideExitTowardsLeft,
),
resumeTransition = slideInHorizontally(
initialOffsetX = slideEnterFromLeftTowardsRight,
),
)
and provided it to the NavHost
like the following:
val navController = rememberNavigator()
NavHost(
modifier = Modifier.fillMaxSize(),
navigator = navController,
initialRoute = "list",
navTransition = defaultNavTransition,
swipeProperties = remember { SwipeProperties() }
) {
scene(
...
}
Bug: When navigating from screen A to B none of the transitions are used. When popping the backstack from B to A I get the expected transition as defined above. Same behaviour on both android and ios.
Have I misconfigured anything or is there a bug in PreCompose?
PreCompose version: 1.6.0