react 15.3.0-rc.2 → 15.3.1-rc.2

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 (54) hide show
  1. package/dist/react-with-addons.js +1362 -1408
  2. package/dist/react-with-addons.min.js +6 -6
  3. package/dist/react.js +1291 -1339
  4. package/dist/react.min.js +6 -6
  5. package/lib/DOMPropertyOperations.js +0 -7
  6. package/lib/EventPluginHub.js +2 -0
  7. package/lib/ReactChildReconciler.js +21 -5
  8. package/lib/{ReactChildrenMutationWarningDevtool.js → ReactChildrenMutationWarningHook.js} +11 -19
  9. package/lib/ReactComponentBrowserEnvironment.js +1 -10
  10. package/lib/ReactComponentEnvironment.js +0 -8
  11. package/lib/ReactComponentTreeDevtool.js +2 -205
  12. package/lib/ReactComponentTreeHook.js +342 -0
  13. package/lib/ReactComponentTreeTestUtils.js +11 -11
  14. package/lib/ReactCompositeComponent.js +10 -34
  15. package/lib/ReactDOM.js +9 -0
  16. package/lib/ReactDOMComponent.js +23 -43
  17. package/lib/ReactDOMComponentTree.js +1 -1
  18. package/lib/ReactDOMEmptyComponent.js +1 -1
  19. package/lib/ReactDOMFactories.js +138 -144
  20. package/lib/ReactDOMInput.js +25 -3
  21. package/lib/{ReactDOMNullInputValuePropDevtool.js → ReactDOMNullInputValuePropHook.js} +5 -5
  22. package/lib/ReactDOMSelect.js +5 -4
  23. package/lib/ReactDOMTextComponent.js +1 -8
  24. package/lib/{ReactDOMUnknownPropertyDevtool.js → ReactDOMUnknownPropertyHook.js} +8 -8
  25. package/lib/ReactDebugTool.js +73 -79
  26. package/lib/ReactElement.js +37 -33
  27. package/lib/ReactElementValidator.js +5 -3
  28. package/lib/{ReactHostOperationHistoryDevtool.js → ReactHostOperationHistoryHook.js} +4 -4
  29. package/lib/{ReactInvalidSetStateWarningDevTool.js → ReactInvalidSetStateWarningHook.js} +3 -3
  30. package/lib/ReactMount.js +3 -7
  31. package/lib/ReactMultiChild.js +11 -13
  32. package/lib/ReactNativeBaseComponent.js +5 -3
  33. package/lib/ReactNativeComponentEnvironment.js +0 -7
  34. package/lib/ReactNativeMount.js +2 -5
  35. package/lib/ReactNativeTextComponent.js +2 -10
  36. package/lib/ReactPropTypes.js +4 -2
  37. package/lib/ReactReconciler.js +5 -11
  38. package/lib/ReactServerRendering.js +2 -1
  39. package/lib/ReactSimpleEmptyComponent.js +3 -2
  40. package/lib/ReactTestMount.js +0 -5
  41. package/lib/ReactTestUtils.js +8 -6
  42. package/lib/ReactUpdateQueue.js +2 -1
  43. package/lib/ReactVersion.js +1 -1
  44. package/lib/ResponderEventPlugin.js +6 -5
  45. package/lib/SimpleEventPlugin.js +2 -0
  46. package/lib/SyntheticEvent.js +8 -1
  47. package/lib/checkReactTypeSpec.js +16 -3
  48. package/lib/createReactNativeComponentClass.js +1 -1
  49. package/lib/flattenChildren.js +17 -2
  50. package/lib/instantiateReactComponent.js +1 -28
  51. package/package.json +1 -1
  52. package/lib/ReactDOMDebugTool.js +0 -67
  53. package/lib/ReactDOMInstrumentation.js +0 -21
  54. package/lib/createHierarchyRenderer.js +0 -85
@@ -69,7 +69,11 @@ var ReactDOMInput = {
69
69
  type: undefined,
70
70
  // Make sure we set .step before .value (setting .value before .step
71
71
  // means .value is rounded on mount, based upon step precision)
72
- step: undefined
72
+ step: undefined,
73
+ // Make sure we set .min & .max before .value (to ensure proper order
74
+ // in corner cases such as min or max deriving from value, e.g. Issue #7170)
75
+ min: undefined,
76
+ max: undefined
73
77
  }, DisabledInputUtils.getHostProps(inst, props), {
74
78
  defaultChecked: undefined,
75
79
  defaultValue: undefined,
@@ -175,8 +179,26 @@ var ReactDOMInput = {
175
179
  // are not resetable nodes so this operation doesn't matter and actually
176
180
  // removes browser-default values (eg "Submit Query") when no value is
177
181
  // provided.
178
- if (props.type !== 'submit' && props.type !== 'reset') {
179
- node.value = node.value;
182
+
183
+ switch (props.type) {
184
+ case 'submit':
185
+ case 'reset':
186
+ break;
187
+ case 'color':
188
+ case 'date':
189
+ case 'datetime':
190
+ case 'datetime-local':
191
+ case 'month':
192
+ case 'time':
193
+ case 'week':
194
+ // This fixes the no-show issue on iOS Safari and Android Chrome:
195
+ // https://github.com/facebook/react/issues/7233
196
+ node.value = '';
197
+ node.value = node.defaultValue;
198
+ break;
199
+ default:
200
+ node.value = node.value;
201
+ break;
180
202
  }
181
203
 
182
204
  // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
@@ -6,12 +6,12 @@
6
6
  * LICENSE file in the root directory of this source tree. An additional grant
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
- * @providesModule ReactDOMNullInputValuePropDevtool
9
+ * @providesModule ReactDOMNullInputValuePropHook
10
10
  */
11
11
 
12
12
  'use strict';
13
13
 
14
- var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
14
+ var ReactComponentTreeHook = require('./ReactComponentTreeHook');
15
15
 
16
16
  var warning = require('fbjs/lib/warning');
17
17
 
@@ -25,13 +25,13 @@ function handleElement(debugID, element) {
25
25
  return;
26
26
  }
27
27
  if (element.props != null && element.props.value === null && !didWarnValueNull) {
28
- process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.%s', element.type, ReactComponentTreeDevtool.getStackAddendumByID(debugID)) : void 0;
28
+ process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.%s', element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
29
29
 
30
30
  didWarnValueNull = true;
31
31
  }
32
32
  }
33
33
 
34
- var ReactDOMUnknownPropertyDevtool = {
34
+ var ReactDOMNullInputValuePropHook = {
35
35
  onBeforeMountComponent: function (debugID, element) {
36
36
  handleElement(debugID, element);
37
37
  },
@@ -40,4 +40,4 @@ var ReactDOMUnknownPropertyDevtool = {
40
40
  }
41
41
  };
42
42
 
43
- module.exports = ReactDOMUnknownPropertyDevtool;
43
+ module.exports = ReactDOMNullInputValuePropHook;
@@ -66,10 +66,11 @@ function checkSelectPropTypes(inst, props) {
66
66
  if (props[propName] == null) {
67
67
  continue;
68
68
  }
69
- if (props.multiple) {
70
- process.env.NODE_ENV !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
71
- } else {
72
- process.env.NODE_ENV !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
69
+ var isArray = Array.isArray(props[propName]);
70
+ if (props.multiple && !isArray) {
71
+ process.env.NODE_ENV !== 'production' ? warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
72
+ } else if (!props.multiple && isArray) {
73
+ process.env.NODE_ENV !== 'production' ? warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : void 0;
73
74
  }
74
75
  }
75
76
  }
@@ -17,7 +17,6 @@ var _prodInvariant = require('./reactProdInvariant'),
17
17
  var DOMChildrenOperations = require('./DOMChildrenOperations');
18
18
  var DOMLazyTree = require('./DOMLazyTree');
19
19
  var ReactDOMComponentTree = require('./ReactDOMComponentTree');
20
- var ReactInstrumentation = require('./ReactInstrumentation');
21
20
 
22
21
  var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
23
22
  var invariant = require('fbjs/lib/invariant');
@@ -47,7 +46,7 @@ var ReactDOMTextComponent = function (text) {
47
46
  this._hostParent = null;
48
47
 
49
48
  // Properties
50
- this._domID = null;
49
+ this._domID = 0;
51
50
  this._mountIndex = 0;
52
51
  this._closingComment = null;
53
52
  this._commentNodes = null;
@@ -65,8 +64,6 @@ _assign(ReactDOMTextComponent.prototype, {
65
64
  */
66
65
  mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
67
66
  if (process.env.NODE_ENV !== 'production') {
68
- ReactInstrumentation.debugTool.onSetText(this._debugID, this._stringText);
69
-
70
67
  var parentInfo;
71
68
  if (hostParent != null) {
72
69
  parentInfo = hostParent._ancestorInfo;
@@ -130,10 +127,6 @@ _assign(ReactDOMTextComponent.prototype, {
130
127
  this._stringText = nextStringText;
131
128
  var commentNodes = this.getHostNode();
132
129
  DOMChildrenOperations.replaceDelimitedText(commentNodes[0], commentNodes[1], nextStringText);
133
-
134
- if (process.env.NODE_ENV !== 'production') {
135
- ReactInstrumentation.debugTool.onSetText(this._debugID, nextStringText);
136
- }
137
130
  }
138
131
  }
139
132
  },
@@ -6,14 +6,14 @@
6
6
  * LICENSE file in the root directory of this source tree. An additional grant
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
- * @providesModule ReactDOMUnknownPropertyDevtool
9
+ * @providesModule ReactDOMUnknownPropertyHook
10
10
  */
11
11
 
12
12
  'use strict';
13
13
 
14
14
  var DOMProperty = require('./DOMProperty');
15
15
  var EventPluginRegistry = require('./EventPluginRegistry');
16
- var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
16
+ var ReactComponentTreeHook = require('./ReactComponentTreeHook');
17
17
 
18
18
  var warning = require('fbjs/lib/warning');
19
19
 
@@ -55,10 +55,10 @@ if (process.env.NODE_ENV !== 'production') {
55
55
  var registrationName = EventPluginRegistry.possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? EventPluginRegistry.possibleRegistrationNames[lowerCasedName] : null;
56
56
 
57
57
  if (standardName != null) {
58
- process.env.NODE_ENV !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?%s', name, standardName, ReactComponentTreeDevtool.getStackAddendumByID(debugID)) : void 0;
58
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown DOM property %s. Did you mean %s?%s', name, standardName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
59
59
  return true;
60
60
  } else if (registrationName != null) {
61
- process.env.NODE_ENV !== 'production' ? warning(registrationName == null, 'Unknown event handler property %s. Did you mean `%s`?%s', name, registrationName, ReactComponentTreeDevtool.getStackAddendumByID(debugID)) : void 0;
61
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown event handler property %s. Did you mean `%s`?%s', name, registrationName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
62
62
  return true;
63
63
  } else {
64
64
  // We were unable to guess which prop the user intended.
@@ -84,9 +84,9 @@ var warnUnknownProperties = function (debugID, element) {
84
84
  }).join(', ');
85
85
 
86
86
  if (unknownProps.length === 1) {
87
- process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown prop %s on <%s> tag. Remove this prop from the element. ' + 'For details, see https://fb.me/react-unknown-prop%s', unknownPropString, element.type, ReactComponentTreeDevtool.getStackAddendumByID(debugID)) : void 0;
87
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown prop %s on <%s> tag. Remove this prop from the element. ' + 'For details, see https://fb.me/react-unknown-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
88
88
  } else if (unknownProps.length > 1) {
89
- process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown props %s on <%s> tag. Remove these props from the element. ' + 'For details, see https://fb.me/react-unknown-prop%s', unknownPropString, element.type, ReactComponentTreeDevtool.getStackAddendumByID(debugID)) : void 0;
89
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown props %s on <%s> tag. Remove these props from the element. ' + 'For details, see https://fb.me/react-unknown-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
90
90
  }
91
91
  };
92
92
 
@@ -100,7 +100,7 @@ function handleElement(debugID, element) {
100
100
  warnUnknownProperties(debugID, element);
101
101
  }
102
102
 
103
- var ReactDOMUnknownPropertyDevtool = {
103
+ var ReactDOMUnknownPropertyHook = {
104
104
  onBeforeMountComponent: function (debugID, element) {
105
105
  handleElement(debugID, element);
106
106
  },
@@ -109,4 +109,4 @@ var ReactDOMUnknownPropertyDevtool = {
109
109
  }
110
110
  };
111
111
 
112
- module.exports = ReactDOMUnknownPropertyDevtool;
112
+ module.exports = ReactDOMUnknownPropertyHook;
@@ -11,29 +11,35 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var ReactInvalidSetStateWarningDevTool = require('./ReactInvalidSetStateWarningDevTool');
15
- var ReactHostOperationHistoryDevtool = require('./ReactHostOperationHistoryDevtool');
16
- var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
17
- var ReactChildrenMutationWarningDevtool = require('./ReactChildrenMutationWarningDevtool');
14
+ var ReactInvalidSetStateWarningHook = require('./ReactInvalidSetStateWarningHook');
15
+ var ReactHostOperationHistoryHook = require('./ReactHostOperationHistoryHook');
16
+ var ReactComponentTreeHook = require('./ReactComponentTreeHook');
17
+ var ReactChildrenMutationWarningHook = require('./ReactChildrenMutationWarningHook');
18
18
  var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
19
19
 
20
20
  var performanceNow = require('fbjs/lib/performanceNow');
21
21
  var warning = require('fbjs/lib/warning');
22
22
 
23
- var eventHandlers = [];
24
- var handlerDoesThrowForEvent = {};
23
+ var hooks = [];
24
+ var didHookThrowForEvent = {};
25
25
 
26
- function emitEvent(handlerFunctionName, arg1, arg2, arg3, arg4, arg5) {
27
- eventHandlers.forEach(function (handler) {
28
- try {
29
- if (handler[handlerFunctionName]) {
30
- handler[handlerFunctionName](arg1, arg2, arg3, arg4, arg5);
31
- }
32
- } catch (e) {
33
- process.env.NODE_ENV !== 'production' ? warning(handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, e + '\n' + e.stack) : void 0;
34
- handlerDoesThrowForEvent[handlerFunctionName] = true;
26
+ function callHook(event, fn, context, arg1, arg2, arg3, arg4, arg5) {
27
+ try {
28
+ fn.call(context, arg1, arg2, arg3, arg4, arg5);
29
+ } catch (e) {
30
+ process.env.NODE_ENV !== 'production' ? warning(didHookThrowForEvent[event], 'Exception thrown by hook while handling %s: %s', event, e + '\n' + e.stack) : void 0;
31
+ didHookThrowForEvent[event] = true;
32
+ }
33
+ }
34
+
35
+ function emitEvent(event, arg1, arg2, arg3, arg4, arg5) {
36
+ for (var i = 0; i < hooks.length; i++) {
37
+ var hook = hooks[i];
38
+ var fn = hook[event];
39
+ if (fn) {
40
+ callHook(event, fn, hook, arg1, arg2, arg3, arg4, arg5);
35
41
  }
36
- });
42
+ }
37
43
  }
38
44
 
39
45
  var isProfiling = false;
@@ -47,22 +53,24 @@ var currentTimerStartTime = null;
47
53
  var currentTimerNestedFlushDuration = null;
48
54
  var currentTimerType = null;
49
55
 
56
+ var lifeCycleTimerHasWarned = false;
57
+
50
58
  function clearHistory() {
51
- ReactComponentTreeDevtool.purgeUnmountedComponents();
52
- ReactHostOperationHistoryDevtool.clearHistory();
59
+ ReactComponentTreeHook.purgeUnmountedComponents();
60
+ ReactHostOperationHistoryHook.clearHistory();
53
61
  }
54
62
 
55
63
  function getTreeSnapshot(registeredIDs) {
56
64
  return registeredIDs.reduce(function (tree, id) {
57
- var ownerID = ReactComponentTreeDevtool.getOwnerID(id);
58
- var parentID = ReactComponentTreeDevtool.getParentID(id);
65
+ var ownerID = ReactComponentTreeHook.getOwnerID(id);
66
+ var parentID = ReactComponentTreeHook.getParentID(id);
59
67
  tree[id] = {
60
- displayName: ReactComponentTreeDevtool.getDisplayName(id),
61
- text: ReactComponentTreeDevtool.getText(id),
62
- updateCount: ReactComponentTreeDevtool.getUpdateCount(id),
63
- childIDs: ReactComponentTreeDevtool.getChildIDs(id),
68
+ displayName: ReactComponentTreeHook.getDisplayName(id),
69
+ text: ReactComponentTreeHook.getText(id),
70
+ updateCount: ReactComponentTreeHook.getUpdateCount(id),
71
+ childIDs: ReactComponentTreeHook.getChildIDs(id),
64
72
  // Text nodes don't have owners but this is close enough.
65
- ownerID: ownerID || ReactComponentTreeDevtool.getOwnerID(parentID),
73
+ ownerID: ownerID || ReactComponentTreeHook.getOwnerID(parentID),
66
74
  parentID: parentID
67
75
  };
68
76
  return tree;
@@ -72,7 +80,7 @@ function getTreeSnapshot(registeredIDs) {
72
80
  function resetMeasurements() {
73
81
  var previousStartTime = currentFlushStartTime;
74
82
  var previousMeasurements = currentFlushMeasurements || [];
75
- var previousOperations = ReactHostOperationHistoryDevtool.getHistory();
83
+ var previousOperations = ReactHostOperationHistoryHook.getHistory();
76
84
 
77
85
  if (currentFlushNesting === 0) {
78
86
  currentFlushStartTime = null;
@@ -82,7 +90,7 @@ function resetMeasurements() {
82
90
  }
83
91
 
84
92
  if (previousMeasurements.length || previousOperations.length) {
85
- var registeredIDs = ReactComponentTreeDevtool.getRegisteredIDs();
93
+ var registeredIDs = ReactComponentTreeHook.getRegisteredIDs();
86
94
  flushHistory.push({
87
95
  duration: performanceNow() - previousStartTime,
88
96
  measurements: previousMeasurements || [],
@@ -97,14 +105,24 @@ function resetMeasurements() {
97
105
  }
98
106
 
99
107
  function checkDebugID(debugID) {
100
- process.env.NODE_ENV !== 'production' ? warning(debugID, 'ReactDebugTool: debugID may not be empty.') : void 0;
108
+ var allowRoot = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
109
+
110
+ if (allowRoot && debugID === 0) {
111
+ return;
112
+ }
113
+ if (!debugID) {
114
+ process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDebugTool: debugID may not be empty.') : void 0;
115
+ }
101
116
  }
102
117
 
103
118
  function beginLifeCycleTimer(debugID, timerType) {
104
119
  if (currentFlushNesting === 0) {
105
120
  return;
106
121
  }
107
- process.env.NODE_ENV !== 'production' ? warning(!currentTimerType, 'There is an internal error in the React performance measurement code. ' + 'Did not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
122
+ if (currentTimerType && !lifeCycleTimerHasWarned) {
123
+ process.env.NODE_ENV !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'Did not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
124
+ lifeCycleTimerHasWarned = true;
125
+ }
108
126
  currentTimerStartTime = performanceNow();
109
127
  currentTimerNestedFlushDuration = 0;
110
128
  currentTimerDebugID = debugID;
@@ -115,7 +133,10 @@ function endLifeCycleTimer(debugID, timerType) {
115
133
  if (currentFlushNesting === 0) {
116
134
  return;
117
135
  }
118
- process.env.NODE_ENV !== 'production' ? warning(currentTimerType === timerType, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
136
+ if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) {
137
+ process.env.NODE_ENV !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
138
+ lifeCycleTimerHasWarned = true;
139
+ }
119
140
  if (isProfiling) {
120
141
  currentFlushMeasurements.push({
121
142
  timerType: timerType,
@@ -159,13 +180,13 @@ function resumeCurrentLifeCycleTimer() {
159
180
  }
160
181
 
161
182
  var ReactDebugTool = {
162
- addDevtool: function (devtool) {
163
- eventHandlers.push(devtool);
183
+ addHook: function (hook) {
184
+ hooks.push(hook);
164
185
  },
165
- removeDevtool: function (devtool) {
166
- for (var i = 0; i < eventHandlers.length; i++) {
167
- if (eventHandlers[i] === devtool) {
168
- eventHandlers.splice(i, 1);
186
+ removeHook: function (hook) {
187
+ for (var i = 0; i < hooks.length; i++) {
188
+ if (hooks[i] === hook) {
189
+ hooks.splice(i, 1);
169
190
  i--;
170
191
  }
171
192
  }
@@ -181,7 +202,7 @@ var ReactDebugTool = {
181
202
  isProfiling = true;
182
203
  flushHistory.length = 0;
183
204
  resetMeasurements();
184
- ReactDebugTool.addDevtool(ReactHostOperationHistoryDevtool);
205
+ ReactDebugTool.addHook(ReactHostOperationHistoryHook);
185
206
  },
186
207
  endProfiling: function () {
187
208
  if (!isProfiling) {
@@ -190,7 +211,7 @@ var ReactDebugTool = {
190
211
 
191
212
  isProfiling = false;
192
213
  resetMeasurements();
193
- ReactDebugTool.removeDevtool(ReactHostOperationHistoryDevtool);
214
+ ReactDebugTool.removeHook(ReactHostOperationHistoryHook);
194
215
  },
195
216
  getFlushHistory: function () {
196
217
  return flushHistory;
@@ -217,14 +238,6 @@ var ReactDebugTool = {
217
238
  endLifeCycleTimer(debugID, timerType);
218
239
  emitEvent('onEndLifeCycleTimer', debugID, timerType);
219
240
  },
220
- onBeginReconcilerTimer: function (debugID, timerType) {
221
- checkDebugID(debugID);
222
- emitEvent('onBeginReconcilerTimer', debugID, timerType);
223
- },
224
- onEndReconcilerTimer: function (debugID, timerType) {
225
- checkDebugID(debugID);
226
- emitEvent('onEndReconcilerTimer', debugID, timerType);
227
- },
228
241
  onError: function (debugID) {
229
242
  if (currentTimerDebugID != null) {
230
243
  endLifeCycleTimer(currentTimerDebugID, currentTimerType);
@@ -241,45 +254,18 @@ var ReactDebugTool = {
241
254
  checkDebugID(debugID);
242
255
  emitEvent('onHostOperation', debugID, type, payload);
243
256
  },
244
- onComponentHasMounted: function (debugID) {
245
- checkDebugID(debugID);
246
- emitEvent('onComponentHasMounted', debugID);
247
- },
248
- onComponentHasUpdated: function (debugID) {
249
- checkDebugID(debugID);
250
- emitEvent('onComponentHasUpdated', debugID);
251
- },
252
257
  onSetState: function () {
253
258
  emitEvent('onSetState');
254
259
  },
255
- onSetDisplayName: function (debugID, displayName) {
256
- checkDebugID(debugID);
257
- emitEvent('onSetDisplayName', debugID, displayName);
258
- },
259
260
  onSetChildren: function (debugID, childDebugIDs) {
260
261
  checkDebugID(debugID);
261
262
  childDebugIDs.forEach(checkDebugID);
262
263
  emitEvent('onSetChildren', debugID, childDebugIDs);
263
264
  },
264
- onSetOwner: function (debugID, ownerDebugID) {
265
- checkDebugID(debugID);
266
- emitEvent('onSetOwner', debugID, ownerDebugID);
267
- },
268
- onSetParent: function (debugID, parentDebugID) {
269
- checkDebugID(debugID);
270
- emitEvent('onSetParent', debugID, parentDebugID);
271
- },
272
- onSetText: function (debugID, text) {
273
- checkDebugID(debugID);
274
- emitEvent('onSetText', debugID, text);
275
- },
276
- onMountRootComponent: function (debugID) {
277
- checkDebugID(debugID);
278
- emitEvent('onMountRootComponent', debugID);
279
- },
280
- onBeforeMountComponent: function (debugID, element) {
265
+ onBeforeMountComponent: function (debugID, element, parentDebugID) {
281
266
  checkDebugID(debugID);
282
- emitEvent('onBeforeMountComponent', debugID, element);
267
+ checkDebugID(parentDebugID, true);
268
+ emitEvent('onBeforeMountComponent', debugID, element, parentDebugID);
283
269
  },
284
270
  onMountComponent: function (debugID) {
285
271
  checkDebugID(debugID);
@@ -293,6 +279,10 @@ var ReactDebugTool = {
293
279
  checkDebugID(debugID);
294
280
  emitEvent('onUpdateComponent', debugID);
295
281
  },
282
+ onBeforeUnmountComponent: function (debugID) {
283
+ checkDebugID(debugID);
284
+ emitEvent('onBeforeUnmountComponent', debugID);
285
+ },
296
286
  onUnmountComponent: function (debugID) {
297
287
  checkDebugID(debugID);
298
288
  emitEvent('onUnmountComponent', debugID);
@@ -302,9 +292,13 @@ var ReactDebugTool = {
302
292
  }
303
293
  };
304
294
 
305
- ReactDebugTool.addDevtool(ReactInvalidSetStateWarningDevTool);
306
- ReactDebugTool.addDevtool(ReactComponentTreeDevtool);
307
- ReactDebugTool.addDevtool(ReactChildrenMutationWarningDevtool);
295
+ // TODO remove these when RN/www gets updated
296
+ ReactDebugTool.addDevtool = ReactDebugTool.addHook;
297
+ ReactDebugTool.removeDevtool = ReactDebugTool.removeHook;
298
+
299
+ ReactDebugTool.addHook(ReactInvalidSetStateWarningHook);
300
+ ReactDebugTool.addHook(ReactComponentTreeHook);
301
+ ReactDebugTool.addHook(ReactChildrenMutationWarningHook);
308
302
  var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
309
303
  if (/[?&]react_perf\b/.test(url)) {
310
304
  ReactDebugTool.beginProfiling();