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.
- package/dist/react-with-addons.js +1362 -1408
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +1291 -1339
- package/dist/react.min.js +6 -6
- package/lib/DOMPropertyOperations.js +0 -7
- package/lib/EventPluginHub.js +2 -0
- package/lib/ReactChildReconciler.js +21 -5
- package/lib/{ReactChildrenMutationWarningDevtool.js → ReactChildrenMutationWarningHook.js} +11 -19
- package/lib/ReactComponentBrowserEnvironment.js +1 -10
- package/lib/ReactComponentEnvironment.js +0 -8
- package/lib/ReactComponentTreeDevtool.js +2 -205
- package/lib/ReactComponentTreeHook.js +342 -0
- package/lib/ReactComponentTreeTestUtils.js +11 -11
- package/lib/ReactCompositeComponent.js +10 -34
- package/lib/ReactDOM.js +9 -0
- package/lib/ReactDOMComponent.js +23 -43
- package/lib/ReactDOMComponentTree.js +1 -1
- package/lib/ReactDOMEmptyComponent.js +1 -1
- package/lib/ReactDOMFactories.js +138 -144
- package/lib/ReactDOMInput.js +25 -3
- package/lib/{ReactDOMNullInputValuePropDevtool.js → ReactDOMNullInputValuePropHook.js} +5 -5
- package/lib/ReactDOMSelect.js +5 -4
- package/lib/ReactDOMTextComponent.js +1 -8
- package/lib/{ReactDOMUnknownPropertyDevtool.js → ReactDOMUnknownPropertyHook.js} +8 -8
- package/lib/ReactDebugTool.js +73 -79
- package/lib/ReactElement.js +37 -33
- package/lib/ReactElementValidator.js +5 -3
- package/lib/{ReactHostOperationHistoryDevtool.js → ReactHostOperationHistoryHook.js} +4 -4
- package/lib/{ReactInvalidSetStateWarningDevTool.js → ReactInvalidSetStateWarningHook.js} +3 -3
- package/lib/ReactMount.js +3 -7
- package/lib/ReactMultiChild.js +11 -13
- package/lib/ReactNativeBaseComponent.js +5 -3
- package/lib/ReactNativeComponentEnvironment.js +0 -7
- package/lib/ReactNativeMount.js +2 -5
- package/lib/ReactNativeTextComponent.js +2 -10
- package/lib/ReactPropTypes.js +4 -2
- package/lib/ReactReconciler.js +5 -11
- package/lib/ReactServerRendering.js +2 -1
- package/lib/ReactSimpleEmptyComponent.js +3 -2
- package/lib/ReactTestMount.js +0 -5
- package/lib/ReactTestUtils.js +8 -6
- package/lib/ReactUpdateQueue.js +2 -1
- package/lib/ReactVersion.js +1 -1
- package/lib/ResponderEventPlugin.js +6 -5
- package/lib/SimpleEventPlugin.js +2 -0
- package/lib/SyntheticEvent.js +8 -1
- package/lib/checkReactTypeSpec.js +16 -3
- package/lib/createReactNativeComponentClass.js +1 -1
- package/lib/flattenChildren.js +17 -2
- package/lib/instantiateReactComponent.js +1 -28
- package/package.json +1 -1
- package/lib/ReactDOMDebugTool.js +0 -67
- package/lib/ReactDOMInstrumentation.js +0 -21
- package/lib/createHierarchyRenderer.js +0 -85
package/lib/ReactDOMInput.js
CHANGED
|
@@ -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
|
-
|
|
179
|
-
|
|
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
|
|
9
|
+
* @providesModule ReactDOMNullInputValuePropHook
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var
|
|
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,
|
|
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
|
|
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 =
|
|
43
|
+
module.exports = ReactDOMNullInputValuePropHook;
|
package/lib/ReactDOMSelect.js
CHANGED
|
@@ -66,10 +66,11 @@ function checkSelectPropTypes(inst, props) {
|
|
|
66
66
|
if (props[propName] == null) {
|
|
67
67
|
continue;
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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 =
|
|
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
|
|
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
|
|
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(
|
|
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(
|
|
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,
|
|
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,
|
|
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
|
|
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 =
|
|
112
|
+
module.exports = ReactDOMUnknownPropertyHook;
|
package/lib/ReactDebugTool.js
CHANGED
|
@@ -11,29 +11,35 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
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
|
|
24
|
-
var
|
|
23
|
+
var hooks = [];
|
|
24
|
+
var didHookThrowForEvent = {};
|
|
25
25
|
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
52
|
-
|
|
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 =
|
|
58
|
-
var parentID =
|
|
65
|
+
var ownerID = ReactComponentTreeHook.getOwnerID(id);
|
|
66
|
+
var parentID = ReactComponentTreeHook.getParentID(id);
|
|
59
67
|
tree[id] = {
|
|
60
|
-
displayName:
|
|
61
|
-
text:
|
|
62
|
-
updateCount:
|
|
63
|
-
childIDs:
|
|
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 ||
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
163
|
-
|
|
183
|
+
addHook: function (hook) {
|
|
184
|
+
hooks.push(hook);
|
|
164
185
|
},
|
|
165
|
-
|
|
166
|
-
for (var i = 0; i <
|
|
167
|
-
if (
|
|
168
|
-
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
306
|
-
ReactDebugTool.addDevtool
|
|
307
|
-
ReactDebugTool.
|
|
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();
|