marklawlor / nativewind

React Native utility-first universal design system - powered by Tailwind CSS
https://nativewind.dev
MIT License
4.3k stars 233 forks source link

[v4] Complete control of color scheme mode #866

Closed jgornick closed 3 weeks ago

jgornick commented 1 month ago

Describe the bug

DISCLAIMER: I'm logging this issue only by looking at the code implementation.

It seems like light/dark mode is always listening to changes coming from react-native Appearance. I have a use-case where I have application-specific light/dark mode toggle overrides. If I understanding the implementation, it seems that you can manually set the color scheme, but if your system changes, it'll update to your system.

To Reproduce Steps to reproduce the behavior:

  1. Manually set the color scheme and observe changes.
  2. Change your system color scheme to something different than the manual value and observe changes.
  3. Notice how even though an application-specific manual override has been applied, the system will continue to change the color scheme in the app.

Expected behavior Once a manual color scheme has been set, NativeWind no longer changes based on the system.

jgornick commented 3 weeks ago

Closing the issue because I verified that once you override and set the color scheme explicitly, it will not change even if the system changes.

For example, if you set the color scheme to light or dark, it will always be in that mode and system changes won't trigger changes either.