Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appreance.getColorScheme() always returns "light" | Android | IOS | React Native | Expo #44522

Closed
AbdullahSherMuhammad opened this issue May 10, 2024 · 2 comments

Comments

@AbdullahSherMuhammad
Copy link

Description

Whenever using Expo to build React Native apps, Apperance.getColorScheme always returns "Light". It is not a React Native bug rather a Expo bugs. I search for a solution for days but couldn't find one. Ever had a same issue of github titled same but no good answer.

Finally I got the fix and I want to share it with the community "Note: make sure your iOs or Android project is not hard-coded to a light user-interface style, or the above will not work. If using Expo, you will need to set "userInterfaceStyle": "automatic" in your app.json under the expo key (the default is “light”)."

Steps to reproduce

"expo": {
"name": "FirstRNApp",
"slug": "FirstRNApp",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},

React Native Version

0.73.6

Affected Platforms

Other (please specify)

Output of npx react-native info

light

Stacktrace or Logs

This error is located at:
    in App (at withDevTools.js:18)
    in withDevTools(App) (at renderApplication.js:57)
    in RCTView (at View.js:116)
    in View (at AppContainer.js:127)
    in RCTView (at View.js:116)
    in View (at AppContainer.js:155)
    in AppContainer (at renderApplication.js:50)
    in main(RootComp

Reproducer

https://github.com/AbdullahSherMuhammad/FocusApp-ReactNative

Screenshots and Videos

No response

Copy link

⚠️ Newer Version of React Native is Available!
ℹ️ You are on a supported minor version, but it looks like there's a newer patch available - 0.73.8. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

@github-actions github-actions bot added Newer Patch Available Platform: Android Android applications. Platform: iOS iOS applications. labels May 10, 2024
@cortinico
Copy link
Contributor

Whenever using Expo to build React Native apps, Apperance.getColorScheme always returns "Light". It is not a React Native bug rather a Expo bugs. I search for a solution for days but couldn't find one. Ever had a same issue of github titled same but no good answer.

Finally I got the fix and I want to share it with the community "Note: make sure your iOs or Android project is not hard-coded to a light user-interface style, or the above will not work. If using Expo, you will need to set "userInterfaceStyle": "automatic" in your app.json under the expo key (the default is “light”)."

Thanks for sharing your solution. Closing it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants