react 15.0.2 → 15.1.0
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 +1545 -918
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +1515 -1339
- package/dist/react.min.js +6 -6
- package/lib/CSSPropertyOperations.js +5 -5
- package/lib/DOMChildrenOperations.js +41 -6
- package/lib/DOMLazyTree.js +15 -3
- package/lib/DOMPropertyOperations.js +22 -13
- package/lib/LinkedStateMixin.js +1 -0
- package/lib/ReactCSSTransitionGroup.js +5 -0
- package/lib/ReactChildren.js +9 -1
- package/lib/ReactClass.js +1 -0
- package/lib/ReactComponentBrowserEnvironment.js +0 -5
- package/lib/ReactComponentTreeDevtool.js +145 -0
- package/lib/ReactComponentWithPureRenderMixin.js +2 -0
- package/lib/ReactCompositeComponent.js +147 -18
- package/lib/ReactDOM.js +1 -4
- package/lib/ReactDOMComponent.js +51 -11
- package/lib/ReactDOMIDOperations.js +0 -5
- package/lib/ReactDOMInput.js +5 -3
- package/lib/ReactDOMTextComponent.js +7 -6
- package/lib/ReactDebugTool.js +188 -10
- package/lib/ReactDefaultInjection.js +0 -9
- package/lib/ReactElement.js +26 -0
- package/lib/ReactFragment.js +5 -2
- package/lib/ReactInjection.js +0 -2
- package/lib/ReactLink.js +3 -0
- package/lib/ReactMount.js +22 -7
- package/lib/ReactMultiChild.js +21 -0
- package/lib/ReactNativeAttributePayload.js +7 -36
- package/lib/{IOSNativeBridgeEventPlugin.js → ReactNativeBridgeEventPlugin.js} +8 -5
- package/lib/ReactNativeDOMIDOperations.js +3 -6
- package/lib/ReactNativeDefaultInjection.js +15 -12
- package/lib/ReactNativeEventEmitter.js +6 -3
- package/lib/{IOSDefaultEventPluginOrder.js → ReactNativeEventPluginOrder.js} +3 -3
- package/lib/ReactNativeMount.js +24 -7
- package/lib/ReactNativeOperationHistoryDevtool.js +37 -0
- package/lib/ReactNativeTextComponent.js +8 -0
- package/lib/ReactPerf.js +397 -75
- package/lib/ReactReconciler.js +46 -5
- package/lib/ReactServerRendering.js +20 -1
- package/lib/ReactServerRenderingTransaction.js +5 -1
- package/lib/ReactTestUtils.js +8 -0
- package/lib/ReactTransitionGroup.js +5 -0
- package/lib/ReactUpdates.js +21 -3
- package/lib/ReactVersion.js +1 -1
- package/lib/ReactWithAddons.js +1 -1
- package/lib/findDOMNode.js +2 -0
- package/lib/instantiateReactComponent.js +34 -1
- package/lib/onlyChild.js +7 -4
- package/lib/shallowCompare.js +1 -0
- package/lib/update.js +4 -0
- package/package.json +2 -2
- package/lib/ReactDebugInstanceMap.js +0 -102
- package/lib/ReactDefaultPerf.js +0 -316
- package/lib/ReactDefaultPerfAnalysis.js +0 -210
package/lib/ReactMount.js
CHANGED
|
@@ -22,7 +22,6 @@ var ReactElement = require('./ReactElement');
|
|
|
22
22
|
var ReactFeatureFlags = require('./ReactFeatureFlags');
|
|
23
23
|
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
24
24
|
var ReactMarkupChecksum = require('./ReactMarkupChecksum');
|
|
25
|
-
var ReactPerf = require('./ReactPerf');
|
|
26
25
|
var ReactReconciler = require('./ReactReconciler');
|
|
27
26
|
var ReactUpdateQueue = require('./ReactUpdateQueue');
|
|
28
27
|
var ReactUpdates = require('./ReactUpdates');
|
|
@@ -260,6 +259,10 @@ var ReactMount = {
|
|
|
260
259
|
* @return {ReactComponent} nextComponent
|
|
261
260
|
*/
|
|
262
261
|
_renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
|
|
262
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
263
|
+
ReactInstrumentation.debugTool.onBeginFlush();
|
|
264
|
+
}
|
|
265
|
+
|
|
263
266
|
// Various parts of our code (such as ReactCompositeComponent's
|
|
264
267
|
// _renderValidatedComponent) assume that calls to render aren't nested;
|
|
265
268
|
// verify that that's the case.
|
|
@@ -270,6 +273,12 @@ var ReactMount = {
|
|
|
270
273
|
ReactBrowserEventEmitter.ensureScrollValueMonitoring();
|
|
271
274
|
var componentInstance = instantiateReactComponent(nextElement);
|
|
272
275
|
|
|
276
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
277
|
+
// Mute future events from the top level wrapper.
|
|
278
|
+
// It is an implementation detail that devtools should not know about.
|
|
279
|
+
componentInstance._debugID = 0;
|
|
280
|
+
}
|
|
281
|
+
|
|
273
282
|
// The initial render is synchronous but any updates that happen during
|
|
274
283
|
// rendering, in componentWillMount or componentDidMount, will be batched
|
|
275
284
|
// according to the current batching strategy.
|
|
@@ -280,7 +289,9 @@ var ReactMount = {
|
|
|
280
289
|
instancesByReactRootID[wrapperID] = componentInstance;
|
|
281
290
|
|
|
282
291
|
if (process.env.NODE_ENV !== 'production') {
|
|
283
|
-
|
|
292
|
+
// The instance here is TopLevelWrapper so we report mount for its child.
|
|
293
|
+
ReactInstrumentation.debugTool.onMountRootComponent(componentInstance._renderedComponent._debugID);
|
|
294
|
+
ReactInstrumentation.debugTool.onEndFlush();
|
|
284
295
|
}
|
|
285
296
|
|
|
286
297
|
return componentInstance;
|
|
@@ -360,6 +371,7 @@ var ReactMount = {
|
|
|
360
371
|
|
|
361
372
|
/**
|
|
362
373
|
* Renders a React component into the DOM in the supplied `container`.
|
|
374
|
+
* See https://facebook.github.io/react/docs/top-level-api.html#reactdom.render
|
|
363
375
|
*
|
|
364
376
|
* If the React component was previously rendered into `container`, this will
|
|
365
377
|
* perform an update on it and only mutate the DOM as necessary to reflect the
|
|
@@ -376,6 +388,7 @@ var ReactMount = {
|
|
|
376
388
|
|
|
377
389
|
/**
|
|
378
390
|
* Unmounts and destroys the React component rendered in the `container`.
|
|
391
|
+
* See https://facebook.github.io/react/docs/top-level-api.html#reactdom.unmountcomponentatnode
|
|
379
392
|
*
|
|
380
393
|
* @param {DOMElement} container DOM element containing a React component.
|
|
381
394
|
* @return {boolean} True if a component was found in and unmounted from
|
|
@@ -467,12 +480,14 @@ var ReactMount = {
|
|
|
467
480
|
setInnerHTML(container, markup);
|
|
468
481
|
ReactDOMComponentTree.precacheNode(instance, container.firstChild);
|
|
469
482
|
}
|
|
483
|
+
|
|
484
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
485
|
+
var nativeNode = ReactDOMComponentTree.getInstanceFromNode(container.firstChild);
|
|
486
|
+
if (nativeNode._debugID !== 0) {
|
|
487
|
+
ReactInstrumentation.debugTool.onNativeOperation(nativeNode._debugID, 'mount', markup.toString());
|
|
488
|
+
}
|
|
489
|
+
}
|
|
470
490
|
}
|
|
471
491
|
};
|
|
472
492
|
|
|
473
|
-
ReactPerf.measureMethods(ReactMount, 'ReactMount', {
|
|
474
|
-
_renderNewRootComponent: '_renderNewRootComponent',
|
|
475
|
-
_mountImageIntoNode: '_mountImageIntoNode'
|
|
476
|
-
});
|
|
477
|
-
|
|
478
493
|
module.exports = ReactMount;
|
package/lib/ReactMultiChild.js
CHANGED
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
14
|
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
|
|
15
|
+
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
15
16
|
var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
|
|
16
17
|
|
|
17
18
|
var ReactCurrentOwner = require('./ReactCurrentOwner');
|
|
18
19
|
var ReactReconciler = require('./ReactReconciler');
|
|
19
20
|
var ReactChildReconciler = require('./ReactChildReconciler');
|
|
20
21
|
|
|
22
|
+
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
21
23
|
var flattenChildren = require('./flattenChildren');
|
|
22
24
|
var invariant = require('fbjs/lib/invariant');
|
|
23
25
|
|
|
@@ -134,6 +136,15 @@ function processQueue(inst, updateQueue) {
|
|
|
134
136
|
ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue);
|
|
135
137
|
}
|
|
136
138
|
|
|
139
|
+
var setChildrenForInstrumentation = emptyFunction;
|
|
140
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
141
|
+
setChildrenForInstrumentation = function (children) {
|
|
142
|
+
ReactInstrumentation.debugTool.onSetChildren(this._debugID, children ? Object.keys(children).map(function (key) {
|
|
143
|
+
return children[key]._debugID;
|
|
144
|
+
}) : []);
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
137
148
|
/**
|
|
138
149
|
* ReactMultiChild are capable of reconciling multiple children.
|
|
139
150
|
*
|
|
@@ -195,6 +206,7 @@ var ReactMultiChild = {
|
|
|
195
206
|
mountChildren: function (nestedChildren, transaction, context) {
|
|
196
207
|
var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
|
|
197
208
|
this._renderedChildren = children;
|
|
209
|
+
|
|
198
210
|
var mountImages = [];
|
|
199
211
|
var index = 0;
|
|
200
212
|
for (var name in children) {
|
|
@@ -205,6 +217,11 @@ var ReactMultiChild = {
|
|
|
205
217
|
mountImages.push(mountImage);
|
|
206
218
|
}
|
|
207
219
|
}
|
|
220
|
+
|
|
221
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
222
|
+
setChildrenForInstrumentation.call(this, children);
|
|
223
|
+
}
|
|
224
|
+
|
|
208
225
|
return mountImages;
|
|
209
226
|
},
|
|
210
227
|
|
|
@@ -311,6 +328,10 @@ var ReactMultiChild = {
|
|
|
311
328
|
processQueue(this, updates);
|
|
312
329
|
}
|
|
313
330
|
this._renderedChildren = nextChildren;
|
|
331
|
+
|
|
332
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
333
|
+
setChildrenForInstrumentation.call(this, nextChildren);
|
|
334
|
+
}
|
|
314
335
|
},
|
|
315
336
|
|
|
316
337
|
/**
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
*/
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var Platform = require('Platform');
|
|
15
14
|
var ReactNativePropRegistry = require('./ReactNativePropRegistry');
|
|
16
15
|
|
|
17
16
|
var deepDiffer = require('deepDiffer');
|
|
@@ -35,21 +34,6 @@ var emptyObject = {};
|
|
|
35
34
|
var removedKeys = null;
|
|
36
35
|
var removedKeyCount = 0;
|
|
37
36
|
|
|
38
|
-
function translateKey(propKey) {
|
|
39
|
-
if (propKey === 'transform') {
|
|
40
|
-
// We currently special case the key for `transform`. iOS uses the
|
|
41
|
-
// transformMatrix name and Android uses the decomposedMatrix name.
|
|
42
|
-
// TODO: We could unify these names and just use the name `transform`
|
|
43
|
-
// all the time. Just need to update the native side.
|
|
44
|
-
if (Platform.OS === 'android') {
|
|
45
|
-
return 'decomposedMatrix';
|
|
46
|
-
} else {
|
|
47
|
-
return 'transformMatrix';
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return propKey;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
37
|
function defaultDiffer(prevProp, nextProp) {
|
|
54
38
|
if (typeof nextProp !== 'object' || nextProp === null) {
|
|
55
39
|
// Scalars have already been checked for equality
|
|
@@ -224,7 +208,6 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
|
|
|
224
208
|
var attributeConfig;
|
|
225
209
|
var nextProp;
|
|
226
210
|
var prevProp;
|
|
227
|
-
var altKey;
|
|
228
211
|
|
|
229
212
|
for (var propKey in nextProps) {
|
|
230
213
|
attributeConfig = validAttributes[propKey];
|
|
@@ -232,12 +215,6 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
|
|
|
232
215
|
continue; // not a valid native prop
|
|
233
216
|
}
|
|
234
217
|
|
|
235
|
-
altKey = translateKey(propKey);
|
|
236
|
-
if (!validAttributes[altKey]) {
|
|
237
|
-
// If there is no config for the alternative, bail out. Helps ART.
|
|
238
|
-
altKey = propKey;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
218
|
prevProp = prevProps[propKey];
|
|
242
219
|
nextProp = nextProps[propKey];
|
|
243
220
|
|
|
@@ -265,7 +242,7 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
|
|
|
265
242
|
removedKeys[propKey] = false;
|
|
266
243
|
}
|
|
267
244
|
|
|
268
|
-
if (updatePayload && updatePayload[
|
|
245
|
+
if (updatePayload && updatePayload[propKey] !== undefined) {
|
|
269
246
|
// Something else already triggered an update to this key because another
|
|
270
247
|
// value diffed. Since we're now later in the nested arrays our value is
|
|
271
248
|
// more important so we need to calculate it and override the existing
|
|
@@ -274,11 +251,11 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
|
|
|
274
251
|
// Pattern match on: attributeConfig
|
|
275
252
|
if (typeof attributeConfig !== 'object') {
|
|
276
253
|
// case: !Object is the default case
|
|
277
|
-
updatePayload[
|
|
254
|
+
updatePayload[propKey] = nextProp;
|
|
278
255
|
} else if (typeof attributeConfig.diff === 'function' || typeof attributeConfig.process === 'function') {
|
|
279
256
|
// case: CustomAttributeConfiguration
|
|
280
257
|
var nextValue = typeof attributeConfig.process === 'function' ? attributeConfig.process(nextProp) : nextProp;
|
|
281
|
-
updatePayload[
|
|
258
|
+
updatePayload[propKey] = nextValue;
|
|
282
259
|
}
|
|
283
260
|
continue;
|
|
284
261
|
}
|
|
@@ -292,14 +269,14 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
|
|
|
292
269
|
// case: !Object is the default case
|
|
293
270
|
if (defaultDiffer(prevProp, nextProp)) {
|
|
294
271
|
// a normal leaf has changed
|
|
295
|
-
(updatePayload || (updatePayload = {}))[
|
|
272
|
+
(updatePayload || (updatePayload = {}))[propKey] = nextProp;
|
|
296
273
|
}
|
|
297
274
|
} else if (typeof attributeConfig.diff === 'function' || typeof attributeConfig.process === 'function') {
|
|
298
275
|
// case: CustomAttributeConfiguration
|
|
299
276
|
var shouldUpdate = prevProp === undefined || (typeof attributeConfig.diff === 'function' ? attributeConfig.diff(prevProp, nextProp) : defaultDiffer(prevProp, nextProp));
|
|
300
277
|
if (shouldUpdate) {
|
|
301
278
|
nextValue = typeof attributeConfig.process === 'function' ? attributeConfig.process(nextProp) : nextProp;
|
|
302
|
-
(updatePayload || (updatePayload = {}))[
|
|
279
|
+
(updatePayload || (updatePayload = {}))[propKey] = nextValue;
|
|
303
280
|
}
|
|
304
281
|
} else {
|
|
305
282
|
// default: fallthrough case when nested properties are defined
|
|
@@ -325,13 +302,7 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
|
|
|
325
302
|
continue; // not a valid native prop
|
|
326
303
|
}
|
|
327
304
|
|
|
328
|
-
|
|
329
|
-
if (!attributeConfig[altKey]) {
|
|
330
|
-
// If there is no config for the alternative, bail out. Helps ART.
|
|
331
|
-
altKey = propKey;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
if (updatePayload && updatePayload[altKey] !== undefined) {
|
|
305
|
+
if (updatePayload && updatePayload[propKey] !== undefined) {
|
|
335
306
|
// This was already updated to a diff result earlier.
|
|
336
307
|
continue;
|
|
337
308
|
}
|
|
@@ -345,7 +316,7 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
|
|
|
345
316
|
|
|
346
317
|
// case: CustomAttributeConfiguration | !Object
|
|
347
318
|
// Flag the leaf property for removal by sending a sentinel.
|
|
348
|
-
(updatePayload || (updatePayload = {}))[
|
|
319
|
+
(updatePayload || (updatePayload = {}))[propKey] = null;
|
|
349
320
|
if (!removedKeys) {
|
|
350
321
|
removedKeys = {};
|
|
351
322
|
}
|
|
@@ -6,16 +6,19 @@
|
|
|
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 ReactNativeBridgeEventPlugin
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _assign = require('object-assign');
|
|
15
|
+
|
|
16
|
+
var _extends = _assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
17
|
+
|
|
14
18
|
var EventPropagators = require('./EventPropagators');
|
|
15
19
|
var SyntheticEvent = require('./SyntheticEvent');
|
|
16
20
|
var UIManager = require('UIManager');
|
|
17
21
|
|
|
18
|
-
var merge = require('merge');
|
|
19
22
|
var warning = require('fbjs/lib/warning');
|
|
20
23
|
|
|
21
24
|
var customBubblingEventTypes = UIManager.customBubblingEventTypes;
|
|
@@ -32,9 +35,9 @@ for (var directTypeName in customDirectEventTypes) {
|
|
|
32
35
|
allTypesByEventName[directTypeName] = customDirectEventTypes[directTypeName];
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
var
|
|
38
|
+
var ReactNativeBridgeEventPlugin = {
|
|
36
39
|
|
|
37
|
-
eventTypes:
|
|
40
|
+
eventTypes: _extends({}, customBubblingEventTypes, customDirectEventTypes),
|
|
38
41
|
|
|
39
42
|
/**
|
|
40
43
|
* @see {EventPluginHub.extractEvents}
|
|
@@ -54,4 +57,4 @@ var IOSNativeBridgeEventPlugin = {
|
|
|
54
57
|
}
|
|
55
58
|
};
|
|
56
59
|
|
|
57
|
-
module.exports =
|
|
60
|
+
module.exports = ReactNativeBridgeEventPlugin;
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
|
|
14
14
|
var ReactNativeComponentTree = require('./ReactNativeComponentTree');
|
|
15
15
|
var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
|
|
16
|
-
var ReactPerf = require('./ReactPerf');
|
|
17
16
|
var UIManager = require('UIManager');
|
|
18
17
|
|
|
19
18
|
/**
|
|
@@ -64,9 +63,7 @@ var dangerouslyProcessChildrenUpdates = function (inst, childrenUpdates) {
|
|
|
64
63
|
* `ReactComponent.DOMIDOperations`.
|
|
65
64
|
*/
|
|
66
65
|
var ReactNativeDOMIDOperations = {
|
|
67
|
-
dangerouslyProcessChildrenUpdates:
|
|
68
|
-
// FIXME(frantic): #4441289 Hack to avoid modifying react-tools
|
|
69
|
-
'ReactDOMIDOperations', 'dangerouslyProcessChildrenUpdates', dangerouslyProcessChildrenUpdates),
|
|
66
|
+
dangerouslyProcessChildrenUpdates: dangerouslyProcessChildrenUpdates,
|
|
70
67
|
|
|
71
68
|
/**
|
|
72
69
|
* Replaces a view that exists in the document with markup.
|
|
@@ -74,10 +71,10 @@ var ReactNativeDOMIDOperations = {
|
|
|
74
71
|
* @param {string} id ID of child to be replaced.
|
|
75
72
|
* @param {string} markup Mount image to replace child with id.
|
|
76
73
|
*/
|
|
77
|
-
dangerouslyReplaceNodeWithMarkupByID:
|
|
74
|
+
dangerouslyReplaceNodeWithMarkupByID: function (id, mountImage) {
|
|
78
75
|
var oldTag = id;
|
|
79
76
|
UIManager.replaceExistingNonRootView(oldTag, mountImage);
|
|
80
|
-
}
|
|
77
|
+
}
|
|
81
78
|
};
|
|
82
79
|
|
|
83
80
|
module.exports = ReactNativeDOMIDOperations;
|
|
@@ -15,40 +15,43 @@
|
|
|
15
15
|
* Make sure essential globals are available and are patched correctly. Please don't remove this
|
|
16
16
|
* line. Bundles created by react-packager `require` it before executing any application code. This
|
|
17
17
|
* ensures it exists in the dependency graph and can be `require`d.
|
|
18
|
+
* TODO: require this in packager, not in React #10932517
|
|
18
19
|
*/
|
|
19
20
|
|
|
20
21
|
require('InitializeJavaScriptAppEngine');
|
|
21
22
|
|
|
22
23
|
var EventPluginHub = require('./EventPluginHub');
|
|
23
24
|
var EventPluginUtils = require('./EventPluginUtils');
|
|
24
|
-
var
|
|
25
|
-
var IOSNativeBridgeEventPlugin = require('./IOSNativeBridgeEventPlugin');
|
|
26
|
-
var ReactElement = require('./ReactElement');
|
|
25
|
+
var RCTEventEmitter = require('RCTEventEmitter');
|
|
27
26
|
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
|
|
28
27
|
var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
|
|
28
|
+
var ReactElement = require('./ReactElement');
|
|
29
29
|
var ReactEmptyComponent = require('./ReactEmptyComponent');
|
|
30
|
+
var ReactNativeBridgeEventPlugin = require('./ReactNativeBridgeEventPlugin');
|
|
31
|
+
var ReactNativeComponent = require('./ReactNativeComponent');
|
|
30
32
|
var ReactNativeComponentEnvironment = require('./ReactNativeComponentEnvironment');
|
|
33
|
+
var ReactNativeComponentTree = require('./ReactNativeComponentTree');
|
|
34
|
+
var ReactNativeEventEmitter = require('./ReactNativeEventEmitter');
|
|
35
|
+
var ReactNativeEventPluginOrder = require('./ReactNativeEventPluginOrder');
|
|
31
36
|
var ReactNativeGlobalResponderHandler = require('./ReactNativeGlobalResponderHandler');
|
|
32
37
|
var ReactNativeTextComponent = require('./ReactNativeTextComponent');
|
|
33
38
|
var ReactNativeTreeTraversal = require('./ReactNativeTreeTraversal');
|
|
34
|
-
var ReactNativeComponent = require('./ReactNativeComponent');
|
|
35
|
-
var ReactNativeComponentTree = require('./ReactNativeComponentTree');
|
|
36
39
|
var ReactSimpleEmptyComponent = require('./ReactSimpleEmptyComponent');
|
|
37
40
|
var ReactUpdates = require('./ReactUpdates');
|
|
38
41
|
var ResponderEventPlugin = require('./ResponderEventPlugin');
|
|
39
42
|
|
|
40
43
|
var invariant = require('fbjs/lib/invariant');
|
|
41
44
|
|
|
42
|
-
// Just to ensure this gets packaged, since its only caller is from Native.
|
|
43
|
-
require('RCTEventEmitter');
|
|
44
|
-
require('RCTLog');
|
|
45
|
-
require('JSTimersExecution');
|
|
46
|
-
|
|
47
45
|
function inject() {
|
|
46
|
+
/**
|
|
47
|
+
* Register the event emitter with the native bridge
|
|
48
|
+
*/
|
|
49
|
+
RCTEventEmitter.register(ReactNativeEventEmitter);
|
|
50
|
+
|
|
48
51
|
/**
|
|
49
52
|
* Inject module for resolving DOM hierarchy and plugin ordering.
|
|
50
53
|
*/
|
|
51
|
-
EventPluginHub.injection.injectEventPluginOrder(
|
|
54
|
+
EventPluginHub.injection.injectEventPluginOrder(ReactNativeEventPluginOrder);
|
|
52
55
|
EventPluginUtils.injection.injectComponentTree(ReactNativeComponentTree);
|
|
53
56
|
EventPluginUtils.injection.injectTreeTraversal(ReactNativeTreeTraversal);
|
|
54
57
|
|
|
@@ -60,7 +63,7 @@ function inject() {
|
|
|
60
63
|
*/
|
|
61
64
|
EventPluginHub.injection.injectEventPluginsByName({
|
|
62
65
|
'ResponderEventPlugin': ResponderEventPlugin,
|
|
63
|
-
'
|
|
66
|
+
'ReactNativeBridgeEventPlugin': ReactNativeBridgeEventPlugin
|
|
64
67
|
});
|
|
65
68
|
|
|
66
69
|
ReactUpdates.injection.injectReconcileTransaction(ReactNativeComponentEnvironment.ReactReconcileTransaction);
|
|
@@ -11,15 +11,18 @@
|
|
|
11
11
|
*/
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _assign = require('object-assign');
|
|
15
|
+
|
|
16
|
+
var _extends = _assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
17
|
+
|
|
18
|
+
var EventConstants = require('./EventConstants');
|
|
14
19
|
var EventPluginHub = require('./EventPluginHub');
|
|
15
20
|
var EventPluginRegistry = require('./EventPluginRegistry');
|
|
16
21
|
var ReactEventEmitterMixin = require('./ReactEventEmitterMixin');
|
|
17
22
|
var ReactNativeComponentTree = require('./ReactNativeComponentTree');
|
|
18
23
|
var ReactNativeTagHandles = require('./ReactNativeTagHandles');
|
|
19
24
|
var ReactUpdates = require('./ReactUpdates');
|
|
20
|
-
var EventConstants = require('./EventConstants');
|
|
21
25
|
|
|
22
|
-
var merge = require('merge');
|
|
23
26
|
var warning = require('fbjs/lib/warning');
|
|
24
27
|
|
|
25
28
|
var topLevelTypes = EventConstants.topLevelTypes;
|
|
@@ -88,7 +91,7 @@ var removeTouchesAtIndices = function (touches, indices) {
|
|
|
88
91
|
*
|
|
89
92
|
* @internal
|
|
90
93
|
*/
|
|
91
|
-
var ReactNativeEventEmitter =
|
|
94
|
+
var ReactNativeEventEmitter = _extends({}, ReactEventEmitterMixin, {
|
|
92
95
|
|
|
93
96
|
registrationNames: EventPluginRegistry.registrationNameModules,
|
|
94
97
|
|
|
@@ -6,11 +6,11 @@
|
|
|
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 ReactNativeEventPluginOrder
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var ReactNativeEventPluginOrder = ['ResponderEventPlugin', 'ReactNativeBridgeEventPlugin'];
|
|
15
15
|
|
|
16
|
-
module.exports =
|
|
16
|
+
module.exports = ReactNativeEventPluginOrder;
|
package/lib/ReactNativeMount.js
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
14
|
var ReactElement = require('./ReactElement');
|
|
15
|
+
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
15
16
|
var ReactNativeContainerInfo = require('./ReactNativeContainerInfo');
|
|
16
17
|
var ReactNativeTagHandles = require('./ReactNativeTagHandles');
|
|
17
|
-
var ReactPerf = require('./ReactPerf');
|
|
18
18
|
var ReactReconciler = require('./ReactReconciler');
|
|
19
19
|
var ReactUpdateQueue = require('./ReactUpdateQueue');
|
|
20
20
|
var ReactUpdates = require('./ReactUpdates');
|
|
@@ -109,11 +109,26 @@ var ReactNativeMount = {
|
|
|
109
109
|
var instance = instantiateReactComponent(nextWrappedElement);
|
|
110
110
|
ReactNativeMount._instancesByContainerID[containerTag] = instance;
|
|
111
111
|
|
|
112
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
113
|
+
// Mute future events from the top level wrapper.
|
|
114
|
+
// It is an implementation detail that devtools should not know about.
|
|
115
|
+
instance._debugID = 0;
|
|
116
|
+
|
|
117
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
118
|
+
ReactInstrumentation.debugTool.onBeginFlush();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
112
122
|
// The initial render is synchronous but any updates that happen during
|
|
113
123
|
// rendering, in componentWillMount or componentDidMount, will be batched
|
|
114
124
|
// according to the current batching strategy.
|
|
115
125
|
|
|
116
126
|
ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, instance, containerTag);
|
|
127
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
128
|
+
// The instance here is TopLevelWrapper so we report mount for its child.
|
|
129
|
+
ReactInstrumentation.debugTool.onMountRootComponent(instance._renderedComponent._debugID);
|
|
130
|
+
ReactInstrumentation.debugTool.onEndFlush();
|
|
131
|
+
}
|
|
117
132
|
var component = instance.getPublicInstance();
|
|
118
133
|
if (callback) {
|
|
119
134
|
callback.call(component);
|
|
@@ -125,14 +140,12 @@ var ReactNativeMount = {
|
|
|
125
140
|
* @param {View} view View tree image.
|
|
126
141
|
* @param {number} containerViewID View to insert sub-view into.
|
|
127
142
|
*/
|
|
128
|
-
_mountImageIntoNode:
|
|
129
|
-
// FIXME(frantic): #4441289 Hack to avoid modifying react-tools
|
|
130
|
-
'ReactComponentBrowserEnvironment', 'mountImageIntoNode', function (mountImage, containerID) {
|
|
143
|
+
_mountImageIntoNode: function (mountImage, containerID) {
|
|
131
144
|
// Since we now know that the `mountImage` has been mounted, we can
|
|
132
145
|
// mark it as such.
|
|
133
146
|
var childTag = mountImage;
|
|
134
147
|
UIManager.setChildren(containerID, [childTag]);
|
|
135
|
-
}
|
|
148
|
+
},
|
|
136
149
|
|
|
137
150
|
/**
|
|
138
151
|
* Standard unmounting of the component that is rendered into `containerID`,
|
|
@@ -163,8 +176,14 @@ var ReactNativeMount = {
|
|
|
163
176
|
if (!instance) {
|
|
164
177
|
return false;
|
|
165
178
|
}
|
|
179
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
180
|
+
ReactInstrumentation.debugTool.onBeginFlush();
|
|
181
|
+
}
|
|
166
182
|
ReactNativeMount.unmountComponentFromNode(instance, containerTag);
|
|
167
183
|
delete ReactNativeMount._instancesByContainerID[containerTag];
|
|
184
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
185
|
+
ReactInstrumentation.debugTool.onEndFlush();
|
|
186
|
+
}
|
|
168
187
|
return true;
|
|
169
188
|
},
|
|
170
189
|
|
|
@@ -185,6 +204,4 @@ var ReactNativeMount = {
|
|
|
185
204
|
|
|
186
205
|
};
|
|
187
206
|
|
|
188
|
-
ReactNativeMount.renderComponent = ReactPerf.measure('ReactMount', '_renderNewRootComponent', ReactNativeMount.renderComponent);
|
|
189
|
-
|
|
190
207
|
module.exports = ReactNativeMount;
|