Skip to content

RCTSharedApplication().appearance = appearance; makes the window responsive to OS theme changes #2717

@ospfranco

Description

@ospfranco

Environment

npm ls react-native-macos: 0.79

Steps to reproduce the bug

Change the OS theme twice. First time it works. Second time RN app is stuck in the value it changed to.

Expected Behavior

Correctly switched themes

Actual Behavior

It's stuck.

The issue is here:

https://github.com/microsoft/react-native-macos/blob/main/packages/react-native/React/CoreModules/RCTAppearance.mm#L169

By setting the NSApp.appearance after the first change, the app stops being responsive to changes. It needs to be nil for the propagation to suceed. Commenting it out fixes the issue but probably breaks other stuff underneath

Reproducible Demo

None :)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions