react 15.0.3-alpha.1 → 15.2.0-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.
Files changed (122) hide show
  1. package/dist/react-with-addons.js +3311 -2007
  2. package/dist/react-with-addons.min.js +7 -6
  3. package/dist/react.js +2734 -2014
  4. package/dist/react.min.js +6 -6
  5. package/lib/CSSPropertyOperations.js +5 -5
  6. package/lib/CallbackQueue.js +3 -2
  7. package/lib/DOMChildrenOperations.js +42 -7
  8. package/lib/DOMLazyTree.js +18 -5
  9. package/lib/DOMProperty.js +6 -4
  10. package/lib/DOMPropertyOperations.js +35 -12
  11. package/lib/Danger.js +10 -8
  12. package/lib/DisabledInputUtils.js +5 -5
  13. package/lib/EventPluginHub.js +8 -2
  14. package/lib/EventPluginRegistry.js +13 -7
  15. package/lib/EventPluginUtils.js +3 -1
  16. package/lib/HTMLDOMPropertyConfig.js +1 -2
  17. package/lib/LinkedStateMixin.js +1 -0
  18. package/lib/LinkedValueUtils.js +5 -3
  19. package/lib/NativeMethodsMixin.js +6 -4
  20. package/lib/PooledClass.js +3 -1
  21. package/lib/React.js +1 -1
  22. package/lib/ReactCSSTransitionGroup.js +5 -0
  23. package/lib/ReactCSSTransitionGroupChild.js +15 -8
  24. package/lib/ReactChildReconciler.js +15 -6
  25. package/lib/ReactChildren.js +9 -1
  26. package/lib/ReactClass.js +15 -13
  27. package/lib/ReactComponent.js +3 -6
  28. package/lib/ReactComponentBrowserEnvironment.js +0 -5
  29. package/lib/ReactComponentEnvironment.js +3 -1
  30. package/lib/ReactComponentTreeDevtool.js +223 -0
  31. package/lib/ReactComponentTreeTestUtils.js +87 -0
  32. package/lib/ReactComponentWithPureRenderMixin.js +2 -0
  33. package/lib/ReactCompositeComponent.js +208 -119
  34. package/lib/ReactDOM.js +3 -6
  35. package/lib/ReactDOMButton.js +2 -2
  36. package/lib/ReactDOMComponent.js +165 -71
  37. package/lib/ReactDOMComponentTree.js +23 -21
  38. package/lib/ReactDOMDebugTool.js +7 -1
  39. package/lib/ReactDOMEmptyComponent.js +9 -9
  40. package/lib/ReactDOMFactories.js +1 -1
  41. package/lib/ReactDOMIDOperations.js +0 -5
  42. package/lib/ReactDOMInput.js +57 -19
  43. package/lib/ReactDOMOption.js +40 -26
  44. package/lib/ReactDOMSelect.js +3 -3
  45. package/lib/ReactDOMTextComponent.js +28 -26
  46. package/lib/ReactDOMTextarea.js +59 -32
  47. package/lib/ReactDOMTreeTraversal.js +18 -16
  48. package/lib/ReactDOMUnknownPropertyDevtool.js +41 -15
  49. package/lib/ReactDebugTool.js +250 -11
  50. package/lib/ReactDefaultInjection.js +2 -11
  51. package/lib/ReactElement.js +90 -25
  52. package/lib/ReactElementValidator.js +26 -81
  53. package/lib/ReactEventListener.js +2 -2
  54. package/lib/ReactFragment.js +8 -3
  55. package/lib/{ReactNativeComponent.js → ReactHostComponent.js} +10 -29
  56. package/lib/ReactHostOperationHistoryDevtool.js +37 -0
  57. package/lib/ReactInjection.js +2 -4
  58. package/lib/ReactInstanceHandles.js +8 -6
  59. package/lib/ReactLink.js +3 -0
  60. package/lib/ReactMount.js +43 -20
  61. package/lib/ReactMultiChild.js +51 -8
  62. package/lib/ReactNativeAttributePayload.js +5 -2
  63. package/lib/ReactNativeBaseComponent.js +7 -7
  64. package/lib/ReactNativeBridgeEventPlugin.js +1 -1
  65. package/lib/ReactNativeComponentTree.js +8 -6
  66. package/lib/ReactNativeDOMIDOperations.js +4 -8
  67. package/lib/ReactNativeDefaultInjection.js +9 -7
  68. package/lib/ReactNativeGlobalResponderHandler.js +1 -1
  69. package/lib/ReactNativeMount.js +25 -8
  70. package/lib/ReactNativeTagHandles.js +3 -1
  71. package/lib/ReactNativeTextComponent.js +18 -9
  72. package/lib/ReactNativeTreeTraversal.js +11 -11
  73. package/lib/ReactNodeTypes.js +5 -3
  74. package/lib/ReactNoop.js +76 -0
  75. package/lib/ReactOwner.js +4 -2
  76. package/lib/ReactPerf.js +473 -75
  77. package/lib/ReactPropTypes.js +23 -0
  78. package/lib/ReactReconcileTransaction.js +1 -1
  79. package/lib/ReactReconciler.js +57 -11
  80. package/lib/ReactServerRendering.js +24 -3
  81. package/lib/ReactServerRenderingTransaction.js +5 -1
  82. package/lib/ReactSimpleEmptyComponent.js +4 -4
  83. package/lib/ReactTestMount.js +126 -0
  84. package/lib/ReactTestReconcileTransaction.js +100 -0
  85. package/lib/ReactTestRenderer.js +133 -0
  86. package/lib/ReactTestUtils.js +25 -10
  87. package/lib/ReactTransitionChildMapping.js +7 -1
  88. package/lib/ReactTransitionGroup.js +44 -5
  89. package/lib/ReactUpdateQueue.js +9 -1
  90. package/lib/ReactUpdates.js +30 -11
  91. package/lib/ReactVersion.js +1 -1
  92. package/lib/ReactWithAddons.js +1 -1
  93. package/lib/ResponderEventPlugin.js +8 -6
  94. package/lib/ResponderTouchHistoryStore.js +6 -4
  95. package/lib/SimpleEventPlugin.js +3 -1
  96. package/lib/SyntheticEvent.js +2 -3
  97. package/lib/SyntheticUIEvent.js +1 -1
  98. package/lib/Transaction.js +4 -2
  99. package/lib/accumulate.js +3 -1
  100. package/lib/accumulateInto.js +3 -1
  101. package/lib/checkReactTypeSpec.js +71 -0
  102. package/lib/createReactNativeComponentClass.js +2 -2
  103. package/lib/dangerousStyleValue.js +3 -1
  104. package/lib/escapeTextContentForBrowser.js +96 -12
  105. package/lib/findDOMNode.js +8 -4
  106. package/lib/findNodeHandle.js +5 -3
  107. package/lib/flattenChildren.js +13 -4
  108. package/lib/{getNativeComponentFromComposite.js → getHostComponentFromComposite.js} +4 -4
  109. package/lib/instantiateReactComponent.js +44 -10
  110. package/lib/onlyChild.js +10 -5
  111. package/lib/reactComponentExpect.js +3 -3
  112. package/lib/reactProdInvariant.js +38 -0
  113. package/lib/setInnerHTML.js +17 -1
  114. package/lib/setTextContent.js +8 -0
  115. package/lib/shallowCompare.js +1 -0
  116. package/lib/traverseAllChildren.js +3 -1
  117. package/lib/update.js +16 -11
  118. package/package.json +2 -2
  119. package/lib/MetaMatchers.js +0 -118
  120. package/lib/ReactDebugInstanceMap.js +0 -102
  121. package/lib/ReactDefaultPerf.js +0 -316
  122. package/lib/ReactDefaultPerfAnalysis.js +0 -210
@@ -11,13 +11,18 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var ReactComponentEnvironment = require('./ReactComponentEnvironment');
17
+ var ReactInstanceMap = require('./ReactInstanceMap');
18
+ var ReactInstrumentation = require('./ReactInstrumentation');
15
19
  var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
16
20
 
17
21
  var ReactCurrentOwner = require('./ReactCurrentOwner');
18
22
  var ReactReconciler = require('./ReactReconciler');
19
23
  var ReactChildReconciler = require('./ReactChildReconciler');
20
24
 
25
+ var emptyFunction = require('fbjs/lib/emptyFunction');
21
26
  var flattenChildren = require('./flattenChildren');
22
27
  var invariant = require('fbjs/lib/invariant');
23
28
 
@@ -53,7 +58,7 @@ function makeMove(child, afterNode, toIndex) {
53
58
  type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
54
59
  content: null,
55
60
  fromIndex: child._mountIndex,
56
- fromNode: ReactReconciler.getNativeNode(child),
61
+ fromNode: ReactReconciler.getHostNode(child),
57
62
  toIndex: toIndex,
58
63
  afterNode: afterNode
59
64
  };
@@ -134,6 +139,31 @@ function processQueue(inst, updateQueue) {
134
139
  ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue);
135
140
  }
136
141
 
142
+ var setParentForInstrumentation = emptyFunction;
143
+ var setChildrenForInstrumentation = emptyFunction;
144
+ if (process.env.NODE_ENV !== 'production') {
145
+ var getDebugID = function (inst) {
146
+ if (!inst._debugID) {
147
+ // Check for ART-like instances. TODO: This is silly/gross.
148
+ var internal;
149
+ if (internal = ReactInstanceMap.get(inst)) {
150
+ inst = internal;
151
+ }
152
+ }
153
+ return inst._debugID;
154
+ };
155
+ setParentForInstrumentation = function (child) {
156
+ if (child._debugID !== 0) {
157
+ ReactInstrumentation.debugTool.onSetParent(child._debugID, getDebugID(this));
158
+ }
159
+ };
160
+ setChildrenForInstrumentation = function (children) {
161
+ ReactInstrumentation.debugTool.onSetChildren(getDebugID(this), children ? Object.keys(children).map(function (key) {
162
+ return children[key]._debugID;
163
+ }) : []);
164
+ };
165
+ }
166
+
137
167
  /**
138
168
  * ReactMultiChild are capable of reconciling multiple children.
139
169
  *
@@ -156,7 +186,7 @@ var ReactMultiChild = {
156
186
  if (this._currentElement) {
157
187
  try {
158
188
  ReactCurrentOwner.current = this._currentElement._owner;
159
- return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
189
+ return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context, this._debugID);
160
190
  } finally {
161
191
  ReactCurrentOwner.current = null;
162
192
  }
@@ -171,7 +201,7 @@ var ReactMultiChild = {
171
201
  if (this._currentElement) {
172
202
  try {
173
203
  ReactCurrentOwner.current = this._currentElement._owner;
174
- nextChildren = flattenChildren(nextNestedChildrenElements);
204
+ nextChildren = flattenChildren(nextNestedChildrenElements, this._debugID);
175
205
  } finally {
176
206
  ReactCurrentOwner.current = null;
177
207
  }
@@ -195,16 +225,25 @@ var ReactMultiChild = {
195
225
  mountChildren: function (nestedChildren, transaction, context) {
196
226
  var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
197
227
  this._renderedChildren = children;
228
+
198
229
  var mountImages = [];
199
230
  var index = 0;
200
231
  for (var name in children) {
201
232
  if (children.hasOwnProperty(name)) {
202
233
  var child = children[name];
203
- var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._nativeContainerInfo, context);
234
+ if (process.env.NODE_ENV !== 'production') {
235
+ setParentForInstrumentation.call(this, child);
236
+ }
237
+ var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context);
204
238
  child._mountIndex = index++;
205
239
  mountImages.push(mountImage);
206
240
  }
207
241
  }
242
+
243
+ if (process.env.NODE_ENV !== 'production') {
244
+ setChildrenForInstrumentation.call(this, children);
245
+ }
246
+
208
247
  return mountImages;
209
248
  },
210
249
 
@@ -220,7 +259,7 @@ var ReactMultiChild = {
220
259
  ReactChildReconciler.unmountChildren(prevChildren, false);
221
260
  for (var name in prevChildren) {
222
261
  if (prevChildren.hasOwnProperty(name)) {
223
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : invariant(false) : void 0;
262
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
224
263
  }
225
264
  }
226
265
  // Set new text content.
@@ -240,7 +279,7 @@ var ReactMultiChild = {
240
279
  ReactChildReconciler.unmountChildren(prevChildren, false);
241
280
  for (var name in prevChildren) {
242
281
  if (prevChildren.hasOwnProperty(name)) {
243
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : invariant(false) : void 0;
282
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
244
283
  }
245
284
  }
246
285
  var updates = [makeSetMarkup(nextMarkup)];
@@ -299,7 +338,7 @@ var ReactMultiChild = {
299
338
  updates = enqueue(updates, this._mountChildAtIndex(nextChild, lastPlacedNode, nextIndex, transaction, context));
300
339
  }
301
340
  nextIndex++;
302
- lastPlacedNode = ReactReconciler.getNativeNode(nextChild);
341
+ lastPlacedNode = ReactReconciler.getHostNode(nextChild);
303
342
  }
304
343
  // Remove children that are no longer present.
305
344
  for (name in removedNodes) {
@@ -311,6 +350,10 @@ var ReactMultiChild = {
311
350
  processQueue(this, updates);
312
351
  }
313
352
  this._renderedChildren = nextChildren;
353
+
354
+ if (process.env.NODE_ENV !== 'production') {
355
+ setChildrenForInstrumentation.call(this, nextChildren);
356
+ }
314
357
  },
315
358
 
316
359
  /**
@@ -376,7 +419,7 @@ var ReactMultiChild = {
376
419
  * @private
377
420
  */
378
421
  _mountChildAtIndex: function (child, afterNode, index, transaction, context) {
379
- var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._nativeContainerInfo, context);
422
+ var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context);
380
423
  child._mountIndex = index;
381
424
  return this.createChild(child, afterNode, mountImage);
382
425
  },
@@ -13,8 +13,8 @@
13
13
 
14
14
  var ReactNativePropRegistry = require('./ReactNativePropRegistry');
15
15
 
16
- var deepDiffer = require('deepDiffer');
17
- var flattenStyle = require('flattenStyle');
16
+ var deepDiffer = require('react-native/lib/deepDiffer');
17
+ var flattenStyle = require('react-native/lib/flattenStyle');
18
18
 
19
19
  var emptyObject = {};
20
20
 
@@ -282,6 +282,9 @@ function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
282
282
  // default: fallthrough case when nested properties are defined
283
283
  removedKeys = null;
284
284
  removedKeyCount = 0;
285
+ // We think that attributeConfig is not CustomAttributeConfiguration at
286
+ // this point so we assume it must be AttributeConfiguration.
287
+ // $FlowFixMe
285
288
  updatePayload = diffNestedProperty(updatePayload, prevProp, nextProp, attributeConfig);
286
289
  if (removedKeyCount > 0 && updatePayload) {
287
290
  restoreDeletedValuesInNestedArray(updatePayload, nextProp, attributeConfig);
@@ -19,9 +19,9 @@ var ReactNativeComponentTree = require('./ReactNativeComponentTree');
19
19
  var ReactNativeEventEmitter = require('./ReactNativeEventEmitter');
20
20
  var ReactNativeTagHandles = require('./ReactNativeTagHandles');
21
21
  var ReactMultiChild = require('./ReactMultiChild');
22
- var UIManager = require('UIManager');
22
+ var UIManager = require('react-native/lib/UIManager');
23
23
 
24
- var deepFreezeAndThrowOnMutationInDev = require('deepFreezeAndThrowOnMutationInDev');
24
+ var deepFreezeAndThrowOnMutationInDev = require('react-native/lib/deepFreezeAndThrowOnMutationInDev');
25
25
 
26
26
  var registrationNames = ReactNativeEventEmitter.registrationNames;
27
27
  var putListener = ReactNativeEventEmitter.putListener;
@@ -150,7 +150,7 @@ ReactNativeBaseComponent.Mixin = {
150
150
  *
151
151
  * @return {null} Null.
152
152
  */
153
- getNativeNode: function () {
153
+ getHostNode: function () {
154
154
  return this._rootNodeID;
155
155
  },
156
156
 
@@ -159,12 +159,12 @@ ReactNativeBaseComponent.Mixin = {
159
159
  * @param {Transaction} transaction For creating/updating.
160
160
  * @return {string} Unique iOS view tag.
161
161
  */
162
- mountComponent: function (transaction, nativeParent, nativeContainerInfo, context) {
162
+ mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
163
163
  var tag = ReactNativeTagHandles.allocateTag();
164
164
 
165
165
  this._rootNodeID = tag;
166
- this._nativeParent = nativeParent;
167
- this._nativeContainerInfo = nativeContainerInfo;
166
+ this._hostParent = hostParent;
167
+ this._hostContainerInfo = hostContainerInfo;
168
168
 
169
169
  if (process.env.NODE_ENV !== 'production') {
170
170
  for (var key in this.viewConfig.validAttributes) {
@@ -176,7 +176,7 @@ ReactNativeBaseComponent.Mixin = {
176
176
 
177
177
  var updatePayload = ReactNativeAttributePayload.create(this._currentElement.props, this.viewConfig.validAttributes);
178
178
 
179
- var nativeTopRootTag = nativeContainerInfo._tag;
179
+ var nativeTopRootTag = hostContainerInfo._tag;
180
180
  UIManager.createView(tag, this.viewConfig.uiViewClassName, nativeTopRootTag, updatePayload);
181
181
 
182
182
  ReactNativeComponentTree.precacheNode(this, tag);
@@ -17,7 +17,7 @@ var _extends = _assign || function (target) { for (var i = 1; i < arguments.leng
17
17
 
18
18
  var EventPropagators = require('./EventPropagators');
19
19
  var SyntheticEvent = require('./SyntheticEvent');
20
- var UIManager = require('UIManager');
20
+ var UIManager = require('react-native/lib/UIManager');
21
21
 
22
22
  var warning = require('fbjs/lib/warning');
23
23
 
@@ -11,18 +11,20 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var invariant = require('fbjs/lib/invariant');
15
17
 
16
18
  var instanceCache = {};
17
19
 
18
20
  /**
19
- * Drill down (through composites and empty components) until we get a native or
20
- * native text component.
21
+ * Drill down (through composites and empty components) until we get a host or
22
+ * host text component.
21
23
  *
22
24
  * This is pretty polymorphic but unavoidable with the current structure we have
23
25
  * for `_renderedChildren`.
24
26
  */
25
- function getRenderedNativeOrTextFromComponent(component) {
27
+ function getRenderedHostOrTextFromComponent(component) {
26
28
  var rendered;
27
29
  while (rendered = component._renderedComponent) {
28
30
  component = rendered;
@@ -31,11 +33,11 @@ function getRenderedNativeOrTextFromComponent(component) {
31
33
  }
32
34
 
33
35
  /**
34
- * Populate `_nativeNode` on the rendered native/text component with the given
36
+ * Populate `_hostNode` on the rendered host/text component with the given
35
37
  * DOM node. The passed `inst` can be a composite.
36
38
  */
37
39
  function precacheNode(inst, tag) {
38
- var nativeInst = getRenderedNativeOrTextFromComponent(inst);
40
+ var nativeInst = getRenderedHostOrTextFromComponent(inst);
39
41
  instanceCache[tag] = nativeInst;
40
42
  }
41
43
 
@@ -51,7 +53,7 @@ function getInstanceFromTag(tag) {
51
53
  }
52
54
 
53
55
  function getTagFromInstance(inst) {
54
- !inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'All native instances should have a tag.') : invariant(false) : void 0;
56
+ !inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'All native instances should have a tag.') : _prodInvariant('17') : void 0;
55
57
  return inst._rootNodeID;
56
58
  }
57
59
 
@@ -7,14 +7,12 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule ReactNativeDOMIDOperations
10
- *
11
10
  */
12
11
  'use strict';
13
12
 
14
13
  var ReactNativeComponentTree = require('./ReactNativeComponentTree');
15
14
  var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
16
- var ReactPerf = require('./ReactPerf');
17
- var UIManager = require('UIManager');
15
+ var UIManager = require('react-native/lib/UIManager');
18
16
 
19
17
  /**
20
18
  * Updates a component's children by processing a series of updates.
@@ -64,9 +62,7 @@ var dangerouslyProcessChildrenUpdates = function (inst, childrenUpdates) {
64
62
  * `ReactComponent.DOMIDOperations`.
65
63
  */
66
64
  var ReactNativeDOMIDOperations = {
67
- dangerouslyProcessChildrenUpdates: ReactPerf.measure(
68
- // FIXME(frantic): #4441289 Hack to avoid modifying react-tools
69
- 'ReactDOMIDOperations', 'dangerouslyProcessChildrenUpdates', dangerouslyProcessChildrenUpdates),
65
+ dangerouslyProcessChildrenUpdates: dangerouslyProcessChildrenUpdates,
70
66
 
71
67
  /**
72
68
  * Replaces a view that exists in the document with markup.
@@ -74,10 +70,10 @@ var ReactNativeDOMIDOperations = {
74
70
  * @param {string} id ID of child to be replaced.
75
71
  * @param {string} markup Mount image to replace child with id.
76
72
  */
77
- dangerouslyReplaceNodeWithMarkupByID: ReactPerf.measure('ReactDOMIDOperations', 'dangerouslyReplaceNodeWithMarkupByID', function (id, mountImage) {
73
+ dangerouslyReplaceNodeWithMarkupByID: function (id, mountImage) {
78
74
  var oldTag = id;
79
75
  UIManager.replaceExistingNonRootView(oldTag, mountImage);
80
- })
76
+ }
81
77
  };
82
78
 
83
79
  module.exports = ReactNativeDOMIDOperations;
@@ -18,17 +18,19 @@
18
18
  * TODO: require this in packager, not in React #10932517
19
19
  */
20
20
 
21
- require('InitializeJavaScriptAppEngine');
21
+ var _prodInvariant = require('./reactProdInvariant');
22
+
23
+ require('react-native/lib/InitializeJavaScriptAppEngine');
22
24
 
23
25
  var EventPluginHub = require('./EventPluginHub');
24
26
  var EventPluginUtils = require('./EventPluginUtils');
25
- var RCTEventEmitter = require('RCTEventEmitter');
27
+ var RCTEventEmitter = require('react-native/lib/RCTEventEmitter');
26
28
  var ReactComponentEnvironment = require('./ReactComponentEnvironment');
27
29
  var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
28
30
  var ReactElement = require('./ReactElement');
29
31
  var ReactEmptyComponent = require('./ReactEmptyComponent');
30
32
  var ReactNativeBridgeEventPlugin = require('./ReactNativeBridgeEventPlugin');
31
- var ReactNativeComponent = require('./ReactNativeComponent');
33
+ var ReactHostComponent = require('./ReactHostComponent');
32
34
  var ReactNativeComponentEnvironment = require('./ReactNativeComponentEnvironment');
33
35
  var ReactNativeComponentTree = require('./ReactNativeComponentTree');
34
36
  var ReactNativeEventEmitter = require('./ReactNativeEventEmitter');
@@ -74,7 +76,7 @@ function inject() {
74
76
 
75
77
  var EmptyComponent = function (instantiate) {
76
78
  // Can't import View at the top because it depends on React to make its composite
77
- var View = require('View');
79
+ var View = require('react-native/lib/View');
78
80
  return new ReactSimpleEmptyComponent(ReactElement.createElement(View, {
79
81
  collapsable: true,
80
82
  style: { position: 'absolute' }
@@ -83,14 +85,14 @@ function inject() {
83
85
 
84
86
  ReactEmptyComponent.injection.injectEmptyComponentFactory(EmptyComponent);
85
87
 
86
- ReactNativeComponent.injection.injectTextComponentClass(ReactNativeTextComponent);
87
- ReactNativeComponent.injection.injectGenericComponentClass(function (tag) {
88
+ ReactHostComponent.injection.injectTextComponentClass(ReactNativeTextComponent);
89
+ ReactHostComponent.injection.injectGenericComponentClass(function (tag) {
88
90
  // Show a nicer error message for non-function tags
89
91
  var info = '';
90
92
  if (typeof tag === 'string' && /^[a-z]/.test(tag)) {
91
93
  info += ' Each component name should start with an uppercase letter.';
92
94
  }
93
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected a component class, got %s.%s', tag, info) : invariant(false) : void 0;
95
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected a component class, got %s.%s', tag, info) : _prodInvariant('18', tag, info) : void 0;
94
96
  });
95
97
  }
96
98
 
@@ -10,7 +10,7 @@
10
10
  */
11
11
  'use strict';
12
12
 
13
- var UIManager = require('UIManager');
13
+ var UIManager = require('react-native/lib/UIManager');
14
14
 
15
15
  var ReactNativeGlobalResponderHandler = {
16
16
  onChange: function (from, to, blockNativeResponder) {
@@ -12,13 +12,13 @@
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');
21
- var UIManager = require('UIManager');
21
+ var UIManager = require('react-native/lib/UIManager');
22
22
 
23
23
  var emptyObject = require('fbjs/lib/emptyObject');
24
24
  var instantiateReactComponent = require('./instantiateReactComponent');
@@ -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: ReactPerf.measure(
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;