Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e120862

Browse files
authored
Make React 0.14 compatible with prop-types (facebook#9412)
1 parent 66fff86 commit e120862

File tree

4 files changed

+33
-7
lines changed

4 files changed

+33
-7
lines changed

src/isomorphic/classic/element/ReactElementValidator.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,14 @@ function checkPropTypes(componentName, propTypes, props, location) {
195195
ReactPropTypeLocationNames[location],
196196
propName
197197
);
198-
error = propTypes[propName](props, propName, componentName, location);
198+
error = propTypes[propName](
199+
props,
200+
propName,
201+
componentName,
202+
location,
203+
null,
204+
'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'
205+
);
199206
} catch (ex) {
200207
error = ex;
201208
}

src/isomorphic/classic/types/ReactPropTypes.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ function createArrayOfTypeChecker(typeChecker) {
159159
i,
160160
componentName,
161161
location,
162-
`${propFullName}[${i}]`
162+
`${propFullName}[${i}]`,
163+
'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'
163164
);
164165
if (error instanceof Error) {
165166
return error;
@@ -246,7 +247,8 @@ function createObjectOfTypeChecker(typeChecker) {
246247
key,
247248
componentName,
248249
location,
249-
`${propFullName}.${key}`
250+
`${propFullName}.${key}`,
251+
'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'
250252
);
251253
if (error instanceof Error) {
252254
return error;
@@ -271,7 +273,14 @@ function createUnionTypeChecker(arrayOfTypeCheckers) {
271273
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
272274
var checker = arrayOfTypeCheckers[i];
273275
if (
274-
checker(props, propName, componentName, location, propFullName) == null
276+
checker(
277+
props,
278+
propName,
279+
componentName,
280+
location,
281+
propFullName,
282+
'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'
283+
) == null
275284
) {
276285
return null;
277286
}
@@ -321,7 +330,8 @@ function createShapeTypeChecker(shapeTypes) {
321330
key,
322331
componentName,
323332
location,
324-
`${propFullName}.${key}`
333+
`${propFullName}.${key}`,
334+
'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'
325335
);
326336
if (error) {
327337
return error;

src/renderers/dom/client/wrappers/LinkedValueUtils.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ var LinkedValueUtils = {
110110
props,
111111
propName,
112112
tagName,
113-
ReactPropTypeLocations.prop
113+
ReactPropTypeLocations.prop,
114+
null,
115+
'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'
114116
);
115117
}
116118
if (error instanceof Error && !(error.message in loggedTypeFailures)) {

src/renderers/shared/reconciler/ReactCompositeComponent.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,14 @@ var ReactCompositeComponentMixin = {
471471
ReactPropTypeLocationNames[location],
472472
propName
473473
);
474-
error = propTypes[propName](props, propName, componentName, location);
474+
error = propTypes[propName](
475+
props,
476+
propName,
477+
componentName,
478+
location,
479+
null,
480+
'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'
481+
);
475482
} catch (ex) {
476483
error = ex;
477484
}

0 commit comments

Comments
 (0)