react 0.0.0-experimental-b53ea6ca0 → 0.0.0-experimental-f42431abe
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/build-info.json +4 -4
- package/cjs/react.development.js +468 -502
- package/cjs/react.production.min.js +14 -13
- package/package.json +1 -1
- package/umd/react.development.js +476 -506
- package/umd/react.production.min.js +3 -3
- package/umd/react.profiling.min.js +3 -3
package/build-info.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"branch": "master",
|
|
3
|
-
"buildNumber": "
|
|
4
|
-
"checksum": "
|
|
5
|
-
"commit": "
|
|
3
|
+
"buildNumber": "68681",
|
|
4
|
+
"checksum": "79816fa",
|
|
5
|
+
"commit": "f42431abe",
|
|
6
6
|
"environment": "ci",
|
|
7
|
-
"reactVersion": "16.
|
|
7
|
+
"reactVersion": "16.12.0-experimental-f42431abe"
|
|
8
8
|
}
|
package/cjs/react.development.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v0.0.0-experimental-
|
|
1
|
+
/** @license React v0.0.0-experimental-f42431abe
|
|
2
2
|
* react.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -20,7 +20,7 @@ var checkPropTypes = require('prop-types/checkPropTypes');
|
|
|
20
20
|
|
|
21
21
|
// TODO: this is special because it gets imported during build.
|
|
22
22
|
|
|
23
|
-
var ReactVersion = '16.
|
|
23
|
+
var ReactVersion = '16.12.0-experimental-f42431abe';
|
|
24
24
|
|
|
25
25
|
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
26
26
|
// nor polyfill, then a plain number is used for performance.
|
|
@@ -60,353 +60,6 @@ function getIteratorFn(maybeIterable) {
|
|
|
60
60
|
return null;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
// Do not require this module directly! Use normal `invariant` calls with
|
|
64
|
-
// template literal strings. The messages will be replaced with error codes
|
|
65
|
-
// during build.
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Use invariant() to assert state which your program assumes to be true.
|
|
69
|
-
*
|
|
70
|
-
* Provide sprintf-style format (only %s is supported) and arguments
|
|
71
|
-
* to provide information about what broke and what you were
|
|
72
|
-
* expecting.
|
|
73
|
-
*
|
|
74
|
-
* The invariant message will be stripped in production, but the invariant
|
|
75
|
-
* will remain to ensure logic does not differ in production.
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Forked from fbjs/warning:
|
|
80
|
-
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
81
|
-
*
|
|
82
|
-
* Only change is we use console.warn instead of console.error,
|
|
83
|
-
* and do nothing when 'console' is not supported.
|
|
84
|
-
* This really simplifies the code.
|
|
85
|
-
* ---
|
|
86
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
|
87
|
-
* This can be used to log issues in development environments in critical
|
|
88
|
-
* paths. Removing the logging code for production environments will keep the
|
|
89
|
-
* same logic and follow the same code paths.
|
|
90
|
-
*/
|
|
91
|
-
var lowPriorityWarningWithoutStack = function () {};
|
|
92
|
-
|
|
93
|
-
{
|
|
94
|
-
var printWarning = function (format) {
|
|
95
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
96
|
-
args[_key - 1] = arguments[_key];
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
var argIndex = 0;
|
|
100
|
-
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
101
|
-
return args[argIndex++];
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
if (typeof console !== 'undefined') {
|
|
105
|
-
console.warn(message);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
try {
|
|
109
|
-
// --- Welcome to debugging React ---
|
|
110
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
111
|
-
// to find the callsite that caused this warning to fire.
|
|
112
|
-
throw new Error(message);
|
|
113
|
-
} catch (x) {}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
lowPriorityWarningWithoutStack = function (condition, format) {
|
|
117
|
-
if (format === undefined) {
|
|
118
|
-
throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (!condition) {
|
|
122
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
123
|
-
args[_key2 - 2] = arguments[_key2];
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
printWarning.apply(void 0, [format].concat(args));
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
|
135
|
-
* This can be used to log issues in development environments in critical
|
|
136
|
-
* paths. Removing the logging code for production environments will keep the
|
|
137
|
-
* same logic and follow the same code paths.
|
|
138
|
-
*/
|
|
139
|
-
var warningWithoutStack = function () {};
|
|
140
|
-
|
|
141
|
-
{
|
|
142
|
-
warningWithoutStack = function (condition, format) {
|
|
143
|
-
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
144
|
-
args[_key - 2] = arguments[_key];
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (format === undefined) {
|
|
148
|
-
throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (args.length > 8) {
|
|
152
|
-
// Check before the condition to catch violations early.
|
|
153
|
-
throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (condition) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
if (typeof console !== 'undefined') {
|
|
161
|
-
var argsWithFormat = args.map(function (item) {
|
|
162
|
-
return '' + item;
|
|
163
|
-
});
|
|
164
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
165
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
166
|
-
|
|
167
|
-
Function.prototype.apply.call(console.error, console, argsWithFormat);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
try {
|
|
171
|
-
// --- Welcome to debugging React ---
|
|
172
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
173
|
-
// to find the callsite that caused this warning to fire.
|
|
174
|
-
var argIndex = 0;
|
|
175
|
-
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
176
|
-
return args[argIndex++];
|
|
177
|
-
});
|
|
178
|
-
throw new Error(message);
|
|
179
|
-
} catch (x) {}
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
var warningWithoutStack$1 = warningWithoutStack;
|
|
184
|
-
|
|
185
|
-
var didWarnStateUpdateForUnmountedComponent = {};
|
|
186
|
-
|
|
187
|
-
function warnNoop(publicInstance, callerName) {
|
|
188
|
-
{
|
|
189
|
-
var _constructor = publicInstance.constructor;
|
|
190
|
-
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
|
191
|
-
var warningKey = componentName + "." + callerName;
|
|
192
|
-
|
|
193
|
-
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
warningWithoutStack$1(false, "Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
|
|
198
|
-
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* This is the abstract API for an update queue.
|
|
203
|
-
*/
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
var ReactNoopUpdateQueue = {
|
|
207
|
-
/**
|
|
208
|
-
* Checks whether or not this composite component is mounted.
|
|
209
|
-
* @param {ReactClass} publicInstance The instance we want to test.
|
|
210
|
-
* @return {boolean} True if mounted, false otherwise.
|
|
211
|
-
* @protected
|
|
212
|
-
* @final
|
|
213
|
-
*/
|
|
214
|
-
isMounted: function (publicInstance) {
|
|
215
|
-
return false;
|
|
216
|
-
},
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Forces an update. This should only be invoked when it is known with
|
|
220
|
-
* certainty that we are **not** in a DOM transaction.
|
|
221
|
-
*
|
|
222
|
-
* You may want to call this when you know that some deeper aspect of the
|
|
223
|
-
* component's state has changed but `setState` was not called.
|
|
224
|
-
*
|
|
225
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
226
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
|
227
|
-
*
|
|
228
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
229
|
-
* @param {?function} callback Called after component is updated.
|
|
230
|
-
* @param {?string} callerName name of the calling function in the public API.
|
|
231
|
-
* @internal
|
|
232
|
-
*/
|
|
233
|
-
enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
|
234
|
-
warnNoop(publicInstance, 'forceUpdate');
|
|
235
|
-
},
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Replaces all of the state. Always use this or `setState` to mutate state.
|
|
239
|
-
* You should treat `this.state` as immutable.
|
|
240
|
-
*
|
|
241
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
242
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
243
|
-
*
|
|
244
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
245
|
-
* @param {object} completeState Next state.
|
|
246
|
-
* @param {?function} callback Called after component is updated.
|
|
247
|
-
* @param {?string} callerName name of the calling function in the public API.
|
|
248
|
-
* @internal
|
|
249
|
-
*/
|
|
250
|
-
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
|
251
|
-
warnNoop(publicInstance, 'replaceState');
|
|
252
|
-
},
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Sets a subset of the state. This only exists because _pendingState is
|
|
256
|
-
* internal. This provides a merging strategy that is not available to deep
|
|
257
|
-
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
258
|
-
* during the merge.
|
|
259
|
-
*
|
|
260
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
261
|
-
* @param {object} partialState Next partial state to be merged with state.
|
|
262
|
-
* @param {?function} callback Called after component is updated.
|
|
263
|
-
* @param {?string} Name of the calling function in the public API.
|
|
264
|
-
* @internal
|
|
265
|
-
*/
|
|
266
|
-
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
|
267
|
-
warnNoop(publicInstance, 'setState');
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
var emptyObject = {};
|
|
272
|
-
|
|
273
|
-
{
|
|
274
|
-
Object.freeze(emptyObject);
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Base class helpers for the updating state of a component.
|
|
278
|
-
*/
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
function Component(props, context, updater) {
|
|
282
|
-
this.props = props;
|
|
283
|
-
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
284
|
-
|
|
285
|
-
this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
|
|
286
|
-
// renderer.
|
|
287
|
-
|
|
288
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
Component.prototype.isReactComponent = {};
|
|
292
|
-
/**
|
|
293
|
-
* Sets a subset of the state. Always use this to mutate
|
|
294
|
-
* state. You should treat `this.state` as immutable.
|
|
295
|
-
*
|
|
296
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
297
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
298
|
-
*
|
|
299
|
-
* There is no guarantee that calls to `setState` will run synchronously,
|
|
300
|
-
* as they may eventually be batched together. You can provide an optional
|
|
301
|
-
* callback that will be executed when the call to setState is actually
|
|
302
|
-
* completed.
|
|
303
|
-
*
|
|
304
|
-
* When a function is provided to setState, it will be called at some point in
|
|
305
|
-
* the future (not synchronously). It will be called with the up to date
|
|
306
|
-
* component arguments (state, props, context). These values can be different
|
|
307
|
-
* from this.* because your function may be called after receiveProps but before
|
|
308
|
-
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
|
309
|
-
* assigned to this.
|
|
310
|
-
*
|
|
311
|
-
* @param {object|function} partialState Next partial state or function to
|
|
312
|
-
* produce next partial state to be merged with current state.
|
|
313
|
-
* @param {?function} callback Called after state is updated.
|
|
314
|
-
* @final
|
|
315
|
-
* @protected
|
|
316
|
-
*/
|
|
317
|
-
|
|
318
|
-
Component.prototype.setState = function (partialState, callback) {
|
|
319
|
-
if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
|
|
320
|
-
{
|
|
321
|
-
throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
326
|
-
};
|
|
327
|
-
/**
|
|
328
|
-
* Forces an update. This should only be invoked when it is known with
|
|
329
|
-
* certainty that we are **not** in a DOM transaction.
|
|
330
|
-
*
|
|
331
|
-
* You may want to call this when you know that some deeper aspect of the
|
|
332
|
-
* component's state has changed but `setState` was not called.
|
|
333
|
-
*
|
|
334
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
335
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
|
336
|
-
*
|
|
337
|
-
* @param {?function} callback Called after update is complete.
|
|
338
|
-
* @final
|
|
339
|
-
* @protected
|
|
340
|
-
*/
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
Component.prototype.forceUpdate = function (callback) {
|
|
344
|
-
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
345
|
-
};
|
|
346
|
-
/**
|
|
347
|
-
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
348
|
-
* we would like to deprecate them, we're not going to move them over to this
|
|
349
|
-
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
350
|
-
*/
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
{
|
|
354
|
-
var deprecatedAPIs = {
|
|
355
|
-
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
356
|
-
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
var defineDeprecationWarning = function (methodName, info) {
|
|
360
|
-
Object.defineProperty(Component.prototype, methodName, {
|
|
361
|
-
get: function () {
|
|
362
|
-
lowPriorityWarningWithoutStack$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
363
|
-
return undefined;
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
for (var fnName in deprecatedAPIs) {
|
|
369
|
-
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
370
|
-
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
function ComponentDummy() {}
|
|
376
|
-
|
|
377
|
-
ComponentDummy.prototype = Component.prototype;
|
|
378
|
-
/**
|
|
379
|
-
* Convenience component with default shallow equality check for sCU.
|
|
380
|
-
*/
|
|
381
|
-
|
|
382
|
-
function PureComponent(props, context, updater) {
|
|
383
|
-
this.props = props;
|
|
384
|
-
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
385
|
-
|
|
386
|
-
this.refs = emptyObject;
|
|
387
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
391
|
-
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
|
|
392
|
-
|
|
393
|
-
_assign(pureComponentPrototype, Component.prototype);
|
|
394
|
-
|
|
395
|
-
pureComponentPrototype.isPureReactComponent = true;
|
|
396
|
-
|
|
397
|
-
// an immutable object with a single mutable value
|
|
398
|
-
function createRef() {
|
|
399
|
-
var refObject = {
|
|
400
|
-
current: null
|
|
401
|
-
};
|
|
402
|
-
|
|
403
|
-
{
|
|
404
|
-
Object.seal(refObject);
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
return refObject;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
63
|
/**
|
|
411
64
|
* Keeps track of the current dispatcher.
|
|
412
65
|
*/
|
|
@@ -492,7 +145,7 @@ function getComponentName(type) {
|
|
|
492
145
|
|
|
493
146
|
{
|
|
494
147
|
if (typeof type.tag === 'number') {
|
|
495
|
-
|
|
148
|
+
error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
496
149
|
}
|
|
497
150
|
}
|
|
498
151
|
|
|
@@ -520,127 +173,402 @@ function getComponentName(type) {
|
|
|
520
173
|
case REACT_SUSPENSE_TYPE:
|
|
521
174
|
return 'Suspense';
|
|
522
175
|
|
|
523
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
524
|
-
return 'SuspenseList';
|
|
176
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
177
|
+
return 'SuspenseList';
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (typeof type === 'object') {
|
|
181
|
+
switch (type.$$typeof) {
|
|
182
|
+
case REACT_CONTEXT_TYPE:
|
|
183
|
+
return 'Context.Consumer';
|
|
184
|
+
|
|
185
|
+
case REACT_PROVIDER_TYPE:
|
|
186
|
+
return 'Context.Provider';
|
|
187
|
+
|
|
188
|
+
case REACT_FORWARD_REF_TYPE:
|
|
189
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
190
|
+
|
|
191
|
+
case REACT_MEMO_TYPE:
|
|
192
|
+
return getComponentName(type.type);
|
|
193
|
+
|
|
194
|
+
case REACT_LAZY_TYPE:
|
|
195
|
+
{
|
|
196
|
+
var thenable = type;
|
|
197
|
+
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
198
|
+
|
|
199
|
+
if (resolvedThenable) {
|
|
200
|
+
return getComponentName(resolvedThenable);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
var ReactDebugCurrentFrame = {};
|
|
212
|
+
var currentlyValidatingElement = null;
|
|
213
|
+
function setCurrentlyValidatingElement(element) {
|
|
214
|
+
{
|
|
215
|
+
currentlyValidatingElement = element;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
{
|
|
220
|
+
// Stack implementation injected by the current renderer.
|
|
221
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
222
|
+
|
|
223
|
+
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
224
|
+
var stack = ''; // Add an extra top frame while an element is being validated
|
|
225
|
+
|
|
226
|
+
if (currentlyValidatingElement) {
|
|
227
|
+
var name = getComponentName(currentlyValidatingElement.type);
|
|
228
|
+
var owner = currentlyValidatingElement._owner;
|
|
229
|
+
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
|
230
|
+
} // Delegate to the injected renderer-specific implementation
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
234
|
+
|
|
235
|
+
if (impl) {
|
|
236
|
+
stack += impl() || '';
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return stack;
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Used by act() to track whether you're inside an act() scope.
|
|
245
|
+
*/
|
|
246
|
+
var IsSomeRendererActing = {
|
|
247
|
+
current: false
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
var ReactSharedInternals = {
|
|
251
|
+
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
252
|
+
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
253
|
+
ReactCurrentOwner: ReactCurrentOwner,
|
|
254
|
+
IsSomeRendererActing: IsSomeRendererActing,
|
|
255
|
+
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
256
|
+
assign: _assign
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
{
|
|
260
|
+
_assign(ReactSharedInternals, {
|
|
261
|
+
// These should not be included in production.
|
|
262
|
+
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
263
|
+
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
264
|
+
// TODO: remove in React 17.0.
|
|
265
|
+
ReactComponentTreeHook: {}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// by calls to these methods by a Babel plugin.
|
|
270
|
+
//
|
|
271
|
+
// In PROD (or in packages without access to React internals),
|
|
272
|
+
// they are left as they are instead.
|
|
273
|
+
|
|
274
|
+
function warn(format) {
|
|
275
|
+
{
|
|
276
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
277
|
+
args[_key - 1] = arguments[_key];
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
printWarning('warn', format, args);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
function error(format) {
|
|
284
|
+
{
|
|
285
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
286
|
+
args[_key2 - 1] = arguments[_key2];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
printWarning('error', format, args);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function printWarning(level, format, args) {
|
|
294
|
+
{
|
|
295
|
+
var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
|
|
296
|
+
|
|
297
|
+
if (!hasExistingStack) {
|
|
298
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
299
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
300
|
+
|
|
301
|
+
if (stack !== '') {
|
|
302
|
+
format += '%s';
|
|
303
|
+
args = args.concat([stack]);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
var argsWithFormat = args.map(function (item) {
|
|
308
|
+
return '' + item;
|
|
309
|
+
}); // Careful: RN currently depends on this prefix
|
|
310
|
+
|
|
311
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
312
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
313
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
314
|
+
|
|
315
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
316
|
+
|
|
317
|
+
try {
|
|
318
|
+
// --- Welcome to debugging React ---
|
|
319
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
320
|
+
// to find the callsite that caused this warning to fire.
|
|
321
|
+
var argIndex = 0;
|
|
322
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
323
|
+
return args[argIndex++];
|
|
324
|
+
});
|
|
325
|
+
throw new Error(message);
|
|
326
|
+
} catch (x) {}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// Do not require this module directly! Use normal `invariant` calls with
|
|
331
|
+
// template literal strings. The messages will be replaced with error codes
|
|
332
|
+
// during build.
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Use invariant() to assert state which your program assumes to be true.
|
|
336
|
+
*
|
|
337
|
+
* Provide sprintf-style format (only %s is supported) and arguments
|
|
338
|
+
* to provide information about what broke and what you were
|
|
339
|
+
* expecting.
|
|
340
|
+
*
|
|
341
|
+
* The invariant message will be stripped in production, but the invariant
|
|
342
|
+
* will remain to ensure logic does not differ in production.
|
|
343
|
+
*/
|
|
344
|
+
|
|
345
|
+
var didWarnStateUpdateForUnmountedComponent = {};
|
|
346
|
+
|
|
347
|
+
function warnNoop(publicInstance, callerName) {
|
|
348
|
+
{
|
|
349
|
+
var _constructor = publicInstance.constructor;
|
|
350
|
+
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
|
351
|
+
var warningKey = componentName + "." + callerName;
|
|
352
|
+
|
|
353
|
+
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
|
|
358
|
+
|
|
359
|
+
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* This is the abstract API for an update queue.
|
|
364
|
+
*/
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
var ReactNoopUpdateQueue = {
|
|
368
|
+
/**
|
|
369
|
+
* Checks whether or not this composite component is mounted.
|
|
370
|
+
* @param {ReactClass} publicInstance The instance we want to test.
|
|
371
|
+
* @return {boolean} True if mounted, false otherwise.
|
|
372
|
+
* @protected
|
|
373
|
+
* @final
|
|
374
|
+
*/
|
|
375
|
+
isMounted: function (publicInstance) {
|
|
376
|
+
return false;
|
|
377
|
+
},
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Forces an update. This should only be invoked when it is known with
|
|
381
|
+
* certainty that we are **not** in a DOM transaction.
|
|
382
|
+
*
|
|
383
|
+
* You may want to call this when you know that some deeper aspect of the
|
|
384
|
+
* component's state has changed but `setState` was not called.
|
|
385
|
+
*
|
|
386
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
387
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
|
388
|
+
*
|
|
389
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
390
|
+
* @param {?function} callback Called after component is updated.
|
|
391
|
+
* @param {?string} callerName name of the calling function in the public API.
|
|
392
|
+
* @internal
|
|
393
|
+
*/
|
|
394
|
+
enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
|
395
|
+
warnNoop(publicInstance, 'forceUpdate');
|
|
396
|
+
},
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Replaces all of the state. Always use this or `setState` to mutate state.
|
|
400
|
+
* You should treat `this.state` as immutable.
|
|
401
|
+
*
|
|
402
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
|
403
|
+
* accessing `this.state` after calling this method may return the old value.
|
|
404
|
+
*
|
|
405
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
406
|
+
* @param {object} completeState Next state.
|
|
407
|
+
* @param {?function} callback Called after component is updated.
|
|
408
|
+
* @param {?string} callerName name of the calling function in the public API.
|
|
409
|
+
* @internal
|
|
410
|
+
*/
|
|
411
|
+
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
|
412
|
+
warnNoop(publicInstance, 'replaceState');
|
|
413
|
+
},
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Sets a subset of the state. This only exists because _pendingState is
|
|
417
|
+
* internal. This provides a merging strategy that is not available to deep
|
|
418
|
+
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
419
|
+
* during the merge.
|
|
420
|
+
*
|
|
421
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
422
|
+
* @param {object} partialState Next partial state to be merged with state.
|
|
423
|
+
* @param {?function} callback Called after component is updated.
|
|
424
|
+
* @param {?string} Name of the calling function in the public API.
|
|
425
|
+
* @internal
|
|
426
|
+
*/
|
|
427
|
+
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
|
428
|
+
warnNoop(publicInstance, 'setState');
|
|
525
429
|
}
|
|
430
|
+
};
|
|
526
431
|
|
|
527
|
-
|
|
528
|
-
switch (type.$$typeof) {
|
|
529
|
-
case REACT_CONTEXT_TYPE:
|
|
530
|
-
return 'Context.Consumer';
|
|
432
|
+
var emptyObject = {};
|
|
531
433
|
|
|
532
|
-
|
|
533
|
-
|
|
434
|
+
{
|
|
435
|
+
Object.freeze(emptyObject);
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Base class helpers for the updating state of a component.
|
|
439
|
+
*/
|
|
534
440
|
|
|
535
|
-
case REACT_FORWARD_REF_TYPE:
|
|
536
|
-
return getWrappedName(type, type.render, 'ForwardRef');
|
|
537
441
|
|
|
538
|
-
|
|
539
|
-
|
|
442
|
+
function Component(props, context, updater) {
|
|
443
|
+
this.props = props;
|
|
444
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
540
445
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
var thenable = type;
|
|
544
|
-
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
446
|
+
this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
|
|
447
|
+
// renderer.
|
|
545
448
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
}
|
|
449
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
450
|
+
}
|
|
549
451
|
|
|
550
|
-
|
|
551
|
-
|
|
452
|
+
Component.prototype.isReactComponent = {};
|
|
453
|
+
/**
|
|
454
|
+
* Sets a subset of the state. Always use this to mutate
|
|
455
|
+
* state. You should treat `this.state` as immutable.
|
|
456
|
+
*
|
|
457
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
|
458
|
+
* accessing `this.state` after calling this method may return the old value.
|
|
459
|
+
*
|
|
460
|
+
* There is no guarantee that calls to `setState` will run synchronously,
|
|
461
|
+
* as they may eventually be batched together. You can provide an optional
|
|
462
|
+
* callback that will be executed when the call to setState is actually
|
|
463
|
+
* completed.
|
|
464
|
+
*
|
|
465
|
+
* When a function is provided to setState, it will be called at some point in
|
|
466
|
+
* the future (not synchronously). It will be called with the up to date
|
|
467
|
+
* component arguments (state, props, context). These values can be different
|
|
468
|
+
* from this.* because your function may be called after receiveProps but before
|
|
469
|
+
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
|
470
|
+
* assigned to this.
|
|
471
|
+
*
|
|
472
|
+
* @param {object|function} partialState Next partial state or function to
|
|
473
|
+
* produce next partial state to be merged with current state.
|
|
474
|
+
* @param {?function} callback Called after state is updated.
|
|
475
|
+
* @final
|
|
476
|
+
* @protected
|
|
477
|
+
*/
|
|
478
|
+
|
|
479
|
+
Component.prototype.setState = function (partialState, callback) {
|
|
480
|
+
if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
|
|
481
|
+
{
|
|
482
|
+
throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
|
|
552
483
|
}
|
|
553
484
|
}
|
|
554
485
|
|
|
555
|
-
|
|
556
|
-
}
|
|
486
|
+
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
487
|
+
};
|
|
488
|
+
/**
|
|
489
|
+
* Forces an update. This should only be invoked when it is known with
|
|
490
|
+
* certainty that we are **not** in a DOM transaction.
|
|
491
|
+
*
|
|
492
|
+
* You may want to call this when you know that some deeper aspect of the
|
|
493
|
+
* component's state has changed but `setState` was not called.
|
|
494
|
+
*
|
|
495
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
496
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
|
497
|
+
*
|
|
498
|
+
* @param {?function} callback Called after update is complete.
|
|
499
|
+
* @final
|
|
500
|
+
* @protected
|
|
501
|
+
*/
|
|
557
502
|
|
|
558
|
-
var ReactDebugCurrentFrame = {};
|
|
559
|
-
var currentlyValidatingElement = null;
|
|
560
|
-
function setCurrentlyValidatingElement(element) {
|
|
561
|
-
{
|
|
562
|
-
currentlyValidatingElement = element;
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
503
|
|
|
566
|
-
{
|
|
567
|
-
|
|
568
|
-
|
|
504
|
+
Component.prototype.forceUpdate = function (callback) {
|
|
505
|
+
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
506
|
+
};
|
|
507
|
+
/**
|
|
508
|
+
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
509
|
+
* we would like to deprecate them, we're not going to move them over to this
|
|
510
|
+
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
511
|
+
*/
|
|
569
512
|
|
|
570
|
-
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
571
|
-
var stack = ''; // Add an extra top frame while an element is being validated
|
|
572
513
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
514
|
+
{
|
|
515
|
+
var deprecatedAPIs = {
|
|
516
|
+
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
517
|
+
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
518
|
+
};
|
|
578
519
|
|
|
520
|
+
var defineDeprecationWarning = function (methodName, info) {
|
|
521
|
+
Object.defineProperty(Component.prototype, methodName, {
|
|
522
|
+
get: function () {
|
|
523
|
+
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
579
524
|
|
|
580
|
-
|
|
525
|
+
return undefined;
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
};
|
|
581
529
|
|
|
582
|
-
|
|
583
|
-
|
|
530
|
+
for (var fnName in deprecatedAPIs) {
|
|
531
|
+
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
532
|
+
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
584
533
|
}
|
|
585
|
-
|
|
586
|
-
return stack;
|
|
587
|
-
};
|
|
534
|
+
}
|
|
588
535
|
}
|
|
589
536
|
|
|
537
|
+
function ComponentDummy() {}
|
|
538
|
+
|
|
539
|
+
ComponentDummy.prototype = Component.prototype;
|
|
590
540
|
/**
|
|
591
|
-
*
|
|
541
|
+
* Convenience component with default shallow equality check for sCU.
|
|
592
542
|
*/
|
|
593
|
-
var IsSomeRendererActing = {
|
|
594
|
-
current: false
|
|
595
|
-
};
|
|
596
543
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
ReactCurrentOwner: ReactCurrentOwner,
|
|
601
|
-
IsSomeRendererActing: IsSomeRendererActing,
|
|
602
|
-
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
603
|
-
assign: _assign
|
|
604
|
-
};
|
|
544
|
+
function PureComponent(props, context, updater) {
|
|
545
|
+
this.props = props;
|
|
546
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
605
547
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
// These should not be included in production.
|
|
609
|
-
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
610
|
-
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
611
|
-
// TODO: remove in React 17.0.
|
|
612
|
-
ReactComponentTreeHook: {}
|
|
613
|
-
});
|
|
548
|
+
this.refs = emptyObject;
|
|
549
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
614
550
|
}
|
|
615
551
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
* This can be used to log issues in development environments in critical
|
|
619
|
-
* paths. Removing the logging code for production environments will keep the
|
|
620
|
-
* same logic and follow the same code paths.
|
|
621
|
-
*/
|
|
552
|
+
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
553
|
+
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
|
|
622
554
|
|
|
623
|
-
|
|
555
|
+
_assign(pureComponentPrototype, Component.prototype);
|
|
624
556
|
|
|
625
|
-
|
|
626
|
-
warning = function (condition, format) {
|
|
627
|
-
if (condition) {
|
|
628
|
-
return;
|
|
629
|
-
}
|
|
557
|
+
pureComponentPrototype.isPureReactComponent = true;
|
|
630
558
|
|
|
631
|
-
|
|
632
|
-
|
|
559
|
+
// an immutable object with a single mutable value
|
|
560
|
+
function createRef() {
|
|
561
|
+
var refObject = {
|
|
562
|
+
current: null
|
|
563
|
+
};
|
|
633
564
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
565
|
+
{
|
|
566
|
+
Object.seal(refObject);
|
|
567
|
+
}
|
|
637
568
|
|
|
638
|
-
|
|
639
|
-
};
|
|
569
|
+
return refObject;
|
|
640
570
|
}
|
|
641
571
|
|
|
642
|
-
var warning$1 = warning;
|
|
643
|
-
|
|
644
572
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
645
573
|
var RESERVED_PROPS = {
|
|
646
574
|
key: true,
|
|
@@ -681,9 +609,12 @@ function hasValidKey(config) {
|
|
|
681
609
|
|
|
682
610
|
function defineKeyPropWarningGetter(props, displayName) {
|
|
683
611
|
var warnAboutAccessingKey = function () {
|
|
684
|
-
|
|
685
|
-
specialPropKeyWarningShown
|
|
686
|
-
|
|
612
|
+
{
|
|
613
|
+
if (!specialPropKeyWarningShown) {
|
|
614
|
+
specialPropKeyWarningShown = true;
|
|
615
|
+
|
|
616
|
+
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
617
|
+
}
|
|
687
618
|
}
|
|
688
619
|
};
|
|
689
620
|
|
|
@@ -696,9 +627,12 @@ function defineKeyPropWarningGetter(props, displayName) {
|
|
|
696
627
|
|
|
697
628
|
function defineRefPropWarningGetter(props, displayName) {
|
|
698
629
|
var warnAboutAccessingRef = function () {
|
|
699
|
-
|
|
700
|
-
specialPropRefWarningShown
|
|
701
|
-
|
|
630
|
+
{
|
|
631
|
+
if (!specialPropRefWarningShown) {
|
|
632
|
+
specialPropRefWarningShown = true;
|
|
633
|
+
|
|
634
|
+
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
635
|
+
}
|
|
702
636
|
}
|
|
703
637
|
};
|
|
704
638
|
|
|
@@ -1167,7 +1101,10 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1167
1101
|
{
|
|
1168
1102
|
// Warn about using Maps as children
|
|
1169
1103
|
if (iteratorFn === children.entries) {
|
|
1170
|
-
!didWarnAboutMaps
|
|
1104
|
+
if (!didWarnAboutMaps) {
|
|
1105
|
+
error('Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.');
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1171
1108
|
didWarnAboutMaps = true;
|
|
1172
1109
|
}
|
|
1173
1110
|
}
|
|
@@ -1394,7 +1331,9 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1394
1331
|
calculateChangedBits = null;
|
|
1395
1332
|
} else {
|
|
1396
1333
|
{
|
|
1397
|
-
|
|
1334
|
+
if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
|
|
1335
|
+
error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
|
|
1336
|
+
}
|
|
1398
1337
|
}
|
|
1399
1338
|
}
|
|
1400
1339
|
|
|
@@ -1437,7 +1376,8 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1437
1376
|
get: function () {
|
|
1438
1377
|
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
1439
1378
|
hasWarnedAboutUsingConsumerProvider = true;
|
|
1440
|
-
|
|
1379
|
+
|
|
1380
|
+
error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
|
|
1441
1381
|
}
|
|
1442
1382
|
|
|
1443
1383
|
return context.Provider;
|
|
@@ -1474,7 +1414,8 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1474
1414
|
get: function () {
|
|
1475
1415
|
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
1476
1416
|
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
1477
|
-
|
|
1417
|
+
|
|
1418
|
+
error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
|
1478
1419
|
}
|
|
1479
1420
|
|
|
1480
1421
|
return context.Consumer;
|
|
@@ -1513,7 +1454,8 @@ function lazy(ctor) {
|
|
|
1513
1454
|
return defaultProps;
|
|
1514
1455
|
},
|
|
1515
1456
|
set: function (newDefaultProps) {
|
|
1516
|
-
|
|
1457
|
+
error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
|
1458
|
+
|
|
1517
1459
|
defaultProps = newDefaultProps; // Match production behavior more closely:
|
|
1518
1460
|
|
|
1519
1461
|
Object.defineProperty(lazyType, 'defaultProps', {
|
|
@@ -1527,7 +1469,8 @@ function lazy(ctor) {
|
|
|
1527
1469
|
return propTypes;
|
|
1528
1470
|
},
|
|
1529
1471
|
set: function (newPropTypes) {
|
|
1530
|
-
|
|
1472
|
+
error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
|
1473
|
+
|
|
1531
1474
|
propTypes = newPropTypes; // Match production behavior more closely:
|
|
1532
1475
|
|
|
1533
1476
|
Object.defineProperty(lazyType, 'propTypes', {
|
|
@@ -1544,16 +1487,19 @@ function lazy(ctor) {
|
|
|
1544
1487
|
function forwardRef(render) {
|
|
1545
1488
|
{
|
|
1546
1489
|
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
1547
|
-
|
|
1490
|
+
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
|
1548
1491
|
} else if (typeof render !== 'function') {
|
|
1549
|
-
|
|
1492
|
+
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
1550
1493
|
} else {
|
|
1551
|
-
|
|
1552
|
-
|
|
1494
|
+
if (render.length !== 0 && render.length !== 2) {
|
|
1495
|
+
error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
|
|
1496
|
+
}
|
|
1553
1497
|
}
|
|
1554
1498
|
|
|
1555
1499
|
if (render != null) {
|
|
1556
|
-
|
|
1500
|
+
if (render.defaultProps != null || render.propTypes != null) {
|
|
1501
|
+
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
|
1502
|
+
}
|
|
1557
1503
|
}
|
|
1558
1504
|
}
|
|
1559
1505
|
|
|
@@ -1571,7 +1517,7 @@ function isValidElementType(type) {
|
|
|
1571
1517
|
function memo(type, compare) {
|
|
1572
1518
|
{
|
|
1573
1519
|
if (!isValidElementType(type)) {
|
|
1574
|
-
|
|
1520
|
+
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
|
1575
1521
|
}
|
|
1576
1522
|
}
|
|
1577
1523
|
|
|
@@ -1598,16 +1544,19 @@ function useContext(Context, unstable_observedBits) {
|
|
|
1598
1544
|
var dispatcher = resolveDispatcher();
|
|
1599
1545
|
|
|
1600
1546
|
{
|
|
1601
|
-
|
|
1547
|
+
if (unstable_observedBits !== undefined) {
|
|
1548
|
+
error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '');
|
|
1549
|
+
} // TODO: add a more generic warning for invalid values.
|
|
1550
|
+
|
|
1602
1551
|
|
|
1603
1552
|
if (Context._context !== undefined) {
|
|
1604
1553
|
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
|
1605
1554
|
// and nobody should be using this in existing code.
|
|
1606
1555
|
|
|
1607
1556
|
if (realContext.Consumer === Context) {
|
|
1608
|
-
|
|
1557
|
+
error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
|
|
1609
1558
|
} else if (realContext.Provider === Context) {
|
|
1610
|
-
|
|
1559
|
+
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
|
1611
1560
|
}
|
|
1612
1561
|
}
|
|
1613
1562
|
}
|
|
@@ -1658,7 +1607,8 @@ function useResponder(responder, listenerProps) {
|
|
|
1658
1607
|
|
|
1659
1608
|
{
|
|
1660
1609
|
if (responder == null || responder.$$typeof !== REACT_RESPONDER_TYPE) {
|
|
1661
|
-
|
|
1610
|
+
error('useResponder: invalid first argument. Expected an event responder, but instead got %s', responder);
|
|
1611
|
+
|
|
1662
1612
|
return;
|
|
1663
1613
|
}
|
|
1664
1614
|
}
|
|
@@ -1789,7 +1739,7 @@ function validateExplicitKey(element, parentType) {
|
|
|
1789
1739
|
setCurrentlyValidatingElement(element);
|
|
1790
1740
|
|
|
1791
1741
|
{
|
|
1792
|
-
|
|
1742
|
+
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
1793
1743
|
}
|
|
1794
1744
|
|
|
1795
1745
|
setCurrentlyValidatingElement(null);
|
|
@@ -1851,36 +1801,39 @@ function validateChildKeys(node, parentType) {
|
|
|
1851
1801
|
|
|
1852
1802
|
|
|
1853
1803
|
function validatePropTypes(element) {
|
|
1854
|
-
|
|
1804
|
+
{
|
|
1805
|
+
var type = element.type;
|
|
1855
1806
|
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1807
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
1808
|
+
return;
|
|
1809
|
+
}
|
|
1859
1810
|
|
|
1860
|
-
|
|
1861
|
-
|
|
1811
|
+
var name = getComponentName(type);
|
|
1812
|
+
var propTypes;
|
|
1862
1813
|
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1814
|
+
if (typeof type === 'function') {
|
|
1815
|
+
propTypes = type.propTypes;
|
|
1816
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
1817
|
+
// Inner props are checked in the reconciler.
|
|
1818
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
1819
|
+
propTypes = type.propTypes;
|
|
1820
|
+
} else {
|
|
1821
|
+
return;
|
|
1822
|
+
}
|
|
1872
1823
|
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1824
|
+
if (propTypes) {
|
|
1825
|
+
setCurrentlyValidatingElement(element);
|
|
1826
|
+
checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
1827
|
+
setCurrentlyValidatingElement(null);
|
|
1828
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1829
|
+
propTypesMisspellWarningShown = true;
|
|
1830
|
+
|
|
1831
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
|
1832
|
+
}
|
|
1881
1833
|
|
|
1882
|
-
|
|
1883
|
-
|
|
1834
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
1835
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
1836
|
+
}
|
|
1884
1837
|
}
|
|
1885
1838
|
}
|
|
1886
1839
|
/**
|
|
@@ -1890,23 +1843,26 @@ function validatePropTypes(element) {
|
|
|
1890
1843
|
|
|
1891
1844
|
|
|
1892
1845
|
function validateFragmentProps(fragment) {
|
|
1893
|
-
|
|
1894
|
-
|
|
1846
|
+
{
|
|
1847
|
+
setCurrentlyValidatingElement(fragment);
|
|
1848
|
+
var keys = Object.keys(fragment.props);
|
|
1849
|
+
|
|
1850
|
+
for (var i = 0; i < keys.length; i++) {
|
|
1851
|
+
var key = keys[i];
|
|
1852
|
+
|
|
1853
|
+
if (key !== 'children' && key !== 'key') {
|
|
1854
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1895
1855
|
|
|
1896
|
-
|
|
1897
|
-
|
|
1856
|
+
break;
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1898
1859
|
|
|
1899
|
-
if (
|
|
1900
|
-
|
|
1901
|
-
break;
|
|
1860
|
+
if (fragment.ref !== null) {
|
|
1861
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1902
1862
|
}
|
|
1903
|
-
}
|
|
1904
1863
|
|
|
1905
|
-
|
|
1906
|
-
warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1864
|
+
setCurrentlyValidatingElement(null);
|
|
1907
1865
|
}
|
|
1908
|
-
|
|
1909
|
-
setCurrentlyValidatingElement(null);
|
|
1910
1866
|
}
|
|
1911
1867
|
|
|
1912
1868
|
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
@@ -1941,7 +1897,9 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1941
1897
|
typeString = typeof type;
|
|
1942
1898
|
}
|
|
1943
1899
|
|
|
1944
|
-
|
|
1900
|
+
{
|
|
1901
|
+
error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
1902
|
+
}
|
|
1945
1903
|
}
|
|
1946
1904
|
|
|
1947
1905
|
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
@@ -1970,7 +1928,9 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1970
1928
|
Object.freeze(children);
|
|
1971
1929
|
}
|
|
1972
1930
|
} else {
|
|
1973
|
-
|
|
1931
|
+
{
|
|
1932
|
+
error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
|
1933
|
+
}
|
|
1974
1934
|
}
|
|
1975
1935
|
} else {
|
|
1976
1936
|
validateChildKeys(children, type);
|
|
@@ -1979,7 +1939,9 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1979
1939
|
}
|
|
1980
1940
|
|
|
1981
1941
|
if (hasOwnProperty$1.call(props, 'key')) {
|
|
1982
|
-
|
|
1942
|
+
{
|
|
1943
|
+
error('React.jsx: Spreading a key to JSX is a deprecated pattern. ' + 'Explicitly pass a key after spreading props in your JSX call. ' + 'E.g. <ComponentName {...props} key={key} />');
|
|
1944
|
+
}
|
|
1983
1945
|
}
|
|
1984
1946
|
|
|
1985
1947
|
if (type === REACT_FRAGMENT_TYPE) {
|
|
@@ -2032,7 +1994,9 @@ function createElementWithValidation(type, props, children) {
|
|
|
2032
1994
|
typeString = typeof type;
|
|
2033
1995
|
}
|
|
2034
1996
|
|
|
2035
|
-
|
|
1997
|
+
{
|
|
1998
|
+
error('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);
|
|
1999
|
+
}
|
|
2036
2000
|
}
|
|
2037
2001
|
|
|
2038
2002
|
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
|
|
@@ -2069,7 +2033,8 @@ function createFactoryWithValidation(type) {
|
|
|
2069
2033
|
Object.defineProperty(validatedFactory, 'type', {
|
|
2070
2034
|
enumerable: false,
|
|
2071
2035
|
get: function () {
|
|
2072
|
-
|
|
2036
|
+
warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
2037
|
+
|
|
2073
2038
|
Object.defineProperty(this, 'type', {
|
|
2074
2039
|
value: type
|
|
2075
2040
|
});
|
|
@@ -2230,6 +2195,7 @@ var enableJSXTransformAPI = false; // We will enforce mocking scheduler with sch
|
|
|
2230
2195
|
|
|
2231
2196
|
|
|
2232
2197
|
|
|
2198
|
+
|
|
2233
2199
|
// Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance
|
|
2234
2200
|
|
|
2235
2201
|
var React = {
|