react 16.1.0-rc → 16.3.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/react.development.js +159 -99
- package/cjs/react.production.min.js +14 -15
- package/package.json +1 -1
- package/umd/react.development.js +196 -138
- package/umd/react.production.min.js +14 -14
package/cjs/react.development.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.3.0-alpha.0
|
|
2
2
|
* react.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -9,20 +9,50 @@
|
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
|
+
|
|
13
|
+
|
|
12
14
|
if (process.env.NODE_ENV !== "production") {
|
|
13
15
|
(function() {
|
|
14
16
|
'use strict';
|
|
15
17
|
|
|
16
18
|
var _assign = require('object-assign');
|
|
17
|
-
var invariant = require('fbjs/lib/invariant');
|
|
18
19
|
var emptyObject = require('fbjs/lib/emptyObject');
|
|
20
|
+
var invariant = require('fbjs/lib/invariant');
|
|
19
21
|
var warning = require('fbjs/lib/warning');
|
|
20
22
|
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
21
23
|
var checkPropTypes = require('prop-types/checkPropTypes');
|
|
22
24
|
|
|
23
25
|
// TODO: this is special because it gets imported during build.
|
|
24
26
|
|
|
25
|
-
var ReactVersion = '16.
|
|
27
|
+
var ReactVersion = '16.3.0-alpha.0';
|
|
28
|
+
|
|
29
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
30
|
+
// nor polyfill, then a plain number is used for performance.
|
|
31
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol['for'];
|
|
32
|
+
|
|
33
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol['for']('react.element') : 0xeac7;
|
|
34
|
+
var REACT_CALL_TYPE = hasSymbol ? Symbol['for']('react.call') : 0xeac8;
|
|
35
|
+
var REACT_RETURN_TYPE = hasSymbol ? Symbol['for']('react.return') : 0xeac9;
|
|
36
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol['for']('react.portal') : 0xeaca;
|
|
37
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb;
|
|
38
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol['for']('react.strict_mode') : 0xeacc;
|
|
39
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol['for']('react.provider') : 0xeacd;
|
|
40
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol['for']('react.context') : 0xeace;
|
|
41
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol['for']('react.async_mode') : 0xeacf;
|
|
42
|
+
|
|
43
|
+
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
44
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
45
|
+
|
|
46
|
+
function getIteratorFn(maybeIterable) {
|
|
47
|
+
if (maybeIterable === null || typeof maybeIterable === 'undefined') {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
51
|
+
if (typeof maybeIterator === 'function') {
|
|
52
|
+
return maybeIterator;
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
26
56
|
|
|
27
57
|
/**
|
|
28
58
|
* WARNING: DO NOT manually require this module.
|
|
@@ -31,21 +61,6 @@ var ReactVersion = '16.1.0-rc';
|
|
|
31
61
|
* It always throws.
|
|
32
62
|
*/
|
|
33
63
|
|
|
34
|
-
// Exports React.Fragment
|
|
35
|
-
var enableReactFragment = false;
|
|
36
|
-
// Exports ReactDOM.createRoot
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// Mutating mode (React DOM, React ART, React Native):
|
|
41
|
-
|
|
42
|
-
// Experimental noop mode (currently unused):
|
|
43
|
-
|
|
44
|
-
// Experimental persistent mode (CS):
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// Only used in www builds.
|
|
48
|
-
|
|
49
64
|
/**
|
|
50
65
|
* Forked from fbjs/warning:
|
|
51
66
|
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
@@ -103,8 +118,8 @@ var didWarnStateUpdateForUnmountedComponent = {};
|
|
|
103
118
|
|
|
104
119
|
function warnNoop(publicInstance, callerName) {
|
|
105
120
|
{
|
|
106
|
-
var
|
|
107
|
-
var componentName =
|
|
121
|
+
var _constructor = publicInstance.constructor;
|
|
122
|
+
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
|
108
123
|
var warningKey = componentName + '.' + callerName;
|
|
109
124
|
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
110
125
|
return;
|
|
@@ -269,46 +284,25 @@ Component.prototype.forceUpdate = function (callback) {
|
|
|
269
284
|
}
|
|
270
285
|
}
|
|
271
286
|
|
|
287
|
+
function ComponentDummy() {}
|
|
288
|
+
ComponentDummy.prototype = Component.prototype;
|
|
289
|
+
|
|
272
290
|
/**
|
|
273
|
-
*
|
|
291
|
+
* Convenience component with default shallow equality check for sCU.
|
|
274
292
|
*/
|
|
275
293
|
function PureComponent(props, context, updater) {
|
|
276
|
-
// Duplicated from Component.
|
|
277
294
|
this.props = props;
|
|
278
295
|
this.context = context;
|
|
279
296
|
this.refs = emptyObject;
|
|
280
|
-
// We initialize the default updater but the real one gets injected by the
|
|
281
|
-
// renderer.
|
|
282
297
|
this.updater = updater || ReactNoopUpdateQueue;
|
|
283
298
|
}
|
|
284
299
|
|
|
285
|
-
function ComponentDummy() {}
|
|
286
|
-
ComponentDummy.prototype = Component.prototype;
|
|
287
300
|
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
288
301
|
pureComponentPrototype.constructor = PureComponent;
|
|
289
302
|
// Avoid an extra prototype jump for these methods.
|
|
290
303
|
_assign(pureComponentPrototype, Component.prototype);
|
|
291
304
|
pureComponentPrototype.isPureReactComponent = true;
|
|
292
305
|
|
|
293
|
-
function AsyncComponent(props, context, updater) {
|
|
294
|
-
// Duplicated from Component.
|
|
295
|
-
this.props = props;
|
|
296
|
-
this.context = context;
|
|
297
|
-
this.refs = emptyObject;
|
|
298
|
-
// We initialize the default updater but the real one gets injected by the
|
|
299
|
-
// renderer.
|
|
300
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
var asyncComponentPrototype = AsyncComponent.prototype = new ComponentDummy();
|
|
304
|
-
asyncComponentPrototype.constructor = AsyncComponent;
|
|
305
|
-
// Avoid an extra prototype jump for these methods.
|
|
306
|
-
_assign(asyncComponentPrototype, Component.prototype);
|
|
307
|
-
asyncComponentPrototype.unstable_isAsyncReactComponent = true;
|
|
308
|
-
asyncComponentPrototype.render = function () {
|
|
309
|
-
return this.props.children;
|
|
310
|
-
};
|
|
311
|
-
|
|
312
306
|
/**
|
|
313
307
|
* Keeps track of the current owner.
|
|
314
308
|
*
|
|
@@ -325,10 +319,6 @@ var ReactCurrentOwner = {
|
|
|
325
319
|
|
|
326
320
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
327
321
|
|
|
328
|
-
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
|
329
|
-
// nor polyfill, then a plain number is used for performance.
|
|
330
|
-
var REACT_ELEMENT_TYPE$1 = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
|
331
|
-
|
|
332
322
|
var RESERVED_PROPS = {
|
|
333
323
|
key: true,
|
|
334
324
|
ref: true,
|
|
@@ -336,8 +326,8 @@ var RESERVED_PROPS = {
|
|
|
336
326
|
__source: true
|
|
337
327
|
};
|
|
338
328
|
|
|
339
|
-
var specialPropKeyWarningShown;
|
|
340
|
-
var specialPropRefWarningShown;
|
|
329
|
+
var specialPropKeyWarningShown = void 0;
|
|
330
|
+
var specialPropRefWarningShown = void 0;
|
|
341
331
|
|
|
342
332
|
function hasValidRef(config) {
|
|
343
333
|
{
|
|
@@ -414,7 +404,7 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
414
404
|
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
415
405
|
var element = {
|
|
416
406
|
// This tag allow us to uniquely identify this as a React Element
|
|
417
|
-
$$typeof: REACT_ELEMENT_TYPE
|
|
407
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
418
408
|
|
|
419
409
|
// Built-in properties that belong on the element
|
|
420
410
|
type: type,
|
|
@@ -472,7 +462,7 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
472
462
|
* See https://reactjs.org/docs/react-api.html#createelement
|
|
473
463
|
*/
|
|
474
464
|
function createElement(type, config, children) {
|
|
475
|
-
var propName;
|
|
465
|
+
var propName = void 0;
|
|
476
466
|
|
|
477
467
|
// Reserved names are extracted
|
|
478
468
|
var props = {};
|
|
@@ -529,7 +519,7 @@ function createElement(type, config, children) {
|
|
|
529
519
|
}
|
|
530
520
|
{
|
|
531
521
|
if (key || ref) {
|
|
532
|
-
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE
|
|
522
|
+
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
|
|
533
523
|
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
534
524
|
if (key) {
|
|
535
525
|
defineKeyPropWarningGetter(props, displayName);
|
|
@@ -560,7 +550,7 @@ function cloneAndReplaceKey(oldElement, newKey) {
|
|
|
560
550
|
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
561
551
|
*/
|
|
562
552
|
function cloneElement(element, config, children) {
|
|
563
|
-
var propName;
|
|
553
|
+
var propName = void 0;
|
|
564
554
|
|
|
565
555
|
// Original props are copied
|
|
566
556
|
var props = _assign({}, element.props);
|
|
@@ -589,7 +579,7 @@ function cloneElement(element, config, children) {
|
|
|
589
579
|
}
|
|
590
580
|
|
|
591
581
|
// Remaining properties override existing props
|
|
592
|
-
var defaultProps;
|
|
582
|
+
var defaultProps = void 0;
|
|
593
583
|
if (element.type && element.type.defaultProps) {
|
|
594
584
|
defaultProps = element.type.defaultProps;
|
|
595
585
|
}
|
|
@@ -629,7 +619,7 @@ function cloneElement(element, config, children) {
|
|
|
629
619
|
* @final
|
|
630
620
|
*/
|
|
631
621
|
function isValidElement(object) {
|
|
632
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE
|
|
622
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
633
623
|
}
|
|
634
624
|
|
|
635
625
|
var ReactDebugCurrentFrame = {};
|
|
@@ -647,12 +637,6 @@ var ReactDebugCurrentFrame = {};
|
|
|
647
637
|
};
|
|
648
638
|
}
|
|
649
639
|
|
|
650
|
-
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
651
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
652
|
-
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
|
653
|
-
// nor polyfill, then a plain number is used for performance.
|
|
654
|
-
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
|
655
|
-
var REACT_PORTAL_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.portal') || 0xeaca;
|
|
656
640
|
var SEPARATOR = '.';
|
|
657
641
|
var SUBSEPARATOR = ':';
|
|
658
642
|
|
|
@@ -736,10 +720,26 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
736
720
|
children = null;
|
|
737
721
|
}
|
|
738
722
|
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
723
|
+
var invokeCallback = false;
|
|
724
|
+
|
|
725
|
+
if (children === null) {
|
|
726
|
+
invokeCallback = true;
|
|
727
|
+
} else {
|
|
728
|
+
switch (type) {
|
|
729
|
+
case 'string':
|
|
730
|
+
case 'number':
|
|
731
|
+
invokeCallback = true;
|
|
732
|
+
break;
|
|
733
|
+
case 'object':
|
|
734
|
+
switch (children.$$typeof) {
|
|
735
|
+
case REACT_ELEMENT_TYPE:
|
|
736
|
+
case REACT_PORTAL_TYPE:
|
|
737
|
+
invokeCallback = true;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
if (invokeCallback) {
|
|
743
743
|
callback(traverseContext, children,
|
|
744
744
|
// If it's the only child, treat the name as if it was wrapped in an array
|
|
745
745
|
// so that it's consistent if the number of children grows.
|
|
@@ -747,8 +747,8 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
747
747
|
return 1;
|
|
748
748
|
}
|
|
749
749
|
|
|
750
|
-
var child;
|
|
751
|
-
var nextName;
|
|
750
|
+
var child = void 0;
|
|
751
|
+
var nextName = void 0;
|
|
752
752
|
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
753
753
|
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
754
754
|
|
|
@@ -759,7 +759,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
759
759
|
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
760
760
|
}
|
|
761
761
|
} else {
|
|
762
|
-
var iteratorFn =
|
|
762
|
+
var iteratorFn = getIteratorFn(children);
|
|
763
763
|
if (typeof iteratorFn === 'function') {
|
|
764
764
|
{
|
|
765
765
|
// Warn about using Maps as children
|
|
@@ -770,7 +770,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
770
770
|
}
|
|
771
771
|
|
|
772
772
|
var iterator = iteratorFn.call(children);
|
|
773
|
-
var step;
|
|
773
|
+
var step = void 0;
|
|
774
774
|
var ii = 0;
|
|
775
775
|
while (!(step = iterator.next()).done) {
|
|
776
776
|
child = step.value;
|
|
@@ -957,6 +957,39 @@ function onlyChild(children) {
|
|
|
957
957
|
return children;
|
|
958
958
|
}
|
|
959
959
|
|
|
960
|
+
function createContext(defaultValue, calculateChangedBits) {
|
|
961
|
+
if (calculateChangedBits === undefined) {
|
|
962
|
+
calculateChangedBits = null;
|
|
963
|
+
} else {
|
|
964
|
+
{
|
|
965
|
+
warning(calculateChangedBits === null || typeof calculateChangedBits === 'function', 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
var context = {
|
|
970
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
|
971
|
+
calculateChangedBits: calculateChangedBits,
|
|
972
|
+
defaultValue: defaultValue,
|
|
973
|
+
currentValue: defaultValue,
|
|
974
|
+
changedBits: 0,
|
|
975
|
+
// These are circular
|
|
976
|
+
Provider: null,
|
|
977
|
+
Consumer: null
|
|
978
|
+
};
|
|
979
|
+
|
|
980
|
+
context.Provider = {
|
|
981
|
+
$$typeof: REACT_PROVIDER_TYPE,
|
|
982
|
+
context: context
|
|
983
|
+
};
|
|
984
|
+
context.Consumer = context;
|
|
985
|
+
|
|
986
|
+
{
|
|
987
|
+
context._currentRenderer = null;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
return context;
|
|
991
|
+
}
|
|
992
|
+
|
|
960
993
|
var describeComponentFrame = function (name, source, ownerName) {
|
|
961
994
|
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
|
962
995
|
};
|
|
@@ -964,11 +997,21 @@ var describeComponentFrame = function (name, source, ownerName) {
|
|
|
964
997
|
function getComponentName(fiber) {
|
|
965
998
|
var type = fiber.type;
|
|
966
999
|
|
|
1000
|
+
if (typeof type === 'function') {
|
|
1001
|
+
return type.displayName || type.name;
|
|
1002
|
+
}
|
|
967
1003
|
if (typeof type === 'string') {
|
|
968
1004
|
return type;
|
|
969
1005
|
}
|
|
970
|
-
|
|
971
|
-
|
|
1006
|
+
switch (type) {
|
|
1007
|
+
case REACT_FRAGMENT_TYPE:
|
|
1008
|
+
return 'ReactFragment';
|
|
1009
|
+
case REACT_PORTAL_TYPE:
|
|
1010
|
+
return 'ReactPortal';
|
|
1011
|
+
case REACT_CALL_TYPE:
|
|
1012
|
+
return 'ReactCall';
|
|
1013
|
+
case REACT_RETURN_TYPE:
|
|
1014
|
+
return 'ReactReturn';
|
|
972
1015
|
}
|
|
973
1016
|
return null;
|
|
974
1017
|
}
|
|
@@ -980,24 +1023,34 @@ function getComponentName(fiber) {
|
|
|
980
1023
|
* that support it.
|
|
981
1024
|
*/
|
|
982
1025
|
|
|
1026
|
+
var currentlyValidatingElement = void 0;
|
|
1027
|
+
var propTypesMisspellWarningShown = void 0;
|
|
1028
|
+
|
|
1029
|
+
var getDisplayName = function () {};
|
|
1030
|
+
var getStackAddendum = function () {};
|
|
1031
|
+
|
|
1032
|
+
var VALID_FRAGMENT_PROPS = void 0;
|
|
1033
|
+
|
|
983
1034
|
{
|
|
984
|
-
|
|
1035
|
+
currentlyValidatingElement = null;
|
|
1036
|
+
|
|
1037
|
+
propTypesMisspellWarningShown = false;
|
|
985
1038
|
|
|
986
|
-
|
|
1039
|
+
getDisplayName = function (element) {
|
|
987
1040
|
if (element == null) {
|
|
988
1041
|
return '#empty';
|
|
989
1042
|
} else if (typeof element === 'string' || typeof element === 'number') {
|
|
990
1043
|
return '#text';
|
|
991
1044
|
} else if (typeof element.type === 'string') {
|
|
992
1045
|
return element.type;
|
|
993
|
-
} else if (element.type === REACT_FRAGMENT_TYPE
|
|
1046
|
+
} else if (element.type === REACT_FRAGMENT_TYPE) {
|
|
994
1047
|
return 'React.Fragment';
|
|
995
1048
|
} else {
|
|
996
1049
|
return element.type.displayName || element.type.name || 'Unknown';
|
|
997
1050
|
}
|
|
998
1051
|
};
|
|
999
1052
|
|
|
1000
|
-
|
|
1053
|
+
getStackAddendum = function () {
|
|
1001
1054
|
var stack = '';
|
|
1002
1055
|
if (currentlyValidatingElement) {
|
|
1003
1056
|
var name = getDisplayName(currentlyValidatingElement);
|
|
@@ -1008,14 +1061,9 @@ function getComponentName(fiber) {
|
|
|
1008
1061
|
return stack;
|
|
1009
1062
|
};
|
|
1010
1063
|
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
var VALID_FRAGMENT_PROPS = new Map([['children', true], ['key', true]]);
|
|
1064
|
+
VALID_FRAGMENT_PROPS = new Map([['children', true], ['key', true]]);
|
|
1014
1065
|
}
|
|
1015
1066
|
|
|
1016
|
-
var ITERATOR_SYMBOL$1 = typeof Symbol === 'function' && Symbol.iterator;
|
|
1017
|
-
var FAUX_ITERATOR_SYMBOL$1 = '@@iterator'; // Before Symbol spec.
|
|
1018
|
-
|
|
1019
1067
|
function getDeclarationErrorAddendum() {
|
|
1020
1068
|
if (ReactCurrentOwner.current) {
|
|
1021
1069
|
var name = getComponentName(ReactCurrentOwner.current);
|
|
@@ -1120,13 +1168,13 @@ function validateChildKeys(node, parentType) {
|
|
|
1120
1168
|
node._store.validated = true;
|
|
1121
1169
|
}
|
|
1122
1170
|
} else if (node) {
|
|
1123
|
-
var iteratorFn =
|
|
1171
|
+
var iteratorFn = getIteratorFn(node);
|
|
1124
1172
|
if (typeof iteratorFn === 'function') {
|
|
1125
1173
|
// Entry iterators used to provide implicit keys,
|
|
1126
1174
|
// but now we print a separate warning for them later.
|
|
1127
1175
|
if (iteratorFn !== node.entries) {
|
|
1128
1176
|
var iterator = iteratorFn.call(node);
|
|
1129
|
-
var step;
|
|
1177
|
+
var step = void 0;
|
|
1130
1178
|
while (!(step = iterator.next()).done) {
|
|
1131
1179
|
if (isValidElement(step.value)) {
|
|
1132
1180
|
validateExplicitKey(step.value, parentType);
|
|
@@ -1150,11 +1198,13 @@ function validatePropTypes(element) {
|
|
|
1150
1198
|
}
|
|
1151
1199
|
var name = componentClass.displayName || componentClass.name;
|
|
1152
1200
|
var propTypes = componentClass.propTypes;
|
|
1153
|
-
|
|
1154
1201
|
if (propTypes) {
|
|
1155
1202
|
currentlyValidatingElement = element;
|
|
1156
1203
|
checkPropTypes(propTypes, element.props, 'prop', name, getStackAddendum);
|
|
1157
1204
|
currentlyValidatingElement = null;
|
|
1205
|
+
} else if (componentClass.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1206
|
+
propTypesMisspellWarningShown = true;
|
|
1207
|
+
warning(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
|
1158
1208
|
}
|
|
1159
1209
|
if (typeof componentClass.getDefaultProps === 'function') {
|
|
1160
1210
|
warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
@@ -1204,13 +1254,16 @@ function validateFragmentProps(fragment) {
|
|
|
1204
1254
|
}
|
|
1205
1255
|
|
|
1206
1256
|
function createElementWithValidation(type, props, children) {
|
|
1207
|
-
var validType = typeof type === 'string' || typeof type === 'function' ||
|
|
1257
|
+
var validType = typeof type === 'string' || typeof type === 'function' ||
|
|
1258
|
+
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
1259
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_ASYNC_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE);
|
|
1260
|
+
|
|
1208
1261
|
// We warn in this case but don't throw. We expect the element creation to
|
|
1209
1262
|
// succeed and there will likely be errors in render.
|
|
1210
1263
|
if (!validType) {
|
|
1211
1264
|
var info = '';
|
|
1212
1265
|
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1213
|
-
info += ' You likely forgot to export your component from the file ' + "it's defined in.";
|
|
1266
|
+
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
|
1214
1267
|
}
|
|
1215
1268
|
|
|
1216
1269
|
var sourceInfo = getSourceInfoErrorAddendum(props);
|
|
@@ -1222,7 +1275,16 @@ function createElementWithValidation(type, props, children) {
|
|
|
1222
1275
|
|
|
1223
1276
|
info += getStackAddendum() || '';
|
|
1224
1277
|
|
|
1225
|
-
|
|
1278
|
+
var typeString = void 0;
|
|
1279
|
+
if (type === null) {
|
|
1280
|
+
typeString = 'null';
|
|
1281
|
+
} else if (Array.isArray(type)) {
|
|
1282
|
+
typeString = 'array';
|
|
1283
|
+
} else {
|
|
1284
|
+
typeString = typeof type;
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
warning(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
1226
1288
|
}
|
|
1227
1289
|
|
|
1228
1290
|
var element = createElement.apply(this, arguments);
|
|
@@ -1244,7 +1306,7 @@ function createElementWithValidation(type, props, children) {
|
|
|
1244
1306
|
}
|
|
1245
1307
|
}
|
|
1246
1308
|
|
|
1247
|
-
if (
|
|
1309
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
|
1248
1310
|
validateFragmentProps(element);
|
|
1249
1311
|
} else {
|
|
1250
1312
|
validatePropTypes(element);
|
|
@@ -1255,9 +1317,8 @@ function createElementWithValidation(type, props, children) {
|
|
|
1255
1317
|
|
|
1256
1318
|
function createFactoryWithValidation(type) {
|
|
1257
1319
|
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
1258
|
-
// Legacy hook TODO: Warn if this is accessed
|
|
1259
1320
|
validatedFactory.type = type;
|
|
1260
|
-
|
|
1321
|
+
// Legacy hook: remove it
|
|
1261
1322
|
{
|
|
1262
1323
|
Object.defineProperty(validatedFactory, 'type', {
|
|
1263
1324
|
enumerable: false,
|
|
@@ -1283,8 +1344,6 @@ function cloneElementWithValidation(element, props, children) {
|
|
|
1283
1344
|
return newElement;
|
|
1284
1345
|
}
|
|
1285
1346
|
|
|
1286
|
-
var REACT_FRAGMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.fragment') || 0xeacb;
|
|
1287
|
-
|
|
1288
1347
|
var React = {
|
|
1289
1348
|
Children: {
|
|
1290
1349
|
map: mapChildren,
|
|
@@ -1296,7 +1355,12 @@ var React = {
|
|
|
1296
1355
|
|
|
1297
1356
|
Component: Component,
|
|
1298
1357
|
PureComponent: PureComponent,
|
|
1299
|
-
|
|
1358
|
+
|
|
1359
|
+
createContext: createContext,
|
|
1360
|
+
|
|
1361
|
+
Fragment: REACT_FRAGMENT_TYPE,
|
|
1362
|
+
StrictMode: REACT_STRICT_MODE_TYPE,
|
|
1363
|
+
unstable_AsyncMode: REACT_ASYNC_MODE_TYPE,
|
|
1300
1364
|
|
|
1301
1365
|
createElement: createElementWithValidation,
|
|
1302
1366
|
cloneElement: cloneElementWithValidation,
|
|
@@ -1312,10 +1376,6 @@ var React = {
|
|
|
1312
1376
|
}
|
|
1313
1377
|
};
|
|
1314
1378
|
|
|
1315
|
-
if (enableReactFragment) {
|
|
1316
|
-
React.Fragment = REACT_FRAGMENT_TYPE;
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
1379
|
{
|
|
1320
1380
|
_assign(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
|
|
1321
1381
|
// These should not be included in production.
|