Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
尝试将变量“theme”(接收 useColorScheme 库)分配为样式时,会出现以下错误。
错误图片
浅色和深色风格是在styles.js.
styles.js
Github 要点
Github 项目
非常感谢您!
useColorScheme属于'react-native-appearance',不是'react-native'。
useColorScheme
'react-native-appearance'
'react-native'
例子
import { useColorScheme } from 'react-native-appearance'
我遇到了同样的问题,还注意到如果您尝试导入 Appearance 组件,它会以 null 形式出现。
使用模拟器或安卓模拟器