-
Notifications
You must be signed in to change notification settings - Fork 24.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
useColorScheme() returns incorrect value when app is moved to the background on iOS #49330
Comments
Related issue: #35972 |
Have same issues. Not happens all the time, but happens |
Hi @janoslc, I am unable to reproduce this issue with the reproducer you have provided. I am currently testing it on a simulator. Could you please confirm if reproducing it on a real device is required? Additionally, I noticed that there are no details of the New Architecture in the output of your npx react-native info. Could you please share those details as well? |
Hey @sarthak-d11
|
This is actually expected behaviour from iOS and happens on native iOS too. |
@riteshshukla04 okay, but should be flickering should not appear anyway. And it was not on bridglessMode OFF |
Maybe use something like above |
Description
useColorScheme()
call returns a momentarily incorrect value when the app is moved to the background. When bringing the app back in the foreground it causes a flashing behaviour, because all the components support dark and light theme.The issue appears on ExpoGo as well as on a physical device.
Steps to reproduce
scheme = useColorScheme()
scheme
scheme
value was changed (to dark if you were on light theme or inverse) when the app was moved to the background and changed back againReact Native Version
0.76.7
Affected Platforms
Runtime - iOS
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://snack.expo.dev/@janoslc/react-native-usecolorscheme-issue
Screenshots and Videos
The Snack in Expo Go looks like this:
ScreenRecording_02-11-2025.mp4
Having a bigger project with multiple components reduces the speed of re-rendering and it causes a flashing effect:
ScreenRecording_02-11-2025.17-13-21_1.mov
The text was updated successfully, but these errors were encountered: