react 15.6.0 → 15.6.1
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 +244 -57
- package/dist/react-with-addons.min.js +3 -3
- package/dist/react.js +242 -54
- package/dist/react.min.js +2 -2
- package/lib/ReactLink.js +1 -2
- package/lib/ReactVersion.js +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* React (with addons) v15.6.
|
|
2
|
+
* React (with addons) v15.6.1
|
|
3
3
|
*/
|
|
4
4
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.React = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
|
5
5
|
/**
|
|
@@ -2448,8 +2448,6 @@ module.exports = ReactFragment;
|
|
|
2448
2448
|
* consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.
|
|
2449
2449
|
*/
|
|
2450
2450
|
|
|
2451
|
-
var React = _dereq_(5);
|
|
2452
|
-
|
|
2453
2451
|
/**
|
|
2454
2452
|
* Deprecated: An an easy way to express two-way binding with React.
|
|
2455
2453
|
* See https://facebook.github.io/react/docs/two-way-binding-helpers.html
|
|
@@ -2457,13 +2455,14 @@ var React = _dereq_(5);
|
|
|
2457
2455
|
* @param {*} value current value of the link
|
|
2458
2456
|
* @param {function} requestChange callback to request a change
|
|
2459
2457
|
*/
|
|
2458
|
+
|
|
2460
2459
|
function ReactLink(value, requestChange) {
|
|
2461
2460
|
this.value = value;
|
|
2462
2461
|
this.requestChange = requestChange;
|
|
2463
2462
|
}
|
|
2464
2463
|
|
|
2465
2464
|
module.exports = ReactLink;
|
|
2466
|
-
},{
|
|
2465
|
+
},{}],20:[function(_dereq_,module,exports){
|
|
2467
2466
|
/**
|
|
2468
2467
|
* Copyright 2015-present, Facebook, Inc.
|
|
2469
2468
|
* All rights reserved.
|
|
@@ -3147,7 +3146,7 @@ module.exports = ReactTransitionGroup;
|
|
|
3147
3146
|
|
|
3148
3147
|
'use strict';
|
|
3149
3148
|
|
|
3150
|
-
module.exports = '15.6.
|
|
3149
|
+
module.exports = '15.6.1';
|
|
3151
3150
|
},{}],29:[function(_dereq_,module,exports){
|
|
3152
3151
|
/**
|
|
3153
3152
|
* Copyright 2013-present, Facebook, Inc.
|
|
@@ -4003,7 +4002,7 @@ if ("development" !== 'production') {
|
|
|
4003
4002
|
ReactPropTypeLocationNames = {
|
|
4004
4003
|
prop: 'prop',
|
|
4005
4004
|
context: 'context',
|
|
4006
|
-
childContext: 'child context'
|
|
4005
|
+
childContext: 'child context'
|
|
4007
4006
|
};
|
|
4008
4007
|
} else {
|
|
4009
4008
|
ReactPropTypeLocationNames = {};
|
|
@@ -4014,7 +4013,6 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4014
4013
|
* Policies that describe methods in `ReactClassInterface`.
|
|
4015
4014
|
*/
|
|
4016
4015
|
|
|
4017
|
-
|
|
4018
4016
|
var injectedMixins = [];
|
|
4019
4017
|
|
|
4020
4018
|
/**
|
|
@@ -4040,7 +4038,6 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4040
4038
|
* @internal
|
|
4041
4039
|
*/
|
|
4042
4040
|
var ReactClassInterface = {
|
|
4043
|
-
|
|
4044
4041
|
/**
|
|
4045
4042
|
* An array of Mixin objects to include when defining your component.
|
|
4046
4043
|
*
|
|
@@ -4131,7 +4128,6 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4131
4128
|
* }
|
|
4132
4129
|
*
|
|
4133
4130
|
* @return {ReactComponent}
|
|
4134
|
-
* @nosideeffects
|
|
4135
4131
|
* @required
|
|
4136
4132
|
*/
|
|
4137
4133
|
render: 'DEFINE_ONCE',
|
|
@@ -4259,7 +4255,6 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4259
4255
|
* @overridable
|
|
4260
4256
|
*/
|
|
4261
4257
|
updateComponent: 'OVERRIDE_BASE'
|
|
4262
|
-
|
|
4263
4258
|
};
|
|
4264
4259
|
|
|
4265
4260
|
/**
|
|
@@ -4272,71 +4267,106 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4272
4267
|
* which all other static methods are defined.
|
|
4273
4268
|
*/
|
|
4274
4269
|
var RESERVED_SPEC_KEYS = {
|
|
4275
|
-
displayName: function
|
|
4270
|
+
displayName: function(Constructor, displayName) {
|
|
4276
4271
|
Constructor.displayName = displayName;
|
|
4277
4272
|
},
|
|
4278
|
-
mixins: function
|
|
4273
|
+
mixins: function(Constructor, mixins) {
|
|
4279
4274
|
if (mixins) {
|
|
4280
4275
|
for (var i = 0; i < mixins.length; i++) {
|
|
4281
4276
|
mixSpecIntoComponent(Constructor, mixins[i]);
|
|
4282
4277
|
}
|
|
4283
4278
|
}
|
|
4284
4279
|
},
|
|
4285
|
-
childContextTypes: function
|
|
4280
|
+
childContextTypes: function(Constructor, childContextTypes) {
|
|
4286
4281
|
if ("development" !== 'production') {
|
|
4287
4282
|
validateTypeDef(Constructor, childContextTypes, 'childContext');
|
|
4288
4283
|
}
|
|
4289
|
-
Constructor.childContextTypes = _assign(
|
|
4284
|
+
Constructor.childContextTypes = _assign(
|
|
4285
|
+
{},
|
|
4286
|
+
Constructor.childContextTypes,
|
|
4287
|
+
childContextTypes
|
|
4288
|
+
);
|
|
4290
4289
|
},
|
|
4291
|
-
contextTypes: function
|
|
4290
|
+
contextTypes: function(Constructor, contextTypes) {
|
|
4292
4291
|
if ("development" !== 'production') {
|
|
4293
4292
|
validateTypeDef(Constructor, contextTypes, 'context');
|
|
4294
4293
|
}
|
|
4295
|
-
Constructor.contextTypes = _assign(
|
|
4294
|
+
Constructor.contextTypes = _assign(
|
|
4295
|
+
{},
|
|
4296
|
+
Constructor.contextTypes,
|
|
4297
|
+
contextTypes
|
|
4298
|
+
);
|
|
4296
4299
|
},
|
|
4297
4300
|
/**
|
|
4298
4301
|
* Special case getDefaultProps which should move into statics but requires
|
|
4299
4302
|
* automatic merging.
|
|
4300
4303
|
*/
|
|
4301
|
-
getDefaultProps: function
|
|
4304
|
+
getDefaultProps: function(Constructor, getDefaultProps) {
|
|
4302
4305
|
if (Constructor.getDefaultProps) {
|
|
4303
|
-
Constructor.getDefaultProps = createMergedResultFunction(
|
|
4306
|
+
Constructor.getDefaultProps = createMergedResultFunction(
|
|
4307
|
+
Constructor.getDefaultProps,
|
|
4308
|
+
getDefaultProps
|
|
4309
|
+
);
|
|
4304
4310
|
} else {
|
|
4305
4311
|
Constructor.getDefaultProps = getDefaultProps;
|
|
4306
4312
|
}
|
|
4307
4313
|
},
|
|
4308
|
-
propTypes: function
|
|
4314
|
+
propTypes: function(Constructor, propTypes) {
|
|
4309
4315
|
if ("development" !== 'production') {
|
|
4310
4316
|
validateTypeDef(Constructor, propTypes, 'prop');
|
|
4311
4317
|
}
|
|
4312
4318
|
Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
|
|
4313
4319
|
},
|
|
4314
|
-
statics: function
|
|
4320
|
+
statics: function(Constructor, statics) {
|
|
4315
4321
|
mixStaticSpecIntoComponent(Constructor, statics);
|
|
4316
4322
|
},
|
|
4317
|
-
autobind: function
|
|
4323
|
+
autobind: function() {}
|
|
4324
|
+
};
|
|
4318
4325
|
|
|
4319
4326
|
function validateTypeDef(Constructor, typeDef, location) {
|
|
4320
4327
|
for (var propName in typeDef) {
|
|
4321
4328
|
if (typeDef.hasOwnProperty(propName)) {
|
|
4322
4329
|
// use a warning instead of an _invariant so components
|
|
4323
4330
|
// don't show up in prod but only in __DEV__
|
|
4324
|
-
"development" !== 'production'
|
|
4331
|
+
if ("development" !== 'production') {
|
|
4332
|
+
warning(
|
|
4333
|
+
typeof typeDef[propName] === 'function',
|
|
4334
|
+
'%s: %s type `%s` is invalid; it must be a function, usually from ' +
|
|
4335
|
+
'React.PropTypes.',
|
|
4336
|
+
Constructor.displayName || 'ReactClass',
|
|
4337
|
+
ReactPropTypeLocationNames[location],
|
|
4338
|
+
propName
|
|
4339
|
+
);
|
|
4340
|
+
}
|
|
4325
4341
|
}
|
|
4326
4342
|
}
|
|
4327
4343
|
}
|
|
4328
4344
|
|
|
4329
4345
|
function validateMethodOverride(isAlreadyDefined, name) {
|
|
4330
|
-
var specPolicy = ReactClassInterface.hasOwnProperty(name)
|
|
4346
|
+
var specPolicy = ReactClassInterface.hasOwnProperty(name)
|
|
4347
|
+
? ReactClassInterface[name]
|
|
4348
|
+
: null;
|
|
4331
4349
|
|
|
4332
4350
|
// Disallow overriding of base class methods unless explicitly allowed.
|
|
4333
4351
|
if (ReactClassMixin.hasOwnProperty(name)) {
|
|
4334
|
-
_invariant(
|
|
4352
|
+
_invariant(
|
|
4353
|
+
specPolicy === 'OVERRIDE_BASE',
|
|
4354
|
+
'ReactClassInterface: You are attempting to override ' +
|
|
4355
|
+
'`%s` from your class specification. Ensure that your method names ' +
|
|
4356
|
+
'do not overlap with React methods.',
|
|
4357
|
+
name
|
|
4358
|
+
);
|
|
4335
4359
|
}
|
|
4336
4360
|
|
|
4337
4361
|
// Disallow defining methods more than once unless explicitly allowed.
|
|
4338
4362
|
if (isAlreadyDefined) {
|
|
4339
|
-
_invariant(
|
|
4363
|
+
_invariant(
|
|
4364
|
+
specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED',
|
|
4365
|
+
'ReactClassInterface: You are attempting to define ' +
|
|
4366
|
+
'`%s` on your component more than once. This conflict may be due ' +
|
|
4367
|
+
'to a mixin.',
|
|
4368
|
+
name
|
|
4369
|
+
);
|
|
4340
4370
|
}
|
|
4341
4371
|
}
|
|
4342
4372
|
|
|
@@ -4350,14 +4380,33 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4350
4380
|
var typeofSpec = typeof spec;
|
|
4351
4381
|
var isMixinValid = typeofSpec === 'object' && spec !== null;
|
|
4352
4382
|
|
|
4353
|
-
"development" !== 'production'
|
|
4383
|
+
if ("development" !== 'production') {
|
|
4384
|
+
warning(
|
|
4385
|
+
isMixinValid,
|
|
4386
|
+
"%s: You're attempting to include a mixin that is either null " +
|
|
4387
|
+
'or not an object. Check the mixins included by the component, ' +
|
|
4388
|
+
'as well as any mixins they include themselves. ' +
|
|
4389
|
+
'Expected object but got %s.',
|
|
4390
|
+
Constructor.displayName || 'ReactClass',
|
|
4391
|
+
spec === null ? null : typeofSpec
|
|
4392
|
+
);
|
|
4393
|
+
}
|
|
4354
4394
|
}
|
|
4355
4395
|
|
|
4356
4396
|
return;
|
|
4357
4397
|
}
|
|
4358
4398
|
|
|
4359
|
-
_invariant(
|
|
4360
|
-
|
|
4399
|
+
_invariant(
|
|
4400
|
+
typeof spec !== 'function',
|
|
4401
|
+
"ReactClass: You're attempting to " +
|
|
4402
|
+
'use a component class or function as a mixin. Instead, just use a ' +
|
|
4403
|
+
'regular object.'
|
|
4404
|
+
);
|
|
4405
|
+
_invariant(
|
|
4406
|
+
!isValidElement(spec),
|
|
4407
|
+
"ReactClass: You're attempting to " +
|
|
4408
|
+
'use a component as a mixin. Instead, just use a regular object.'
|
|
4409
|
+
);
|
|
4361
4410
|
|
|
4362
4411
|
var proto = Constructor.prototype;
|
|
4363
4412
|
var autoBindPairs = proto.__reactAutoBindPairs;
|
|
@@ -4392,7 +4441,11 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4392
4441
|
// 2. Overridden methods (that were mixed in).
|
|
4393
4442
|
var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
|
|
4394
4443
|
var isFunction = typeof property === 'function';
|
|
4395
|
-
var shouldAutoBind =
|
|
4444
|
+
var shouldAutoBind =
|
|
4445
|
+
isFunction &&
|
|
4446
|
+
!isReactClassMethod &&
|
|
4447
|
+
!isAlreadyDefined &&
|
|
4448
|
+
spec.autobind !== false;
|
|
4396
4449
|
|
|
4397
4450
|
if (shouldAutoBind) {
|
|
4398
4451
|
autoBindPairs.push(name, property);
|
|
@@ -4402,7 +4455,15 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4402
4455
|
var specPolicy = ReactClassInterface[name];
|
|
4403
4456
|
|
|
4404
4457
|
// These cases should already be caught by validateMethodOverride.
|
|
4405
|
-
_invariant(
|
|
4458
|
+
_invariant(
|
|
4459
|
+
isReactClassMethod &&
|
|
4460
|
+
(specPolicy === 'DEFINE_MANY_MERGED' ||
|
|
4461
|
+
specPolicy === 'DEFINE_MANY'),
|
|
4462
|
+
'ReactClass: Unexpected spec policy %s for key %s ' +
|
|
4463
|
+
'when mixing in component specs.',
|
|
4464
|
+
specPolicy,
|
|
4465
|
+
name
|
|
4466
|
+
);
|
|
4406
4467
|
|
|
4407
4468
|
// For methods which are defined more than once, call the existing
|
|
4408
4469
|
// methods before calling the new property, merging if appropriate.
|
|
@@ -4437,10 +4498,23 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4437
4498
|
}
|
|
4438
4499
|
|
|
4439
4500
|
var isReserved = name in RESERVED_SPEC_KEYS;
|
|
4440
|
-
_invariant(
|
|
4501
|
+
_invariant(
|
|
4502
|
+
!isReserved,
|
|
4503
|
+
'ReactClass: You are attempting to define a reserved ' +
|
|
4504
|
+
'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' +
|
|
4505
|
+
'as an instance property instead; it will still be accessible on the ' +
|
|
4506
|
+
'constructor.',
|
|
4507
|
+
name
|
|
4508
|
+
);
|
|
4441
4509
|
|
|
4442
4510
|
var isInherited = name in Constructor;
|
|
4443
|
-
_invariant(
|
|
4511
|
+
_invariant(
|
|
4512
|
+
!isInherited,
|
|
4513
|
+
'ReactClass: You are attempting to define ' +
|
|
4514
|
+
'`%s` on your component more than once. This conflict may be ' +
|
|
4515
|
+
'due to a mixin.',
|
|
4516
|
+
name
|
|
4517
|
+
);
|
|
4444
4518
|
Constructor[name] = property;
|
|
4445
4519
|
}
|
|
4446
4520
|
}
|
|
@@ -4453,11 +4527,22 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4453
4527
|
* @return {object} one after it has been mutated to contain everything in two.
|
|
4454
4528
|
*/
|
|
4455
4529
|
function mergeIntoWithNoDuplicateKeys(one, two) {
|
|
4456
|
-
_invariant(
|
|
4530
|
+
_invariant(
|
|
4531
|
+
one && two && typeof one === 'object' && typeof two === 'object',
|
|
4532
|
+
'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'
|
|
4533
|
+
);
|
|
4457
4534
|
|
|
4458
4535
|
for (var key in two) {
|
|
4459
4536
|
if (two.hasOwnProperty(key)) {
|
|
4460
|
-
_invariant(
|
|
4537
|
+
_invariant(
|
|
4538
|
+
one[key] === undefined,
|
|
4539
|
+
'mergeIntoWithNoDuplicateKeys(): ' +
|
|
4540
|
+
'Tried to merge two objects with the same key: `%s`. This conflict ' +
|
|
4541
|
+
'may be due to a mixin; in particular, this may be caused by two ' +
|
|
4542
|
+
'getInitialState() or getDefaultProps() methods returning objects ' +
|
|
4543
|
+
'with clashing keys.',
|
|
4544
|
+
key
|
|
4545
|
+
);
|
|
4461
4546
|
one[key] = two[key];
|
|
4462
4547
|
}
|
|
4463
4548
|
}
|
|
@@ -4518,8 +4603,14 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4518
4603
|
boundMethod.__reactBoundArguments = null;
|
|
4519
4604
|
var componentName = component.constructor.displayName;
|
|
4520
4605
|
var _bind = boundMethod.bind;
|
|
4521
|
-
boundMethod.bind = function
|
|
4522
|
-
for (
|
|
4606
|
+
boundMethod.bind = function(newThis) {
|
|
4607
|
+
for (
|
|
4608
|
+
var _len = arguments.length,
|
|
4609
|
+
args = Array(_len > 1 ? _len - 1 : 0),
|
|
4610
|
+
_key = 1;
|
|
4611
|
+
_key < _len;
|
|
4612
|
+
_key++
|
|
4613
|
+
) {
|
|
4523
4614
|
args[_key - 1] = arguments[_key];
|
|
4524
4615
|
}
|
|
4525
4616
|
|
|
@@ -4527,9 +4618,24 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4527
4618
|
// ignore the value of "this" that the user is trying to use, so
|
|
4528
4619
|
// let's warn.
|
|
4529
4620
|
if (newThis !== component && newThis !== null) {
|
|
4530
|
-
"development" !== 'production'
|
|
4621
|
+
if ("development" !== 'production') {
|
|
4622
|
+
warning(
|
|
4623
|
+
false,
|
|
4624
|
+
'bind(): React component methods may only be bound to the ' +
|
|
4625
|
+
'component instance. See %s',
|
|
4626
|
+
componentName
|
|
4627
|
+
);
|
|
4628
|
+
}
|
|
4531
4629
|
} else if (!args.length) {
|
|
4532
|
-
"development" !== 'production'
|
|
4630
|
+
if ("development" !== 'production') {
|
|
4631
|
+
warning(
|
|
4632
|
+
false,
|
|
4633
|
+
'bind(): You are binding a component method to the component. ' +
|
|
4634
|
+
'React does this for you automatically in a high-performance ' +
|
|
4635
|
+
'way, so you can safely remove this call. See %s',
|
|
4636
|
+
componentName
|
|
4637
|
+
);
|
|
4638
|
+
}
|
|
4533
4639
|
return boundMethod;
|
|
4534
4640
|
}
|
|
4535
4641
|
var reboundMethod = _bind.apply(boundMethod, arguments);
|
|
@@ -4556,11 +4662,14 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4556
4662
|
}
|
|
4557
4663
|
}
|
|
4558
4664
|
|
|
4559
|
-
var
|
|
4560
|
-
componentDidMount: function
|
|
4665
|
+
var IsMountedPreMixin = {
|
|
4666
|
+
componentDidMount: function() {
|
|
4561
4667
|
this.__isMounted = true;
|
|
4562
|
-
}
|
|
4563
|
-
|
|
4668
|
+
}
|
|
4669
|
+
};
|
|
4670
|
+
|
|
4671
|
+
var IsMountedPostMixin = {
|
|
4672
|
+
componentWillUnmount: function() {
|
|
4564
4673
|
this.__isMounted = false;
|
|
4565
4674
|
}
|
|
4566
4675
|
};
|
|
@@ -4570,12 +4679,11 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4570
4679
|
* therefore not already part of the modern ReactComponent.
|
|
4571
4680
|
*/
|
|
4572
4681
|
var ReactClassMixin = {
|
|
4573
|
-
|
|
4574
4682
|
/**
|
|
4575
4683
|
* TODO: This will be deprecated because state should always keep a consistent
|
|
4576
4684
|
* type signature and the only use case for this, is to avoid that.
|
|
4577
4685
|
*/
|
|
4578
|
-
replaceState: function
|
|
4686
|
+
replaceState: function(newState, callback) {
|
|
4579
4687
|
this.updater.enqueueReplaceState(this, newState, callback);
|
|
4580
4688
|
},
|
|
4581
4689
|
|
|
@@ -4585,17 +4693,29 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4585
4693
|
* @protected
|
|
4586
4694
|
* @final
|
|
4587
4695
|
*/
|
|
4588
|
-
isMounted: function
|
|
4696
|
+
isMounted: function() {
|
|
4589
4697
|
if ("development" !== 'production') {
|
|
4590
|
-
|
|
4698
|
+
warning(
|
|
4699
|
+
this.__didWarnIsMounted,
|
|
4700
|
+
'%s: isMounted is deprecated. Instead, make sure to clean up ' +
|
|
4701
|
+
'subscriptions and pending requests in componentWillUnmount to ' +
|
|
4702
|
+
'prevent memory leaks.',
|
|
4703
|
+
(this.constructor && this.constructor.displayName) ||
|
|
4704
|
+
this.name ||
|
|
4705
|
+
'Component'
|
|
4706
|
+
);
|
|
4591
4707
|
this.__didWarnIsMounted = true;
|
|
4592
4708
|
}
|
|
4593
4709
|
return !!this.__isMounted;
|
|
4594
4710
|
}
|
|
4595
4711
|
};
|
|
4596
4712
|
|
|
4597
|
-
var ReactClassComponent = function
|
|
4598
|
-
_assign(
|
|
4713
|
+
var ReactClassComponent = function() {};
|
|
4714
|
+
_assign(
|
|
4715
|
+
ReactClassComponent.prototype,
|
|
4716
|
+
ReactComponent.prototype,
|
|
4717
|
+
ReactClassMixin
|
|
4718
|
+
);
|
|
4599
4719
|
|
|
4600
4720
|
/**
|
|
4601
4721
|
* Creates a composite component class given a class specification.
|
|
@@ -4609,12 +4729,16 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4609
4729
|
// To keep our warnings more understandable, we'll use a little hack here to
|
|
4610
4730
|
// ensure that Constructor.name !== 'Constructor'. This makes sure we don't
|
|
4611
4731
|
// unnecessarily identify a class without displayName as 'Constructor'.
|
|
4612
|
-
var Constructor = identity(function
|
|
4732
|
+
var Constructor = identity(function(props, context, updater) {
|
|
4613
4733
|
// This constructor gets overridden by mocks. The argument is used
|
|
4614
4734
|
// by mocks to assert on what gets mounted.
|
|
4615
4735
|
|
|
4616
4736
|
if ("development" !== 'production') {
|
|
4617
|
-
|
|
4737
|
+
warning(
|
|
4738
|
+
this instanceof Constructor,
|
|
4739
|
+
'Something is calling a React component directly. Use a factory or ' +
|
|
4740
|
+
'JSX instead. See: https://fb.me/react-legacyfactory'
|
|
4741
|
+
);
|
|
4618
4742
|
}
|
|
4619
4743
|
|
|
4620
4744
|
// Wire up auto-binding
|
|
@@ -4635,13 +4759,20 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4635
4759
|
var initialState = this.getInitialState ? this.getInitialState() : null;
|
|
4636
4760
|
if ("development" !== 'production') {
|
|
4637
4761
|
// We allow auto-mocks to proceed as if they're returning null.
|
|
4638
|
-
if (
|
|
4762
|
+
if (
|
|
4763
|
+
initialState === undefined &&
|
|
4764
|
+
this.getInitialState._isMockFunction
|
|
4765
|
+
) {
|
|
4639
4766
|
// This is probably bad practice. Consider warning here and
|
|
4640
4767
|
// deprecating this convenience.
|
|
4641
4768
|
initialState = null;
|
|
4642
4769
|
}
|
|
4643
4770
|
}
|
|
4644
|
-
_invariant(
|
|
4771
|
+
_invariant(
|
|
4772
|
+
typeof initialState === 'object' && !Array.isArray(initialState),
|
|
4773
|
+
'%s.getInitialState(): must return an object or null',
|
|
4774
|
+
Constructor.displayName || 'ReactCompositeComponent'
|
|
4775
|
+
);
|
|
4645
4776
|
|
|
4646
4777
|
this.state = initialState;
|
|
4647
4778
|
});
|
|
@@ -4651,8 +4782,9 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4651
4782
|
|
|
4652
4783
|
injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
|
|
4653
4784
|
|
|
4654
|
-
mixSpecIntoComponent(Constructor,
|
|
4785
|
+
mixSpecIntoComponent(Constructor, IsMountedPreMixin);
|
|
4655
4786
|
mixSpecIntoComponent(Constructor, spec);
|
|
4787
|
+
mixSpecIntoComponent(Constructor, IsMountedPostMixin);
|
|
4656
4788
|
|
|
4657
4789
|
// Initialize the defaultProps property after all mixins have been merged.
|
|
4658
4790
|
if (Constructor.getDefaultProps) {
|
|
@@ -4672,11 +4804,26 @@ function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
|
|
|
4672
4804
|
}
|
|
4673
4805
|
}
|
|
4674
4806
|
|
|
4675
|
-
_invariant(
|
|
4807
|
+
_invariant(
|
|
4808
|
+
Constructor.prototype.render,
|
|
4809
|
+
'createClass(...): Class specification must implement a `render` method.'
|
|
4810
|
+
);
|
|
4676
4811
|
|
|
4677
4812
|
if ("development" !== 'production') {
|
|
4678
|
-
|
|
4679
|
-
|
|
4813
|
+
warning(
|
|
4814
|
+
!Constructor.prototype.componentShouldUpdate,
|
|
4815
|
+
'%s has a method called ' +
|
|
4816
|
+
'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
|
|
4817
|
+
'The name is phrased as a question because the function is ' +
|
|
4818
|
+
'expected to return a value.',
|
|
4819
|
+
spec.displayName || 'A component'
|
|
4820
|
+
);
|
|
4821
|
+
warning(
|
|
4822
|
+
!Constructor.prototype.componentWillRecieveProps,
|
|
4823
|
+
'%s has a method called ' +
|
|
4824
|
+
'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?',
|
|
4825
|
+
spec.displayName || 'A component'
|
|
4826
|
+
);
|
|
4680
4827
|
}
|
|
4681
4828
|
|
|
4682
4829
|
// Reduce time spent doing lookups by setting these on the prototype.
|
|
@@ -5431,6 +5578,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
5431
5578
|
function createChainableTypeChecker(validate) {
|
|
5432
5579
|
if ("development" !== 'production') {
|
|
5433
5580
|
var manualPropTypeCallCache = {};
|
|
5581
|
+
var manualPropTypeWarningCount = 0;
|
|
5434
5582
|
}
|
|
5435
5583
|
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
5436
5584
|
componentName = componentName || ANONYMOUS;
|
|
@@ -5448,7 +5596,11 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
5448
5596
|
} else if ("development" !== 'production' && typeof console !== 'undefined') {
|
|
5449
5597
|
// Old behavior for people using React.PropTypes
|
|
5450
5598
|
var cacheKey = componentName + ':' + propName;
|
|
5451
|
-
if (
|
|
5599
|
+
if (
|
|
5600
|
+
!manualPropTypeCallCache[cacheKey] &&
|
|
5601
|
+
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
5602
|
+
manualPropTypeWarningCount < 3
|
|
5603
|
+
) {
|
|
5452
5604
|
warning(
|
|
5453
5605
|
false,
|
|
5454
5606
|
'You are manually calling a React.PropTypes validation ' +
|
|
@@ -5460,6 +5612,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
5460
5612
|
componentName
|
|
5461
5613
|
);
|
|
5462
5614
|
manualPropTypeCallCache[cacheKey] = true;
|
|
5615
|
+
manualPropTypeWarningCount++;
|
|
5463
5616
|
}
|
|
5464
5617
|
}
|
|
5465
5618
|
}
|
|
@@ -5597,6 +5750,20 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
5597
5750
|
return emptyFunction.thatReturnsNull;
|
|
5598
5751
|
}
|
|
5599
5752
|
|
|
5753
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
5754
|
+
var checker = arrayOfTypeCheckers[i];
|
|
5755
|
+
if (typeof checker !== 'function') {
|
|
5756
|
+
warning(
|
|
5757
|
+
false,
|
|
5758
|
+
'Invalid argument supplid to oneOfType. Expected an array of check functions, but ' +
|
|
5759
|
+
'received %s at index %s.',
|
|
5760
|
+
getPostfixForTypeWarning(checker),
|
|
5761
|
+
i
|
|
5762
|
+
);
|
|
5763
|
+
return emptyFunction.thatReturnsNull;
|
|
5764
|
+
}
|
|
5765
|
+
}
|
|
5766
|
+
|
|
5600
5767
|
function validate(props, propName, componentName, location, propFullName) {
|
|
5601
5768
|
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
5602
5769
|
var checker = arrayOfTypeCheckers[i];
|
|
@@ -5729,6 +5896,9 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
5729
5896
|
// This handles more types than `getPropType`. Only used for error messages.
|
|
5730
5897
|
// See `createPrimitiveTypeChecker`.
|
|
5731
5898
|
function getPreciseType(propValue) {
|
|
5899
|
+
if (typeof propValue === 'undefined' || propValue === null) {
|
|
5900
|
+
return '' + propValue;
|
|
5901
|
+
}
|
|
5732
5902
|
var propType = getPropType(propValue);
|
|
5733
5903
|
if (propType === 'object') {
|
|
5734
5904
|
if (propValue instanceof Date) {
|
|
@@ -5740,6 +5910,23 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
|
5740
5910
|
return propType;
|
|
5741
5911
|
}
|
|
5742
5912
|
|
|
5913
|
+
// Returns a string that is postfixed to a warning about an invalid type.
|
|
5914
|
+
// For example, "undefined" or "of type array"
|
|
5915
|
+
function getPostfixForTypeWarning(value) {
|
|
5916
|
+
var type = getPreciseType(value);
|
|
5917
|
+
switch (type) {
|
|
5918
|
+
case 'array':
|
|
5919
|
+
case 'object':
|
|
5920
|
+
return 'an ' + type;
|
|
5921
|
+
case 'boolean':
|
|
5922
|
+
case 'date':
|
|
5923
|
+
case 'regexp':
|
|
5924
|
+
return 'a ' + type;
|
|
5925
|
+
default:
|
|
5926
|
+
return type;
|
|
5927
|
+
}
|
|
5928
|
+
}
|
|
5929
|
+
|
|
5743
5930
|
// Returns class name of the object, if any.
|
|
5744
5931
|
function getClassName(propValue) {
|
|
5745
5932
|
if (!propValue.constructor || !propValue.constructor.name) {
|