-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] NavTransition::createTransition
and destroyTransition
not used when navigating
#321
Comments
Hi, do you have a more complete example for this? since I can not reproduce this issue. |
Here is my code up until the nav configuration:
and here is a screen recording of how it works with that code (the list screen is A, and the details screen is B): recording.movDoes this help illustrate what my problem is? |
NavTransition::createTransition
and createTransition
not used when navigatingNavTransition::createTransition
and destroyTransition
not used when navigating
Sorry, it is still quite hard to figure out the issue. I tried to use the sample app to reproduce the issue, but without success. |
Almost same here. scene(
route = NavigationTree.AuthFlow.Login.name,
navTransition = getNavTransition(
createDirection = {
if (previousEntry?.route?.route == NavigationTree.AuthFlow.Main.name) SlideDirection.Left
else SlideDirection.Right
},
destroyDirection = {
if (previousEntry?.route?.route == NavigationTree.AuthFlow.Main.name) SlideDirection.Left
else SlideDirection.Right
}
)
) {
SomeComposable()
} fun getNavTransition(
createDirection: () -> SlideDirection,
destroyDirection: () -> SlideDirection,
pauseDirection: () -> SlideDirection = destroyDirection,
resumeDirection: () -> SlideDirection = createDirection
): NavTransition {
return object : NavTransition {
override val createTransition: EnterTransition
get() = slideIntoContainer(createDirection())
override val destroyTransition: ExitTransition
get() = slideOutOfContainer(destroyDirection())
override val pauseTransition: ExitTransition
get() = slideOutOfContainer(pauseDirection())
override val resumeTransition: EnterTransition
get() = slideIntoContainer(resumeDirection())
}
} When I navigate to this screen using this code: val toLoginScreen: () -> Unit = remember {
{
navigator.navigate(
route = NavigationTree.AuthFlow.Login.name
)
}
} navigation works as expected! scene is recomposing, it's navTransition triggers and checking previous entry and I'm getting correct slide direction. But if i use NavOptions: val toLoginScreen: () -> Unit = remember {
{
navigator.navigate(
route = NavigationTree.AuthFlow.Login.name,
options = NavOptions(
popUpTo = PopUpTo.First()
)
)
}
} scene is not recomposing, it's navTransition not recalculating and i get wrong direction. Checking with debug stop points at "if(....)". With NavOptions PopUpTo it's not stopping there |
I have defined the following NavTransition:
and provided it to the
NavHost
like the following: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
The text was updated successfully, but these errors were encountered: