Skip to content

Add Appearance.addSystemChangeListener to listen to system color scheme changes #930

@ferretwithaberet

Description

@ferretwithaberet

Introduction

Currently, Appearance.addChangeListener listens to the change of the user preference for the current app. I propose another API Appearance.addSystemChangeListener, this will listen to the system setting change.

Details

This came to me as I tried to use react-native-ui-lib, which's dark mode support is finnicky (wix/react-native-ui-lib#2127) and, at the moment for proper support, you need to keep the current color scheme until the user restarts the app. To keep all UI elements themed accordingly you have to use Appearance.setColorScheme, but that causes Appearance.addChangeListener to not fire anymore on system color scheme change. I propose the above mentioned Appearance.addSystemChangeListener as a way to display a message to inform them that they have to restart the app to see the theme change.

Discussion points

  • Is this already supported through other APIs?
  • Should the API for listening to system color scheme changes be different than mentioned above?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions