mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix Appearance.setColorScheme(null) not resetting color scheme value (#47739)
Summary: Fixes https://github.com/facebook/react-native/issues/47725 Calling Appearance.setColorScheme(null) or Appearance.setColorScheme(undefined) no longer resets the color scheme useColorScheme returns like on previous rn versions. ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [GENERAL] [FIXED] - Fix `Appearance.setColorScheme(null)` not resetting color scheme value Pull Request resolved: https://github.com/facebook/react-native/pull/47739 Test Plan: Repo with a patch ready to test: https://github.com/sangonz193/react-native-color-scheme-patch Reviewed By: yungsters Differential Revision: D66230236 Pulled By: cipolleschi fbshipit-source-id: cc668acb1fde6d30f2706fc0ab7dee5cea1c3b14
This commit is contained in:
+3
-1
@@ -105,7 +105,9 @@ export function setColorScheme(colorScheme: ?ColorSchemeName): void {
|
||||
const {NativeAppearance} = state;
|
||||
if (NativeAppearance != null) {
|
||||
NativeAppearance.setColorScheme(colorScheme ?? 'unspecified');
|
||||
state.appearance = {colorScheme};
|
||||
state.appearance = {
|
||||
colorScheme: toColorScheme(NativeAppearance.getColorScheme()),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user