手动调用 React.PropTypes 验证 React 原生“^0.30.0"; [英] Manually calling a React.PropTypes validation React native "^0.30.0"

查看:44
本文介绍了手动调用 React.PropTypes 验证 React 原生“^0.30.0";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经升级到最新版本的 React/RN:反应":^ 15.2.1","react-native": "^0.30.0",

而且我开始收到很多关于样式表的警告.我实际上没有对样式表使用 React.PropTypes 验证,为什么会抛出这些警告?

const 样式 = StyleSheet.create({欢迎: {字体大小:20,文本对齐:居中",保证金:10,},

<块引用>

ExceptionsManager.js:76 警告:您正在手动调用fontSize 道具的 React.PropTypes 验证函数StyleSheet 欢迎.这已被弃用,在下一个将不起作用主要版本.由于第三方,您可能会看到此警告PropTypes 库.见 https://facebook.github.io/react/warnings/dont-call-proptypes.html有关详细信息.reactConsoleError @

ExceptionsManager.js:76 警告:您正在手动调用textAlign 道具的 React.PropTypes 验证函数StyleSheet 欢迎.这已被弃用,在下一个将不起作用主要版本.由于第三方,您可能会看到此警告PropTypes 库.见 https://facebook.github.io/react/warnings/dont-call-proptypes.html

ExceptionsManager.js:76 警告:您正在手动调用margin 道具的 React.PropTypes 验证函数StyleSheet 欢迎.这已被弃用,在下一个将不起作用主要版本.由于第三方,您可能会看到此警告PropTypes 库.见 https://facebook.github.io/react/warnings/dont-call-proptypes.html详情.

解决方案

React native 0.30 依赖于 react 15.2.0 而不是 15.2.1.所以你应该做rm -rf node_modules/react,从package.json中删除react版本,然后npm install --save react@15.2.0.这应该可以解决问题.

I have upgraded to the latest version of React/RN: "react": "^15.2.1", "react-native": "^0.30.0",

And I am starting to get a lot of warnings regarding the stylesheets. I am actually not using React.PropTypes validation for the style sheets, so why is throwing these warnings?

const styles = StyleSheet.create({
    welcome: {
        fontSize: 20,
        textAlign: "center",
        margin: 10,
    },

ExceptionsManager.js:76 Warning: You are manually calling a React.PropTypes validation function for the fontSize prop on StyleSheet welcome. This is deprecated and will not work in the next major version. You may be seeing this warning due to a third-party PropTypes library. See https://facebook.github.io/react/warnings/dont-call-proptypes.html for details.reactConsoleError @

ExceptionsManager.js:76 Warning: You are manually calling a React.PropTypes validation function for the textAlign prop on StyleSheet welcome. This is deprecated and will not work in the next major version. You may be seeing this warning due to a third-party PropTypes library. See https://facebook.github.io/react/warnings/dont-call-proptypes.html

ExceptionsManager.js:76 Warning: You are manually calling a React.PropTypes validation function for the margin prop on StyleSheet welcome. This is deprecated and will not work in the next major version. You may be seeing this warning due to a third-party PropTypes library. See https://facebook.github.io/react/warnings/dont-call-proptypes.html for details.

解决方案

React native 0.30 was dependent on react 15.2.0 not 15.2.1. So you should do rm -rf node_modules/react, remove the react version from package.json, then npm install --save react@15.2.0. This should do the trick.

这篇关于手动调用 React.PropTypes 验证 React 原生“^0.30.0";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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