@media (prefers-color-scheme: dark) not working with Expo 54
維護者通常 3 天內回覆
@danstepanov 已經在處理了。
開始於 2025年10月24日。
評估
這個 Issue 還沒有評估資料。
描述
Describe the bug
@media (prefers-color-scheme: dark) does not work with ios. It does however work on web. It is clear the problem is with the media query because React's useColorScheme hook is working fine.
Reproduction
Here is trimmed version of my globals.css file:
@import "tailwindcss/theme.css" layer(theme);
@import "tailwindcss/preflight.css" layer(base);
@import "tailwindcss/utilities.css";
@import "nativewind/theme";
@theme {
--color-border: var(--border);
--color-input: var(--input);
--color-ring: var(--ring);
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-primary: var(--primary);
--color-primary-foreground: var(--primary-foreground);
--color-secondary: var(--secondary);
--color-secondary-foreground: var(--secondary-foreground);
--color-destructive: var(--destructive);
}
:root {
--radius: 0.625rem;
--background: #ffffff;
--foreground: #252525;
--card: #ffffff;
--card-foreground: #252525;
--popover: #ffffff;
}
@media (prefers-color-scheme: dark) {
:root {
--background: #252525;
--foreground: #fbfbfb;
--card: #343434;
--card-foreground: #fbfbfb;
--popover: #444444;
}
}
Here is my expo config:
{
"expo": {
"name": "expo-starter",
"slug": "expo-starter",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "expostarter",
"userInterfaceStyle": "automatic",
"newArchEnabled": true,
"androidStatusBar": {
"backgroundColor": "#000000",
"barStyle": "light-content",
"translucent": false
},
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.ekrich.expostarter",
"infoPlist": {
"ITSAppUsesNonExemptEncryption": false
}
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png",
"backgroundColor": "#ffffff"
},
"edgeToEdgeEnabled": true,
"package": "com.ekrich.expostarter"
},
"web": {
"bundler": "metro",
"output": "server",
"favicon": "./assets/images/favicon.png"
},
"plugins": [
"expo-router",
[
"expo-splash-screen",
{
"image": "./assets/images/splash-icon.png",
"imageWidth": 200,
"resizeMode": "contain",
"backgroundColor": "#ffffff"
}
],
"expo-font",
"expo-web-browser"
],
"experiments": {
"typedRoutes": true
},
"extra": {
"router": {},
"eas": {
"projectId": "my id"
}
},
"runtimeVersion": {
"policy": "appVersion"
},
}
}
I am running expo go for demo purposes (this is for a ui library).
Expected behavior
The theme colors should correctly switch with dark/light mode on native platforms as well.
Additional context
Discord thread discussing the issue.
- 主要語言
- TypeScript
- 星號
- 166
- 分支
- 45
- 平均合併
- 13 天 14 小時
- 30 天內合併 PR
- 1
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
nativewind/react-native-css 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
nativewind/react-native-css#545 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
nativewind/react-native-css#544 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
nativewind/react-native-css#543 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 84/100
nativewind/react-native-css#540 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
nativewind/react-native-css#538 ·
維護者通常 3 天內回覆
查看 nativewind/react-native-css 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
Graphify-Labs/graphify#4860 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
sveltejs/eslint-plugin-svelte#1615 ·
維護者通常 7 天內回覆
-
Parallel reticle_verify opens per-flow leases without the source lease's ignoreHTTPSErrors可能已有人在做 @as992949791 今天認領。 未關閉good first issue help wanted
難度 2/5 1-3 小時 新手友好度 85/100
reticlehq/reticle#2033 · 1 則留言 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆