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

Expo router starter has wrong colorScheme on device set on light mode #2691

Closed
giacomocerquone opened this issue Jun 3, 2024 · 7 comments · Fixed by #2697
Closed

Expo router starter has wrong colorScheme on device set on light mode #2691

giacomocerquone opened this issue Jun 3, 2024 · 7 comments · Fixed by #2697
Assignees

Comments

@giacomocerquone
Copy link

giacomocerquone commented Jun 3, 2024

Current Behavior

Hey there. Just spawned up a new project with npm create and I've chosen the expo router starter.

The simulator is in light mode, and for some reason this is what I see (n.b. the problem is not there when setting the simulator in dark mode):

336034925-b6b77100-5297-44fe-8273-4c978e46c791

Expected Behavior

I should be able to read the text and have the correct color scheme

Tamagui Version

^1.99.1

Platform (Web, iOS, Android)

iOS

Reproduction

`npm create tamagui@latest`
select expo router
yarn run ios

System Info

System:
    OS: macOS 14.5
    CPU: (11) arm64 Apple M3 Pro
    Memory: 82.81 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    Yarn: 4.0.2 - ~/.nvm/versions/node/v20.11.1/bin/yarn
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
    Watchman: 2024.01.15.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 120.0.6099.216
    Safari: 17.5
  npmPackages:
    @babel/core: ^7.24.5 => 7.24.5 
    @expo/metro-runtime: ~3.2.1 => 3.2.1 
    @react-navigation/native: 6.1.17 => 6.1.17 
    @tamagui/config: ^1.99.1 => 1.99.1 
    @tamagui/lucide-icons: ^1.99.1 => 1.99.1 
    @tamagui/metro-plugin: ^1.99.1 => 1.99.1 
    @tamagui/toast: ^1.99.1 => 1.99.1 
    @types/react: ~18.2.79 => 18.2.79 
    @types/react-native: ^0.73.0 => 0.73.0 
    babel-preset-expo: ^11.0.6 => 11.0.6 
    burnt: ^0.12.2 => 0.12.2 
    expo: 51.0.9 => 51.0.9 
    expo-font: 12.0.6 => 12.0.6 
    expo-linking: ~6.3.1 => 6.3.1 
    expo-router: ~3.5.14 => 3.5.14 
    expo-splash-screen: ~0.27.4 => 0.27.4 
    expo-status-bar: ^1.12.1 => 1.12.1 
    expo-system-ui: ~3.0.4 => 3.0.4 
    expo-web-browser: ~13.0.3 => 13.0.3 
    react: ^18.2.0 => 18.2.0 
    react-dom: 18.2.0 => 18.2.0 
    react-native: 0.74.1 => 0.74.1 
    react-native-reanimated: 3.10.1 => 3.10.1 
    react-native-safe-area-context: 4.10.1 => 4.10.1 
    react-native-screens: ~3.31.1 => 3.31.1 
    react-native-svg: 15.2.0 => 15.2.0 
    react-native-web: ^0.19.12 => 0.19.12 
    tamagui: ^1.99.1 => 1.99.1 
    typescript: ^5.3.3 => 5.4.5 
@giacomocerquone
Copy link
Author

giacomocerquone commented Jun 3, 2024

I'm not even sure the problem lies here or in expo router (or react navigation) since it seems like the DarkTheme passed to the ThemeProvider is not applied.

@SamuraiF0x SamuraiF0x self-assigned this Jun 3, 2024
@SamuraiF0x
Copy link
Contributor

pushed fix, can you try now?

@giacomocerquone
Copy link
Author

giacomocerquone commented Jun 4, 2024

pushed fix, can you try now?

Hey there. Thank you, but no, now on both light and dark mode, it appears like this:

image

Also, here you should not set defaultTheme: https://github.com/tamagui/tamagui/blob/master/starters/expo-router/app/_layout.tsx#L47, but removing it still doesn't solve the problem and most importantly, you shouldn't push stuff like that, it makes difficult for me, or other contributors, to comment or to give feedbacks in general.

What do you say of opening a PR next time?

@giacomocerquone
Copy link
Author

Imho your changes are wrong and should be reverted.
You've also added a background="$bg" to the index view which sounds wrong since the background should be actually enforced by react-navigation that is not correctly applying the theme (react-navigation or expo router, one of the two).

I've started an expo project that has slightly different libs version and then added tamagui on top of that and it's working really well for some reason. I could investigate on that but running out of time sadly

@giacomocerquone
Copy link
Author

Just noticed that deleting the lockfile and the node_modules folder, and then reissuing yarn install, make the ThemeProvider work... what a nightmare, I believe yarn 4 is giving inconsistent results for some reason totally unknown to me.

I also tried to compare the “pre” and “post” lock files, but the diff is huge.
react-native-screens went from 6.5.11 to 6.5.20
@react-navigation/native-stack went from 6.9.17 to 6.9.26
@react-navigation/elements went from 1.3.21 to 1.3.30

and the "weird" change is this one:

image

where expo router uses 6.1.6 but the 6.1.17 was added

@SamuraiF0x SamuraiF0x linked a pull request Jun 4, 2024 that will close this issue
@SamuraiF0x
Copy link
Contributor

Hi @giacomocerquone, thank you for your feedback and advice! I made a pr with changes, should work now if you want to test it

@giacomocerquone
Copy link
Author

Hi @giacomocerquone, thank you for your feedback and advice! I made a pr with changes, should work now if you want to test it

yes it is, thank you!

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

Successfully merging a pull request may close this issue.

2 participants