react 15.3.0 → 15.3.2-rc.1
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 +1581 -1626
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +1515 -1560
- package/dist/react.min.js +6 -6
- package/lib/BeforeInputEventPlugin.js +3 -1
- package/lib/ChangeEventPlugin.js +2 -2
- package/lib/DOMPropertyOperations.js +0 -7
- package/lib/EventPluginHub.js +2 -0
- package/lib/HTMLDOMPropertyConfig.js +3 -0
- package/lib/ReactBrowserEventEmitter.js +14 -1
- package/lib/ReactChildReconciler.js +11 -8
- 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 +111 -151
- package/lib/ReactDOM.js +9 -0
- package/lib/ReactDOMComponent.js +33 -52
- package/lib/ReactDOMComponentTree.js +1 -1
- package/lib/ReactDOMEmptyComponent.js +1 -1
- package/lib/ReactDOMFactories.js +138 -144
- package/lib/ReactDOMFiber.js +0 -2
- package/lib/ReactDOMInput.js +26 -4
- package/lib/{ReactDOMNullInputValuePropDevtool.js → ReactDOMNullInputValuePropHook.js} +5 -5
- package/lib/ReactDOMSelect.js +5 -4
- package/lib/ReactDOMTextComponent.js +2 -9
- package/lib/{ReactDOMUnknownPropertyDevtool.js → ReactDOMUnknownPropertyHook.js} +8 -8
- package/lib/ReactDebugTool.js +63 -83
- package/lib/ReactElement.js +37 -49
- 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 +45 -10
- 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/ReactNativeReconcileTransaction.js +13 -0
- package/lib/ReactNativeTextComponent.js +2 -10
- package/lib/ReactPropTypes.js +26 -12
- package/lib/ReactReconciler.js +5 -11
- package/lib/ReactRef.js +1 -1
- package/lib/ReactServerRendering.js +2 -1
- package/lib/ReactSimpleEmptyComponent.js +3 -2
- package/lib/ReactTestMount.js +3 -5
- package/lib/ReactTestReconcileTransaction.js +13 -0
- package/lib/ReactTestUtils.js +5 -5
- package/lib/ReactVersion.js +1 -1
- package/lib/ResponderEventPlugin.js +6 -5
- package/lib/SelectEventPlugin.js +1 -1
- package/lib/SimpleEventPlugin.js +2 -0
- package/lib/SyntheticEvent.js +10 -2
- package/lib/checkReactTypeSpec.js +6 -6
- package/lib/createReactNativeComponentClass.js +1 -1
- package/lib/escapeTextContentForBrowser.js +1 -0
- package/lib/flattenChildren.js +7 -5
- package/lib/instantiateReactComponent.js +1 -28
- package/lib/onlyChild.js +1 -1
- package/lib/setInnerHTML.js +3 -3
- package/lib/validateDOMNesting.js +16 -3
- package/package.json +2 -2
- package/lib/ReactDOMDebugTool.js +0 -67
- package/lib/ReactDOMInstrumentation.js +0 -21
- package/lib/createHierarchyRenderer.js +0 -85
package/lib/ReactDOMFiber.js
CHANGED
package/lib/ReactDOMInput.js
CHANGED
|
@@ -39,7 +39,7 @@ function forceUpdateIfMounted() {
|
|
|
39
39
|
|
|
40
40
|
function isControlled(props) {
|
|
41
41
|
var usesChecked = props.type === 'checkbox' || props.type === 'radio';
|
|
42
|
-
return usesChecked ? props.checked
|
|
42
|
+
return usesChecked ? props.checked != null : props.value != null;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
@@ -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;
|
|
@@ -76,7 +73,7 @@ _assign(ReactDOMTextComponent.prototype, {
|
|
|
76
73
|
if (parentInfo) {
|
|
77
74
|
// parentInfo should always be present except for the top-level
|
|
78
75
|
// component when server rendering
|
|
79
|
-
validateDOMNesting(
|
|
76
|
+
validateDOMNesting(null, this._stringText, this, parentInfo);
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
79
|
|
|
@@ -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;
|
|
@@ -50,21 +56,21 @@ var currentTimerType = null;
|
|
|
50
56
|
var lifeCycleTimerHasWarned = false;
|
|
51
57
|
|
|
52
58
|
function clearHistory() {
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
ReactComponentTreeHook.purgeUnmountedComponents();
|
|
60
|
+
ReactHostOperationHistoryHook.clearHistory();
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
function getTreeSnapshot(registeredIDs) {
|
|
58
64
|
return registeredIDs.reduce(function (tree, id) {
|
|
59
|
-
var ownerID =
|
|
60
|
-
var parentID =
|
|
65
|
+
var ownerID = ReactComponentTreeHook.getOwnerID(id);
|
|
66
|
+
var parentID = ReactComponentTreeHook.getParentID(id);
|
|
61
67
|
tree[id] = {
|
|
62
|
-
displayName:
|
|
63
|
-
text:
|
|
64
|
-
updateCount:
|
|
65
|
-
childIDs:
|
|
68
|
+
displayName: ReactComponentTreeHook.getDisplayName(id),
|
|
69
|
+
text: ReactComponentTreeHook.getText(id),
|
|
70
|
+
updateCount: ReactComponentTreeHook.getUpdateCount(id),
|
|
71
|
+
childIDs: ReactComponentTreeHook.getChildIDs(id),
|
|
66
72
|
// Text nodes don't have owners but this is close enough.
|
|
67
|
-
ownerID: ownerID ||
|
|
73
|
+
ownerID: ownerID || ReactComponentTreeHook.getOwnerID(parentID),
|
|
68
74
|
parentID: parentID
|
|
69
75
|
};
|
|
70
76
|
return tree;
|
|
@@ -74,7 +80,7 @@ function getTreeSnapshot(registeredIDs) {
|
|
|
74
80
|
function resetMeasurements() {
|
|
75
81
|
var previousStartTime = currentFlushStartTime;
|
|
76
82
|
var previousMeasurements = currentFlushMeasurements || [];
|
|
77
|
-
var previousOperations =
|
|
83
|
+
var previousOperations = ReactHostOperationHistoryHook.getHistory();
|
|
78
84
|
|
|
79
85
|
if (currentFlushNesting === 0) {
|
|
80
86
|
currentFlushStartTime = null;
|
|
@@ -84,7 +90,7 @@ function resetMeasurements() {
|
|
|
84
90
|
}
|
|
85
91
|
|
|
86
92
|
if (previousMeasurements.length || previousOperations.length) {
|
|
87
|
-
var registeredIDs =
|
|
93
|
+
var registeredIDs = ReactComponentTreeHook.getRegisteredIDs();
|
|
88
94
|
flushHistory.push({
|
|
89
95
|
duration: performanceNow() - previousStartTime,
|
|
90
96
|
measurements: previousMeasurements || [],
|
|
@@ -99,7 +105,14 @@ function resetMeasurements() {
|
|
|
99
105
|
}
|
|
100
106
|
|
|
101
107
|
function checkDebugID(debugID) {
|
|
102
|
-
|
|
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
|
+
}
|
|
103
116
|
}
|
|
104
117
|
|
|
105
118
|
function beginLifeCycleTimer(debugID, timerType) {
|
|
@@ -167,13 +180,13 @@ function resumeCurrentLifeCycleTimer() {
|
|
|
167
180
|
}
|
|
168
181
|
|
|
169
182
|
var ReactDebugTool = {
|
|
170
|
-
|
|
171
|
-
|
|
183
|
+
addHook: function (hook) {
|
|
184
|
+
hooks.push(hook);
|
|
172
185
|
},
|
|
173
|
-
|
|
174
|
-
for (var i = 0; i <
|
|
175
|
-
if (
|
|
176
|
-
|
|
186
|
+
removeHook: function (hook) {
|
|
187
|
+
for (var i = 0; i < hooks.length; i++) {
|
|
188
|
+
if (hooks[i] === hook) {
|
|
189
|
+
hooks.splice(i, 1);
|
|
177
190
|
i--;
|
|
178
191
|
}
|
|
179
192
|
}
|
|
@@ -189,7 +202,7 @@ var ReactDebugTool = {
|
|
|
189
202
|
isProfiling = true;
|
|
190
203
|
flushHistory.length = 0;
|
|
191
204
|
resetMeasurements();
|
|
192
|
-
ReactDebugTool.
|
|
205
|
+
ReactDebugTool.addHook(ReactHostOperationHistoryHook);
|
|
193
206
|
},
|
|
194
207
|
endProfiling: function () {
|
|
195
208
|
if (!isProfiling) {
|
|
@@ -198,7 +211,7 @@ var ReactDebugTool = {
|
|
|
198
211
|
|
|
199
212
|
isProfiling = false;
|
|
200
213
|
resetMeasurements();
|
|
201
|
-
ReactDebugTool.
|
|
214
|
+
ReactDebugTool.removeHook(ReactHostOperationHistoryHook);
|
|
202
215
|
},
|
|
203
216
|
getFlushHistory: function () {
|
|
204
217
|
return flushHistory;
|
|
@@ -225,20 +238,6 @@ var ReactDebugTool = {
|
|
|
225
238
|
endLifeCycleTimer(debugID, timerType);
|
|
226
239
|
emitEvent('onEndLifeCycleTimer', debugID, timerType);
|
|
227
240
|
},
|
|
228
|
-
onBeginReconcilerTimer: function (debugID, timerType) {
|
|
229
|
-
checkDebugID(debugID);
|
|
230
|
-
emitEvent('onBeginReconcilerTimer', debugID, timerType);
|
|
231
|
-
},
|
|
232
|
-
onEndReconcilerTimer: function (debugID, timerType) {
|
|
233
|
-
checkDebugID(debugID);
|
|
234
|
-
emitEvent('onEndReconcilerTimer', debugID, timerType);
|
|
235
|
-
},
|
|
236
|
-
onError: function (debugID) {
|
|
237
|
-
if (currentTimerDebugID != null) {
|
|
238
|
-
endLifeCycleTimer(currentTimerDebugID, currentTimerType);
|
|
239
|
-
}
|
|
240
|
-
emitEvent('onError', debugID);
|
|
241
|
-
},
|
|
242
241
|
onBeginProcessingChildContext: function () {
|
|
243
242
|
emitEvent('onBeginProcessingChildContext');
|
|
244
243
|
},
|
|
@@ -249,45 +248,18 @@ var ReactDebugTool = {
|
|
|
249
248
|
checkDebugID(debugID);
|
|
250
249
|
emitEvent('onHostOperation', debugID, type, payload);
|
|
251
250
|
},
|
|
252
|
-
onComponentHasMounted: function (debugID) {
|
|
253
|
-
checkDebugID(debugID);
|
|
254
|
-
emitEvent('onComponentHasMounted', debugID);
|
|
255
|
-
},
|
|
256
|
-
onComponentHasUpdated: function (debugID) {
|
|
257
|
-
checkDebugID(debugID);
|
|
258
|
-
emitEvent('onComponentHasUpdated', debugID);
|
|
259
|
-
},
|
|
260
251
|
onSetState: function () {
|
|
261
252
|
emitEvent('onSetState');
|
|
262
253
|
},
|
|
263
|
-
onSetDisplayName: function (debugID, displayName) {
|
|
264
|
-
checkDebugID(debugID);
|
|
265
|
-
emitEvent('onSetDisplayName', debugID, displayName);
|
|
266
|
-
},
|
|
267
254
|
onSetChildren: function (debugID, childDebugIDs) {
|
|
268
255
|
checkDebugID(debugID);
|
|
269
256
|
childDebugIDs.forEach(checkDebugID);
|
|
270
257
|
emitEvent('onSetChildren', debugID, childDebugIDs);
|
|
271
258
|
},
|
|
272
|
-
|
|
273
|
-
checkDebugID(debugID);
|
|
274
|
-
emitEvent('onSetOwner', debugID, ownerDebugID);
|
|
275
|
-
},
|
|
276
|
-
onSetParent: function (debugID, parentDebugID) {
|
|
277
|
-
checkDebugID(debugID);
|
|
278
|
-
emitEvent('onSetParent', debugID, parentDebugID);
|
|
279
|
-
},
|
|
280
|
-
onSetText: function (debugID, text) {
|
|
281
|
-
checkDebugID(debugID);
|
|
282
|
-
emitEvent('onSetText', debugID, text);
|
|
283
|
-
},
|
|
284
|
-
onMountRootComponent: function (debugID) {
|
|
285
|
-
checkDebugID(debugID);
|
|
286
|
-
emitEvent('onMountRootComponent', debugID);
|
|
287
|
-
},
|
|
288
|
-
onBeforeMountComponent: function (debugID, element) {
|
|
259
|
+
onBeforeMountComponent: function (debugID, element, parentDebugID) {
|
|
289
260
|
checkDebugID(debugID);
|
|
290
|
-
|
|
261
|
+
checkDebugID(parentDebugID, true);
|
|
262
|
+
emitEvent('onBeforeMountComponent', debugID, element, parentDebugID);
|
|
291
263
|
},
|
|
292
264
|
onMountComponent: function (debugID) {
|
|
293
265
|
checkDebugID(debugID);
|
|
@@ -301,6 +273,10 @@ var ReactDebugTool = {
|
|
|
301
273
|
checkDebugID(debugID);
|
|
302
274
|
emitEvent('onUpdateComponent', debugID);
|
|
303
275
|
},
|
|
276
|
+
onBeforeUnmountComponent: function (debugID) {
|
|
277
|
+
checkDebugID(debugID);
|
|
278
|
+
emitEvent('onBeforeUnmountComponent', debugID);
|
|
279
|
+
},
|
|
304
280
|
onUnmountComponent: function (debugID) {
|
|
305
281
|
checkDebugID(debugID);
|
|
306
282
|
emitEvent('onUnmountComponent', debugID);
|
|
@@ -310,9 +286,13 @@ var ReactDebugTool = {
|
|
|
310
286
|
}
|
|
311
287
|
};
|
|
312
288
|
|
|
313
|
-
|
|
314
|
-
ReactDebugTool.addDevtool
|
|
315
|
-
ReactDebugTool.
|
|
289
|
+
// TODO remove these when RN/www gets updated
|
|
290
|
+
ReactDebugTool.addDevtool = ReactDebugTool.addHook;
|
|
291
|
+
ReactDebugTool.removeDevtool = ReactDebugTool.removeHook;
|
|
292
|
+
|
|
293
|
+
ReactDebugTool.addHook(ReactInvalidSetStateWarningHook);
|
|
294
|
+
ReactDebugTool.addHook(ReactComponentTreeHook);
|
|
295
|
+
ReactDebugTool.addHook(ReactChildrenMutationWarningHook);
|
|
316
296
|
var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
|
|
317
297
|
if (/[?&]react_perf\b/.test(url)) {
|
|
318
298
|
ReactDebugTool.beginProfiling();
|