react 15.0.0-rc.2 → 15.0.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/dist/react-with-addons.js +1217 -1105
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +1083 -1001
- package/dist/react.min.js +6 -6
- package/lib/CSSPropertyOperations.js +31 -15
- package/lib/CallbackQueue.js +4 -3
- package/lib/DOMChildrenOperations.js +0 -3
- package/lib/DOMProperty.js +3 -3
- package/lib/DOMPropertyOperations.js +3 -2
- package/lib/Danger.js +8 -8
- package/lib/EventPluginHub.js +2 -2
- package/lib/EventPluginRegistry.js +7 -7
- package/lib/EventPluginUtils.js +5 -5
- package/lib/EventPropagators.js +1 -1
- package/lib/FallbackCompositionState.js +3 -2
- package/lib/LinkedValueUtils.js +4 -4
- package/lib/OrderedMap.js +16 -15
- package/lib/PooledClass.js +1 -1
- package/lib/React.js +51 -9
- package/lib/ReactBrowserEventEmitter.js +3 -2
- package/lib/ReactCSSTransitionGroup.js +3 -3
- package/lib/ReactChildReconciler.js +1 -1
- package/lib/ReactClass.js +24 -23
- package/lib/ReactComponent.js +5 -5
- package/lib/ReactComponentEnvironment.js +1 -1
- package/lib/ReactCompositeComponent.js +26 -25
- package/lib/ReactDOM.js +3 -3
- package/lib/ReactDOMComponent.js +27 -22
- package/lib/ReactDOMComponentTree.js +3 -3
- package/lib/ReactDOMDebugTool.js +1 -1
- package/lib/ReactDOMEmptyComponent.js +3 -3
- package/lib/ReactDOMInput.js +11 -10
- package/lib/ReactDOMOption.js +5 -4
- package/lib/ReactDOMSelect.js +8 -7
- package/lib/ReactDOMTextComponent.js +4 -3
- package/lib/ReactDOMTextarea.js +10 -9
- package/lib/ReactDOMTreeTraversal.js +5 -5
- package/lib/ReactDOMUnknownPropertyDevtool.js +2 -2
- package/lib/ReactDebugInstanceMap.js +102 -0
- package/lib/ReactDebugTool.js +1 -1
- package/lib/ReactDefaultBatchingStrategy.js +3 -2
- package/lib/ReactDefaultPerf.js +46 -7
- package/lib/ReactDefaultPerfAnalysis.js +7 -7
- package/lib/ReactElement.js +5 -4
- package/lib/ReactElementValidator.js +7 -7
- package/lib/ReactEventListener.js +3 -2
- package/lib/ReactFragment.js +4 -4
- package/lib/ReactInstanceHandles.js +6 -6
- package/lib/ReactInvalidSetStateWarningDevTool.js +1 -1
- package/lib/ReactMount.js +15 -14
- package/lib/ReactMultiChild.js +2 -2
- package/lib/ReactNativeComponent.js +4 -3
- package/lib/ReactNodeTypes.js +1 -1
- package/lib/ReactNoopUpdateQueue.js +1 -1
- package/lib/ReactOwner.js +2 -2
- package/lib/ReactPropTransferer.js +4 -3
- package/lib/ReactReconcileTransaction.js +3 -3
- package/lib/ReactServerRendering.js +2 -2
- package/lib/ReactServerRenderingTransaction.js +3 -3
- package/lib/ReactSimpleEmptyComponent.js +3 -3
- package/lib/ReactTestUtils.js +18 -8
- package/lib/ReactTransitionGroup.js +3 -2
- package/lib/ReactUMDEntry.js +26 -0
- package/lib/ReactUpdateQueue.js +23 -6
- package/lib/ReactUpdates.js +10 -9
- package/lib/ReactVersion.js +1 -1
- package/lib/ReactWithAddons.js +0 -7
- package/lib/ReactWithAddonsUMDEntry.js +26 -0
- package/lib/ResponderEventPlugin.js +1 -1
- package/lib/ResponderTouchHistoryStore.js +4 -4
- package/lib/SimpleEventPlugin.js +1 -1
- package/lib/SyntheticEvent.js +7 -6
- package/lib/Transaction.js +2 -2
- package/lib/accumulate.js +1 -1
- package/lib/accumulateInto.js +1 -1
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/deprecated.js +4 -3
- package/lib/findDOMNode.js +3 -3
- package/lib/flattenChildren.js +1 -1
- package/lib/instantiateReactComponent.js +6 -5
- package/lib/onlyChild.js +1 -1
- package/lib/reactComponentExpect.js +4 -3
- package/lib/setInnerHTML.js +1 -0
- package/lib/traverseAllChildren.js +2 -2
- package/lib/update.js +14 -13
- package/lib/validateDOMNesting.js +5 -4
- package/package.json +5 -4
- package/addons.js +0 -15
- package/lib/Object.assign.js +0 -47
- package/lib/React.native.js +0 -5
- package/lib/ReactIsomorphic.js +0 -74
package/lib/PooledClass.js
CHANGED
|
@@ -77,7 +77,7 @@ var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
|
|
|
77
77
|
|
|
78
78
|
var standardReleaser = function (instance) {
|
|
79
79
|
var Klass = this;
|
|
80
|
-
!(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) :
|
|
80
|
+
!(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : void 0;
|
|
81
81
|
instance.destructor();
|
|
82
82
|
if (Klass.instancePool.length < Klass.poolSize) {
|
|
83
83
|
Klass.instancePool.push(instance);
|
package/lib/React.js
CHANGED
|
@@ -11,18 +11,60 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
14
|
+
var ReactChildren = require('./ReactChildren');
|
|
15
|
+
var ReactComponent = require('./ReactComponent');
|
|
16
|
+
var ReactClass = require('./ReactClass');
|
|
17
|
+
var ReactDOMFactories = require('./ReactDOMFactories');
|
|
18
|
+
var ReactElement = require('./ReactElement');
|
|
19
|
+
var ReactElementValidator = require('./ReactElementValidator');
|
|
20
|
+
var ReactPropTypes = require('./ReactPropTypes');
|
|
21
|
+
var ReactVersion = require('./ReactVersion');
|
|
17
22
|
|
|
18
|
-
var
|
|
23
|
+
var onlyChild = require('./onlyChild');
|
|
19
24
|
|
|
20
|
-
|
|
21
|
-
var
|
|
25
|
+
var createElement = ReactElement.createElement;
|
|
26
|
+
var createFactory = ReactElement.createFactory;
|
|
27
|
+
var cloneElement = ReactElement.cloneElement;
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
30
|
+
createElement = ReactElementValidator.createElement;
|
|
31
|
+
createFactory = ReactElementValidator.createFactory;
|
|
32
|
+
cloneElement = ReactElementValidator.cloneElement;
|
|
33
|
+
}
|
|
24
34
|
|
|
25
|
-
React
|
|
26
|
-
|
|
35
|
+
var React = {
|
|
36
|
+
|
|
37
|
+
// Modern
|
|
38
|
+
|
|
39
|
+
Children: {
|
|
40
|
+
map: ReactChildren.map,
|
|
41
|
+
forEach: ReactChildren.forEach,
|
|
42
|
+
count: ReactChildren.count,
|
|
43
|
+
toArray: ReactChildren.toArray,
|
|
44
|
+
only: onlyChild
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
Component: ReactComponent,
|
|
48
|
+
|
|
49
|
+
createElement: createElement,
|
|
50
|
+
cloneElement: cloneElement,
|
|
51
|
+
isValidElement: ReactElement.isValidElement,
|
|
52
|
+
|
|
53
|
+
// Classic
|
|
54
|
+
|
|
55
|
+
PropTypes: ReactPropTypes,
|
|
56
|
+
createClass: ReactClass.createClass,
|
|
57
|
+
createFactory: createFactory,
|
|
58
|
+
createMixin: function (mixin) {
|
|
59
|
+
// Currently a noop. Will be used to validate and trace mixins.
|
|
60
|
+
return mixin;
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
// This looks DOM specific but these are actually isomorphic helpers
|
|
64
|
+
// since they are just generating DOM strings.
|
|
65
|
+
DOM: ReactDOMFactories,
|
|
66
|
+
|
|
67
|
+
version: ReactVersion
|
|
68
|
+
};
|
|
27
69
|
|
|
28
70
|
module.exports = React;
|
|
@@ -11,12 +11,13 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _assign = require('object-assign');
|
|
15
|
+
|
|
14
16
|
var EventConstants = require('./EventConstants');
|
|
15
17
|
var EventPluginRegistry = require('./EventPluginRegistry');
|
|
16
18
|
var ReactEventEmitterMixin = require('./ReactEventEmitterMixin');
|
|
17
19
|
var ViewportMetrics = require('./ViewportMetrics');
|
|
18
20
|
|
|
19
|
-
var assign = require('./Object.assign');
|
|
20
21
|
var getVendorPrefixedEventName = require('./getVendorPrefixedEventName');
|
|
21
22
|
var isEventSupported = require('./isEventSupported');
|
|
22
23
|
|
|
@@ -175,7 +176,7 @@ function getListeningForDocument(mountAt) {
|
|
|
175
176
|
*
|
|
176
177
|
* @internal
|
|
177
178
|
*/
|
|
178
|
-
var ReactBrowserEventEmitter =
|
|
179
|
+
var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, {
|
|
179
180
|
|
|
180
181
|
/**
|
|
181
182
|
* Injectable event backend
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _assign = require('object-assign');
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var React = require('./React');
|
|
17
17
|
|
|
18
18
|
var ReactTransitionGroup = require('./ReactTransitionGroup');
|
|
19
19
|
var ReactCSSTransitionGroupChild = require('./ReactCSSTransitionGroupChild');
|
|
@@ -75,7 +75,7 @@ var ReactCSSTransitionGroup = React.createClass({
|
|
|
75
75
|
},
|
|
76
76
|
|
|
77
77
|
render: function () {
|
|
78
|
-
return React.createElement(ReactTransitionGroup,
|
|
78
|
+
return React.createElement(ReactTransitionGroup, _assign({}, this.props, { childFactory: this._wrapChild }));
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
|
|
@@ -22,7 +22,7 @@ function instantiateChild(childInstances, child, name) {
|
|
|
22
22
|
// We found a component instance.
|
|
23
23
|
var keyUnique = childInstances[name] === undefined;
|
|
24
24
|
if (process.env.NODE_ENV !== 'production') {
|
|
25
|
-
process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) :
|
|
25
|
+
process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : void 0;
|
|
26
26
|
}
|
|
27
27
|
if (child != null && keyUnique) {
|
|
28
28
|
childInstances[name] = instantiateReactComponent(child);
|
package/lib/ReactClass.js
CHANGED
|
@@ -11,13 +11,14 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _assign = require('object-assign');
|
|
15
|
+
|
|
14
16
|
var ReactComponent = require('./ReactComponent');
|
|
15
17
|
var ReactElement = require('./ReactElement');
|
|
16
18
|
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
|
|
17
19
|
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
|
|
18
20
|
var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
|
|
19
21
|
|
|
20
|
-
var assign = require('./Object.assign');
|
|
21
22
|
var emptyObject = require('fbjs/lib/emptyObject');
|
|
22
23
|
var invariant = require('fbjs/lib/invariant');
|
|
23
24
|
var keyMirror = require('fbjs/lib/keyMirror');
|
|
@@ -322,13 +323,13 @@ var RESERVED_SPEC_KEYS = {
|
|
|
322
323
|
if (process.env.NODE_ENV !== 'production') {
|
|
323
324
|
validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext);
|
|
324
325
|
}
|
|
325
|
-
Constructor.childContextTypes =
|
|
326
|
+
Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes);
|
|
326
327
|
},
|
|
327
328
|
contextTypes: function (Constructor, contextTypes) {
|
|
328
329
|
if (process.env.NODE_ENV !== 'production') {
|
|
329
330
|
validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context);
|
|
330
331
|
}
|
|
331
|
-
Constructor.contextTypes =
|
|
332
|
+
Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes);
|
|
332
333
|
},
|
|
333
334
|
/**
|
|
334
335
|
* Special case getDefaultProps which should move into statics but requires
|
|
@@ -345,7 +346,7 @@ var RESERVED_SPEC_KEYS = {
|
|
|
345
346
|
if (process.env.NODE_ENV !== 'production') {
|
|
346
347
|
validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop);
|
|
347
348
|
}
|
|
348
|
-
Constructor.propTypes =
|
|
349
|
+
Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
|
|
349
350
|
},
|
|
350
351
|
statics: function (Constructor, statics) {
|
|
351
352
|
mixStaticSpecIntoComponent(Constructor, statics);
|
|
@@ -358,7 +359,7 @@ function validateTypeDef(Constructor, typeDef, location) {
|
|
|
358
359
|
if (typeDef.hasOwnProperty(propName)) {
|
|
359
360
|
// use a warning instead of an invariant so components
|
|
360
361
|
// don't show up in prod but only in __DEV__
|
|
361
|
-
process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) :
|
|
362
|
+
process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0;
|
|
362
363
|
}
|
|
363
364
|
}
|
|
364
365
|
}
|
|
@@ -368,12 +369,12 @@ function validateMethodOverride(isAlreadyDefined, name) {
|
|
|
368
369
|
|
|
369
370
|
// Disallow overriding of base class methods unless explicitly allowed.
|
|
370
371
|
if (ReactClassMixin.hasOwnProperty(name)) {
|
|
371
|
-
!(specPolicy === SpecPolicy.OVERRIDE_BASE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) :
|
|
372
|
+
!(specPolicy === SpecPolicy.OVERRIDE_BASE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : void 0;
|
|
372
373
|
}
|
|
373
374
|
|
|
374
375
|
// Disallow defining methods more than once unless explicitly allowed.
|
|
375
376
|
if (isAlreadyDefined) {
|
|
376
|
-
!(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) :
|
|
377
|
+
!(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : void 0;
|
|
377
378
|
}
|
|
378
379
|
}
|
|
379
380
|
|
|
@@ -386,8 +387,8 @@ function mixSpecIntoComponent(Constructor, spec) {
|
|
|
386
387
|
return;
|
|
387
388
|
}
|
|
388
389
|
|
|
389
|
-
!(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class or function as a mixin. Instead, just use a ' + 'regular object.') : invariant(false) :
|
|
390
|
-
!!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) :
|
|
390
|
+
!(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class or function as a mixin. Instead, just use a ' + 'regular object.') : invariant(false) : void 0;
|
|
391
|
+
!!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : void 0;
|
|
391
392
|
|
|
392
393
|
var proto = Constructor.prototype;
|
|
393
394
|
var autoBindPairs = proto.__reactAutoBindPairs;
|
|
@@ -432,7 +433,7 @@ function mixSpecIntoComponent(Constructor, spec) {
|
|
|
432
433
|
var specPolicy = ReactClassInterface[name];
|
|
433
434
|
|
|
434
435
|
// These cases should already be caught by validateMethodOverride.
|
|
435
|
-
!(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) :
|
|
436
|
+
!(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : void 0;
|
|
436
437
|
|
|
437
438
|
// For methods which are defined more than once, call the existing
|
|
438
439
|
// methods before calling the new property, merging if appropriate.
|
|
@@ -467,10 +468,10 @@ function mixStaticSpecIntoComponent(Constructor, statics) {
|
|
|
467
468
|
}
|
|
468
469
|
|
|
469
470
|
var isReserved = name in RESERVED_SPEC_KEYS;
|
|
470
|
-
!!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) :
|
|
471
|
+
!!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : void 0;
|
|
471
472
|
|
|
472
473
|
var isInherited = name in Constructor;
|
|
473
|
-
!!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) :
|
|
474
|
+
!!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : void 0;
|
|
474
475
|
Constructor[name] = property;
|
|
475
476
|
}
|
|
476
477
|
}
|
|
@@ -483,11 +484,11 @@ function mixStaticSpecIntoComponent(Constructor, statics) {
|
|
|
483
484
|
* @return {object} one after it has been mutated to contain everything in two.
|
|
484
485
|
*/
|
|
485
486
|
function mergeIntoWithNoDuplicateKeys(one, two) {
|
|
486
|
-
!(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) :
|
|
487
|
+
!(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : void 0;
|
|
487
488
|
|
|
488
489
|
for (var key in two) {
|
|
489
490
|
if (two.hasOwnProperty(key)) {
|
|
490
|
-
!(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) :
|
|
491
|
+
!(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : void 0;
|
|
491
492
|
one[key] = two[key];
|
|
492
493
|
}
|
|
493
494
|
}
|
|
@@ -557,9 +558,9 @@ function bindAutoBindMethod(component, method) {
|
|
|
557
558
|
// ignore the value of "this" that the user is trying to use, so
|
|
558
559
|
// let's warn.
|
|
559
560
|
if (newThis !== component && newThis !== null) {
|
|
560
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) :
|
|
561
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0;
|
|
561
562
|
} else if (!args.length) {
|
|
562
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) :
|
|
563
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0;
|
|
563
564
|
return boundMethod;
|
|
564
565
|
}
|
|
565
566
|
var reboundMethod = _bind.apply(boundMethod, arguments);
|
|
@@ -599,7 +600,7 @@ var ReactClassMixin = {
|
|
|
599
600
|
replaceState: function (newState, callback) {
|
|
600
601
|
this.updater.enqueueReplaceState(this, newState);
|
|
601
602
|
if (callback) {
|
|
602
|
-
this.updater.enqueueCallback(this, callback);
|
|
603
|
+
this.updater.enqueueCallback(this, callback, 'replaceState');
|
|
603
604
|
}
|
|
604
605
|
},
|
|
605
606
|
|
|
@@ -615,7 +616,7 @@ var ReactClassMixin = {
|
|
|
615
616
|
};
|
|
616
617
|
|
|
617
618
|
var ReactClassComponent = function () {};
|
|
618
|
-
|
|
619
|
+
_assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
|
|
619
620
|
|
|
620
621
|
/**
|
|
621
622
|
* Module for creating composite components.
|
|
@@ -637,7 +638,7 @@ var ReactClass = {
|
|
|
637
638
|
// by mocks to assert on what gets mounted.
|
|
638
639
|
|
|
639
640
|
if (process.env.NODE_ENV !== 'production') {
|
|
640
|
-
process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') :
|
|
641
|
+
process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0;
|
|
641
642
|
}
|
|
642
643
|
|
|
643
644
|
// Wire up auto-binding
|
|
@@ -664,7 +665,7 @@ var ReactClass = {
|
|
|
664
665
|
initialState = null;
|
|
665
666
|
}
|
|
666
667
|
}
|
|
667
|
-
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) :
|
|
668
|
+
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : void 0;
|
|
668
669
|
|
|
669
670
|
this.state = initialState;
|
|
670
671
|
};
|
|
@@ -694,11 +695,11 @@ var ReactClass = {
|
|
|
694
695
|
}
|
|
695
696
|
}
|
|
696
697
|
|
|
697
|
-
!Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) :
|
|
698
|
+
!Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : void 0;
|
|
698
699
|
|
|
699
700
|
if (process.env.NODE_ENV !== 'production') {
|
|
700
|
-
process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') :
|
|
701
|
-
process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') :
|
|
701
|
+
process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0;
|
|
702
|
+
process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0;
|
|
702
703
|
}
|
|
703
704
|
|
|
704
705
|
// Reduce time spent doing lookups by setting these on the prototype.
|
package/lib/ReactComponent.js
CHANGED
|
@@ -59,14 +59,14 @@ ReactComponent.prototype.isReactComponent = {};
|
|
|
59
59
|
* @protected
|
|
60
60
|
*/
|
|
61
61
|
ReactComponent.prototype.setState = function (partialState, callback) {
|
|
62
|
-
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) :
|
|
62
|
+
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : void 0;
|
|
63
63
|
if (process.env.NODE_ENV !== 'production') {
|
|
64
64
|
ReactInstrumentation.debugTool.onSetState();
|
|
65
|
-
process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') :
|
|
65
|
+
process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0;
|
|
66
66
|
}
|
|
67
67
|
this.updater.enqueueSetState(this, partialState);
|
|
68
68
|
if (callback) {
|
|
69
|
-
this.updater.enqueueCallback(this, callback);
|
|
69
|
+
this.updater.enqueueCallback(this, callback, 'setState');
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
|
|
@@ -87,7 +87,7 @@ ReactComponent.prototype.setState = function (partialState, callback) {
|
|
|
87
87
|
ReactComponent.prototype.forceUpdate = function (callback) {
|
|
88
88
|
this.updater.enqueueForceUpdate(this);
|
|
89
89
|
if (callback) {
|
|
90
|
-
this.updater.enqueueCallback(this, callback);
|
|
90
|
+
this.updater.enqueueCallback(this, callback, 'forceUpdate');
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
93
|
|
|
@@ -105,7 +105,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
105
105
|
if (canDefineProperty) {
|
|
106
106
|
Object.defineProperty(ReactComponent.prototype, methodName, {
|
|
107
107
|
get: function () {
|
|
108
|
-
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) :
|
|
108
|
+
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0;
|
|
109
109
|
return undefined;
|
|
110
110
|
}
|
|
111
111
|
});
|
|
@@ -38,7 +38,7 @@ var ReactComponentEnvironment = {
|
|
|
38
38
|
|
|
39
39
|
injection: {
|
|
40
40
|
injectEnvironment: function (environment) {
|
|
41
|
-
!!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) :
|
|
41
|
+
!!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : void 0;
|
|
42
42
|
ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment;
|
|
43
43
|
ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup;
|
|
44
44
|
ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _assign = require('object-assign');
|
|
15
|
+
|
|
14
16
|
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
|
|
15
17
|
var ReactCurrentOwner = require('./ReactCurrentOwner');
|
|
16
18
|
var ReactElement = require('./ReactElement');
|
|
@@ -24,7 +26,6 @@ var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
|
|
|
24
26
|
var ReactReconciler = require('./ReactReconciler');
|
|
25
27
|
var ReactUpdateQueue = require('./ReactUpdateQueue');
|
|
26
28
|
|
|
27
|
-
var assign = require('./Object.assign');
|
|
28
29
|
var emptyObject = require('fbjs/lib/emptyObject');
|
|
29
30
|
var invariant = require('fbjs/lib/invariant');
|
|
30
31
|
var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
|
|
@@ -51,7 +52,7 @@ StatelessComponent.prototype.render = function () {
|
|
|
51
52
|
|
|
52
53
|
function warnIfInvalidElement(Component, element) {
|
|
53
54
|
if (process.env.NODE_ENV !== 'production') {
|
|
54
|
-
process.env.NODE_ENV !== 'production' ? warning(element === null || element === false || ReactElement.isValidElement(element), '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') :
|
|
55
|
+
process.env.NODE_ENV !== 'production' ? warning(element === null || element === false || ReactElement.isValidElement(element), '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : void 0;
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
|
|
@@ -176,7 +177,7 @@ var ReactCompositeComponentMixin = {
|
|
|
176
177
|
if (inst == null || inst.render == null) {
|
|
177
178
|
renderedElement = inst;
|
|
178
179
|
warnIfInvalidElement(Component, renderedElement);
|
|
179
|
-
!(inst === null || inst === false || ReactElement.isValidElement(inst)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : invariant(false) :
|
|
180
|
+
!(inst === null || inst === false || ReactElement.isValidElement(inst)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : invariant(false) : void 0;
|
|
180
181
|
inst = new StatelessComponent(Component);
|
|
181
182
|
}
|
|
182
183
|
}
|
|
@@ -185,13 +186,13 @@ var ReactCompositeComponentMixin = {
|
|
|
185
186
|
// This will throw later in _renderValidatedComponent, but add an early
|
|
186
187
|
// warning now to help debugging
|
|
187
188
|
if (inst.render == null) {
|
|
188
|
-
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', Component.displayName || Component.name || 'Component') :
|
|
189
|
+
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', Component.displayName || Component.name || 'Component') : void 0;
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
var propsMutated = inst.props !== publicProps;
|
|
192
193
|
var componentName = Component.displayName || Component.name || 'Component';
|
|
193
194
|
|
|
194
|
-
process.env.NODE_ENV !== 'production' ? warning(inst.props === undefined || !propsMutated, '%s(...): When calling super() in `%s`, make sure to pass ' + 'up the same props that your component\'s constructor was passed.', componentName, componentName) :
|
|
195
|
+
process.env.NODE_ENV !== 'production' ? warning(inst.props === undefined || !propsMutated, '%s(...): When calling super() in `%s`, make sure to pass ' + 'up the same props that your component\'s constructor was passed.', componentName, componentName) : void 0;
|
|
195
196
|
}
|
|
196
197
|
|
|
197
198
|
// These should be set up in the constructor, but as a convenience for
|
|
@@ -210,20 +211,20 @@ var ReactCompositeComponentMixin = {
|
|
|
210
211
|
// Since plain JS classes are defined without any special initialization
|
|
211
212
|
// logic, we can not catch common errors early. Therefore, we have to
|
|
212
213
|
// catch them here, at initialization time, instead.
|
|
213
|
-
process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') :
|
|
214
|
-
process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') :
|
|
215
|
-
process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') :
|
|
216
|
-
process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') :
|
|
217
|
-
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') :
|
|
218
|
-
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') :
|
|
219
|
-
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') :
|
|
214
|
+
process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : void 0;
|
|
215
|
+
process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : void 0;
|
|
216
|
+
process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : void 0;
|
|
217
|
+
process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : void 0;
|
|
218
|
+
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : void 0;
|
|
219
|
+
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : void 0;
|
|
220
|
+
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : void 0;
|
|
220
221
|
}
|
|
221
222
|
|
|
222
223
|
var initialState = inst.state;
|
|
223
224
|
if (initialState === undefined) {
|
|
224
225
|
inst.state = initialState = null;
|
|
225
226
|
}
|
|
226
|
-
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) :
|
|
227
|
+
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : void 0;
|
|
227
228
|
|
|
228
229
|
this._pendingStateQueue = null;
|
|
229
230
|
this._pendingReplaceState = false;
|
|
@@ -406,14 +407,14 @@ var ReactCompositeComponentMixin = {
|
|
|
406
407
|
ReactInstrumentation.debugTool.onEndProcessingChildContext();
|
|
407
408
|
}
|
|
408
409
|
if (childContext) {
|
|
409
|
-
!(typeof Component.childContextTypes === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) :
|
|
410
|
+
!(typeof Component.childContextTypes === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : void 0;
|
|
410
411
|
if (process.env.NODE_ENV !== 'production') {
|
|
411
412
|
this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext);
|
|
412
413
|
}
|
|
413
414
|
for (var name in childContext) {
|
|
414
|
-
!(name in Component.childContextTypes) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) :
|
|
415
|
+
!(name in Component.childContextTypes) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : void 0;
|
|
415
416
|
}
|
|
416
|
-
return
|
|
417
|
+
return _assign({}, currentContext, childContext);
|
|
417
418
|
}
|
|
418
419
|
return currentContext;
|
|
419
420
|
},
|
|
@@ -455,7 +456,7 @@ var ReactCompositeComponentMixin = {
|
|
|
455
456
|
try {
|
|
456
457
|
// This is intentionally an invariant that gets caught. It's the same
|
|
457
458
|
// behavior as without this statement except with a better message.
|
|
458
|
-
!(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) :
|
|
459
|
+
!(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : void 0;
|
|
459
460
|
error = propTypes[propName](props, propName, componentName, location);
|
|
460
461
|
} catch (ex) {
|
|
461
462
|
error = ex;
|
|
@@ -468,9 +469,9 @@ var ReactCompositeComponentMixin = {
|
|
|
468
469
|
|
|
469
470
|
if (location === ReactPropTypeLocations.prop) {
|
|
470
471
|
// Preface gives us something to blacklist in warning module
|
|
471
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) :
|
|
472
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : void 0;
|
|
472
473
|
} else {
|
|
473
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) :
|
|
474
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : void 0;
|
|
474
475
|
}
|
|
475
476
|
}
|
|
476
477
|
}
|
|
@@ -554,7 +555,7 @@ var ReactCompositeComponentMixin = {
|
|
|
554
555
|
var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext);
|
|
555
556
|
|
|
556
557
|
if (process.env.NODE_ENV !== 'production') {
|
|
557
|
-
process.env.NODE_ENV !== 'production' ? warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') :
|
|
558
|
+
process.env.NODE_ENV !== 'production' ? warning(shouldUpdate !== undefined, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : void 0;
|
|
558
559
|
}
|
|
559
560
|
|
|
560
561
|
if (shouldUpdate) {
|
|
@@ -587,10 +588,10 @@ var ReactCompositeComponentMixin = {
|
|
|
587
588
|
return queue[0];
|
|
588
589
|
}
|
|
589
590
|
|
|
590
|
-
var nextState =
|
|
591
|
+
var nextState = _assign({}, replace ? queue[0] : inst.state);
|
|
591
592
|
for (var i = replace ? 1 : 0; i < queue.length; i++) {
|
|
592
593
|
var partial = queue[i];
|
|
593
|
-
|
|
594
|
+
_assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
|
|
594
595
|
}
|
|
595
596
|
|
|
596
597
|
return nextState;
|
|
@@ -701,7 +702,7 @@ var ReactCompositeComponentMixin = {
|
|
|
701
702
|
}
|
|
702
703
|
!(
|
|
703
704
|
// TODO: An `isValidNode` function would probably be more appropriate
|
|
704
|
-
renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) :
|
|
705
|
+
renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid React element (or null) must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : void 0;
|
|
705
706
|
return renderedComponent;
|
|
706
707
|
},
|
|
707
708
|
|
|
@@ -715,11 +716,11 @@ var ReactCompositeComponentMixin = {
|
|
|
715
716
|
*/
|
|
716
717
|
attachRef: function (ref, component) {
|
|
717
718
|
var inst = this.getPublicInstance();
|
|
718
|
-
!(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) :
|
|
719
|
+
!(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : void 0;
|
|
719
720
|
var publicComponentInstance = component.getPublicInstance();
|
|
720
721
|
if (process.env.NODE_ENV !== 'production') {
|
|
721
722
|
var componentName = component && component.getName ? component.getName() : 'a component';
|
|
722
|
-
process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) :
|
|
723
|
+
process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : void 0;
|
|
723
724
|
}
|
|
724
725
|
var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
|
|
725
726
|
refs[ref] = publicComponentInstance;
|