-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Screen flicker on Android with stack navigation #10951
Comments
Set the root view colour to solve this issue, https://docs.expo.dev/versions/latest/sdk/system-ui/ |
@raajnadar Thanks for your comment, but we don't use (and want) anything of Expo. |
If you use a package from the expo ecosystem that doesn’t mean you need to use expo go, every package works with vanilla react native. I tried to give you a solution, it is you who needs to find an alternative package if you don't want expo system ui |
@raajnadar Yeah I understand that and thank you for your reaction. But is the flickering not a bug of the react-navigation package? As mentioned in my opening post the workarounds I tried does not work perfect in my opinion. I commented it because the documentation says "you must have the And when I should use this package from expo can I set this on every Stack or Screen? Because we using black and white backgrounds in our application so if you not can set it dynamically it is still visible at least one of them. |
I don't think it is a workaround, we need to set the root view colour ourselves on android, on ios it is handled properly by the OS. In one of my applications, the dominant colour was orange, this is what I did to solve the issue
We set the root view colour to white here so that the background of the keyboard is correct and the BG colour is white for the screens & no flicker. Yes you need to do some native config so that expo packages can be used in any react native project, they also have automated installation which will make the process easier |
The versions mentioned in the issue for the following packages differ from the latest versions on npm:
Can you verify that the issue still exists after upgrading to the latest versions of these packages? |
The versions mentioned in the issue for the following packages differ from the latest versions on npm:
Can you verify that the issue still exists after upgrading to the latest versions of these packages? |
Issue still there in "@react-navigation/native-stack": "^6.9.2", |
@amalmohann-dgnl this issue is not related to the native stack |
@jordiepasman @raajnadar actually, when i set SystemUI.setBackgroundColorAsync("white"), the issue is still exists. |
Yes, it's still exist in latest(6.3.4) packages. |
I have an alternative solution to fix this issue: import {DefaultTheme, NavigationContainer} from '@react-navigation/native'; **const themeColor = {
|
Hi @zahid502 thanks, Yes, you can do it. |
Thank you for updating @jordiepasman, I have fixed it by using dynamic color, not static.
Note: But it's not a proper solution of screen flicker, when there are more elements with different colors, then it will also show screen flicker on android. |
Mine because of the SafeAreaProvider. So I have to change its background color to match with window color. |
Another solution which will fix this and also help with theming your app is react-native-theme-control, specifically AppBackground component |
In my case the problem is related to the default card interpolator, used inside react navigation for android transition animations. Same as @jordiepasman i have a simultaneous two theme application so i cant just set the root view color. I did a little tweak to default animation, to prevent flashing from being so obvious Patch file located at
|
Hey just a simple solution add amination in user navigation stack |
in my case it was SafeAreaView, in which case it defines a background, it can be in the safe area provider as well <SafeAreaView style={{backgroundColor: ‘white'}}>…. |
Even better, |
Current behavior
On Android only: every time when navigating between screens in stack navigation there will be a white flickering.
This is much harder to see on a light background but on a black screen background it is very noticeable.
I have already found and tried previous given workarounds:
NavigationContainer
but we using black and white backgrounds in our application so it is still visible at least by one of them. (but actually still visible at all times)animationEnabled: false
but then you won't have any animations at all.cardStyle
on the navigator.There have been previous issues but I haven't really found a good solution to this yet.
This is an example on a Samsung Galaxy S20+.
And i've added a repo to this example application.
White.flickering.2.0.mp4
Expected behavior
No flickering and smooth navigation.
Reproduction
https://github.com/jordiepasman/white-flickering-issue
Platform
Packages
We do not use expo (packages)!
Environment
The text was updated successfully, but these errors were encountered: