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

Native Stack, React-nativation 5, white screen when navigating back #556

Closed
sa8ab opened this issue Jul 6, 2020 · 34 comments · Fixed by #1066
Closed

Native Stack, React-nativation 5, white screen when navigating back #556

sa8ab opened this issue Jul 6, 2020 · 34 comments · Fixed by #1066
Labels
Bug Something isn't working Platform: Android This issue is specific to Android
Projects

Comments

@sa8ab
Copy link

sa8ab commented Jul 6, 2020

When navigating forward and back using back button in the header, sometimes ( like after 3, 4 ) times of navigating the first screen becomes white ( as it appears ).

Happens on Android not tested on IOS

how to reproduce

create a native stack navigator using react navigation and move forward and back by pressing the back button in the header.

ezgif com-video-to-gif(2)

@WoLewicki
Copy link
Member

I cannot repro this. Can you provide a repo where this happens?

@WoLewicki WoLewicki added Bug Something isn't working Missing repro This issue need minimum repro scenario labels Jul 6, 2020
@sa8ab
Copy link
Author

sa8ab commented Jul 6, 2020

@WoLewicki here is the repo. I made it for Reanimated but I noticed this one as well, so don't mind the name.

https://github.com/sa8ab/reproducing-reanimated-issue

@WoLewicki WoLewicki added Platform: Android This issue is specific to Android and removed Missing repro This issue need minimum repro scenario labels Jul 6, 2020
@beqramo
Copy link

beqramo commented Jul 6, 2020

I face same issue on "react-navigation": "^4.4.0" . it is a real one, it only occours when enableScreens() is called

@WoLewicki

@WoLewicki
Copy link
Member

Yes, I have managed to reproduce it.

@WoLewicki
Copy link
Member

@beqramo did you manage to make this bug appear every time, not randomly? It would be very helpful for debugging.

@beqramo
Copy link

beqramo commented Jul 6, 2020

@WoLewicki I have no clue when it happens sorry

@WoLewicki
Copy link
Member

I am getting such an Error in Logcat of Android Studio when this bug happens:
image
Can someone spot the same thing? Looks like it is the source of the problem.

@sa8ab
Copy link
Author

sa8ab commented Jul 6, 2020

@WoLewicki It happens sometimes on navigating back for the second time, sometimes takes longer, as if you notice the screen recording it happened after 20 seconds or so.

@WoLewicki
Copy link
Member

#556 (comment)
I debugged it more and this Error is not connected strictly to the bug. It just appears when you click on an empty View.

@WoLewicki
Copy link
Member

Can you try and change https://github.com/software-mansion/react-native-screens/blob/master/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.java#L189 to mCurrentTransaction.commitNowAllowingStateLoss(); and see if there are any regressions and if the bug does disappear? Also, could you provide a repo for the #309 since I cannot repro it in release build?

@sa8ab
Copy link
Author

sa8ab commented Jul 9, 2020

I changed the following line from node_modules and rebuilt the project as the result the bug seemed to be disappeared ( I couldn't face the white screen on navigating multiple times for 20 seconds or so ). plus the transition had changed a bit as well. here is the screen recording.
ezgif com-video-to-gif(3)

Should I test in release build as well? @WoLewicki

@WoLewicki
Copy link
Member

I would be grateful if you could.

@chismadalina
Copy link

It happens for me as well with React Navigation 5 and screens enabled.

@WoLewicki
Copy link
Member

@chismadalina does it happen after applying this: #556 (comment)? And are there any other issues after doing so?

@chismadalina
Copy link

@chismadalina does it happen after applying this: #556 (comment)? And are there any other issues after doing so?

@WoLewicki it does fix the issue when navigation back but then I have a white flicker when I enter the screen, only on some screens.

@WoLewicki
Copy link
Member

Can you provide minimal code that shows the flickering after that change?

@chismadalina
Copy link

@WoLewicki I don't think the code of the screen will help as it happens in different screens

@sa8ab
Copy link
Author

sa8ab commented Jul 16, 2020

@chrisnojima does it happen only on the first screen?
I mean like you go from Screen1 to Screen2 and you see the white flicker, but when going from Screen2 to Screen3 there is no flicker.

@awinograd
Copy link

#556 (comment) fixed a similar bug for me that was showing only in release builds.

navigating from A -> push B -> goBack to A -> push B would sometimes cause B to show with opacity < 1.

@awinograd
Copy link

awinograd commented Jul 25, 2020

One of our testers reported a re-occurrence of this bug after the fix mentioned above. At least, the issue appears to be less common

@awinograd
Copy link

One more note from me and sorry for the noise. It looks like my issue wasn't related to react-native-screens at all, but rather LayoutAnimation on android

@ahmed5605
Copy link

Can someone let me know what worked for them?

@WoLewicki
Copy link
Member

@ahmed5605 you can try and change the line to mCurrentTransaction.commitNowAllowingStateLoss(); here: https://github.com/software-mansion/react-native-screens/blob/master/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.java#L219

@gazedash
Copy link

gazedash commented Dec 1, 2020

Native Stack, React-nativation 5, white screen when navigating back

in fact, in my case, it crashes with fatal exception about react-native-screens, but looks like a freeze with white background, exactly as described

@WoLewicki
Copy link
Member

@gazedash can you provide a reproduction of this? It would help with debugging.

@ZeiRashed
Copy link

Still seeing repros of this issue. The line switch above didn't fix the issue for me - has anyone found a fix?

@iagormoraes
Copy link

The flickering is still happening with the components like fast-image and svg when we call goBack().

fast-image.mov

@darron1217
Copy link

darron1217 commented Feb 16, 2021

In my case, map becomes empty when calling navigation.goBack().
But it's fine with touching back button on header.
(Edit)
It was map plugin's problem

@WoLewicki
Copy link
Member

@darron1217 I think your problem is described in #773.

@darron1217
Copy link

@WoLewicki Sorry, it was map plugin's problem.
I appreciate for your help :)

@ZeiRashed
Copy link

@WoLewicki Do you happen to know if the issue with crashing/white screens when going back is being tracked?

@WoLewicki
Copy link
Member

Unfortunately we didn't come up with a better solution than proposed yet, but we are open to suggestions.

jslok added a commit to jslok/react-native-screens that referenced this issue Jun 24, 2021
Fix occasional white screen on goBack. Solution from @WoLewicki software-mansion#556 (comment)
@jslok
Copy link

jslok commented Jun 26, 2021

This seems to have fixed the white screen issue on goBack but the navigation animation is different now. It's more like a partial swoop in from the left.

@WoLewicki
Copy link
Member

Hopefully this issue should be solved by #1066 since the fragment transactions would be committed synchronously then. Could you check if it does not introduce any new problems? It certainly needs much testing and we would like to add it to the next release.

@WoLewicki WoLewicki linked a pull request Aug 26, 2021 that will close this issue
2 tasks
Screens automation moved this from TODO to Done Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Platform: Android This issue is specific to Android
Projects
No open projects
Development

Successfully merging a pull request may close this issue.