Status Update
Comments
il...@google.com <il...@google.com> #2
That comment is not relevant - that case only applies if you've changed your whole graph structure midway through your app running, it has nothing to do with any navigate
call.
Navigation is a wrapper around AnimatedContent
, passing your transitions to it with the current screen - it does not actually run any transitions itself.
There have been some changes in Navigation 2.8 specifically around switching to SeekableTransitionState
and allowing you to set the SizeTransform
you want, so if you're still able to reproduce bad transitions, please include a sample project that reproduces them.
fr...@gmail.com <fr...@gmail.com> #3
Ok, I'll try and put something together to demo the bug.
By the way, I'm trying out 2.8.0-alpha08
and the bug is still present. I'm also seeing a couple of serious new issues. I don't want to derail this bug ticket, but I'll go ahead and log them:
- Lots of error logs when transitioning for
FrameEvents my.package E updateAcquireFence: Did not find frame.
- Transitions have significant startup lag where it appears to be dropping a lot of frames when starting. Might be related to errors.
- Race condition where back stack gets in an incorrect state when rapidly adding and popping a page. I'm seeing my root page occasionally get popped instead of my page on top of the stack.
fr...@gmail.com <fr...@gmail.com> #4
I've created a minimal reproduction case here:
Steps to reproduce:
- Click "Page 2" to navigate to Page 2.
- Click "Back" button within 1 second to navigate back to Page 1.
- Observe the weird "zoom from center" transition that occurs.
In the video, I first demonstrate working navigation, where I'm waiting at least 1 second to let the main thread unblock. Then, I navigate rapidly while the main thread is blocked, which triggers the weird transition.
ty...@gmail.com <ty...@gmail.com> #5
I ran into a similar issue with
Race condition where back stack gets in an incorrect state when rapidly adding and popping a page. I'm seeing my root page occasionally get popped instead of my page on top of the stack.
For me I had a nav graph with destination A -> B. If during this transition I used system back the screen content would not update but the nav controller stack was.
So if I did A -> B -> back during transition, the back transition did not occur and the B composable was still showing. Using system back again would finish the activity since the nav controller thinks the stack only has 1 entry.
Butttt, I then enabled predictive back in the manifest with
android:enableOnBackInvokedCallback="true"
and now it seems to work just fine
ty...@gmail.com <ty...@gmail.com> #6
Although this only seems to work for devices that support predictive back. Pixel Fold running Android 15 beta works great, Pixel 6A running Android 13 still has the problem.
ty...@gmail.com <ty...@gmail.com> #7
Updated my Pixel 6A to Android 14 and now it also works. Hopefully this is helpful..
fe...@gmail.com <fe...@gmail.com> #8
ty...@gmail.com <ty...@gmail.com> #9
2.8.0-beta04 fixed the issues I was having :)
il...@google.com <il...@google.com> #10
That's great to hear. Please file a new issue with a sample project if you're still seeing any lingering issues after upgrading to Navigation 2.8.0-beta04 or higher.
bi...@gmail.com <bi...@gmail.com> #11
Also easily reproducted with a bottom NavigationBar when navigating quickly from a NavigatinoBarItem to another with
drawerNavController.runCatching {
drawerNavController.navigate(item.route) {
popUpTo(drawerNavController.graph.findStartDestination().id) {
saveState = true
}
launchSingleTop = true
restoreState = true
}
}
Description
Component used: Navigation Version used: 2.7.7 Devices/Android versions reproduced on: Emulator API level 33
When navigating too quickly or when clearing the back stack, compose navigation does a weird expanding transition. It appears to be running a SizeTransform from 0 to the current page size, instead of going from the previous page size to the current page size. This is visually jarring and definitely not desired behavior. Looking at the source of
NavHost
, there's a comment that seems relevant:Some ideas for fixing this could be:
NavHost
has a fixed size due to constraints, which I suspect is most of the time. Since I'm using this for full-page navigation, I'm usingfillMaxSize()
on the NavHost.Here's some sample code that replaces the back stack with a new route, causing the weird transition:
Here's a stackoverflow question that appears to be the same issue, there's a video linked in the question:https://stackoverflow.com/questions/77542610/strange-jetpack-compose-navigation-transition-behavior