我正处于反应原生项目的中间。我已经安装,链接和使用了很多包。但是现在通过npm安装包是成功的,它是在package.json中添加的,但是当我从包中导入一些功能到我的项目文件时,应用程序崩溃显示如下消息:
"undefined is not a object (evaluating '_react.PropTypes.array')
"undefined is not a object (evaluating '_react.PropTypes.bool')
"undefined is not a object (evaluating '_react.PropTypes.object')
示例,当我安装react-native-modal-picker时:
> C:\Users\Taylon\reactive-native-projects\gps7plus>npm install
> react-native-modal
> -picker --save npm WARN eslint-plugin-react-native@3.2.1 requires a peer of eslint@^3.17.0 || ^
> 4.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY:
> fsevents@1.1.3 (node_modules\fse vents): npm WARN notsup SKIPPING
> OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
> 1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"} )
>
> + react-native-modal-picker@0.0.16 added 1 package in 19.823s
这些WARN消息是否会混乱?
链接(任何消息):
C:\Users\Taylon\reactive-native-projects\gps7plus>react-native link react-native
-modal-picker
Scanning folders for symlinks in C:\Users\Taylon\reactive-native-projects\gps7pl
us\node_modules (31ms)
C:\Users\Taylon\reactive-native-projects\gps7plus>
导入...
import ModalPicker from 'react-native-modal-picker';
我还没有这样做。所以红屏:
"undefined is not a object (evaluating '_react.PropTypes.array')
是否有任何方法可以检查npm错误?或者一些来验证包是否真的安装了?
答案 0 :(得分:2)
模块react-native-modal-picker
长期以来一直没有更新,PropTypes
已被移动到单独的包中,因为React
v15.5
版本here < / p>
您可以在index.js文件中找到证据
import React,{
PropTypes
} from 'react';
因此,您需要找到替代方案。我建议你使用这个包react-native-actionsheet
,因为它是跨平台的,并提供相同的功能。