SDK Version: 42.0.0
Platforms(Android/iOS/web/all): Android
Hey guys,
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"
}
}
}
1 Like
thanks for pointing this out – this appears to be a bug on the android side in expo go. i have created an issue for it here: Root userInterfaceStyle does not apply on Android in Expo Go · Issue #13488 · expo/expo · GitHub
1 Like
system
Closed
August 3, 2021, 10:27pm
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.