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

Created on 6 Jul 2020  路  32Comments  路  Source: software-mansion/react-native-screens

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)

Android bug

Most helpful comment

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

All 32 comments

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

@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

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

@WoLewicki

Yes, I have managed to reproduce it.

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

@WoLewicki I have no clue when it happens sorry

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.

@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.

https://github.com/software-mansion/react-native-screens/issues/556#issuecomment-654283994
I debugged it more and this Error is not connected strictly to the bug. It just appears when you click on an empty View.

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?

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

I would be grateful if you could.

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

@chismadalina does it happen after applying this: https://github.com/software-mansion/react-native-screens/issues/556#issuecomment-656044339? And are there any other issues after doing so?

@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.

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

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

@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.

https://github.com/software-mansion/react-native-screens/issues/556#issuecomment-656044339 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.

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

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

Can someone let me know what worked for them?

@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

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

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

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

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

https://user-images.githubusercontent.com/13892132/105480810-f9b8ac00-5c84-11eb-92c6-6b4e1462daa1.mov

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

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

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

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joshua-augustinus picture joshua-augustinus  路  4Comments

jeveloper picture jeveloper  路  5Comments

bartzy picture bartzy  路  3Comments

chai86 picture chai86  路  3Comments

thomasgosse picture thomasgosse  路  4Comments