Skip to content

Appearence. addChangeListener does not reacts to changes of the themes change on OS after Appearance.setColorScheme was used and reacts only to Appearance.setColorScheme  #43715

Description

@OlexandrRomanovsky

Description

Issue Summary:
After The Appearance.addChangeListener method does not respond to changes in the operating system's theme settings after the Appearance.setColorScheme method has been invoked within the application. It seems that manually setting a color scheme causes the listener to ignore subsequent OS theme changes, thereby not triggering the expected callbacks when the OS theme is altered.
Expected Behavior:
The listener set up through Appearance.addChangeListener should react to changes in the OS theme, even after manually setting the application's theme using Appearance.setColorScheme. It is expected to trigger the appropriate callbacks, allowing the application to adapt to the OS theme changes dynamically.

Steps to reproduce

  1. Start the application with the Appearance.addChangeListener already set up to listen for theme changes.
  2. Manually change the application theme using Appearance.setColorScheme('dark') or Appearance.setColorScheme('light').
  3. Change the operating system's theme (e.g., from light to dark mode or vice versa).
  4. Observe that the change listener does not trigger a callback in response to the OS theme change.

React Native Version

0.72.4

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.4
  CPU: (10) arm64 Apple M1 Pro
  Memory: 98.70 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 16.20.2
    path: ~/.nvm/versions/node/v16.20.2/bin/node
  Yarn: Not Found
  npm:
    version: 8.19.4
    path: ~/.nvm/versions/node/v16.20.2/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.12.1
    path: /Users/oleksandrromanovskij/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK:
    API Levels:
      - "28"
      - "29"
      - "30"
      - "31"
      - "33"
      - "34"
    Build Tools:
      - 28.0.3
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 33.0.0
    System Images:
      - android-29 | Intel x86 Atom_64
      - android-30 | Google APIs ARM 64 v8a
      - android-30 | Google APIs Intel x86 Atom
      - android-30 | Google Play Intel x86 Atom
      - android-31 | Google APIs ARM 64 v8a
      - android-31 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2021.1 AI-211.7628.21.2111.8309675
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.19
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /Users/oleksandrromanovskij/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.4
    wanted: 0.72.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

No crash but incorrect work

Reproducer

its not

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions