SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

Add listener API to OverrideColorScheme for dynamic dark mode updates (#54791)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54791

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 `{add|remove}SchemeChangeListener()` function to `OverrideColorScheme` interface to support dynamic appearance updates via override

Reviewed By: javache

Differential Revision: D88427482

fbshipit-source-id: 02b71335bb5bebd1f44bf9723c3120f9a1fc182c
A
Alan Lee committed
80e384a8011762f571ff6f47b6674de00aab0485
Parent: 17b3c1c
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com> on 12/10/2025, 9:05:46 PM