Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ BUG ] App does not actively listen to system theme changes #321

Open
JeremyXXXuuu opened this issue Jan 23, 2025 · 1 comment
Open

[ BUG ] App does not actively listen to system theme changes #321

JeremyXXXuuu opened this issue Jan 23, 2025 · 1 comment
Labels
bug Something isn't working nativewind bug

Comments

@JeremyXXXuuu
Copy link

Describe the bug
When the app is set to follow the system theme mode, changing the theme via the iPhone Control Center does not instantly update the app's theme. Instead, the app only detects the theme change after closing the Control Center. This behavior is inconsistent with the expected behavior of React Native's built-in useColorScheme hook, which should trigger theme changes immediately, even while the Control Center is open.

To Reproduce
Steps to reproduce the behavior:

  1. Set the app to follow the system theme mode.
  2. Open the iPhone Control Center.
  3. Change the theme (e.g., from light to dark or vice versa).
  4. Observe that the app's theme does not update until the Control Center is closed.

Expected behavior
The app should instantly update the theme in response to system theme changes, even when the Control Center is open.

Screenshots
If applicable, add screenshots to help explain your problem.

ScreenRecording_01-23-2025.16-11-09_1.MP4
expected-behavior.MP4

Platform (please complete the following information):

  • Type: [ iphone 15 pro]
  • OS: [ios 18]
  • Expo Go

Additional context

  • The useColorScheme hook from React Native is known to detect theme changes immediately, even when the Control Center is open.
  • It seems the app's current implementation may not be leveraging useColorScheme effectively to detect system theme changes in real time.
@JeremyXXXuuu JeremyXXXuuu added the bug Something isn't working label Jan 23, 2025
@mrzachnugent
Copy link
Owner

Hey @JeremyXXXuuu, I believe this is how NativeWind is set up: https://github.com/nativewind/nativewind/blob/main/packages/react-native-css-interop/src/runtime/native/appearance-observables.ts#L101

NativeWind seems to have an event listener on the appearance change but it only updates the color scheme when the app state is active.

Can you create this issue for NativeWind's repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working nativewind bug
Projects
None yet
Development

No branches or pull requests

2 participants