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
Appearance issue #30484
Comments
|
@chukhlov More Information Needed |
I have experienced something similar using RN 0.63.4 on iOS 14.4. The problem appears to be with the value passed to the Appearance listener. This is unreliable for me on iOS; the change listener will sometimes receive the incorrect color scheme when the app is restored from background mode, such as by tapping the "back" link in the upper left of the screen: useEffect(() => {
const listener = ({colorScheme}: any) => {
setIsDarkMode(colorScheme === 'dark');
};
Appearance.addChangeListener(listener);
return () => {
Appearance.removeChangeListener(listener);
};
}, []); This, however, always seems to work: useEffect(() => {
const listener = () => {
setIsDarkMode(Appearance.getColorScheme() === 'dark');
};
Appearance.addChangeListener(listener);
return () => {
Appearance.removeChangeListener(listener);
};
}, []); The |
I also encountered the same problem.
The phone is set to dark mode. When my app switches to the background, it will trigger a listener.The colorScheme parameter of the listener method prints light, while the one obtained by Appearance.getColorScheme() is dark. |
Same issue like what @1111mp described. react-native: 0.64.1 |
same issue |
This worked |
This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days. |
This issue was closed because the author hasn't provided the requested feedback after 7 days. |
React-native Appearance has some issue on background mode.
Here is an video example how to reproduce the bug in the app https://ru.files.fm/u/x5uzfjqtb#/view/swr72wr5p
Appearance listener will change the colorScheme value to "light" when app is in background mode and never back to dark.
The text was updated successfully, but these errors were encountered: