fix: color scheme in appearance state after setting it to unspecified#54993
fix: color scheme in appearance state after setting it to unspecified#54993ismarbesic wants to merge 1 commit intofacebook:mainfrom
Conversation
|
Hello @facebook-github-bot Can this be merged as RN v0.83.2 patch fix? Seems like a huge regression issue which blocks teams to migrate to RN 0.83 Thanks a lot |
|
|
@cortinico has imported this pull request. If you are a Meta employee, you can view this in D92391594. |
|
/rebase |
|
This pull request was successfully merged by @ismarbesic in 08d1764 When will my fix make it into a release? | How to file a pick request? |
|
The official CHANGELOG says that this change was included in 0.83.2, but the npmjs tarball doesn't actually include it. Repro Will output export function setColorScheme(colorScheme: ColorSchemeName): void {
const state = getState();
const {NativeAppearance} = state;
if (NativeAppearance != null) {
NativeAppearance.setColorScheme(colorScheme);
state.appearance = {
colorScheme,
};
}
}Which is the code from before this fix was merged |
|
Yup, I also installed v0.83.2 specifically for this fix, but I discovered it wasn't actually included weirdly. |
|
…#54993) Summary: Fixed the value of the color scheme in the appearance state after setting it to unspecified when state updates. The issue is described here #54959. This is a regression from #53397 and should be reproducible from 0.82 and higher. The `useColorScheme()` hook will return "unspecified" when you change the appearance from system color (dark or light) to system which breaks many apps using the value to determine whether to use dark/light mode colors. ## 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 color scheme in appearance state after setting it to unspecified Pull Request resolved: #54993 Test Plan: 1. Run the reproducer app in the issue - use dark mode when launching the app, press "change to dark" and then "change to system". The hook will return "unspecified" although the correct behavior should be dark. 2. Apply the changes in this PR. 3. The correct behavior should be seen. Reviewed By: cipolleschi Differential Revision: D92391594 Pulled By: cortinico fbshipit-source-id: 3c0c471069f2eb4681bd53abf67957bcaa04e7b4
|
This pull request was successfully merged by @ismarbesic in c338d19 When will my fix make it into a release? | How to file a pick request? |
Summary:
Fixed the value of the color scheme in the appearance state after setting it to unspecified when state updates. The issue is described here #54959. This is a regression from #53397 and should be reproducible from 0.82 and higher. The
useColorScheme()hook will return "unspecified" when you change the appearance from system color (dark or light) to system which breaks many apps using the value to determine whether to use dark/light mode colors.Changelog:
[GENERAL] [FIXED] - Fix color scheme in appearance state after setting it to unspecified
Test Plan: