mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
ReactElementValidator uses temporary ReactNative View propTypes getter (#9256)
This commit is contained in:
committed by
Dan Abramov
parent
60e78e37b8
commit
c5156eb0be
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user