Skip to content
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

[Navigation Animation] Avoid crashing when the start destination changes #1243

Merged
merged 1 commit into from Jul 13, 2022

Conversation

jbw0033
Copy link
Collaborator

@jbw0033 jbw0033 commented Jul 12, 2022

Since moving to using visibleEntries, if you change your start
destination dynamically, instead of dropping the graph and rebuilding,
the AnimatedNavHost crashes.

The reason for this crash is that setting the graph synchronously pops
the entire back stack, which clears all of the visibleEntries so there
is a frame in AnimatedNavHost where it fails to find any of the old
entries.

We should move setNavGraph over to using the popWithTransition function,
but there is pre-req works that needs to be done. So as a stop gap, we
will return null from visibleEntries and disable the animations on
AnimatedNavHost.

Fixes #1162

Since moving to using visibleEntries, if you change your start
destination dynamically, instead of dropping the graph and rebuilding,
the AnimatedNavHost crashes.

The reason for this crash is that setting the graph synchronously pops
the entire back stack, which clears all of the visibleEntries so there
is a frame in AnimatedNavHost where it fails to find any of the old
entries.

We should move setNavGraph over to using the popWithTransition function,
but there is pre-req works that needs to be done. So as a stop gap, we
will return null from visibleEntries and disable the animations on
AnimatedNavHost.

Fixes google#1162
@jbw0033 jbw0033 requested review from ianhanniballake Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants