Merge pull request #2282 from ecency/nt/theme-chage-fix

added work around for iOS bug of colorScheme change on app resume
This commit is contained in:
Feruz M 2022-04-29 06:25:56 +03:00 committed by GitHub
commit a1d9f5415d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -271,9 +271,11 @@ class ApplicationContainer extends Component {
}; };
//change app theme on the fly //change app theme on the fly
_appearanceChangeListener = ({ colorScheme }) => { _appearanceChangeListener = () => {
console.log('OS color scheme changed', colorScheme);
const { dispatch } = this.props; const { dispatch } = this.props;
//workaround for bug with Appearece package: https://github.com/facebook/react-native/issues/28525#issuecomment-841812810
const colorScheme = Appearance.getColorScheme();
getTheme().then((darkThemeSetting) => { getTheme().then((darkThemeSetting) => {
if (darkThemeSetting === null) { if (darkThemeSetting === null) {
dispatch(isDarkTheme(colorScheme === 'dark')); dispatch(isDarkTheme(colorScheme === 'dark'));