react-native: Getting proptype warning errors for FB components

Since upgrading to 0.30.0, we are now getting many, many warnings not to manually call React.Proptypes validation functions. But these are not in our code, they’re in RCT code.

Two of many:

ExceptionsManager.js:76 Warning: You are manually calling a React.PropTypes validation function for the borderBottomRightRadius prop on RCTImageView. 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://fb.me/react-warning-dont-call-proptypes for details.

ExceptionsManager.js:76 Warning: You are manually calling a React.PropTypes validation function for the translateY prop on TouchableHighlight. 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://fb.me/react-warning-dont-call-proptypes for details.

We’ve updated all our modules, so…

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 14
  • Comments: 16 (9 by maintainers)

Most upvoted comments

The fix is to use the version of React that is specified by

require('react-native/package.json').peerDependencies.react

For RN 0.30 and 0.31: npm install react@~15.2.1 For RN 0.32: npm install react@~15.3.0

That’s why you should stick to required peer dependencies: react-native requires react@~15.2.0, which does not include react 15.3, only versions >= 15.2 and < 15.3 (even if I also tried it haha). This change from ^ to ~ was recently introduced in react-native to avoid this kind of issue.

Thanks to @ide, replace "react": "^15.2.1", to "react": "~15.2.1", fix all the warnings, love. (react-native ^0.31.0)

I downgraded to React 15.2.1 until a fix for this is issued

It’s related to React 15.3.0 https://github.com/facebook/react/releases I shield these warn by comment Related code in react/lib/ReactPropTypes.js line 119 -122

        // if (!manualPropTypeCallCache[cacheKey]) {
        //   process.env.NODE_ENV !== 'production' ? warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. 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://fb.me/react-warning-dont-call-proptypes for details.', propFullName, componentName) : void 0;
        //   manualPropTypeCallCache[cacheKey] = true;
        // }

+1 with 0.29.0

+1, ETA for an official fix?

@antoinerousseau I’ve updated react after install react-addons-pure-render-mixin. So, I’ve installed both 15.2 versions and all works fine again 😄

But if you want to ignore that peer dependency requirement and use react 15.3 anyway, you can apply @ios122’s hack by removing lines 116-124 from node_modules/react/lib/ReactPropTypes.js:

if (process.env.NODE_ENV !== 'production') {
  if (secret !== ReactPropTypesSecret && typeof console !== 'undefined') {
    var cacheKey = componentName + ':' + propName;
    if (!manualPropTypeCallCache[cacheKey]) {
      process.env.NODE_ENV !== 'production' ? warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. 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://fb.me/react-warning-dont-call-proptypes for details.', propFullName, componentName) : void 0;
      manualPropTypeCallCache[cacheKey] = true;
    }
  }
}

Is there any workaround for this issue?