Skip to content

Conversation

@alanleedev
Copy link
Contributor

Summary:
This change adds a listener mechanism to the OverrideColorScheme interface to enable dynamic updates when the user's dark mode preference changes via OverrideColorScheme.

Previously, AppearanceModule would only reflect the initial color scheme state when instantiated. If a user toggled dark mode through an OverrideColorScheme implementation, React Native JavaScript would not be notified of the change, causing UI inconsistencies.

This implementation adds:

  1. An optional addListener() method to the OverrideColorScheme interface with a default no-op implementation for backward compatibility
  2. Automatic listener registration in AppearanceModule's init block that triggers onConfigurationChanged() when the color scheme changes

Changelog:
[Android][Added] - Add addListener() function to OverrideColorScheme interface to support dynamic appearance updates via override

Differential Revision: D88427482

@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 5, 2025
@meta-codesync
Copy link

meta-codesync bot commented Dec 5, 2025

@alanleedev has exported this pull request. If you are a Meta employee, you can view the originating Diff in D88427482.

alanleedev added a commit to alanleedev/react-native that referenced this pull request Dec 5, 2025
…facebook#54791)

Summary:

This change adds a listener mechanism to the `OverrideColorScheme` interface to enable dynamic updates when the user's dark mode preference changes via `OverrideColorScheme`.

Previously, `AppearanceModule` would only reflect the initial color scheme state when instantiated. If a user toggled dark mode through an `OverrideColorScheme` implementation, React Native JavaScript would not be notified of the change, causing UI inconsistencies.

This implementation adds:
1. An optional `addSchemeChangeListener()` method to the `OverrideColorScheme` interface with a default no-op implementation for backward compatibility. Also adding matching `removeSchemeChangeListener()`.
2. Automatic listener registration in `AppearanceModule`'s init block that triggers `onConfigurationChanged()` when the color scheme changes

Changelog:
[Android][Added] - Add `addSchemeChangeListener()` function to `OverrideColorScheme` interface to support dynamic appearance updates via override

Reviewed By: mdvacca

Differential Revision: D88427482
alanleedev added a commit to alanleedev/react-native that referenced this pull request Dec 5, 2025
…facebook#54791)

Summary:

This change adds a listener mechanism to the `OverrideColorScheme` interface to enable dynamic updates when the user's dark mode preference changes via `OverrideColorScheme`.

Previously, `AppearanceModule` would only reflect the initial color scheme state when instantiated. If a user toggled dark mode through an `OverrideColorScheme` implementation, React Native JavaScript would not be notified of the change, causing UI inconsistencies.

This implementation adds:
1. An optional `addSchemeChangeListener()` method to the `OverrideColorScheme` interface with a default no-op implementation for backward compatibility. Also adding matching `removeSchemeChangeListener()`.
2. Automatic listener registration in `AppearanceModule`'s init block that triggers `onConfigurationChanged()` when the color scheme changes

Changelog:
[Android][Added] - Add `addSchemeChangeListener()` function to `OverrideColorScheme` interface to support dynamic appearance updates via override

Reviewed By: javache

Differential Revision: D88427482
alanleedev added a commit to alanleedev/react-native that referenced this pull request Dec 5, 2025
…facebook#54791)

Summary:

This change adds a listener mechanism to the `OverrideColorScheme` interface to enable dynamic updates when the user's dark mode preference changes via `OverrideColorScheme`.

Previously, `AppearanceModule` would only reflect the initial color scheme state when instantiated. If a user toggled dark mode through an `OverrideColorScheme` implementation, React Native JavaScript would not be notified of the change, causing UI inconsistencies.

This implementation adds:
1. An optional `addSchemeChangeListener()` method to the `OverrideColorScheme` interface with a default no-op implementation for backward compatibility. Also adding matching `removeSchemeChangeListener()`.
2. Automatic listener registration in `AppearanceModule`'s init block that triggers `onConfigurationChanged()` when the color scheme changes

Changelog:
[Android][Added] - Add `addSchemeChangeListener()` function to `OverrideColorScheme` interface to support dynamic appearance updates via override

Reviewed By: javache

Differential Revision: D88427482
alanleedev added a commit to alanleedev/react-native that referenced this pull request Dec 5, 2025
…facebook#54791)

Summary:

This change adds a listener mechanism to the `OverrideColorScheme` interface to enable dynamic updates when the user's dark mode preference changes via `OverrideColorScheme`.

Previously, `AppearanceModule` would only reflect the initial color scheme state when instantiated. If a user toggled dark mode through an `OverrideColorScheme` implementation, React Native JavaScript would not be notified of the change, causing UI inconsistencies.

This implementation adds:
1. An optional `addSchemeChangeListener()` method to the `OverrideColorScheme` interface with a default no-op implementation for backward compatibility. Also adding matching `removeSchemeChangeListener()`.
2. Automatic listener registration in `AppearanceModule`'s init block that triggers `onConfigurationChanged()` when the color scheme changes

Changelog:
[Android][Added] - Add `addSchemeChangeListener()` function to `OverrideColorScheme` interface to support dynamic appearance updates via override

Reviewed By: javache

Differential Revision: D88427482
…facebook#54791)

Summary:

This change adds a listener mechanism to the `OverrideColorScheme` interface to enable dynamic updates when the user's dark mode preference changes via `OverrideColorScheme`.

Previously, `AppearanceModule` would only reflect the initial color scheme state when instantiated. If a user toggled dark mode through an `OverrideColorScheme` implementation, React Native JavaScript would not be notified of the change, causing UI inconsistencies.

This implementation adds:
1. An optional `addSchemeChangeListener()` method to the `OverrideColorScheme` interface with a default no-op implementation for backward compatibility. Also adding matching `removeSchemeChangeListener()`.
2. Automatic listener registration in `AppearanceModule`'s init block that triggers `onConfigurationChanged()` when the color scheme changes

Changelog:
[Android][Added] - Add `addSchemeChangeListener()` function to `OverrideColorScheme` interface to support dynamic appearance updates via override

Reviewed By: javache

Differential Revision: D88427482
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. fb-exported meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants