mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Make React 0.14 compatible with prop-types (#9412)
This commit is contained in:
@@ -195,7 +195,14 @@ function checkPropTypes(componentName, propTypes, props, location) {
|
||||
ReactPropTypeLocationNames[location],
|
||||
propName
|
||||
);
|
||||
error = propTypes[propName](props, propName, componentName, location);
|
||||
error = propTypes[propName](
|
||||
props,
|
||||
propName,
|
||||
componentName,
|
||||
location,
|
||||
null,
|
||||
'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'
|
||||
);
|
||||
} catch (ex) {
|
||||
error = ex;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,8 @@ function createArrayOfTypeChecker(typeChecker) {
|
||||
i,
|
||||
componentName,
|
||||
location,
|
||||
`${propFullName}[${i}]`
|
||||
`${propFullName}[${i}]`,
|
||||
'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'
|
||||
);
|
||||
if (error instanceof Error) {
|
||||
return error;
|
||||
@@ -246,7 +247,8 @@ function createObjectOfTypeChecker(typeChecker) {
|
||||
key,
|
||||
componentName,
|
||||
location,
|
||||
`${propFullName}.${key}`
|
||||
`${propFullName}.${key}`,
|
||||
'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'
|
||||
);
|
||||
if (error instanceof Error) {
|
||||
return error;
|
||||
@@ -271,7 +273,14 @@ function createUnionTypeChecker(arrayOfTypeCheckers) {
|
||||
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
||||
var checker = arrayOfTypeCheckers[i];
|
||||
if (
|
||||
checker(props, propName, componentName, location, propFullName) == null
|
||||
checker(
|
||||
props,
|
||||
propName,
|
||||
componentName,
|
||||
location,
|
||||
propFullName,
|
||||
'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'
|
||||
) == null
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
@@ -321,7 +330,8 @@ function createShapeTypeChecker(shapeTypes) {
|
||||
key,
|
||||
componentName,
|
||||
location,
|
||||
`${propFullName}.${key}`
|
||||
`${propFullName}.${key}`,
|
||||
'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'
|
||||
);
|
||||
if (error) {
|
||||
return error;
|
||||
|
||||
@@ -110,7 +110,9 @@ var LinkedValueUtils = {
|
||||
props,
|
||||
propName,
|
||||
tagName,
|
||||
ReactPropTypeLocations.prop
|
||||
ReactPropTypeLocations.prop,
|
||||
null,
|
||||
'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'
|
||||
);
|
||||
}
|
||||
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
||||
|
||||
@@ -471,7 +471,14 @@ var ReactCompositeComponentMixin = {
|
||||
ReactPropTypeLocationNames[location],
|
||||
propName
|
||||
);
|
||||
error = propTypes[propName](props, propName, componentName, location);
|
||||
error = propTypes[propName](
|
||||
props,
|
||||
propName,
|
||||
componentName,
|
||||
location,
|
||||
null,
|
||||
'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'
|
||||
);
|
||||
} catch (ex) {
|
||||
error = ex;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user