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/ReactElement.js
CHANGED
|
@@ -56,6 +56,34 @@ function hasValidKey(config) {
|
|
|
56
56
|
return config.key !== undefined;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
60
|
+
var warnAboutAccessingKey = function () {
|
|
61
|
+
if (!specialPropKeyWarningShown) {
|
|
62
|
+
specialPropKeyWarningShown = true;
|
|
63
|
+
process.env.NODE_ENV !== 'production' ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
67
|
+
Object.defineProperty(props, 'key', {
|
|
68
|
+
get: warnAboutAccessingKey,
|
|
69
|
+
configurable: true
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function defineRefPropWarningGetter(props, displayName) {
|
|
74
|
+
var warnAboutAccessingRef = function () {
|
|
75
|
+
if (!specialPropRefWarningShown) {
|
|
76
|
+
specialPropRefWarningShown = true;
|
|
77
|
+
process.env.NODE_ENV !== 'production' ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
warnAboutAccessingRef.isReactWarning = true;
|
|
81
|
+
Object.defineProperty(props, 'ref', {
|
|
82
|
+
get: warnAboutAccessingRef,
|
|
83
|
+
configurable: true
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
59
87
|
/**
|
|
60
88
|
* Factory method to create a new React element. This no longer adheres to
|
|
61
89
|
* the class pattern, so do not use new to call it. Also, no instanceof check
|
|
@@ -210,39 +238,15 @@ ReactElement.createElement = function (type, config, children) {
|
|
|
210
238
|
}
|
|
211
239
|
}
|
|
212
240
|
if (process.env.NODE_ENV !== 'production') {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
};
|
|
223
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
224
|
-
|
|
225
|
-
var warnAboutAccessingRef = function () {
|
|
226
|
-
if (!specialPropRefWarningShown) {
|
|
227
|
-
specialPropRefWarningShown = true;
|
|
228
|
-
process.env.NODE_ENV !== 'production' ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0;
|
|
229
|
-
}
|
|
230
|
-
return undefined;
|
|
231
|
-
};
|
|
232
|
-
warnAboutAccessingRef.isReactWarning = true;
|
|
233
|
-
|
|
234
|
-
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
|
|
235
|
-
if (!props.hasOwnProperty('key')) {
|
|
236
|
-
Object.defineProperty(props, 'key', {
|
|
237
|
-
get: warnAboutAccessingKey,
|
|
238
|
-
configurable: true
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
if (!props.hasOwnProperty('ref')) {
|
|
242
|
-
Object.defineProperty(props, 'ref', {
|
|
243
|
-
get: warnAboutAccessingRef,
|
|
244
|
-
configurable: true
|
|
245
|
-
});
|
|
241
|
+
if (key || ref) {
|
|
242
|
+
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
|
|
243
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
244
|
+
if (key) {
|
|
245
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
246
|
+
}
|
|
247
|
+
if (ref) {
|
|
248
|
+
defineRefPropWarningGetter(props, displayName);
|
|
249
|
+
}
|
|
246
250
|
}
|
|
247
251
|
}
|
|
248
252
|
}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
'use strict';
|
|
20
20
|
|
|
21
21
|
var ReactCurrentOwner = require('./ReactCurrentOwner');
|
|
22
|
-
var
|
|
22
|
+
var ReactComponentTreeHook = require('./ReactComponentTreeHook');
|
|
23
23
|
var ReactElement = require('./ReactElement');
|
|
24
24
|
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
|
|
25
25
|
|
|
@@ -92,7 +92,7 @@ function validateExplicitKey(element, parentType) {
|
|
|
92
92
|
childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner,
|
|
95
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, ReactComponentTreeHook.getCurrentStackAddendum(element)) : void 0;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
@@ -163,7 +163,9 @@ var ReactElementValidator = {
|
|
|
163
163
|
var validType = typeof type === 'string' || typeof type === 'function';
|
|
164
164
|
// We warn in this case but don't throw. We expect the element creation to
|
|
165
165
|
// succeed and there will likely be errors in render.
|
|
166
|
-
|
|
166
|
+
if (!validType) {
|
|
167
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : void 0;
|
|
168
|
+
}
|
|
167
169
|
|
|
168
170
|
var element = ReactElement.createElement.apply(this, arguments);
|
|
169
171
|
|
|
@@ -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 ReactHostOperationHistoryHook
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
14
|
var history = [];
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var ReactHostOperationHistoryHook = {
|
|
17
17
|
onHostOperation: function (debugID, type, payload) {
|
|
18
18
|
history.push({
|
|
19
19
|
instanceID: debugID,
|
|
@@ -22,7 +22,7 @@ var ReactHostOperationHistoryDevtool = {
|
|
|
22
22
|
});
|
|
23
23
|
},
|
|
24
24
|
clearHistory: function () {
|
|
25
|
-
if (
|
|
25
|
+
if (ReactHostOperationHistoryHook._preventClearing) {
|
|
26
26
|
// Should only be used for tests.
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
@@ -34,4 +34,4 @@ var ReactHostOperationHistoryDevtool = {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
module.exports =
|
|
37
|
+
module.exports = ReactHostOperationHistoryHook;
|
|
@@ -6,7 +6,7 @@
|
|
|
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 ReactInvalidSetStateWarningHook
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
@@ -21,7 +21,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var ReactInvalidSetStateWarningHook = {
|
|
25
25
|
onBeginProcessingChildContext: function () {
|
|
26
26
|
processingChildContext = true;
|
|
27
27
|
},
|
|
@@ -33,4 +33,4 @@ var ReactInvalidSetStateWarningDevTool = {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
module.exports =
|
|
36
|
+
module.exports = ReactInvalidSetStateWarningHook;
|
package/lib/ReactMount.js
CHANGED
|
@@ -102,7 +102,8 @@ function mountComponentIntoNode(wrapperInstance, container, transaction, shouldR
|
|
|
102
102
|
console.time(markerName);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context
|
|
105
|
+
var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context, 0 /* parentDebugID */
|
|
106
|
+
);
|
|
106
107
|
|
|
107
108
|
if (markerName) {
|
|
108
109
|
console.timeEnd(markerName);
|
|
@@ -260,7 +261,7 @@ var ReactMount = {
|
|
|
260
261
|
},
|
|
261
262
|
|
|
262
263
|
/**
|
|
263
|
-
* Render a new component into the DOM. Hooked by
|
|
264
|
+
* Render a new component into the DOM. Hooked by hooks!
|
|
264
265
|
*
|
|
265
266
|
* @param {ReactElement} nextElement element to render
|
|
266
267
|
* @param {DOMElement} container container to render into
|
|
@@ -287,11 +288,6 @@ var ReactMount = {
|
|
|
287
288
|
var wrapperID = componentInstance._instance.rootID;
|
|
288
289
|
instancesByReactRootID[wrapperID] = componentInstance;
|
|
289
290
|
|
|
290
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
291
|
-
// The instance here is TopLevelWrapper so we report mount for its child.
|
|
292
|
-
ReactInstrumentation.debugTool.onMountRootComponent(componentInstance._renderedComponent._debugID);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
291
|
return componentInstance;
|
|
296
292
|
},
|
|
297
293
|
|
package/lib/ReactMultiChild.js
CHANGED
|
@@ -139,7 +139,6 @@ function processQueue(inst, updateQueue) {
|
|
|
139
139
|
ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
var setParentForInstrumentation = emptyFunction;
|
|
143
142
|
var setChildrenForInstrumentation = emptyFunction;
|
|
144
143
|
if (process.env.NODE_ENV !== 'production') {
|
|
145
144
|
var getDebugID = function (inst) {
|
|
@@ -152,11 +151,6 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
152
151
|
}
|
|
153
152
|
return inst._debugID;
|
|
154
153
|
};
|
|
155
|
-
setParentForInstrumentation = function (child) {
|
|
156
|
-
if (child._debugID !== 0) {
|
|
157
|
-
ReactInstrumentation.debugTool.onSetParent(child._debugID, getDebugID(this));
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
154
|
setChildrenForInstrumentation = function (children) {
|
|
161
155
|
var debugID = getDebugID(this);
|
|
162
156
|
// TODO: React Native empty components are also multichild.
|
|
@@ -188,10 +182,11 @@ var ReactMultiChild = {
|
|
|
188
182
|
|
|
189
183
|
_reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
|
|
190
184
|
if (process.env.NODE_ENV !== 'production') {
|
|
185
|
+
var selfDebugID = getDebugID(this);
|
|
191
186
|
if (this._currentElement) {
|
|
192
187
|
try {
|
|
193
188
|
ReactCurrentOwner.current = this._currentElement._owner;
|
|
194
|
-
return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context,
|
|
189
|
+
return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context, selfDebugID);
|
|
195
190
|
} finally {
|
|
196
191
|
ReactCurrentOwner.current = null;
|
|
197
192
|
}
|
|
@@ -202,20 +197,22 @@ var ReactMultiChild = {
|
|
|
202
197
|
|
|
203
198
|
_reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context) {
|
|
204
199
|
var nextChildren;
|
|
200
|
+
var selfDebugID = 0;
|
|
205
201
|
if (process.env.NODE_ENV !== 'production') {
|
|
202
|
+
selfDebugID = getDebugID(this);
|
|
206
203
|
if (this._currentElement) {
|
|
207
204
|
try {
|
|
208
205
|
ReactCurrentOwner.current = this._currentElement._owner;
|
|
209
|
-
nextChildren = flattenChildren(nextNestedChildrenElements,
|
|
206
|
+
nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
|
|
210
207
|
} finally {
|
|
211
208
|
ReactCurrentOwner.current = null;
|
|
212
209
|
}
|
|
213
|
-
ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context);
|
|
210
|
+
ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
|
|
214
211
|
return nextChildren;
|
|
215
212
|
}
|
|
216
213
|
}
|
|
217
|
-
nextChildren = flattenChildren(nextNestedChildrenElements);
|
|
218
|
-
ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context);
|
|
214
|
+
nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
|
|
215
|
+
ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
|
|
219
216
|
return nextChildren;
|
|
220
217
|
},
|
|
221
218
|
|
|
@@ -236,10 +233,11 @@ var ReactMultiChild = {
|
|
|
236
233
|
for (var name in children) {
|
|
237
234
|
if (children.hasOwnProperty(name)) {
|
|
238
235
|
var child = children[name];
|
|
236
|
+
var selfDebugID = 0;
|
|
239
237
|
if (process.env.NODE_ENV !== 'production') {
|
|
240
|
-
|
|
238
|
+
selfDebugID = getDebugID(this);
|
|
241
239
|
}
|
|
242
|
-
var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context);
|
|
240
|
+
var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context, selfDebugID);
|
|
243
241
|
child._mountIndex = index++;
|
|
244
242
|
mountImages.push(mountImage);
|
|
245
243
|
}
|
|
@@ -54,7 +54,7 @@ ReactNativeBaseComponent.Mixin = {
|
|
|
54
54
|
ReactNativeComponentTree.uncacheNode(this);
|
|
55
55
|
deleteAllListeners(this);
|
|
56
56
|
this.unmountChildren();
|
|
57
|
-
this._rootNodeID =
|
|
57
|
+
this._rootNodeID = 0;
|
|
58
58
|
},
|
|
59
59
|
|
|
60
60
|
/**
|
|
@@ -155,8 +155,10 @@ ReactNativeBaseComponent.Mixin = {
|
|
|
155
155
|
},
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
|
-
* @param {
|
|
159
|
-
* @param {
|
|
158
|
+
* @param {ReactNativeReconcileTransaction} transaction
|
|
159
|
+
* @param {?ReactNativeBaseComponent} the parent component instance
|
|
160
|
+
* @param {?object} info about the host container
|
|
161
|
+
* @param {object} context
|
|
160
162
|
* @return {string} Unique iOS view tag.
|
|
161
163
|
*/
|
|
162
164
|
mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
|
|
@@ -20,13 +20,6 @@ var ReactNativeComponentEnvironment = {
|
|
|
20
20
|
|
|
21
21
|
replaceNodeWithMarkup: ReactNativeDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* Nothing to do for UIKit bridge.
|
|
25
|
-
*
|
|
26
|
-
* @private
|
|
27
|
-
*/
|
|
28
|
-
unmountIDFromEnvironment: function () /*rootNodeID*/{},
|
|
29
|
-
|
|
30
23
|
/**
|
|
31
24
|
* @param {DOMElement} Element to clear.
|
|
32
25
|
*/
|
package/lib/ReactNativeMount.js
CHANGED
|
@@ -48,7 +48,8 @@ TopLevelWrapper.prototype.render = function () {
|
|
|
48
48
|
* @param {ReactReconcileTransaction} transaction
|
|
49
49
|
*/
|
|
50
50
|
function mountComponentIntoNode(componentInstance, containerTag, transaction) {
|
|
51
|
-
var markup = ReactReconciler.mountComponent(componentInstance, transaction, null, ReactNativeContainerInfo(containerTag), emptyObject
|
|
51
|
+
var markup = ReactReconciler.mountComponent(componentInstance, transaction, null, ReactNativeContainerInfo(containerTag), emptyObject, 0 /* parentDebugID */
|
|
52
|
+
);
|
|
52
53
|
componentInstance._renderedComponent._topLevelWrapper = componentInstance;
|
|
53
54
|
ReactNativeMount._mountImageIntoNode(markup, containerTag);
|
|
54
55
|
}
|
|
@@ -114,10 +115,6 @@ var ReactNativeMount = {
|
|
|
114
115
|
// according to the current batching strategy.
|
|
115
116
|
|
|
116
117
|
ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, instance, containerTag);
|
|
117
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
118
|
-
// The instance here is TopLevelWrapper so we report mount for its child.
|
|
119
|
-
ReactInstrumentation.debugTool.onMountRootComponent(instance._renderedComponent._debugID);
|
|
120
|
-
}
|
|
121
118
|
var component = instance.getPublicInstance();
|
|
122
119
|
if (callback) {
|
|
123
120
|
callback.call(component);
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
var _prodInvariant = require('./reactProdInvariant'),
|
|
15
15
|
_assign = require('object-assign');
|
|
16
16
|
|
|
17
|
-
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
18
17
|
var ReactNativeComponentTree = require('./ReactNativeComponentTree');
|
|
19
18
|
var ReactNativeTagHandles = require('./ReactNativeTagHandles');
|
|
20
19
|
var UIManager = require('react-native/lib/UIManager');
|
|
@@ -26,16 +25,12 @@ var ReactNativeTextComponent = function (text) {
|
|
|
26
25
|
this._currentElement = text;
|
|
27
26
|
this._stringText = '' + text;
|
|
28
27
|
this._hostParent = null;
|
|
29
|
-
this._rootNodeID =
|
|
28
|
+
this._rootNodeID = 0;
|
|
30
29
|
};
|
|
31
30
|
|
|
32
31
|
_assign(ReactNativeTextComponent.prototype, {
|
|
33
32
|
|
|
34
33
|
mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
|
|
35
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
36
|
-
ReactInstrumentation.debugTool.onSetText(this._debugID, this._stringText);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
34
|
// TODO: hostParent should have this context already. Stop abusing context.
|
|
40
35
|
!context.isInAParentText ? process.env.NODE_ENV !== 'production' ? invariant(false, 'RawText "%s" must be wrapped in an explicit <Text> component.', this._stringText) : _prodInvariant('20', this._stringText) : void 0;
|
|
41
36
|
this._hostParent = hostParent;
|
|
@@ -60,9 +55,6 @@ _assign(ReactNativeTextComponent.prototype, {
|
|
|
60
55
|
if (nextStringText !== this._stringText) {
|
|
61
56
|
this._stringText = nextStringText;
|
|
62
57
|
UIManager.updateView(this._rootNodeID, 'RCTRawText', { text: this._stringText });
|
|
63
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
64
|
-
ReactInstrumentation.debugTool.onSetText(this._debugID, nextStringText);
|
|
65
|
-
}
|
|
66
58
|
}
|
|
67
59
|
}
|
|
68
60
|
},
|
|
@@ -71,7 +63,7 @@ _assign(ReactNativeTextComponent.prototype, {
|
|
|
71
63
|
ReactNativeComponentTree.uncacheNode(this);
|
|
72
64
|
this._currentElement = null;
|
|
73
65
|
this._stringText = null;
|
|
74
|
-
this._rootNodeID =
|
|
66
|
+
this._rootNodeID = 0;
|
|
75
67
|
}
|
|
76
68
|
|
|
77
69
|
});
|
package/lib/ReactPropTypes.js
CHANGED
|
@@ -185,9 +185,11 @@ function createArrayOfTypeChecker(typeChecker) {
|
|
|
185
185
|
|
|
186
186
|
function createElementTypeChecker() {
|
|
187
187
|
function validate(props, propName, componentName, location, propFullName) {
|
|
188
|
-
|
|
188
|
+
var propValue = props[propName];
|
|
189
|
+
if (!ReactElement.isValidElement(propValue)) {
|
|
189
190
|
var locationName = ReactPropTypeLocationNames[location];
|
|
190
|
-
|
|
191
|
+
var propType = getPropType(propValue);
|
|
192
|
+
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
191
193
|
}
|
|
192
194
|
return null;
|
|
193
195
|
}
|
package/lib/ReactReconciler.js
CHANGED
|
@@ -37,20 +37,19 @@ var ReactReconciler = {
|
|
|
37
37
|
* @final
|
|
38
38
|
* @internal
|
|
39
39
|
*/
|
|
40
|
-
mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context
|
|
40
|
+
mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID // 0 in production and for roots
|
|
41
|
+
) {
|
|
41
42
|
if (process.env.NODE_ENV !== 'production') {
|
|
42
43
|
if (internalInstance._debugID !== 0) {
|
|
43
|
-
ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement);
|
|
44
|
-
ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'mountComponent');
|
|
44
|
+
ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context);
|
|
47
|
+
var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context, parentDebugID);
|
|
48
48
|
if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
|
|
49
49
|
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
|
|
50
50
|
}
|
|
51
51
|
if (process.env.NODE_ENV !== 'production') {
|
|
52
52
|
if (internalInstance._debugID !== 0) {
|
|
53
|
-
ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'mountComponent');
|
|
54
53
|
ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID);
|
|
55
54
|
}
|
|
56
55
|
}
|
|
@@ -74,14 +73,13 @@ var ReactReconciler = {
|
|
|
74
73
|
unmountComponent: function (internalInstance, safely) {
|
|
75
74
|
if (process.env.NODE_ENV !== 'production') {
|
|
76
75
|
if (internalInstance._debugID !== 0) {
|
|
77
|
-
ReactInstrumentation.debugTool.
|
|
76
|
+
ReactInstrumentation.debugTool.onBeforeUnmountComponent(internalInstance._debugID);
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
|
|
81
80
|
internalInstance.unmountComponent(safely);
|
|
82
81
|
if (process.env.NODE_ENV !== 'production') {
|
|
83
82
|
if (internalInstance._debugID !== 0) {
|
|
84
|
-
ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'unmountComponent');
|
|
85
83
|
ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID);
|
|
86
84
|
}
|
|
87
85
|
}
|
|
@@ -116,7 +114,6 @@ var ReactReconciler = {
|
|
|
116
114
|
if (process.env.NODE_ENV !== 'production') {
|
|
117
115
|
if (internalInstance._debugID !== 0) {
|
|
118
116
|
ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement);
|
|
119
|
-
ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'receiveComponent');
|
|
120
117
|
}
|
|
121
118
|
}
|
|
122
119
|
|
|
@@ -134,7 +131,6 @@ var ReactReconciler = {
|
|
|
134
131
|
|
|
135
132
|
if (process.env.NODE_ENV !== 'production') {
|
|
136
133
|
if (internalInstance._debugID !== 0) {
|
|
137
|
-
ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'receiveComponent');
|
|
138
134
|
ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
|
|
139
135
|
}
|
|
140
136
|
}
|
|
@@ -156,14 +152,12 @@ var ReactReconciler = {
|
|
|
156
152
|
}
|
|
157
153
|
if (process.env.NODE_ENV !== 'production') {
|
|
158
154
|
if (internalInstance._debugID !== 0) {
|
|
159
|
-
ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'performUpdateIfNecessary');
|
|
160
155
|
ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement);
|
|
161
156
|
}
|
|
162
157
|
}
|
|
163
158
|
internalInstance.performUpdateIfNecessary(transaction);
|
|
164
159
|
if (process.env.NODE_ENV !== 'production') {
|
|
165
160
|
if (internalInstance._debugID !== 0) {
|
|
166
|
-
ReactInstrumentation.debugTool.onEndReconcilerTimer(internalInstance._debugID, 'performUpdateIfNecessary');
|
|
167
161
|
ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID);
|
|
168
162
|
}
|
|
169
163
|
}
|