无法读取未定义的属性“字符串" |React.PropTypes |LayoutPropTypes.js [英] Cannot read property 'string' of undefined | React.PropTypes | LayoutPropTypes.js

查看:15
本文介绍了无法读取未定义的属性“字符串" |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.

node_modules/react-native/Libraries/StyleSheet/LayoutPropTypes.js以下变量未定义:var ReactPropTypes = require('React').PropTypes;

反应原生:0.45.1反应:16.0.0-alpha.12

react-native: 0.45.1 react: 16.0.0-alpha.12

推荐答案

React.PropTypes 现在已弃用:

注意:React.PropTypes 从 React v15.5 开始被弃用.请使用取而代之的是 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.

这篇关于无法读取未定义的属性“字符串" |React.PropTypes |LayoutPropTypes.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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