React Native 0.62.2 Appearance return wrong color scheme

Viewed 5274

On iOS simulator (13.3) and Android 10

I have an issue with Appearance and useColorScheme when I set up dark mode it's still returned "light".

import { useColorScheme, Appearance } from 'react-native';

const colorScheme = useColorScheme();
console.log(colorScheme, Appearance.getColorScheme()) // "light", "light"

Am I doing something wrong?

4 Answers

add

"userInterfaceStyle": "automatic",

to app.json

Also make sure you do not have UIUserInterfaceStyle set in your Info.plist. I had it set to 'light' so Appearance.getColorScheme() was always returning 'light'.

In your app in ios folder => your-project-name => Info.plist add the unspecified value instead of Light or Dark.

        <dict>
            <key>UIUserInterfaceStyle</key>
            <string>unspecified</string>
        </dict>
Related