Skip to content

fix: color scheme in appearance state after setting it to unspecified#54993

Closed
ismarbesic wants to merge 1 commit intofacebook:mainfrom
ismarbesic:main
Closed

fix: color scheme in appearance state after setting it to unspecified#54993
ismarbesic wants to merge 1 commit intofacebook:mainfrom
ismarbesic:main

Conversation

@ismarbesic
Copy link
Copy Markdown
Contributor

@ismarbesic ismarbesic commented Dec 29, 2025

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:

  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.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 29, 2025
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Dec 29, 2025
@oleksandr-dziuban
Copy link
Copy Markdown

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

@astrahov
Copy link
Copy Markdown

astrahov commented Jan 20, 2026

// 0.83.1
Appearance.setColorScheme('unspecified')

// iOS Log:
Invalid UIUserInterfaceStyle 'unspecified'. should be one of: (
    dark,
    light
)

@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Feb 5, 2026

@cortinico has imported this pull request. If you are a Meta employee, you can view this in D92391594.

@cortinico
Copy link
Copy Markdown
Contributor

/rebase

@meta-codesync meta-codesync bot closed this in 08d1764 Feb 6, 2026
@react-native-bot
Copy link
Copy Markdown
Collaborator

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?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Feb 6, 2026
@danielma
Copy link
Copy Markdown

The official CHANGELOG says that this change was included in 0.83.2, but the npmjs tarball doesn't actually include it.

Repro

curl -O https://registry.npmjs.org/react-native/-/react-native-0.83.2.tgz
tar -xzf react-native-0.83.2.tgz -C .
sed -n 96,105p package/Libraries/Utilities/Appearance.js

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

@JustJoostNL
Copy link
Copy Markdown

Yup, I also installed v0.83.2 specifically for this fix, but I discovered it wasn't actually included weirdly.

@julian-dueck
Copy link
Copy Markdown

The official CHANGELOG says that this change was included in 0.83.2, but the npmjs tarball doesn't actually include it.

Repro

curl -O https://registry.npmjs.org/react-native/-/react-native-0.83.2.tgz
tar -xzf react-native-0.83.2.tgz -C .
sed -n 96,105p package/Libraries/Utilities/Appearance.js

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

@cortinico

react-native-bot pushed a commit that referenced this pull request Apr 10, 2026
…#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
@react-native-bot
Copy link
Copy Markdown
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants