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

Blank page when using setParams in ReactNavigationv5 on Android 8 #544

Closed
alimek opened this issue Jun 16, 2020 · 16 comments
Closed

Blank page when using setParams in ReactNavigationv5 on Android 8 #544

alimek opened this issue Jun 16, 2020 · 16 comments

Comments

@alimek
Copy link
Contributor

alimek commented Jun 16, 2020

Hello,

Found issue where calling setParams in componentDidMount for example is casuing blank page on Android 8.

Everything works fine on Android 9+ in my app.

If I remove enableScreens(), everything works fine.
Found workaround that adding timeout for 100ms and then call setParams is also working fine.

react-native-screens: 2.8.0
@react-navigation/bottom-tabs": "^5.5.2"
@react-navigation/drawer": "^5.8.2"
@react-navigation/native": "^5.5.1"
@react-navigation/stack": "^5.5.1"

anyone faced similar issue?

@WoLewicki
Copy link
Member

Can you provide a repo/snack with minimal configuration needed to reproduce the issue?

@alimek
Copy link
Contributor Author

alimek commented Jun 17, 2020

Sure, trying to create repo now. One question regarding the enableScreens().

If I am not using createNativeStackNavigator in my app, is enablingScreens doing something?

@alimek
Copy link
Contributor Author

alimek commented Jun 17, 2020

@WoLewicki repo here: https://github.com/alimek/react-native-screens-bug

by default app will open with "blank" screen, please comment line https://github.com/alimek/react-native-screens-bug/blob/master/App.tsx#L20 and you will get default RN screen page.

While testing noticed, that the same is happening on all androids: 8, 9, 10. For some reason on my app it was happening only on 8, but maybe i was lost with android version while testing it :P

@WoLewicki
Copy link
Member

So does it happen on all Android versions or not? I added this screen to my app with Android 10 and everything works just fine.

@alimek
Copy link
Contributor Author

alimek commented Jun 17, 2020

That's what i am using for testing as well as real device - Xiaomi phone with android 10

Screenshot 2020-06-17 at 14 44 26
Screenshot 2020-06-17 at 14 44 00

@WoLewicki
Copy link
Member

Could you check if applying react-navigation/react-navigation#8473 fixes your issue?

@alimek
Copy link
Contributor Author

alimek commented Jun 18, 2020

yes, it does! 🎉

@WoLewicki
Copy link
Member

Ok so I am closing this issue. Feel free to comment if there is something wrong.

@alimek
Copy link
Contributor Author

alimek commented Jun 18, 2020

its fixing few other problems for me too (like on Android YouTube Player was not playing video sometimes), but now, once user is logged to app i am getting this error.

bug

I have if for rendering either login screen or whole bottom tabs component

@WoLewicki
Copy link
Member

Can you repro it on a small example?

@WoLewicki WoLewicki reopened this Jun 18, 2020
@alimek
Copy link
Contributor Author

alimek commented Jun 18, 2020

sure, will prepare tomorrow or on Monday

@alimek
Copy link
Contributor Author

alimek commented Jun 19, 2020

@WoLewicki any hint how can i debug this on my app? My Android dev expierence is not big and cant reproduce it in simple app, which means must be something related to my app code, but cant find what really is causing problem.

Like you see on screenshot, i have the ViewID but cant find anything in FragmentManager which help me find where is problem.

I have component which has aniamted splashscreen when app is cold opened and then redirecting to login or user module,
but the same screen is opened when user is redirected from Login screen to main app, to run some nice animation for logging in.

I noticed when module is null for first time everything is fine, then i am on Login Screen and once user logs in, user is redirected to this component again and i have crash, if i redirect user straight to app, crash is not happening.

<NavigationContainer>
        <Stack.Navigator screenOptions={{ headerShown: false, animationEnabled: false }}>
          {module === null && (
            <Stack.Screen
              name={Screens.AUTH_CHECK}
              component={AuthCheck}
              options={{ animationEnabled: false }}
            />
          )}
          {!!module && <Stack.Screen name="Main" component={AfterAnimationAppStack} />}
        </Stack.Navigator>
      </NavigationContainer>

I would assume something must be with RN clearing Screens once they are created/removed dynamically.
I am still digging, so if will find what is causing this crash will update repo with example or just let you know that its my app code ;-)

@WoLewicki
Copy link
Member

Isn't it the same issue as #463?

@alimek
Copy link
Contributor Author

alimek commented Jun 19, 2020

yes, looks like its the same problem.

@edit
or it may be save thing, but from different use cases, beacause stack is different.

@alimek
Copy link
Contributor Author

alimek commented Jun 19, 2020

I managed to get rid of crash on Android.

Not sure if that's a bug or not, but i couldnt reproduce it on simple app without any extra heavy logic which my app is doing.

Problem on my app was, that once user is logged in, in very short time my app was trying to render Main app component with whole drawer and bottom navigation and then back to Splash screen when animation was happening and navigating to this main screen again. I was not aware that main app compoennt was loaded (it was that quick). After adding some more condition to prevent doing that, crash is not happening and everything is working fine.

@WoLewicki i am patching the @react-nativation/stack for now and have hope that your fix will land soon in NPM.

Thanks for help!

satya164 pushed a commit to react-navigation/react-navigation that referenced this issue Jun 19, 2020
Added `collapsable={false}` to the View in order for the Android to render screens properly. This issue is most probably similar to 9c06a92 but fixes it on Android since the View seems to be removed from a native view hierarchy due to not drawing anything. To see the bug go to software-mansion/react-native-screens#544.
@WoLewicki
Copy link
Member

Nice! Could you try and repro it anyhow and add this repro to the #463 even if it seems a bit big? It would greatly help us remove the problem.
@react-navigation is publishing very often so you won't have to wait long.
I am closing this issue then, feel free to comment if something is wrong.

joshuapinter pushed a commit to cntral/react-navigation that referenced this issue Sep 29, 2021
Added `collapsable={false}` to the View in order for the Android to render screens properly. This issue is most probably similar to react-navigation@9c06a92 but fixes it on Android since the View seems to be removed from a native view hierarchy due to not drawing anything. To see the bug go to software-mansion/react-native-screens#544.
YAfullStack pushed a commit to YAfullStack/React-navigation that referenced this issue Dec 4, 2021
Added `collapsable={false}` to the View in order for the Android to render screens properly. This issue is most probably similar to react-navigation/react-navigation@9c06a92 but fixes it on Android since the View seems to be removed from a native view hierarchy due to not drawing anything. To see the bug go to software-mansion/react-native-screens#544.
redhawkIT pushed a commit to redhawkIT/react-navigation that referenced this issue Dec 23, 2021
Added `collapsable={false}` to the View in order for the Android to render screens properly. This issue is most probably similar to react-navigation/react-navigation@9c06a92 but fixes it on Android since the View seems to be removed from a native view hierarchy due to not drawing anything. To see the bug go to software-mansion/react-native-screens#544.
darkhorse-coder pushed a commit to darkhorse-coder/react-navigation that referenced this issue Apr 7, 2022
Added `collapsable={false}` to the View in order for the Android to render screens properly. This issue is most probably similar to react-navigation/react-navigation@9c06a92 but fixes it on Android since the View seems to be removed from a native view hierarchy due to not drawing anything. To see the bug go to software-mansion/react-native-screens#544.
nenad0212 pushed a commit to nenad0212/temp1 that referenced this issue Sep 6, 2022
Added `collapsable={false}` to the View in order for the Android to render screens properly. This issue is most probably similar to react-navigation/react-navigation@9c06a92 but fixes it on Android since the View seems to be removed from a native view hierarchy due to not drawing anything. To see the bug go to software-mansion/react-native-screens#544.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants