react 0.0.0-f6b8d31a7 → 0.0.0-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 CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "branch": "master",
3
- "buildNumber": "54692",
4
- "checksum": "2b60c86",
5
- "commit": "f6b8d31a7",
3
+ "buildNumber": "68677",
4
+ "checksum": "79816fa",
5
+ "commit": "f42431abe",
6
6
  "environment": "ci",
7
- "reactVersion": "16.11.0-f6b8d31a7"
7
+ "reactVersion": "16.12.0-f42431abe"
8
8
  }
@@ -1,4 +1,4 @@
1
- /** @license React v0.0.0-f6b8d31a7
1
+ /** @license React v0.0.0-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.11.0-f6b8d31a7';
23
+ var ReactVersion = '16.12.0-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,113 +60,260 @@ 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.
63
+ /**
64
+ * Keeps track of the current dispatcher.
65
+ */
66
+ var ReactCurrentDispatcher = {
67
+ /**
68
+ * @internal
69
+ * @type {ReactComponent}
70
+ */
71
+ current: null
72
+ };
66
73
 
67
74
  /**
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.
75
+ * Keeps track of the current batch's configuration such as how long an update
76
+ * should suspend for if it needs to.
76
77
  */
78
+ var ReactCurrentBatchConfig = {
79
+ suspense: null
80
+ };
77
81
 
78
82
  /**
79
- * Forked from fbjs/warning:
80
- * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
83
+ * Keeps track of the current owner.
81
84
  *
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.
85
+ * The current owner is the component who should own any components that are
86
+ * currently being constructed.
90
87
  */
91
- var lowPriorityWarningWithoutStack = function () {};
88
+ var ReactCurrentOwner = {
89
+ /**
90
+ * @internal
91
+ * @type {ReactComponent}
92
+ */
93
+ current: null
94
+ };
92
95
 
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];
96
+ var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
97
+ var describeComponentFrame = function (name, source, ownerName) {
98
+ var sourceInfo = '';
99
+
100
+ if (source) {
101
+ var path = source.fileName;
102
+ var fileName = path.replace(BEFORE_SLASH_RE, '');
103
+
104
+ {
105
+ // In DEV, include code for a common special case:
106
+ // prefer "folder/index.js" instead of just "index.js".
107
+ if (/^index\./.test(fileName)) {
108
+ var match = path.match(BEFORE_SLASH_RE);
109
+
110
+ if (match) {
111
+ var pathBeforeSlash = match[1];
112
+
113
+ if (pathBeforeSlash) {
114
+ var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
115
+ fileName = folderName + '/' + fileName;
116
+ }
117
+ }
118
+ }
97
119
  }
98
120
 
99
- var argIndex = 0;
100
- var message = 'Warning: ' + format.replace(/%s/g, function () {
101
- return args[argIndex++];
102
- });
121
+ sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
122
+ } else if (ownerName) {
123
+ sourceInfo = ' (created by ' + ownerName + ')';
124
+ }
125
+
126
+ return '\n in ' + (name || 'Unknown') + sourceInfo;
127
+ };
128
+
129
+ var Resolved = 1;
130
+
131
+ function refineResolvedLazyComponent(lazyComponent) {
132
+ return lazyComponent._status === Resolved ? lazyComponent._result : null;
133
+ }
134
+
135
+ function getWrappedName(outerType, innerType, wrapperName) {
136
+ var functionName = innerType.displayName || innerType.name || '';
137
+ return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
138
+ }
139
+
140
+ function getComponentName(type) {
141
+ if (type == null) {
142
+ // Host root, text node or just invalid type.
143
+ return null;
144
+ }
103
145
 
104
- if (typeof console !== 'undefined') {
105
- console.warn(message);
146
+ {
147
+ if (typeof type.tag === 'number') {
148
+ error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
106
149
  }
150
+ }
107
151
 
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
- };
152
+ if (typeof type === 'function') {
153
+ return type.displayName || type.name || null;
154
+ }
155
+
156
+ if (typeof type === 'string') {
157
+ return type;
158
+ }
115
159
 
116
- lowPriorityWarningWithoutStack = function (condition, format) {
117
- if (format === undefined) {
118
- throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
160
+ switch (type) {
161
+ case REACT_FRAGMENT_TYPE:
162
+ return 'Fragment';
163
+
164
+ case REACT_PORTAL_TYPE:
165
+ return 'Portal';
166
+
167
+ case REACT_PROFILER_TYPE:
168
+ return "Profiler";
169
+
170
+ case REACT_STRICT_MODE_TYPE:
171
+ return 'StrictMode';
172
+
173
+ case REACT_SUSPENSE_TYPE:
174
+ return 'Suspense';
175
+
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
+ }
119
205
  }
206
+ }
120
207
 
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
- }
208
+ return null;
209
+ }
125
210
 
126
- printWarning.apply(void 0, [format].concat(args));
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() || '';
127
237
  }
238
+
239
+ return stack;
128
240
  };
129
241
  }
130
242
 
131
- var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
132
-
133
243
  /**
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.
244
+ * Used by act() to track whether you're inside an act() scope.
138
245
  */
139
- var warningWithoutStack = function () {};
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
+ };
140
258
 
141
259
  {
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
- }
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
+ }
146
268
 
147
- if (format === undefined) {
148
- throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
149
- }
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.
150
273
 
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.');
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];
154
278
  }
155
279
 
156
- if (condition) {
157
- return;
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];
158
287
  }
159
288
 
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
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();
166
300
 
167
- Function.prototype.apply.call(console.error, console, argsWithFormat);
301
+ if (stack !== '') {
302
+ format += '%s';
303
+ args = args.concat([stack]);
304
+ }
168
305
  }
169
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
+
170
317
  try {
171
318
  // --- Welcome to debugging React ---
172
319
  // This error was thrown as a convenience so that you can use this stack
@@ -177,10 +324,23 @@ var warningWithoutStack = function () {};
177
324
  });
178
325
  throw new Error(message);
179
326
  } catch (x) {}
180
- };
327
+ }
181
328
  }
182
329
 
183
- var warningWithoutStack$1 = warningWithoutStack;
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
+ */
184
344
 
185
345
  var didWarnStateUpdateForUnmountedComponent = {};
186
346
 
@@ -194,7 +354,8 @@ function warnNoop(publicInstance, callerName) {
194
354
  return;
195
355
  }
196
356
 
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);
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
+
198
359
  didWarnStateUpdateForUnmountedComponent[warningKey] = true;
199
360
  }
200
361
  }
@@ -251,396 +412,163 @@ var ReactNoopUpdateQueue = {
251
412
  warnNoop(publicInstance, 'replaceState');
252
413
  },
253
414
 
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
- /**
411
- * Keeps track of the current dispatcher.
412
- */
413
- var ReactCurrentDispatcher = {
414
- /**
415
- * @internal
416
- * @type {ReactComponent}
417
- */
418
- current: null
419
- };
420
-
421
- /**
422
- * Keeps track of the current batch's configuration such as how long an update
423
- * should suspend for if it needs to.
424
- */
425
- var ReactCurrentBatchConfig = {
426
- suspense: null
427
- };
428
-
429
- /**
430
- * Keeps track of the current owner.
431
- *
432
- * The current owner is the component who should own any components that are
433
- * currently being constructed.
434
- */
435
- var ReactCurrentOwner = {
436
- /**
437
- * @internal
438
- * @type {ReactComponent}
439
- */
440
- current: null
441
- };
442
-
443
- var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
444
- var describeComponentFrame = function (name, source, ownerName) {
445
- var sourceInfo = '';
446
-
447
- if (source) {
448
- var path = source.fileName;
449
- var fileName = path.replace(BEFORE_SLASH_RE, '');
450
-
451
- {
452
- // In DEV, include code for a common special case:
453
- // prefer "folder/index.js" instead of just "index.js".
454
- if (/^index\./.test(fileName)) {
455
- var match = path.match(BEFORE_SLASH_RE);
456
-
457
- if (match) {
458
- var pathBeforeSlash = match[1];
459
-
460
- if (pathBeforeSlash) {
461
- var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
462
- fileName = folderName + '/' + fileName;
463
- }
464
- }
465
- }
466
- }
467
-
468
- sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
469
- } else if (ownerName) {
470
- sourceInfo = ' (created by ' + ownerName + ')';
471
- }
472
-
473
- return '\n in ' + (name || 'Unknown') + sourceInfo;
474
- };
475
-
476
- var Resolved = 1;
477
-
478
- function refineResolvedLazyComponent(lazyComponent) {
479
- return lazyComponent._status === Resolved ? lazyComponent._result : null;
480
- }
481
-
482
- function getWrappedName(outerType, innerType, wrapperName) {
483
- var functionName = innerType.displayName || innerType.name || '';
484
- return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
485
- }
486
-
487
- function getComponentName(type) {
488
- if (type == null) {
489
- // Host root, text node or just invalid type.
490
- return null;
491
- }
492
-
493
- {
494
- if (typeof type.tag === 'number') {
495
- warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
496
- }
497
- }
498
-
499
- if (typeof type === 'function') {
500
- return type.displayName || type.name || null;
501
- }
502
-
503
- if (typeof type === 'string') {
504
- return type;
505
- }
506
-
507
- switch (type) {
508
- case REACT_FRAGMENT_TYPE:
509
- return 'Fragment';
510
-
511
- case REACT_PORTAL_TYPE:
512
- return 'Portal';
513
-
514
- case REACT_PROFILER_TYPE:
515
- return "Profiler";
516
-
517
- case REACT_STRICT_MODE_TYPE:
518
- return 'StrictMode';
519
-
520
- case REACT_SUSPENSE_TYPE:
521
- return 'Suspense';
522
-
523
- case REACT_SUSPENSE_LIST_TYPE:
524
- return 'SuspenseList';
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
- if (typeof type === 'object') {
528
- switch (type.$$typeof) {
529
- case REACT_CONTEXT_TYPE:
530
- return 'Context.Consumer';
432
+ var emptyObject = {};
531
433
 
532
- case REACT_PROVIDER_TYPE:
533
- return 'Context.Provider';
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
- case REACT_MEMO_TYPE:
539
- return getComponentName(type.type);
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
- case REACT_LAZY_TYPE:
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
- if (resolvedThenable) {
547
- return getComponentName(resolvedThenable);
548
- }
449
+ this.updater = updater || ReactNoopUpdateQueue;
450
+ }
549
451
 
550
- break;
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
- return null;
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
- // Stack implementation injected by the current renderer.
568
- ReactDebugCurrentFrame.getCurrentStack = null;
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
- if (currentlyValidatingElement) {
574
- var name = getComponentName(currentlyValidatingElement.type);
575
- var owner = currentlyValidatingElement._owner;
576
- stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
577
- } // Delegate to the injected renderer-specific implementation
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
- var impl = ReactDebugCurrentFrame.getCurrentStack;
525
+ return undefined;
526
+ }
527
+ });
528
+ };
581
529
 
582
- if (impl) {
583
- stack += impl() || '';
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
- * Used by act() to track whether you're inside an act() scope.
541
+ * Convenience component with default shallow equality check for sCU.
592
542
  */
593
- var IsSomeRendererActing = {
594
- current: false
595
- };
596
543
 
597
- var ReactSharedInternals = {
598
- ReactCurrentDispatcher: ReactCurrentDispatcher,
599
- ReactCurrentBatchConfig: ReactCurrentBatchConfig,
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
- _assign(ReactSharedInternals, {
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
- * Similar to invariant but only logs a warning if the condition is not met.
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
- var warning = warningWithoutStack$1;
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
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
632
- var stack = ReactDebugCurrentFrame.getStackAddendum(); // eslint-disable-next-line react-internal/warning-and-invariant-args
559
+ // an immutable object with a single mutable value
560
+ function createRef() {
561
+ var refObject = {
562
+ current: null
563
+ };
633
564
 
634
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
635
- args[_key - 2] = arguments[_key];
636
- }
565
+ {
566
+ Object.seal(refObject);
567
+ }
637
568
 
638
- warningWithoutStack$1.apply(void 0, [false, format + '%s'].concat(args, [stack]));
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
- if (!specialPropKeyWarningShown) {
685
- specialPropKeyWarningShown = true;
686
- warningWithoutStack$1(false, '%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);
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
- if (!specialPropRefWarningShown) {
700
- specialPropRefWarningShown = true;
701
- warningWithoutStack$1(false, '%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);
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 ? warning$1(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.') : void 0;
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
- !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
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
- warning$1(false, 'Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
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
- warning$1(false, 'Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
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
- warning$1(false, '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.');
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
- warning$1(false, '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.');
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
- warningWithoutStack$1(false, 'forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
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
- warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1492
+ error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1550
1493
  } else {
1551
- !( // Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
1552
- render.length === 0 || render.length === 2) ? warningWithoutStack$1(false, '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.') : void 0;
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
- !(render.defaultProps == null && render.propTypes == null) ? warningWithoutStack$1(false, 'forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?') : void 0;
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
- warningWithoutStack$1(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
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
- !(unstable_observedBits === undefined) ? warning$1(false, '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' : '') : void 0; // TODO: add a more generic warning for invalid values.
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
- warning$1(false, '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?');
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
- warning$1(false, 'Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
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
- warning$1(false, 'useResponder: invalid first argument. Expected an event responder, but instead got %s', responder);
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
- warning$1(false, '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);
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
- var type = element.type;
1804
+ {
1805
+ var type = element.type;
1855
1806
 
1856
- if (type === null || type === undefined || typeof type === 'string') {
1857
- return;
1858
- }
1807
+ if (type === null || type === undefined || typeof type === 'string') {
1808
+ return;
1809
+ }
1859
1810
 
1860
- var name = getComponentName(type);
1861
- var propTypes;
1811
+ var name = getComponentName(type);
1812
+ var propTypes;
1862
1813
 
1863
- if (typeof type === 'function') {
1864
- propTypes = type.propTypes;
1865
- } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1866
- // Inner props are checked in the reconciler.
1867
- type.$$typeof === REACT_MEMO_TYPE)) {
1868
- propTypes = type.propTypes;
1869
- } else {
1870
- return;
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
- if (propTypes) {
1874
- setCurrentlyValidatingElement(element);
1875
- checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
1876
- setCurrentlyValidatingElement(null);
1877
- } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1878
- propTypesMisspellWarningShown = true;
1879
- warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
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;
1881
1830
 
1882
- if (typeof type.getDefaultProps === 'function') {
1883
- !type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
1831
+ error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
1832
+ }
1833
+
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
- setCurrentlyValidatingElement(fragment);
1894
- var keys = Object.keys(fragment.props);
1846
+ {
1847
+ setCurrentlyValidatingElement(fragment);
1848
+ var keys = Object.keys(fragment.props);
1895
1849
 
1896
- for (var i = 0; i < keys.length; i++) {
1897
- var key = keys[i];
1850
+ for (var i = 0; i < keys.length; i++) {
1851
+ var key = keys[i];
1898
1852
 
1899
- if (key !== 'children' && key !== 'key') {
1900
- warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1901
- break;
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);
1855
+
1856
+ break;
1857
+ }
1902
1858
  }
1903
- }
1904
1859
 
1905
- if (fragment.ref !== null) {
1906
- warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
1907
- }
1860
+ if (fragment.ref !== null) {
1861
+ error('Invalid attribute `ref` supplied to `React.Fragment`.');
1862
+ }
1908
1863
 
1909
- setCurrentlyValidatingElement(null);
1864
+ setCurrentlyValidatingElement(null);
1865
+ }
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
- warning$1(false, '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);
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
- warning$1(false, 'React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
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
- warning$1(false, '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} />');
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
- warning$1(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
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
- lowPriorityWarningWithoutStack$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
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
  });
@@ -2174,12 +2139,8 @@ function createScope() {
2174
2139
  return scopeComponent;
2175
2140
  }
2176
2141
 
2177
- // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
2178
-
2179
- // In some cases, StrictMode should also double-render lifecycles.
2180
- // This can be confusing for tests though,
2181
- // And it can be bad for performance in production.
2182
- // This feature flag can be used to control the behavior:
2142
+ // Helps identify side effects in render-phase lifecycle hooks and setState
2143
+ // reducers by double invoking them in Strict Mode.
2183
2144
 
2184
2145
  // To preserve the "Pause on caught exceptions" behavior of the debugger, we
2185
2146
  // replay the begin phase of a failed component inside invokeGuardedCallback.
@@ -2230,6 +2191,13 @@ var enableJSXTransformAPI = false; // We will enforce mocking scheduler with sch
2230
2191
  // from React.createElement to React.jsx
2231
2192
  // https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
2232
2193
 
2194
+
2195
+
2196
+
2197
+
2198
+
2199
+ // Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance
2200
+
2233
2201
  var React = {
2234
2202
  Children: {
2235
2203
  map: mapChildren,