Weird back stack motion behavior on nested graph
See original GitHub issueI have 4 navigation routes: first, second, third, fourth.
When i try to navigate first
-> second
-> third
-> fourth
, the transitions behave normally as it should.
However when i try to navigate back (back press) first
<- second
<- third
<- fourth
, the only transition that behave normally is the first pop backstack (in this case third
<- fourth
), other pop backstack just overlaps the current backstack.
I’m not sure how to explain it well but i have included a sample project for testing it here and a video here
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Android Jetpack Navigation nested tab backward navigation ...
Yes, that back stack is expected (bottom nav always goes back through the startDestination of the graph, but doesn't go through intermediate ...
Read more >Nested navigation graphs - Android Developers
The nested graph encapsulates its destinations. As with a root graph, a nested graph must have a destination identified as the start destination ......
Read more >Stack is not restored for nested NavHostFragments [122770335]
My expected behavior is that the inner NavHostFragment stack is cleared by step 4 and the back button will navigate the user to...
Read more >Motion User Guide (PDF) - Apple Support
Motion is a behavior-driven motion graphics application used to create stunning imaging effects in real time for a wide variety of broadcast, video, ......
Read more >Using nested graph for a bottom bar destination recreates its ...
B is declared in a nested graph that is embedded in route so that some destination starting from B cannot be started from...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
working perfectly fine, thank you for the release!
I checked this issue.
MaterialMotion
is implemented based onAnimatedContent
in Jetpack Compose Animation. And inAnimatedContent
, I confirmed that the order of content is reversed when ‘pop’.The followings are sample codes using accompanist
AnimatedNavHost
based onAnimatedContent
.I found this issue before, and added the following code to fix it. https://github.com/fornewid/material-motion-compose/blob/main/core/src/main/java/soup/compose/material/motion/MaterialMotion.kt#L85
However, you have confirmed that this fix is not perfect either. So I have to think about new fixes.
However, this is only a temporary patch. Finally, I should request to add a feature to
AnimatedContent
.