React Native(iOS) 模块 AppRegistry 不是注册的可调用模块(调用 runApplication) [英] React Native(iOS) Module AppRegistry is not a registered callable module (calling runApplication)

查看:84
本文介绍了React Native(iOS) 模块 AppRegistry 不是注册的可调用模块(调用 runApplication)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在升级以处理较新设备后,我的应用程序在启动画面处停止时遇到问题.我正在运行以下内容.

I am having an issue with my app stopping at the splash screen after upgrading to handle newer devices. I'm running the following.

"react": "^16.2.0",
"react-native": "^0.51.0",

打包器中没有错误,但在 xCode 中我看到以下内容

There is no error in the packager but in xCode I see the following

Unhandled JS Exception: Module AppRegistry is not a registered 
callable module (calling runApplication)

[tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS 
Exception: undefined is not an object (evaluating '_react2.PropTypes.oneOf')

如有任何帮助追踪这些错误,我们将不胜感激.

Any help tracking down either of these errors would be appreciated.

推荐答案

PropTypes 已从 React v16 及更高版本的 React 包中移除.

PropTypes have been moved away from the React package in React v16 and above.

在你的代码中,你要么有 React.PropTypes 要么像这样的导入语句 import { PropTypes } from 'react'

Somewhere in your code you either have React.PropTypes or an import statement like this import { PropTypes } from 'react'

你必须通过像这样导入 PropTypes 来改变它:

You have to change this by importing PropTypes like this:

import PropTypes from 'prop-types'; // ES6

像这样使用它.

MyComponent.propTypes = {
 props: PropTypes.string
}

您还必须确保在 dependencies 内的 package.json 中具有 prop-types 依赖项,例如通过运行:

You also have to make sure that in your package.json inside of dependencies you have the prop-types dependency, for example by running:

npm install --save prop-types

这篇关于React Native(iOS) 模块 AppRegistry 不是注册的可调用模块(调用 runApplication)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆