-
-
Notifications
You must be signed in to change notification settings - Fork 518
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
fix: check if view is not null #671
Conversation
Already accepted this, but after looking at #646 it'd be good to understand what are the cases when the view is null. It may be the case that we should never expect view to be null at this point and the fact it isn't defined is some other issue surfaced this way |
It can be caused by the asynchronous transitions between screens, but I am not sure. cc @janicduplessis, maybe you have a clue why there can be null already? Also, @kmagiera should I merge it as a temporary workaround? |
I think it could be caused by the fragment being destroyed during the animation. Not sure how this can happen, maybe if an ancestor view of the fragment is removed? |
IMO this is safe to be merged. The crash means that fragment that ends animation is no longer mounted. In that case there see to be no benefit of dispatching the "end transition" event we use the animation listener for because the receiver no longer exists anyway. |
362acc5
to
bc4d848
Compare
@kmagiera and @janicduplessis I can confirm this does fix the issue, but if you are still trying to work out how to replicate it, its with any nested stack navigator and spamming the android back button to dismiss the nested stack. Navigate to the "Yellow" screen and spam the android device back button in quick succession and it will cause the crash at #646
|
Thanks @owinter86 for sending that. I still want to investigate to see if the fix does not actually put the stack in some weird state regardless of the fact that it no longer crashes. Will try that later this week. Thanks so much! |
The repro case @owinter86 worked and managed to get the crash w/o this patch applied. This also helped me investigate the case in more depth and now have full confidence about this fix. As suspected the crash was due to the fact that the stack would unmount while performing animation. In the repro case we do exacly that by hitting back button twice: first back starts transition on the nested stack while the second is transitions the parent stack. In such a case the proposed patch would prevent us from calling |
Added a check for if
View
is a null. Should resolve #646.