Skip to content

Commit

Permalink
ReactElementValidator uses temporary ReactNative View propTypes getter (
Browse files Browse the repository at this point in the history
  • Loading branch information
bvaughn authored and gaearon committed Mar 24, 2017
1 parent 60e78e3 commit c5156eb
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/isomorphic/classic/element/ReactElementValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,17 @@ function validatePropTypes(element) {
return;
}
var name = componentClass.displayName || componentClass.name;
if (componentClass.propTypes) {
checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name);

// ReactNative `View.propTypes` have been deprecated in favor of `ViewPropTypes`.
// In their place a temporary getter has been added with a deprecated warning message.
// Avoid triggering that warning during validation using the temporary workaround, __propTypesSecretDontUseThesePlease.
// TODO (bvaughn) Revert this particular change any time after April 1 ReactNative RC is tagged.
var propTypes = typeof componentClass.__propTypesSecretDontUseThesePlease === 'object'
? componentClass.__propTypesSecretDontUseThesePlease
: componentClass.propTypes;

if (propTypes) {
checkReactTypeSpec(propTypes, element.props, 'prop', name);
}
if (typeof componentClass.getDefaultProps === 'function') {
warning(
Expand Down

0 comments on commit c5156eb

Please sign in to comment.