-
Notifications
You must be signed in to change notification settings - Fork 27
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
Navigate to a new destination and pop backstack upto the new destination #28
Comments
I have achieved the similar behaviour by the following code
With that said, the new destination doesn't animate in. It just appears abruptly. |
@msa1422 Your suggestion looks nice. For animation, unfortunately, that's a system limitation. The best you can do is delay push call a bit, that will make sure |
I tried your suggestion like such
But result is still the same as before, HomeScreen appears without any animation. I think it is because the delay doesn't matter if the call sequence is the same. Push first and pop after delay also doesn't work because splashScreenRoute remains in backstack somehow. As a workaround, I have added an opacity animation in SplashScreen and in onAppear of HomeScreen to create a crossfade effect. |
Can you try |
Sure. I will try it within 2-3 days. |
Hi @msa1422 Have you had a chance to try it yet? |
Hi.
Please let me know, if there is any other way to navigate in such a pattern. I will test it and let you know. |
Case 1 is the correct one, you need to pop first and then push the route. Maybe you can try |
In one of my android apps, I have set initial screen to SplashScreen. SplashScreen is responsible for a local database transaction and a couple of network transactions. After transactions, user is navigated to HomeScreen and SplashScreen is removed from the backstack. Is such a behaviour is possible with UIPilot?
One more use case is when navigating from SplashScreen to AuthScreen, then AuthScreen to OnBoardingScreen, then OnBoardingScreen to InitialSettingsScreen and finally from InitialSettingsScreen to HomeScreen. In this use case, all the screens in the backstack should be popped when HomeScreen is reached.
In android, there is a convenience method in NavigationController called "builder.popUpTo(route: String)" which does exactly the same thing that I have mentioned.
Reference from Android docs:
https://developer.android.com/reference/kotlin/androidx/navigation/NavOptions#popUpToRoute()
The text was updated successfully, but these errors were encountered: