无法读取未定义的属性'string' React.PropTypes | LayoutPropTypes.js [英] Cannot read property 'string' of undefined | React.PropTypes | LayoutPropTypes.js
问题描述
删除并重新安装我的node_modules文件夹后,我遇到了一个我在LayoutPropTypes.js文件中无法理解的问题。
After deleting and reinstalling my node_modules folder, I'm facing an issue that I don't understand in LayoutPropTypes.js file.
In node_modules / react-native / Libraries / StyleSheet / LayoutPropTypes.js
以下变量未定义: var ReactPropTypes = require('React')。PropTypes;
react-native:0.45.1
react:16.0.0-alpha.12
react-native: 0.45.1 react: 16.0.0-alpha.12
推荐答案
注意:从React v15.5开始,不推荐使用React.PropTypes。请改用
prop-types库。
Note: React.PropTypes is deprecated as of React v15.5. Please use the prop-types library instead.
您需要添加 prop-types 包现在分开。该错误很可能刚刚开始显示,因为您删除了 node_modules
文件夹,然后重新安装了升级 react
版本的所有内容。
You need to add the prop-types package separately now. The error most likely just started to show up because you deleted your node_modules
folder and then reinstalled everything which upgraded your react
version.
这篇关于无法读取未定义的属性'string' React.PropTypes | LayoutPropTypes.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!