![](/img/trans.png)
[英]React Native, undefined is not an object (evaluating ‘_reactNative.Image.propTypes.resizeMode’)
[英]TypeError: undefined is not an object (evaluating '_reactNative.Stylesheet.create') in react native
我正在用 React Native 制作一個項目,並且已經為它安裝了所有依賴項,但是當我運行它顯示的代碼時
TypeError: undefined is not an object (evaluating '_reactNative.Stylesheet.create')
連同下面這個
node_modules/react-native/Libraries/LogBox/LogBox.js:148:8 in registerError
node_modules/react-native/Libraries/LogBox/LogBox.js:59:8 in errorImpl
node_modules/react-native/Libraries/LogBox/LogBox.js:33:4 in console.error
node_modules/expo/build/environment/react-native-logs.fx.js:27:4 錯誤
node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
node_modules/react-native/Libraries/Core/ExceptionsManager.js:171:19 in handleException
node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
node_modules/expo-error-recovery/build/ErrorRecovery.fx.js:9:32 在 ErrorUtils.setGlobalHandler$argument_0
node_modules/regenerator-runtime/runtime.js:63:36 在 tryCatch
node_modules/regenerator-runtime/runtime.js:293:29 invoke
node_modules/regenerator-runtime/runtime.js:63:36 在 tryCatch
node_modules/regenerator-runtime/runtime.js:154:27 invoke
node_modules/regenerator-runtime/runtime.js:164:18 in PromiseImpl.resolve.then$argument_0
node_modules/react-native/node_modules/promise/setimmediate/core.js:37:13 在 tryCallOne
node_modules/react-native/node_modules/promise/setimmediate/core.js:123:24 in setImmediate$argument_0
node_modules/react-native/Libraries/Core/Timers/JSTimers.js:130:14 in _callTimer
node_modules/react-native/Libraries/Core/Timers/JSTimers.js:181:14 in _callImmediatesPass
node_modules/react-native/Libraries/Core/Timers/JSTimers.js:441:30 in callImmediates
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:387:6 in __callImmediates
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:135:6 in __guard$argument_0
__guard 中的 node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:364:10
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:134:4 influshedQueue
- [本機代碼]:flushedQueue 中的 null
- [本機代碼]:invokeCallbackAndReturnFlushedQueue 中的 null
起初它說的是我修復的一個函數,但我不明白它在哪里引用了未定義的對象,如果有人能找到它所談論的文件或函數,那就太好了。
請嘗試這樣的事情
const styles = StyleSheet.create({
_container: {
flex: 1,
backgroundColor: 'blue',
alignItems: 'center',
justifyContent: 'center'
},
get container() {
return this._container;
},
set container(value) {
this._container = value;
},
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.