简体   繁体   English

将 react-native 从 0.68 升级到 0.69 时,出现此错误

[英]While upgrading react-native from 0.68 to 0.69 , getting this error

ERROR: Invariant Violation: ViewPropTypes has been removed from React Native.错误:不变违规:ViewPropTypes 已从 React Native 中删除。 Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types'.迁移到从 'deprecated-react-native-prop-types' 导出的 ViewPropTypes。 ERROR: Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication).错误:不变违规:模块 AppRegistry 不是已注册的可调用模块(调用 runApplication)。 A frequent cause of the error is that the application entry file path is incorrect.错误的一个常见原因是应用程序入口文件路径不正确。 This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.当 JS 包损坏或加载 React Native 时出现早期初始化错误时,也会发生这种情况。 ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication).错误不变违规:模块 AppRegistry 不是已注册的可调用模块(调用 runApplication)。 A frequent cause of the error is that the application entry file path is incorrect.错误的一个常见原因是应用程序入口文件路径不正确。 This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.当 JS 包损坏或加载 React Native 时出现早期初始化错误时,也会发生这种情况。

I have replace these functions with the below lines in node_modules/react-native/index.js我已经用node_modules/react-native/index.js中的以下行替换了这些函数

// Deprecated Prop Types
get ColorPropType(): $FlowFixMe {
  console.warn('');
  return require('deprecated-react-native-prop-types').ColorPropType;
},

get EdgeInsetsPropType(): $FlowFixMe {
  console.warn('');
  return require('deprecated-react-native-prop-types').EdgeInsetsPropType;
},

get PointPropType(): $FlowFixMe {
  console.warn('');
  return require('deprecated-react-native-prop-types').PointPropType;
},

get ViewPropTypes(): $FlowFixMe {
  console.warn('');
  return require('deprecated-react-native-prop-types').ViewPropTypes;
},

but got this error:但出现此错误:

TypeError: undefined is not an object (evaluating '_reactNative.Text.propTypes.style') TypeError: undefined 不是 object(评估 '_reactNative.Text.propTypes.style')

Is there any other method to resolve this error without changing node modules codes or without using patch有没有其他方法可以在不更改节点模块代码或不使用补丁的情况下解决此错误

Install the plugin安装插件

npm install --save-dev babel-plugin-module-resolver deprecated-react-native-prop-types

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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