Okay, I understand. You want to determine if your Expo app with NativeWind is currently respecting the system's theme (i.e., following the device's dark/light mode setting) rather than having a theme explicitly set within the app. Here's how you can approach this, along with the reasoning:
Here's how you can determine if your Expo app with NativeWind is using the system theme:
1. Check app.json (or app.config.js)
2. Using useColorScheme Hook[[2]][[4]][[6]]
Explanation
userInterfaceStyle in app.json: This setting is crucial. If it's not "automatic", your app won't be respecting the system theme, regardless of what you do in your components.
useColorScheme(): This hook tells you what the current color scheme is ("light" or "dark").[[3]] However, it doesn't directly tell you if you're using the system setting.
isSystem State: The useEffect hook sets isSystem to true if the color scheme is equal to null or undefined meaning that it's not dark or light, which is system.
In summary: The most reliable way to determine if you're using the system theme is to check the userInterfaceStyle in app.json. The useColorScheme hook tells you the result of the theme selection (light or dark) but not the source of that selection (system or app-defined). The code above provides a way to infer "system" usage by checking if useColorScheme returns null or undefined.