question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dark mode: useColorScheme() always returns light on Android

See original GitHub issue

Hey there,

on my Xiaomi Pocophone F1 with Android version 10 and MIUI Version 12.0.3 the dark mode is not working. When setting it up in the settings it is kind of dark, not black, but grey instead. When I want to get the current theme, with
useColorScheme() it always returns light. I am no expert with Android but why could that issue happen? Does Xiaomi have some built-in dark mode instead of using the dark mode of the apps individually?

UPDATE: It also doesn’t work on Galaxy A9. It also always returns “light”

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

51reactions
chipmunkcodecommented, Jul 4, 2021

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"
    }
  }
}
7reactions
ghostcommented, Jul 30, 2022

Have you tried disabling a debug remote because it prevents making the app theme dark. That’s what I tried on my side and it worked.

Screenshot_20220730-030254_Expo Go

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dark Mode: useColorScheme() always returns light on Android
I am trying to get Dark Mode to work and it doesn't work on Android. It always returns "light". On iOS it works...
Read more >
useColorScheme - React Native
The useColorScheme React hook provides and subscribes to color scheme ... Chrome debugger is enabled, this hook will always return "light" .
Read more >
Light and dark modes - Expo Documentation
Light and dark modes. Learn how to support light and dark modes in your app. Regardless of whether you are personally on team...
Read more >
Adding dark mode to your expo app - | Negative Epsilon
export const ThemeProvider = (props) => { // Getting the device color theme const colorScheme = useColorScheme(); // Can be dark | light...
Read more >
React Native Dark Mode and Theming | by Alex Borton
Make use of the new iOS Dark mode in your React Native application and gear up for users ... const colorScheme = useColorScheme()...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found