-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Fix React Native Appearance/useColorScheme support for SDK 38 #8793
Conversation
… React Native useColorScheme
…Native AppearanceModule - Fixes userInterfaceStyle app.json setting when used in combination with useColorScheme from React native
… like elsewhere in activity
e70013b
to
b2beca7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting changes to have a separate PR to expo/react-native on a branch prefixed with expo/
so that we don't lose this commit in the future.
Talking to @esamelson if we want this in the release we need this to be in a shippable state soon (Tuesday or Wednesday) since we've already versioned the Android code (will need to re-version) and are otherwise ready to continue the release process.
@Override | ||
public void onConfigurationChanged(Configuration newConfig) { | ||
super.onConfigurationChanged(newConfig); | ||
|
||
if (mReactInstanceManager != null && mReactInstanceManager.isNotNull() && !mIsCrashed) { | ||
mReactInstanceManager.call("onConfigurationChanged", this, newConfig); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed this part; looks fine to me.
* [android] Add onConfigurationChanged to BaseExperienceActivity to fix React Native useColorScheme * [ReactAndroid] Use getLocalNightMode from AppCompatDelegate in React Native AppearanceModule - Fixes userInterfaceStyle app.json setting when used in combination with useColorScheme from React native * [android] Validate mReactInstanceManager before calling method on it, like elsewhere in activity
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793
Added to the react-native fork in expo/react-native@48e27f6 and pushed to this branch https://github.com/expo/react-native/tree/expo/respect-local-night-mode |
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e54ff9f5d9f5639cea201f101efac472a9 Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
… play nicely with Expo client color scheme locking mechanism. expo/expo#8793 This is a squashed commits with the following changes: commit 945096e Author: Kudo Chien <kudo@expo.io> Date: Tue Jul 27 16:49:09 2021 +0800 [android] Upgrade androidx.appcompat to 1.2.0 Backport from: expo/expo@58fa52e
Why
useColorScheme
has two problems right now:onConfigurationChanged
in our activity.userInterfaceStyle
in app.json.How
onConfigurationChanged
method as required, verified that this fixesuseColorScheme
fromreact-native
ExpoAppearanceModule
to give priority to the current activity local night mode configuration (which is what we use to enforce a specific scheme whenuserInterfaceStyle
is set in app.json). This required bumping appcompat to 1.1.0 in ReactAndroid.TODO
Test Plan
userInterfaceStyle
tolight
in app.json and verify that it's light when you use dark mode, and nothing happens when you toggle between modes while it's open. Same for dark. Verify automatic works as expected.