I am trying to get Dark Mode to work and it doesn't work on Android. It always returns "light". On iOS it works fine.
import React from 'react';
import { useColorScheme } from "react-native";
export default function App() {
const theme = useColorScheme();
alert("your color scheme is: " + theme); // always returns "light" on Android
return null;
}
I am using Expo SDK 42.
I put "userInterfaceStyle": "automatic" in my app.json but it doesn't make a difference.
I figured it out. It was not enough to just put "userInterfaceStyle": "automatic" in app.json root, I had to define it for iOS and Android individually too:
app.json:
{
"expo": {
"userInterfaceStyle": "automatic",
"ios": {
"userInterfaceStyle": "automatic"
},
"android": {
"userInterfaceStyle": "automatic"
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With