react 15.3.2-rc.1 → 15.4.0-rc.3

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 (209) hide show
  1. package/dist/react-with-addons.js +3863 -21388
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2639 -19486
  4. package/dist/react.min.js +2 -6
  5. package/lib/KeyEscapeUtils.js +0 -1
  6. package/lib/LinkedStateMixin.js +1 -3
  7. package/lib/PooledClass.js +3 -1
  8. package/lib/React.js +0 -1
  9. package/lib/ReactAddonsDOMDependencies.js +35 -0
  10. package/lib/ReactAddonsDOMDependenciesUMDShim.js +31 -0
  11. package/lib/ReactCSSTransitionGroup.js +60 -43
  12. package/lib/ReactCSSTransitionGroupChild.js +2 -3
  13. package/lib/ReactChildren.js +0 -1
  14. package/lib/ReactClass.js +38 -54
  15. package/lib/ReactComponent.js +0 -1
  16. package/lib/ReactComponentTreeDevtool.js +0 -1
  17. package/lib/ReactComponentTreeHook.js +84 -101
  18. package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +4 -7
  19. package/lib/ReactComponentWithPureRenderMixin.js +0 -1
  20. package/lib/ReactCurrentOwner.js +1 -2
  21. package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +5 -4
  22. package/lib/ReactDOMFactories.js +0 -1
  23. package/lib/ReactElement.js +6 -14
  24. package/lib/ReactElementSymbol.js +19 -0
  25. package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +3 -9
  26. package/lib/ReactElementValidator.js +1 -3
  27. package/lib/ReactFragment.js +0 -1
  28. package/lib/ReactLink.js +0 -1
  29. package/lib/ReactNoopUpdateQueue.js +0 -1
  30. package/lib/ReactPropTypeLocationNames.js +1 -1
  31. package/lib/ReactPropTypeLocations.js +2 -12
  32. package/lib/ReactPropTypes.js +5 -3
  33. package/lib/ReactPropTypesSecret.js +1 -1
  34. package/lib/ReactPureComponent.js +0 -1
  35. package/lib/ReactStateSetters.js +0 -1
  36. package/lib/ReactTransitionChildMapping.js +0 -1
  37. package/lib/ReactTransitionEvents.js +1 -2
  38. package/lib/ReactTransitionGroup.js +145 -142
  39. package/lib/ReactUMDEntry.js +11 -6
  40. package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +3 -6
  41. package/lib/ReactVersion.js +1 -2
  42. package/lib/ReactWithAddons.js +15 -3
  43. package/lib/ReactWithAddonsUMDEntry.js +11 -6
  44. package/lib/canDefineProperty.js +2 -1
  45. package/lib/checkReactTypeSpec.js +0 -1
  46. package/lib/deprecated.js +0 -1
  47. package/lib/flattenChildren.js +0 -1
  48. package/lib/getIteratorFn.js +0 -1
  49. package/lib/onlyChild.js +0 -1
  50. package/lib/reactProdInvariant.js +0 -1
  51. package/lib/sliceChildren.js +0 -1
  52. package/lib/traverseAllChildren.js +11 -3
  53. package/lib/update.js +6 -8
  54. package/package.json +1 -1
  55. package/lib/AutoFocusUtils.js +0 -24
  56. package/lib/BeforeInputEventPlugin.js +0 -390
  57. package/lib/CSSProperty.js +0 -148
  58. package/lib/CSSPropertyOperations.js +0 -205
  59. package/lib/CallbackQueue.js +0 -106
  60. package/lib/ChangeEventPlugin.js +0 -325
  61. package/lib/DOMChildrenOperations.js +0 -194
  62. package/lib/DOMLazyTree.js +0 -118
  63. package/lib/DOMProperty.js +0 -206
  64. package/lib/DOMPropertyOperations.js +0 -221
  65. package/lib/Danger.js +0 -48
  66. package/lib/DefaultEventPluginOrder.js +0 -27
  67. package/lib/DisabledInputUtils.js +0 -50
  68. package/lib/EnterLeaveEventPlugin.js +0 -105
  69. package/lib/EventConstants.js +0 -97
  70. package/lib/EventPluginHub.js +0 -251
  71. package/lib/EventPluginRegistry.js +0 -247
  72. package/lib/EventPluginUtils.js +0 -229
  73. package/lib/EventPropagators.js +0 -137
  74. package/lib/FallbackCompositionState.js +0 -95
  75. package/lib/HTMLDOMPropertyConfig.js +0 -212
  76. package/lib/LinkedValueUtils.js +0 -136
  77. package/lib/NativeMethodsMixin.js +0 -167
  78. package/lib/ReactBrowserEventEmitter.js +0 -330
  79. package/lib/ReactChildReconciler.js +0 -154
  80. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  81. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  82. package/lib/ReactComponentEnvironment.js +0 -45
  83. package/lib/ReactComponentTreeTestUtils.js +0 -87
  84. package/lib/ReactCompositeComponent.js +0 -904
  85. package/lib/ReactDOM.js +0 -110
  86. package/lib/ReactDOMButton.js +0 -24
  87. package/lib/ReactDOMComponent.js +0 -1006
  88. package/lib/ReactDOMComponentTree.js +0 -188
  89. package/lib/ReactDOMContainerInfo.js +0 -33
  90. package/lib/ReactDOMEmptyComponent.js +0 -60
  91. package/lib/ReactDOMFiber.js +0 -76
  92. package/lib/ReactDOMIDOperations.js +0 -34
  93. package/lib/ReactDOMInput.js +0 -269
  94. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  95. package/lib/ReactDOMOption.js +0 -123
  96. package/lib/ReactDOMSelect.js +0 -201
  97. package/lib/ReactDOMSelection.js +0 -212
  98. package/lib/ReactDOMServer.js +0 -26
  99. package/lib/ReactDOMTextComponent.js +0 -164
  100. package/lib/ReactDOMTextarea.js +0 -155
  101. package/lib/ReactDOMTreeTraversal.js +0 -136
  102. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  103. package/lib/ReactDebugTool.js +0 -301
  104. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  105. package/lib/ReactDefaultInjection.js +0 -84
  106. package/lib/ReactEmptyComponent.js +0 -30
  107. package/lib/ReactErrorUtils.js +0 -76
  108. package/lib/ReactEventEmitterMixin.js +0 -33
  109. package/lib/ReactEventListener.js +0 -157
  110. package/lib/ReactFeatureFlags.js +0 -22
  111. package/lib/ReactHostComponent.js +0 -76
  112. package/lib/ReactHostOperationHistoryHook.js +0 -37
  113. package/lib/ReactInjection.js +0 -36
  114. package/lib/ReactInputSelection.js +0 -124
  115. package/lib/ReactInstanceHandles.js +0 -302
  116. package/lib/ReactInstanceMap.js +0 -48
  117. package/lib/ReactInstrumentation.js +0 -21
  118. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  119. package/lib/ReactMarkupChecksum.js +0 -50
  120. package/lib/ReactMount.js +0 -534
  121. package/lib/ReactMultiChild.js +0 -451
  122. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  123. package/lib/ReactNative.js +0 -71
  124. package/lib/ReactNativeAttributePayload.js +0 -371
  125. package/lib/ReactNativeBaseComponent.js +0 -198
  126. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  127. package/lib/ReactNativeComponentEnvironment.js +0 -31
  128. package/lib/ReactNativeComponentTree.js +0 -68
  129. package/lib/ReactNativeContainerInfo.js +0 -21
  130. package/lib/ReactNativeDOMIDOperations.js +0 -79
  131. package/lib/ReactNativeDefaultInjection.js +0 -101
  132. package/lib/ReactNativeEventEmitter.js +0 -191
  133. package/lib/ReactNativeEventPluginOrder.js +0 -16
  134. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  135. package/lib/ReactNativeMount.js +0 -193
  136. package/lib/ReactNativePropRegistry.js +0 -52
  137. package/lib/ReactNativeReconcileTransaction.js +0 -129
  138. package/lib/ReactNativeTagHandles.js +0 -56
  139. package/lib/ReactNativeTextComponent.js +0 -71
  140. package/lib/ReactNativeTreeTraversal.js +0 -127
  141. package/lib/ReactNodeTypes.js +0 -40
  142. package/lib/ReactNoop.js +0 -173
  143. package/lib/ReactOwner.js +0 -94
  144. package/lib/ReactPerf.js +0 -494
  145. package/lib/ReactReconcileTransaction.js +0 -178
  146. package/lib/ReactReconciler.js +0 -168
  147. package/lib/ReactRef.js +0 -80
  148. package/lib/ReactServerBatchingStrategy.js +0 -22
  149. package/lib/ReactServerRendering.js +0 -90
  150. package/lib/ReactServerRenderingTransaction.js +0 -90
  151. package/lib/ReactServerUpdateQueue.js +0 -141
  152. package/lib/ReactSimpleEmptyComponent.js +0 -37
  153. package/lib/ReactTestMount.js +0 -126
  154. package/lib/ReactTestReconcileTransaction.js +0 -121
  155. package/lib/ReactTestRenderer.js +0 -144
  156. package/lib/ReactTestUtils.js +0 -518
  157. package/lib/ReactUpdateQueue.js +0 -226
  158. package/lib/ReactUpdates.js +0 -251
  159. package/lib/ResponderEventPlugin.js +0 -510
  160. package/lib/ResponderSyntheticEvent.js +0 -39
  161. package/lib/ResponderTouchHistoryStore.js +0 -184
  162. package/lib/SVGDOMPropertyConfig.js +0 -302
  163. package/lib/SelectEventPlugin.js +0 -196
  164. package/lib/SimpleEventPlugin.js +0 -635
  165. package/lib/SyntheticAnimationEvent.js +0 -39
  166. package/lib/SyntheticClipboardEvent.js +0 -38
  167. package/lib/SyntheticCompositionEvent.js +0 -36
  168. package/lib/SyntheticDragEvent.js +0 -36
  169. package/lib/SyntheticEvent.js +0 -268
  170. package/lib/SyntheticFocusEvent.js +0 -36
  171. package/lib/SyntheticInputEvent.js +0 -37
  172. package/lib/SyntheticKeyboardEvent.js +0 -84
  173. package/lib/SyntheticMouseEvent.js +0 -72
  174. package/lib/SyntheticTouchEvent.js +0 -45
  175. package/lib/SyntheticTransitionEvent.js +0 -39
  176. package/lib/SyntheticUIEvent.js +0 -59
  177. package/lib/SyntheticWheelEvent.js +0 -54
  178. package/lib/TapEventPlugin.js +0 -110
  179. package/lib/TouchHistoryMath.js +0 -99
  180. package/lib/Transaction.js +0 -233
  181. package/lib/ViewportMetrics.js +0 -27
  182. package/lib/accumulate.js +0 -46
  183. package/lib/accumulateInto.js +0 -58
  184. package/lib/adler32.js +0 -44
  185. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  186. package/lib/createReactNativeComponentClass.js +0 -42
  187. package/lib/dangerousStyleValue.js +0 -79
  188. package/lib/escapeTextContentForBrowser.js +0 -123
  189. package/lib/findDOMNode.js +0 -60
  190. package/lib/findNodeHandle.js +0 -91
  191. package/lib/forEachAccumulated.js +0 -31
  192. package/lib/getEventCharCode.js +0 -50
  193. package/lib/getEventKey.js +0 -102
  194. package/lib/getEventModifierState.js +0 -43
  195. package/lib/getEventTarget.js +0 -35
  196. package/lib/getHostComponentFromComposite.js +0 -30
  197. package/lib/getNodeForCharacterOffset.js +0 -74
  198. package/lib/getTestDocument.js +0 -21
  199. package/lib/getTextContentAccessor.js +0 -33
  200. package/lib/getVendorPrefixedEventName.js +0 -101
  201. package/lib/instantiateReactComponent.js +0 -119
  202. package/lib/isEventSupported.js +0 -60
  203. package/lib/isTextInputElement.js +0 -51
  204. package/lib/quoteAttributeValueForBrowser.js +0 -26
  205. package/lib/reactComponentExpect.js +0 -217
  206. package/lib/setInnerHTML.js +0 -98
  207. package/lib/setTextContent.js +0 -48
  208. package/lib/shouldUpdateReactComponent.js +0 -42
  209. package/lib/validateDOMNesting.js +0 -382
@@ -1,16 +0,0 @@
1
- /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
8
- *
9
- * @providesModule ReactNativeEventPluginOrder
10
- *
11
- */
12
- 'use strict';
13
-
14
- var ReactNativeEventPluginOrder = ['ResponderEventPlugin', 'ReactNativeBridgeEventPlugin'];
15
-
16
- module.exports = ReactNativeEventPluginOrder;
@@ -1,25 +0,0 @@
1
- /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
8
- *
9
- * @providesModule ReactNativeGlobalResponderHandler
10
- */
11
- 'use strict';
12
-
13
- var UIManager = require('react-native/lib/UIManager');
14
-
15
- var ReactNativeGlobalResponderHandler = {
16
- onChange: function (from, to, blockNativeResponder) {
17
- if (to !== null) {
18
- UIManager.setJSResponder(to._rootNodeID, blockNativeResponder);
19
- } else {
20
- UIManager.clearJSResponder();
21
- }
22
- }
23
- };
24
-
25
- module.exports = ReactNativeGlobalResponderHandler;
@@ -1,193 +0,0 @@
1
- /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
8
- *
9
- * @providesModule ReactNativeMount
10
- *
11
- */
12
- 'use strict';
13
-
14
- var ReactElement = require('./ReactElement');
15
- var ReactInstrumentation = require('./ReactInstrumentation');
16
- var ReactNativeContainerInfo = require('./ReactNativeContainerInfo');
17
- var ReactNativeTagHandles = require('./ReactNativeTagHandles');
18
- var ReactReconciler = require('./ReactReconciler');
19
- var ReactUpdateQueue = require('./ReactUpdateQueue');
20
- var ReactUpdates = require('./ReactUpdates');
21
- var UIManager = require('react-native/lib/UIManager');
22
-
23
- var emptyObject = require('fbjs/lib/emptyObject');
24
- var instantiateReactComponent = require('./instantiateReactComponent');
25
- var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
26
-
27
- /**
28
- * Temporary (?) hack so that we can store all top-level pending updates on
29
- * composites instead of having to worry about different types of components
30
- * here.
31
- */
32
- var TopLevelWrapper = function () {};
33
- TopLevelWrapper.prototype.isReactComponent = {};
34
- if (process.env.NODE_ENV !== 'production') {
35
- TopLevelWrapper.displayName = 'TopLevelWrapper';
36
- }
37
- TopLevelWrapper.prototype.render = function () {
38
- // this.props is actually a ReactElement
39
- return this.props;
40
- };
41
-
42
- /**
43
- * Mounts this component and inserts it into the DOM.
44
- *
45
- * @param {ReactComponent} componentInstance The instance to mount.
46
- * @param {number} rootID ID of the root node.
47
- * @param {number} containerTag container element to mount into.
48
- * @param {ReactReconcileTransaction} transaction
49
- */
50
- function mountComponentIntoNode(componentInstance, containerTag, transaction) {
51
- var markup = ReactReconciler.mountComponent(componentInstance, transaction, null, ReactNativeContainerInfo(containerTag), emptyObject, 0 /* parentDebugID */
52
- );
53
- componentInstance._renderedComponent._topLevelWrapper = componentInstance;
54
- ReactNativeMount._mountImageIntoNode(markup, containerTag);
55
- }
56
-
57
- /**
58
- * Batched mount.
59
- *
60
- * @param {ReactComponent} componentInstance The instance to mount.
61
- * @param {number} rootID ID of the root node.
62
- * @param {number} containerTag container element to mount into.
63
- */
64
- function batchedMountComponentIntoNode(componentInstance, containerTag) {
65
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
66
- transaction.perform(mountComponentIntoNode, null, componentInstance, containerTag, transaction);
67
- ReactUpdates.ReactReconcileTransaction.release(transaction);
68
- }
69
-
70
- /**
71
- * As soon as `ReactMount` is refactored to not rely on the DOM, we can share
72
- * code between the two. For now, we'll hard code the ID logic.
73
- */
74
- var ReactNativeMount = {
75
- _instancesByContainerID: {},
76
-
77
- // these two functions are needed by React Devtools
78
- findNodeHandle: require('./findNodeHandle'),
79
-
80
- /**
81
- * @param {ReactComponent} instance Instance to render.
82
- * @param {containerTag} containerView Handle to native view tag
83
- */
84
- renderComponent: function (nextElement, containerTag, callback) {
85
- var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
86
-
87
- var topRootNodeID = containerTag;
88
- var prevComponent = ReactNativeMount._instancesByContainerID[topRootNodeID];
89
- if (prevComponent) {
90
- var prevWrappedElement = prevComponent._currentElement;
91
- var prevElement = prevWrappedElement.props;
92
- if (shouldUpdateReactComponent(prevElement, nextElement)) {
93
- ReactUpdateQueue.enqueueElementInternal(prevComponent, nextWrappedElement, emptyObject);
94
- if (callback) {
95
- ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
96
- }
97
- return prevComponent;
98
- } else {
99
- ReactNativeMount.unmountComponentAtNode(containerTag);
100
- }
101
- }
102
-
103
- if (!ReactNativeTagHandles.reactTagIsNativeTopRootID(containerTag)) {
104
- console.error('You cannot render into anything but a top root');
105
- return null;
106
- }
107
-
108
- ReactNativeTagHandles.assertRootTag(containerTag);
109
-
110
- var instance = instantiateReactComponent(nextWrappedElement, false);
111
- ReactNativeMount._instancesByContainerID[containerTag] = instance;
112
-
113
- // The initial render is synchronous but any updates that happen during
114
- // rendering, in componentWillMount or componentDidMount, will be batched
115
- // according to the current batching strategy.
116
-
117
- ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, instance, containerTag);
118
- var component = instance.getPublicInstance();
119
- if (callback) {
120
- callback.call(component);
121
- }
122
- return component;
123
- },
124
-
125
- /**
126
- * @param {View} view View tree image.
127
- * @param {number} containerViewID View to insert sub-view into.
128
- */
129
- _mountImageIntoNode: function (mountImage, containerID) {
130
- // Since we now know that the `mountImage` has been mounted, we can
131
- // mark it as such.
132
- var childTag = mountImage;
133
- UIManager.setChildren(containerID, [childTag]);
134
- },
135
-
136
- /**
137
- * Standard unmounting of the component that is rendered into `containerID`,
138
- * but will also execute a command to remove the actual container view
139
- * itself. This is useful when a client is cleaning up a React tree, and also
140
- * knows that the container will no longer be needed. When executing
141
- * asynchronously, it's easier to just have this method be the one that calls
142
- * for removal of the view.
143
- */
144
- unmountComponentAtNodeAndRemoveContainer: function (containerTag) {
145
- ReactNativeMount.unmountComponentAtNode(containerTag);
146
- // call back into native to remove all of the subviews from this container
147
- UIManager.removeRootView(containerTag);
148
- },
149
-
150
- /**
151
- * Unmount component at container ID by iterating through each child component
152
- * that has been rendered and unmounting it. There should just be one child
153
- * component at this time.
154
- */
155
- unmountComponentAtNode: function (containerTag) {
156
- if (!ReactNativeTagHandles.reactTagIsNativeTopRootID(containerTag)) {
157
- console.error('You cannot render into anything but a top root');
158
- return false;
159
- }
160
-
161
- var instance = ReactNativeMount._instancesByContainerID[containerTag];
162
- if (!instance) {
163
- return false;
164
- }
165
- if (process.env.NODE_ENV !== 'production') {
166
- ReactInstrumentation.debugTool.onBeginFlush();
167
- }
168
- ReactNativeMount.unmountComponentFromNode(instance, containerTag);
169
- delete ReactNativeMount._instancesByContainerID[containerTag];
170
- if (process.env.NODE_ENV !== 'production') {
171
- ReactInstrumentation.debugTool.onEndFlush();
172
- }
173
- return true;
174
- },
175
-
176
- /**
177
- * Unmounts a component and sends messages back to iOS to remove its subviews.
178
- *
179
- * @param {ReactComponent} instance React component instance.
180
- * @param {string} containerID ID of container we're removing from.
181
- * @final
182
- * @internal
183
- * @see {ReactNativeMount.unmountComponentAtNode}
184
- */
185
- unmountComponentFromNode: function (instance, containerID) {
186
- // Call back into native to remove all of the subviews from this container
187
- ReactReconciler.unmountComponent(instance);
188
- UIManager.removeSubviewsFromContainerWithID(containerID);
189
- }
190
-
191
- };
192
-
193
- module.exports = ReactNativeMount;
@@ -1,52 +0,0 @@
1
- /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
8
- *
9
- * @providesModule ReactNativePropRegistry
10
- *
11
- */
12
- 'use strict';
13
-
14
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15
-
16
- var objects = {};
17
- var uniqueID = 1;
18
- var emptyObject = {};
19
-
20
- var ReactNativePropRegistry = function () {
21
- function ReactNativePropRegistry() {
22
- _classCallCheck(this, ReactNativePropRegistry);
23
- }
24
-
25
- ReactNativePropRegistry.register = function register(object) {
26
- var id = ++uniqueID;
27
- if (process.env.NODE_ENV !== 'production') {
28
- Object.freeze(object);
29
- }
30
- objects[id] = object;
31
- return id;
32
- };
33
-
34
- ReactNativePropRegistry.getByID = function getByID(id) {
35
- if (!id) {
36
- // Used in the style={[condition && id]} pattern,
37
- // we want it to be a no-op when the value is false or null
38
- return emptyObject;
39
- }
40
-
41
- var object = objects[id];
42
- if (!object) {
43
- console.warn('Invalid style with id `' + id + '`. Skipping ...');
44
- return emptyObject;
45
- }
46
- return object;
47
- };
48
-
49
- return ReactNativePropRegistry;
50
- }();
51
-
52
- module.exports = ReactNativePropRegistry;
@@ -1,129 +0,0 @@
1
- /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
8
- *
9
- * @providesModule ReactNativeReconcileTransaction
10
- *
11
- */
12
- 'use strict';
13
-
14
- var _assign = require('object-assign');
15
-
16
- var CallbackQueue = require('./CallbackQueue');
17
- var PooledClass = require('./PooledClass');
18
- var Transaction = require('./Transaction');
19
- var ReactInstrumentation = require('./ReactInstrumentation');
20
- var ReactUpdateQueue = require('./ReactUpdateQueue');
21
-
22
- /**
23
- * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks during
24
- * the performing of the transaction.
25
- */
26
- var ON_DOM_READY_QUEUEING = {
27
- /**
28
- * Initializes the internal `onDOMReady` queue.
29
- */
30
- initialize: function () {
31
- this.reactMountReady.reset();
32
- },
33
-
34
- /**
35
- * After DOM is flushed, invoke all registered `onDOMReady` callbacks.
36
- */
37
- close: function () {
38
- this.reactMountReady.notifyAll();
39
- }
40
- };
41
-
42
- /**
43
- * Executed within the scope of the `Transaction` instance. Consider these as
44
- * being member methods, but with an implied ordering while being isolated from
45
- * each other.
46
- */
47
- var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
48
-
49
- if (process.env.NODE_ENV !== 'production') {
50
- TRANSACTION_WRAPPERS.push({
51
- initialize: ReactInstrumentation.debugTool.onBeginFlush,
52
- close: ReactInstrumentation.debugTool.onEndFlush
53
- });
54
- }
55
-
56
- /**
57
- * Currently:
58
- * - The order that these are listed in the transaction is critical:
59
- * - Suppresses events.
60
- * - Restores selection range.
61
- *
62
- * Future:
63
- * - Restore document/overflow scroll positions that were unintentionally
64
- * modified via DOM insertions above the top viewport boundary.
65
- * - Implement/integrate with customized constraint based layout system and keep
66
- * track of which dimensions must be remeasured.
67
- *
68
- * @class ReactNativeReconcileTransaction
69
- */
70
- function ReactNativeReconcileTransaction() {
71
- this.reinitializeTransaction();
72
- this.reactMountReady = CallbackQueue.getPooled(null);
73
- }
74
-
75
- var Mixin = {
76
- /**
77
- * @see Transaction
78
- * @abstract
79
- * @final
80
- * @return {array<object>} List of operation wrap procedures.
81
- * TODO: convert to array<TransactionWrapper>
82
- */
83
- getTransactionWrappers: function () {
84
- return TRANSACTION_WRAPPERS;
85
- },
86
-
87
- /**
88
- * @return {object} The queue to collect `onDOMReady` callbacks with.
89
- * TODO: convert to ReactMountReady
90
- */
91
- getReactMountReady: function () {
92
- return this.reactMountReady;
93
- },
94
-
95
- /**
96
- * @return {object} The queue to collect React async events.
97
- */
98
- getUpdateQueue: function () {
99
- return ReactUpdateQueue;
100
- },
101
-
102
- /**
103
- * Save current transaction state -- if the return value from this method is
104
- * passed to `rollback`, the transaction will be reset to that state.
105
- */
106
- checkpoint: function () {
107
- // reactMountReady is the our only stateful wrapper
108
- return this.reactMountReady.checkpoint();
109
- },
110
-
111
- rollback: function (checkpoint) {
112
- this.reactMountReady.rollback(checkpoint);
113
- },
114
-
115
- /**
116
- * `PooledClass` looks for this, and will invoke this before allowing this
117
- * instance to be reused.
118
- */
119
- destructor: function () {
120
- CallbackQueue.release(this.reactMountReady);
121
- this.reactMountReady = null;
122
- }
123
- };
124
-
125
- _assign(ReactNativeReconcileTransaction.prototype, Transaction.Mixin, ReactNativeReconcileTransaction, Mixin);
126
-
127
- PooledClass.addPoolingTo(ReactNativeReconcileTransaction);
128
-
129
- module.exports = ReactNativeReconcileTransaction;
@@ -1,56 +0,0 @@
1
- /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
8
- *
9
- * @providesModule ReactNativeTagHandles
10
- *
11
- */
12
- 'use strict';
13
-
14
- var _prodInvariant = require('./reactProdInvariant');
15
-
16
- var invariant = require('fbjs/lib/invariant');
17
-
18
- /**
19
- * Keeps track of allocating and associating native "tags" which are numeric,
20
- * unique view IDs. All the native tags are negative numbers, to avoid
21
- * collisions, but in the JS we keep track of them as positive integers to store
22
- * them effectively in Arrays. So we must refer to them as "inverses" of the
23
- * native tags (that are * normally negative).
24
- *
25
- * It *must* be the case that every `rootNodeID` always maps to the exact same
26
- * `tag` forever. The easiest way to accomplish this is to never delete
27
- * anything from this table.
28
- * Why: Because `dangerouslyReplaceNodeWithMarkupByID` relies on being able to
29
- * unmount a component with a `rootNodeID`, then mount a new one in its place,
30
- */
31
- var INITIAL_TAG_COUNT = 1;
32
- var ReactNativeTagHandles = {
33
- tagsStartAt: INITIAL_TAG_COUNT,
34
- tagCount: INITIAL_TAG_COUNT,
35
-
36
- allocateTag: function () {
37
- // Skip over root IDs as those are reserved for native
38
- while (this.reactTagIsNativeTopRootID(ReactNativeTagHandles.tagCount)) {
39
- ReactNativeTagHandles.tagCount++;
40
- }
41
- var tag = ReactNativeTagHandles.tagCount;
42
- ReactNativeTagHandles.tagCount++;
43
- return tag;
44
- },
45
-
46
- assertRootTag: function (tag) {
47
- !this.reactTagIsNativeTopRootID(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expect a native root tag, instead got %s', tag) : _prodInvariant('19', tag) : void 0;
48
- },
49
-
50
- reactTagIsNativeTopRootID: function (reactTag) {
51
- // We reserve all tags that are 1 mod 10 for native root views
52
- return reactTag % 10 === 1;
53
- }
54
- };
55
-
56
- module.exports = ReactNativeTagHandles;