react 15.7.0 → 16.0.0-alpha

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.
Files changed (70) hide show
  1. package/LICENSE +26 -16
  2. package/PATENTS +33 -0
  3. package/README.md +7 -0
  4. package/dist/react-with-addons.js +3831 -4404
  5. package/dist/react-with-addons.min.js +7 -6
  6. package/dist/react.js +2929 -3319
  7. package/dist/react.min.js +7 -5
  8. package/lib/KeyEscapeUtils.js +5 -3
  9. package/lib/PooledClass.js +5 -3
  10. package/lib/React.js +20 -61
  11. package/lib/ReactAddonsDOMDependencies.js +5 -3
  12. package/lib/ReactAddonsDOMDependenciesUMDShim.js +5 -3
  13. package/lib/ReactCSSTransitionGroup.js +9 -9
  14. package/lib/ReactCSSTransitionGroupChild.js +118 -134
  15. package/lib/ReactChildren.js +9 -7
  16. package/lib/ReactClass.js +703 -0
  17. package/lib/{ReactBaseClasses.js → ReactComponent.js} +11 -40
  18. package/lib/ReactComponentTreeHook.js +63 -58
  19. package/lib/ReactComponentTreeHookUMDShim.js +5 -3
  20. package/lib/ReactComponentWithPureRenderMixin.js +5 -3
  21. package/lib/ReactCurrentOwner.js +7 -3
  22. package/lib/ReactCurrentOwnerUMDShim.js +5 -3
  23. package/lib/ReactDOMFactories.js +6 -3
  24. package/lib/ReactElement.js +9 -7
  25. package/lib/ReactElementSymbol.js +5 -3
  26. package/lib/ReactElementType.js +5 -3
  27. package/lib/ReactElementValidator.js +13 -12
  28. package/lib/ReactFragment.js +5 -3
  29. package/lib/ReactNoopUpdateQueue.js +15 -16
  30. package/lib/ReactPropTypeLocationNames.js +5 -3
  31. package/lib/ReactPropTypeLocations.js +5 -3
  32. package/lib/ReactPropTypes.js +447 -7
  33. package/lib/ReactPureComponent.js +41 -0
  34. package/lib/ReactStateSetters.js +5 -3
  35. package/lib/ReactTransitionChildMapping.js +5 -3
  36. package/lib/ReactTransitionEvents.js +5 -3
  37. package/lib/ReactTransitionGroup.js +8 -12
  38. package/lib/ReactTypeOfWork.js +26 -0
  39. package/lib/ReactUMDEntry.js +8 -7
  40. package/lib/ReactUMDShim.js +5 -3
  41. package/lib/ReactVersion.js +6 -4
  42. package/lib/ReactWithAddons.js +5 -5
  43. package/lib/ReactWithAddonsUMDEntry.js +8 -7
  44. package/lib/canDefineProperty.js +5 -3
  45. package/lib/checkReactTypeSpec.js +22 -9
  46. package/lib/deprecated.js +8 -6
  47. package/lib/flattenChildren.js +5 -3
  48. package/lib/getComponentName.js +37 -0
  49. package/lib/getIteratorFn.js +5 -3
  50. package/lib/getNextDebugID.js +5 -3
  51. package/lib/onlyChild.js +6 -4
  52. package/lib/reactProdInvariant.js +4 -2
  53. package/lib/shallowCompare.js +5 -3
  54. package/lib/sliceChildren.js +5 -3
  55. package/lib/traverseAllChildren.js +6 -4
  56. package/lib/update.js +5 -3
  57. package/package.json +24 -35
  58. package/cjs/react-jsx-dev-runtime.development.js +0 -866
  59. package/cjs/react-jsx-dev-runtime.production.min.js +0 -9
  60. package/cjs/react-jsx-runtime.development.js +0 -888
  61. package/cjs/react-jsx-runtime.production.min.js +0 -10
  62. package/jsx-dev-runtime.js +0 -7
  63. package/jsx-runtime.js +0 -7
  64. package/lib/LinkedStateMixin.js +0 -32
  65. package/lib/ReactComponentTreeDevtool.js +0 -12
  66. package/lib/ReactLink.js +0 -47
  67. package/lib/ReactPropTypesSecret.js +0 -14
  68. package/lib/createClass.js +0 -20
  69. package/lib/getNextDebugIDUMDShim.js +0 -15
  70. package/lib/lowPriorityWarning.js +0 -62
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ var _assign = require('object-assign');
14
+
15
+ var ReactComponent = require('./ReactComponent');
16
+ var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
17
+
18
+ var emptyObject = require('fbjs/lib/emptyObject');
19
+
20
+ /**
21
+ * Base class helpers for the updating state of a component.
22
+ */
23
+ function ReactPureComponent(props, context, updater) {
24
+ // Duplicated from ReactComponent.
25
+ this.props = props;
26
+ this.context = context;
27
+ this.refs = emptyObject;
28
+ // We initialize the default updater but the real one gets injected by the
29
+ // renderer.
30
+ this.updater = updater || ReactNoopUpdateQueue;
31
+ }
32
+
33
+ function ComponentDummy() {}
34
+ ComponentDummy.prototype = ReactComponent.prototype;
35
+ ReactPureComponent.prototype = new ComponentDummy();
36
+ ReactPureComponent.prototype.constructor = ReactPureComponent;
37
+ // Avoid an extra prototype jump for these methods.
38
+ _assign(ReactPureComponent.prototype, ReactComponent.prototype);
39
+ ReactPureComponent.prototype.isPureReactComponent = true;
40
+
41
+ module.exports = ReactPureComponent;
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
6
8
  *
7
9
  */
8
10
 
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
6
8
  *
7
9
  */
8
10
 
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
6
8
  *
7
9
  */
8
10
 
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
6
8
  *
7
9
  */
8
10
 
@@ -19,9 +21,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
19
21
  var React = require('./React');
20
22
  var ReactTransitionChildMapping = require('./ReactTransitionChildMapping');
21
23
 
22
- var propTypesFactory = require('prop-types/factory');
23
- var PropTypes = propTypesFactory(React.isValidElement);
24
-
25
24
  var emptyFunction = require('fbjs/lib/emptyFunction');
26
25
 
27
26
  /**
@@ -193,10 +192,7 @@ var ReactTransitionGroup = function (_React$Component) {
193
192
  // already been removed. In case you need this behavior you can provide
194
193
  // a childFactory function to wrap every child, even the ones that are
195
194
  // leaving.
196
- childrenToRender.push(React.cloneElement(this.props.childFactory(child), {
197
- ref: key,
198
- key: key
199
- }));
195
+ childrenToRender.push(React.cloneElement(this.props.childFactory(child), { ref: key, key: key }));
200
196
  }
201
197
  }
202
198
 
@@ -220,8 +216,8 @@ var ReactTransitionGroup = function (_React$Component) {
220
216
 
221
217
  ReactTransitionGroup.displayName = 'ReactTransitionGroup';
222
218
  ReactTransitionGroup.propTypes = {
223
- component: PropTypes.any,
224
- childFactory: PropTypes.func
219
+ component: React.PropTypes.any,
220
+ childFactory: React.PropTypes.func
225
221
  };
226
222
  ReactTransitionGroup.defaultProps = {
227
223
  component: 'span',
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ *
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ module.exports = {
15
+ IndeterminateComponent: 0, // Before we know whether it is functional or class
16
+ FunctionalComponent: 1,
17
+ ClassComponent: 2,
18
+ HostRoot: 3, // Root of a host tree. Could be nested inside another node.
19
+ HostPortal: 4, // A subtree. Could be an entry point to a different renderer.
20
+ HostComponent: 5,
21
+ HostText: 6,
22
+ CoroutineComponent: 7,
23
+ CoroutineHandlerPhase: 8,
24
+ YieldComponent: 9,
25
+ Fragment: 10
26
+ };
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
6
8
  *
7
9
  */
8
10
 
@@ -13,17 +15,16 @@ var _assign = require('object-assign');
13
15
  var React = require('./React');
14
16
 
15
17
  // `version` will be added here by the React module.
16
- var ReactUMDEntry = _assign(React, {
18
+ var ReactUMDEntry = _assign({
17
19
  __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
18
20
  ReactCurrentOwner: require('./ReactCurrentOwner')
19
21
  }
20
- });
22
+ }, React);
21
23
 
22
24
  if (process.env.NODE_ENV !== 'production') {
23
25
  _assign(ReactUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
24
26
  // ReactComponentTreeHook should not be included in production.
25
- ReactComponentTreeHook: require('./ReactComponentTreeHook'),
26
- getNextDebugID: require('./getNextDebugID')
27
+ ReactComponentTreeHook: require('./ReactComponentTreeHook')
27
28
  });
28
29
  }
29
30
 
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
6
8
  *
7
9
  */
8
10
 
@@ -1,11 +1,13 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
6
8
  *
7
9
  */
8
10
 
9
11
  'use strict';
10
12
 
11
- module.exports = '15.7.0';
13
+ module.exports = '16.0.0-alpha';
@@ -1,14 +1,15 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
6
8
  *
7
9
  */
8
10
 
9
11
  'use strict';
10
12
 
11
- var LinkedStateMixin = require('./LinkedStateMixin');
12
13
  var React = require('./React');
13
14
  var ReactAddonsDOMDependencies = require('./ReactAddonsDOMDependencies');
14
15
  var ReactComponentWithPureRenderMixin = require('./ReactComponentWithPureRenderMixin');
@@ -21,7 +22,6 @@ var update = require('./update');
21
22
 
22
23
  React.addons = {
23
24
  CSSTransitionGroup: ReactCSSTransitionGroup,
24
- LinkedStateMixin: LinkedStateMixin,
25
25
  PureRenderMixin: ReactComponentWithPureRenderMixin,
26
26
  TransitionGroup: ReactTransitionGroup,
27
27
 
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
6
8
  *
7
9
  */
8
10
 
@@ -13,18 +15,17 @@ var _assign = require('object-assign');
13
15
  var ReactWithAddons = require('./ReactWithAddons');
14
16
 
15
17
  // `version` will be added here by the React module.
16
- var ReactWithAddonsUMDEntry = _assign(ReactWithAddons, {
18
+ var ReactWithAddonsUMDEntry = _assign({
17
19
  __SECRET_INJECTED_REACT_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: null, // Will be injected by ReactDOM UMD build.
18
20
  __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
19
21
  ReactCurrentOwner: require('./ReactCurrentOwner')
20
22
  }
21
- });
23
+ }, ReactWithAddons);
22
24
 
23
25
  if (process.env.NODE_ENV !== 'production') {
24
26
  _assign(ReactWithAddonsUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
25
27
  // ReactComponentTreeHook should not be included in production.
26
- ReactComponentTreeHook: require('./ReactComponentTreeHook'),
27
- getNextDebugID: require('./getNextDebugID')
28
+ ReactComponentTreeHook: require('./ReactComponentTreeHook')
28
29
  });
29
30
  }
30
31
 
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
6
8
  *
7
9
  *
8
10
  */
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
6
8
  *
7
9
  */
8
10
 
@@ -11,7 +13,6 @@
11
13
  var _prodInvariant = require('./reactProdInvariant');
12
14
 
13
15
  var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
14
- var ReactPropTypesSecret = require('./ReactPropTypesSecret');
15
16
 
16
17
  var invariant = require('fbjs/lib/invariant');
17
18
  var warning = require('fbjs/lib/warning');
@@ -38,10 +39,12 @@ var loggedTypeFailures = {};
38
39
  * @param {string} location e.g. "prop", "context", "child context"
39
40
  * @param {string} componentName Name of the component for error messages.
40
41
  * @param {?object} element The React element that is being type-checked
41
- * @param {?number} debugID The React component instance that is being type-checked
42
+ * @param {?number} workInProgressOrDebugID The React component instance that is being type-checked
42
43
  * @private
43
44
  */
44
- function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) {
45
+ function checkReactTypeSpec(typeSpecs, values, location, componentName, element,
46
+ // It is only safe to pass fiber if it is the work-in-progress version, and
47
+ workInProgressOrDebugID) {
45
48
  for (var typeSpecName in typeSpecs) {
46
49
  if (typeSpecs.hasOwnProperty(typeSpecName)) {
47
50
  var error;
@@ -52,7 +55,7 @@ function checkReactTypeSpec(typeSpecs, values, location, componentName, element,
52
55
  // This is intentionally an invariant that gets caught. It's the same
53
56
  // behavior as without this statement except with a better message.
54
57
  !(typeof typeSpecs[typeSpecName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : _prodInvariant('84', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : void 0;
55
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
58
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location);
56
59
  } catch (ex) {
57
60
  error = ex;
58
61
  }
@@ -68,8 +71,18 @@ function checkReactTypeSpec(typeSpecs, values, location, componentName, element,
68
71
  if (!ReactComponentTreeHook) {
69
72
  ReactComponentTreeHook = require('./ReactComponentTreeHook');
70
73
  }
71
- if (debugID !== null) {
72
- componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID);
74
+ if (workInProgressOrDebugID != null) {
75
+ if (typeof workInProgressOrDebugID === 'number') {
76
+ // DebugID from Stack.
77
+ var debugID = workInProgressOrDebugID;
78
+ componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID);
79
+ } else if (typeof workInProgressOrDebugID.tag === 'number') {
80
+ // This is a Fiber.
81
+ // The stack will only be correct if this is a work in progress
82
+ // version and we're calling it during reconciliation.
83
+ var workInProgress = workInProgressOrDebugID;
84
+ componentStackInfo = ReactComponentTreeHook.getStackAddendumByWorkInProgressFiber(workInProgress);
85
+ }
73
86
  } else if (element !== null) {
74
87
  componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element);
75
88
  }
package/lib/deprecated.js CHANGED
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
6
8
  *
7
9
  *
8
10
  */
@@ -11,7 +13,7 @@
11
13
 
12
14
  var _assign = require('object-assign');
13
15
 
14
- var lowPriorityWarning = require('./lowPriorityWarning');
16
+ var warning = require('fbjs/lib/warning');
15
17
 
16
18
  /**
17
19
  * This will log a single deprecation notice per function and forward the call
@@ -28,12 +30,12 @@ function deprecated(fnName, newModule, newPackage, ctx, fn) {
28
30
  var warned = false;
29
31
  if (process.env.NODE_ENV !== 'production') {
30
32
  var newFn = function () {
31
- lowPriorityWarning(warned,
33
+ process.env.NODE_ENV !== 'production' ? warning(warned,
32
34
  /* eslint-disable no-useless-concat */
33
35
  // Require examples in this string must be split to prevent React's
34
36
  // build tools from mistaking them for real requires.
35
37
  // Otherwise the build tools will attempt to build a '%s' module.
36
- 'React.%s is deprecated. Please use %s.%s from require' + "('%s') " + 'instead.', fnName, newModule, fnName, newPackage);
38
+ 'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : void 0;
37
39
  /* eslint-enable no-useless-concat */
38
40
  warned = true;
39
41
  return fn.apply(ctx, arguments);
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
6
8
  *
7
9
  *
8
10
  */
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ *
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ function getComponentName(instanceOrFiber) {
15
+ if (process.env.NODE_ENV !== 'production') {
16
+ if (typeof instanceOrFiber.getName === 'function') {
17
+ // Stack reconciler
18
+ var instance = instanceOrFiber;
19
+ return instance.getName() || 'Component';
20
+ }
21
+ if (typeof instanceOrFiber.tag === 'number') {
22
+ // Fiber reconciler
23
+ var fiber = instanceOrFiber;
24
+ var type = fiber.type;
25
+
26
+ if (typeof type === 'string') {
27
+ return type;
28
+ }
29
+ if (typeof type === 'function') {
30
+ return type.displayName || type.name || null;
31
+ }
32
+ }
33
+ }
34
+ return null;
35
+ }
36
+
37
+ module.exports = getComponentName;