繁体   English   中英

TypeError:undefined 不是本机反应中的对象(正在评估“_reactNative.Stylesheet.create”)

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM