react 15.3.1-rc.2 → 15.4.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.
- package/dist/react-with-addons.js +3961 -21387
- package/dist/react-with-addons.min.js +3 -6
- package/dist/react.js +2701 -19464
- package/dist/react.min.js +2 -6
- package/lib/LinkedStateMixin.js +1 -2
- package/lib/PooledClass.js +3 -0
- package/lib/ReactAddonsDOMDependencies.js +36 -0
- package/lib/ReactAddonsDOMDependenciesUMDShim.js +32 -0
- package/lib/ReactCSSTransitionGroup.js +60 -42
- package/lib/ReactCSSTransitionGroupChild.js +2 -2
- package/lib/ReactClass.js +38 -53
- package/lib/ReactComponentTreeHook.js +84 -100
- package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +5 -7
- package/lib/ReactCurrentOwner.js +1 -1
- package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +6 -4
- package/lib/ReactElement.js +6 -29
- package/lib/ReactElementSymbol.js +20 -0
- package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +4 -9
- package/lib/ReactElementValidator.js +1 -2
- package/lib/ReactPropTypeLocationNames.js +1 -0
- package/lib/ReactPropTypeLocations.js +2 -11
- package/lib/ReactPropTypes.js +30 -13
- package/lib/ReactPropTypesSecret.js +1 -0
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +145 -141
- package/lib/ReactUMDEntry.js +11 -5
- package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +4 -6
- package/lib/ReactVersion.js +1 -1
- package/lib/ReactWithAddons.js +15 -2
- package/lib/ReactWithAddonsUMDEntry.js +11 -5
- package/lib/canDefineProperty.js +2 -0
- package/lib/onlyChild.js +1 -1
- package/lib/traverseAllChildren.js +11 -2
- package/lib/update.js +6 -7
- package/package.json +2 -2
- package/lib/AutoFocusUtils.js +0 -24
- package/lib/BeforeInputEventPlugin.js +0 -388
- package/lib/CSSProperty.js +0 -148
- package/lib/CSSPropertyOperations.js +0 -205
- package/lib/CallbackQueue.js +0 -106
- package/lib/ChangeEventPlugin.js +0 -325
- package/lib/DOMChildrenOperations.js +0 -194
- package/lib/DOMLazyTree.js +0 -118
- package/lib/DOMProperty.js +0 -206
- package/lib/DOMPropertyOperations.js +0 -221
- package/lib/Danger.js +0 -48
- package/lib/DefaultEventPluginOrder.js +0 -27
- package/lib/DisabledInputUtils.js +0 -50
- package/lib/EnterLeaveEventPlugin.js +0 -105
- package/lib/EventConstants.js +0 -97
- package/lib/EventPluginHub.js +0 -251
- package/lib/EventPluginRegistry.js +0 -247
- package/lib/EventPluginUtils.js +0 -229
- package/lib/EventPropagators.js +0 -137
- package/lib/FallbackCompositionState.js +0 -95
- package/lib/HTMLDOMPropertyConfig.js +0 -209
- package/lib/LinkedValueUtils.js +0 -136
- package/lib/NativeMethodsMixin.js +0 -167
- package/lib/ReactBrowserEventEmitter.js +0 -317
- package/lib/ReactChildReconciler.js +0 -154
- package/lib/ReactChildrenMutationWarningHook.js +0 -54
- package/lib/ReactComponentBrowserEnvironment.js +0 -30
- package/lib/ReactComponentEnvironment.js +0 -45
- package/lib/ReactComponentTreeTestUtils.js +0 -87
- package/lib/ReactCompositeComponent.js +0 -920
- package/lib/ReactDOM.js +0 -110
- package/lib/ReactDOMButton.js +0 -24
- package/lib/ReactDOMComponent.js +0 -1005
- package/lib/ReactDOMComponentTree.js +0 -188
- package/lib/ReactDOMContainerInfo.js +0 -33
- package/lib/ReactDOMEmptyComponent.js +0 -60
- package/lib/ReactDOMFiber.js +0 -78
- package/lib/ReactDOMIDOperations.js +0 -34
- package/lib/ReactDOMInput.js +0 -269
- package/lib/ReactDOMNullInputValuePropHook.js +0 -43
- package/lib/ReactDOMOption.js +0 -123
- package/lib/ReactDOMSelect.js +0 -201
- package/lib/ReactDOMSelection.js +0 -212
- package/lib/ReactDOMServer.js +0 -26
- package/lib/ReactDOMTextComponent.js +0 -164
- package/lib/ReactDOMTextarea.js +0 -155
- package/lib/ReactDOMTreeTraversal.js +0 -136
- package/lib/ReactDOMUnknownPropertyHook.js +0 -112
- package/lib/ReactDebugTool.js +0 -307
- package/lib/ReactDefaultBatchingStrategy.js +0 -68
- package/lib/ReactDefaultInjection.js +0 -84
- package/lib/ReactEmptyComponent.js +0 -30
- package/lib/ReactErrorUtils.js +0 -76
- package/lib/ReactEventEmitterMixin.js +0 -33
- package/lib/ReactEventListener.js +0 -157
- package/lib/ReactFeatureFlags.js +0 -22
- package/lib/ReactHostComponent.js +0 -76
- package/lib/ReactHostOperationHistoryHook.js +0 -37
- package/lib/ReactInjection.js +0 -36
- package/lib/ReactInputSelection.js +0 -124
- package/lib/ReactInstanceHandles.js +0 -302
- package/lib/ReactInstanceMap.js +0 -48
- package/lib/ReactInstrumentation.js +0 -21
- package/lib/ReactInvalidSetStateWarningHook.js +0 -36
- package/lib/ReactMarkupChecksum.js +0 -50
- package/lib/ReactMount.js +0 -495
- package/lib/ReactMultiChild.js +0 -451
- package/lib/ReactMultiChildUpdateTypes.js +0 -32
- package/lib/ReactNative.js +0 -71
- package/lib/ReactNativeAttributePayload.js +0 -371
- package/lib/ReactNativeBaseComponent.js +0 -198
- package/lib/ReactNativeBridgeEventPlugin.js +0 -60
- package/lib/ReactNativeComponentEnvironment.js +0 -31
- package/lib/ReactNativeComponentTree.js +0 -68
- package/lib/ReactNativeContainerInfo.js +0 -21
- package/lib/ReactNativeDOMIDOperations.js +0 -79
- package/lib/ReactNativeDefaultInjection.js +0 -101
- package/lib/ReactNativeEventEmitter.js +0 -191
- package/lib/ReactNativeEventPluginOrder.js +0 -16
- package/lib/ReactNativeGlobalResponderHandler.js +0 -25
- package/lib/ReactNativeMount.js +0 -193
- package/lib/ReactNativePropRegistry.js +0 -52
- package/lib/ReactNativeReconcileTransaction.js +0 -116
- package/lib/ReactNativeTagHandles.js +0 -56
- package/lib/ReactNativeTextComponent.js +0 -71
- package/lib/ReactNativeTreeTraversal.js +0 -127
- package/lib/ReactNodeTypes.js +0 -40
- package/lib/ReactNoop.js +0 -173
- package/lib/ReactOwner.js +0 -94
- package/lib/ReactPerf.js +0 -494
- package/lib/ReactReconcileTransaction.js +0 -178
- package/lib/ReactReconciler.js +0 -168
- package/lib/ReactRef.js +0 -80
- package/lib/ReactServerBatchingStrategy.js +0 -22
- package/lib/ReactServerRendering.js +0 -90
- package/lib/ReactServerRenderingTransaction.js +0 -90
- package/lib/ReactServerUpdateQueue.js +0 -141
- package/lib/ReactSimpleEmptyComponent.js +0 -37
- package/lib/ReactTestMount.js +0 -123
- package/lib/ReactTestReconcileTransaction.js +0 -108
- package/lib/ReactTestRenderer.js +0 -144
- package/lib/ReactTestUtils.js +0 -518
- package/lib/ReactUpdateQueue.js +0 -226
- package/lib/ReactUpdates.js +0 -251
- package/lib/ResponderEventPlugin.js +0 -510
- package/lib/ResponderSyntheticEvent.js +0 -39
- package/lib/ResponderTouchHistoryStore.js +0 -184
- package/lib/SVGDOMPropertyConfig.js +0 -302
- package/lib/SelectEventPlugin.js +0 -196
- package/lib/SimpleEventPlugin.js +0 -635
- package/lib/SyntheticAnimationEvent.js +0 -39
- package/lib/SyntheticClipboardEvent.js +0 -38
- package/lib/SyntheticCompositionEvent.js +0 -36
- package/lib/SyntheticDragEvent.js +0 -36
- package/lib/SyntheticEvent.js +0 -267
- package/lib/SyntheticFocusEvent.js +0 -36
- package/lib/SyntheticInputEvent.js +0 -37
- package/lib/SyntheticKeyboardEvent.js +0 -84
- package/lib/SyntheticMouseEvent.js +0 -72
- package/lib/SyntheticTouchEvent.js +0 -45
- package/lib/SyntheticTransitionEvent.js +0 -39
- package/lib/SyntheticUIEvent.js +0 -59
- package/lib/SyntheticWheelEvent.js +0 -54
- package/lib/TapEventPlugin.js +0 -110
- package/lib/TouchHistoryMath.js +0 -99
- package/lib/Transaction.js +0 -233
- package/lib/ViewportMetrics.js +0 -27
- package/lib/accumulate.js +0 -46
- package/lib/accumulateInto.js +0 -58
- package/lib/adler32.js +0 -44
- package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
- package/lib/createReactNativeComponentClass.js +0 -42
- package/lib/dangerousStyleValue.js +0 -79
- package/lib/escapeTextContentForBrowser.js +0 -122
- package/lib/findDOMNode.js +0 -60
- package/lib/findNodeHandle.js +0 -91
- package/lib/forEachAccumulated.js +0 -31
- package/lib/getEventCharCode.js +0 -50
- package/lib/getEventKey.js +0 -102
- package/lib/getEventModifierState.js +0 -43
- package/lib/getEventTarget.js +0 -35
- package/lib/getHostComponentFromComposite.js +0 -30
- package/lib/getNodeForCharacterOffset.js +0 -74
- package/lib/getTestDocument.js +0 -21
- package/lib/getTextContentAccessor.js +0 -33
- package/lib/getVendorPrefixedEventName.js +0 -101
- package/lib/instantiateReactComponent.js +0 -119
- package/lib/isEventSupported.js +0 -60
- package/lib/isTextInputElement.js +0 -51
- package/lib/quoteAttributeValueForBrowser.js +0 -26
- package/lib/reactComponentExpect.js +0 -217
- package/lib/setInnerHTML.js +0 -98
- package/lib/setTextContent.js +0 -48
- package/lib/shouldUpdateReactComponent.js +0 -42
- package/lib/validateDOMNesting.js +0 -369
|
@@ -1,60 +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 ReactNativeBridgeEventPlugin
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
'use strict';
|
|
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 EventPropagators = require('./EventPropagators');
|
|
19
|
-
var SyntheticEvent = require('./SyntheticEvent');
|
|
20
|
-
var UIManager = require('react-native/lib/UIManager');
|
|
21
|
-
|
|
22
|
-
var warning = require('fbjs/lib/warning');
|
|
23
|
-
|
|
24
|
-
var customBubblingEventTypes = UIManager.customBubblingEventTypes;
|
|
25
|
-
var customDirectEventTypes = UIManager.customDirectEventTypes;
|
|
26
|
-
|
|
27
|
-
var allTypesByEventName = {};
|
|
28
|
-
|
|
29
|
-
for (var bubblingTypeName in customBubblingEventTypes) {
|
|
30
|
-
allTypesByEventName[bubblingTypeName] = customBubblingEventTypes[bubblingTypeName];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
for (var directTypeName in customDirectEventTypes) {
|
|
34
|
-
process.env.NODE_ENV !== 'production' ? warning(!customBubblingEventTypes[directTypeName], 'Event cannot be both direct and bubbling: %s', directTypeName) : void 0;
|
|
35
|
-
allTypesByEventName[directTypeName] = customDirectEventTypes[directTypeName];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
var ReactNativeBridgeEventPlugin = {
|
|
39
|
-
|
|
40
|
-
eventTypes: _extends({}, customBubblingEventTypes, customDirectEventTypes),
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @see {EventPluginHub.extractEvents}
|
|
44
|
-
*/
|
|
45
|
-
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
|
|
46
|
-
var bubbleDispatchConfig = customBubblingEventTypes[topLevelType];
|
|
47
|
-
var directDispatchConfig = customDirectEventTypes[topLevelType];
|
|
48
|
-
var event = SyntheticEvent.getPooled(bubbleDispatchConfig || directDispatchConfig, targetInst, nativeEvent, nativeEventTarget);
|
|
49
|
-
if (bubbleDispatchConfig) {
|
|
50
|
-
EventPropagators.accumulateTwoPhaseDispatches(event);
|
|
51
|
-
} else if (directDispatchConfig) {
|
|
52
|
-
EventPropagators.accumulateDirectDispatches(event);
|
|
53
|
-
} else {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
return event;
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
module.exports = ReactNativeBridgeEventPlugin;
|
|
@@ -1,31 +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 ReactNativeComponentEnvironment
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var ReactNativeDOMIDOperations = require('./ReactNativeDOMIDOperations');
|
|
15
|
-
var ReactNativeReconcileTransaction = require('./ReactNativeReconcileTransaction');
|
|
16
|
-
|
|
17
|
-
var ReactNativeComponentEnvironment = {
|
|
18
|
-
|
|
19
|
-
processChildrenUpdates: ReactNativeDOMIDOperations.dangerouslyProcessChildrenUpdates,
|
|
20
|
-
|
|
21
|
-
replaceNodeWithMarkup: ReactNativeDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @param {DOMElement} Element to clear.
|
|
25
|
-
*/
|
|
26
|
-
clearNode: function () /*containerView*/{},
|
|
27
|
-
|
|
28
|
-
ReactReconcileTransaction: ReactNativeReconcileTransaction
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
module.exports = ReactNativeComponentEnvironment;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-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 ReactNativeComponentTree
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
-
|
|
16
|
-
var invariant = require('fbjs/lib/invariant');
|
|
17
|
-
|
|
18
|
-
var instanceCache = {};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Drill down (through composites and empty components) until we get a host or
|
|
22
|
-
* host text component.
|
|
23
|
-
*
|
|
24
|
-
* This is pretty polymorphic but unavoidable with the current structure we have
|
|
25
|
-
* for `_renderedChildren`.
|
|
26
|
-
*/
|
|
27
|
-
function getRenderedHostOrTextFromComponent(component) {
|
|
28
|
-
var rendered;
|
|
29
|
-
while (rendered = component._renderedComponent) {
|
|
30
|
-
component = rendered;
|
|
31
|
-
}
|
|
32
|
-
return component;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Populate `_hostNode` on the rendered host/text component with the given
|
|
37
|
-
* DOM node. The passed `inst` can be a composite.
|
|
38
|
-
*/
|
|
39
|
-
function precacheNode(inst, tag) {
|
|
40
|
-
var nativeInst = getRenderedHostOrTextFromComponent(inst);
|
|
41
|
-
instanceCache[tag] = nativeInst;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function uncacheNode(inst) {
|
|
45
|
-
var tag = inst._rootNodeID;
|
|
46
|
-
if (tag) {
|
|
47
|
-
delete instanceCache[tag];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function getInstanceFromTag(tag) {
|
|
52
|
-
return instanceCache[tag] || null;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function getTagFromInstance(inst) {
|
|
56
|
-
!inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'All native instances should have a tag.') : _prodInvariant('17') : void 0;
|
|
57
|
-
return inst._rootNodeID;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
var ReactNativeComponentTree = {
|
|
61
|
-
getClosestInstanceFromNode: getInstanceFromTag,
|
|
62
|
-
getInstanceFromNode: getInstanceFromTag,
|
|
63
|
-
getNodeFromInstance: getTagFromInstance,
|
|
64
|
-
precacheNode: precacheNode,
|
|
65
|
-
uncacheNode: uncacheNode
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
module.exports = ReactNativeComponentTree;
|
|
@@ -1,21 +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 ReactNativeContainerInfo
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
function ReactNativeContainerInfo(tag) {
|
|
15
|
-
var info = {
|
|
16
|
-
_tag: tag
|
|
17
|
-
};
|
|
18
|
-
return info;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = ReactNativeContainerInfo;
|
|
@@ -1,79 +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 ReactNativeDOMIDOperations
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
var ReactNativeComponentTree = require('./ReactNativeComponentTree');
|
|
14
|
-
var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
|
|
15
|
-
var UIManager = require('react-native/lib/UIManager');
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Updates a component's children by processing a series of updates.
|
|
19
|
-
* For each of the update/create commands, the `fromIndex` refers to the index
|
|
20
|
-
* that the item existed at *before* any of the updates are applied, and the
|
|
21
|
-
* `toIndex` refers to the index after *all* of the updates are applied
|
|
22
|
-
* (including deletes/moves). TODO: refactor so this can be shared with
|
|
23
|
-
* DOMChildrenOperations.
|
|
24
|
-
*
|
|
25
|
-
* @param {ReactNativeBaseComponent} updates List of update configurations.
|
|
26
|
-
* @param {array<string>} markup List of markup strings - in the case of React
|
|
27
|
-
* IOS, the ids of new components assumed to be already created.
|
|
28
|
-
*/
|
|
29
|
-
var dangerouslyProcessChildrenUpdates = function (inst, childrenUpdates) {
|
|
30
|
-
if (!childrenUpdates.length) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
var containerTag = ReactNativeComponentTree.getNodeFromInstance(inst);
|
|
35
|
-
|
|
36
|
-
var moveFromIndices;
|
|
37
|
-
var moveToIndices;
|
|
38
|
-
var addChildTags;
|
|
39
|
-
var addAtIndices;
|
|
40
|
-
var removeAtIndices;
|
|
41
|
-
|
|
42
|
-
for (var i = 0; i < childrenUpdates.length; i++) {
|
|
43
|
-
var update = childrenUpdates[i];
|
|
44
|
-
if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING) {
|
|
45
|
-
(moveFromIndices || (moveFromIndices = [])).push(update.fromIndex);
|
|
46
|
-
(moveToIndices || (moveToIndices = [])).push(update.toIndex);
|
|
47
|
-
} else if (update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
|
|
48
|
-
(removeAtIndices || (removeAtIndices = [])).push(update.fromIndex);
|
|
49
|
-
} else if (update.type === ReactMultiChildUpdateTypes.INSERT_MARKUP) {
|
|
50
|
-
var mountImage = update.content;
|
|
51
|
-
var tag = mountImage;
|
|
52
|
-
(addAtIndices || (addAtIndices = [])).push(update.toIndex);
|
|
53
|
-
(addChildTags || (addChildTags = [])).push(tag);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
UIManager.manageChildren(containerTag, moveFromIndices, moveToIndices, addChildTags, addAtIndices, removeAtIndices);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Operations used to process updates to DOM nodes. This is made injectable via
|
|
62
|
-
* `ReactComponent.DOMIDOperations`.
|
|
63
|
-
*/
|
|
64
|
-
var ReactNativeDOMIDOperations = {
|
|
65
|
-
dangerouslyProcessChildrenUpdates: dangerouslyProcessChildrenUpdates,
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Replaces a view that exists in the document with markup.
|
|
69
|
-
*
|
|
70
|
-
* @param {string} id ID of child to be replaced.
|
|
71
|
-
* @param {string} markup Mount image to replace child with id.
|
|
72
|
-
*/
|
|
73
|
-
dangerouslyReplaceNodeWithMarkupByID: function (id, mountImage) {
|
|
74
|
-
var oldTag = id;
|
|
75
|
-
UIManager.replaceExistingNonRootView(oldTag, mountImage);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
module.exports = ReactNativeDOMIDOperations;
|
|
@@ -1,101 +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 ReactNativeDefaultInjection
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Make sure essential globals are available and are patched correctly. Please don't remove this
|
|
16
|
-
* line. Bundles created by react-packager `require` it before executing any application code. This
|
|
17
|
-
* ensures it exists in the dependency graph and can be `require`d.
|
|
18
|
-
* TODO: require this in packager, not in React #10932517
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
var _prodInvariant = require('./reactProdInvariant');
|
|
22
|
-
|
|
23
|
-
require('react-native/lib/InitializeJavaScriptAppEngine');
|
|
24
|
-
|
|
25
|
-
var EventPluginHub = require('./EventPluginHub');
|
|
26
|
-
var EventPluginUtils = require('./EventPluginUtils');
|
|
27
|
-
var RCTEventEmitter = require('react-native/lib/RCTEventEmitter');
|
|
28
|
-
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
|
|
29
|
-
var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
|
|
30
|
-
var ReactElement = require('./ReactElement');
|
|
31
|
-
var ReactEmptyComponent = require('./ReactEmptyComponent');
|
|
32
|
-
var ReactNativeBridgeEventPlugin = require('./ReactNativeBridgeEventPlugin');
|
|
33
|
-
var ReactHostComponent = require('./ReactHostComponent');
|
|
34
|
-
var ReactNativeComponentEnvironment = require('./ReactNativeComponentEnvironment');
|
|
35
|
-
var ReactNativeComponentTree = require('./ReactNativeComponentTree');
|
|
36
|
-
var ReactNativeEventEmitter = require('./ReactNativeEventEmitter');
|
|
37
|
-
var ReactNativeEventPluginOrder = require('./ReactNativeEventPluginOrder');
|
|
38
|
-
var ReactNativeGlobalResponderHandler = require('./ReactNativeGlobalResponderHandler');
|
|
39
|
-
var ReactNativeTextComponent = require('./ReactNativeTextComponent');
|
|
40
|
-
var ReactNativeTreeTraversal = require('./ReactNativeTreeTraversal');
|
|
41
|
-
var ReactSimpleEmptyComponent = require('./ReactSimpleEmptyComponent');
|
|
42
|
-
var ReactUpdates = require('./ReactUpdates');
|
|
43
|
-
var ResponderEventPlugin = require('./ResponderEventPlugin');
|
|
44
|
-
|
|
45
|
-
var invariant = require('fbjs/lib/invariant');
|
|
46
|
-
|
|
47
|
-
function inject() {
|
|
48
|
-
/**
|
|
49
|
-
* Register the event emitter with the native bridge
|
|
50
|
-
*/
|
|
51
|
-
RCTEventEmitter.register(ReactNativeEventEmitter);
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Inject module for resolving DOM hierarchy and plugin ordering.
|
|
55
|
-
*/
|
|
56
|
-
EventPluginHub.injection.injectEventPluginOrder(ReactNativeEventPluginOrder);
|
|
57
|
-
EventPluginUtils.injection.injectComponentTree(ReactNativeComponentTree);
|
|
58
|
-
EventPluginUtils.injection.injectTreeTraversal(ReactNativeTreeTraversal);
|
|
59
|
-
|
|
60
|
-
ResponderEventPlugin.injection.injectGlobalResponderHandler(ReactNativeGlobalResponderHandler);
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Some important event plugins included by default (without having to require
|
|
64
|
-
* them).
|
|
65
|
-
*/
|
|
66
|
-
EventPluginHub.injection.injectEventPluginsByName({
|
|
67
|
-
'ResponderEventPlugin': ResponderEventPlugin,
|
|
68
|
-
'ReactNativeBridgeEventPlugin': ReactNativeBridgeEventPlugin
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
ReactUpdates.injection.injectReconcileTransaction(ReactNativeComponentEnvironment.ReactReconcileTransaction);
|
|
72
|
-
|
|
73
|
-
ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
|
|
74
|
-
|
|
75
|
-
ReactComponentEnvironment.injection.injectEnvironment(ReactNativeComponentEnvironment);
|
|
76
|
-
|
|
77
|
-
var EmptyComponent = function (instantiate) {
|
|
78
|
-
// Can't import View at the top because it depends on React to make its composite
|
|
79
|
-
var View = require('react-native/lib/View');
|
|
80
|
-
return new ReactSimpleEmptyComponent(ReactElement.createElement(View, {
|
|
81
|
-
collapsable: true,
|
|
82
|
-
style: { position: 'absolute' }
|
|
83
|
-
}), instantiate);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
ReactEmptyComponent.injection.injectEmptyComponentFactory(EmptyComponent);
|
|
87
|
-
|
|
88
|
-
ReactHostComponent.injection.injectTextComponentClass(ReactNativeTextComponent);
|
|
89
|
-
ReactHostComponent.injection.injectGenericComponentClass(function (tag) {
|
|
90
|
-
// Show a nicer error message for non-function tags
|
|
91
|
-
var info = '';
|
|
92
|
-
if (typeof tag === 'string' && /^[a-z]/.test(tag)) {
|
|
93
|
-
info += ' Each component name should start with an uppercase letter.';
|
|
94
|
-
}
|
|
95
|
-
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected a component class, got %s.%s', tag, info) : _prodInvariant('18', tag, info) : void 0;
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
module.exports = {
|
|
100
|
-
inject: inject
|
|
101
|
-
};
|
|
@@ -1,191 +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 ReactNativeEventEmitter
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
'use strict';
|
|
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');
|
|
19
|
-
var EventPluginHub = require('./EventPluginHub');
|
|
20
|
-
var EventPluginRegistry = require('./EventPluginRegistry');
|
|
21
|
-
var ReactEventEmitterMixin = require('./ReactEventEmitterMixin');
|
|
22
|
-
var ReactNativeComponentTree = require('./ReactNativeComponentTree');
|
|
23
|
-
var ReactNativeTagHandles = require('./ReactNativeTagHandles');
|
|
24
|
-
var ReactUpdates = require('./ReactUpdates');
|
|
25
|
-
|
|
26
|
-
var warning = require('fbjs/lib/warning');
|
|
27
|
-
|
|
28
|
-
var topLevelTypes = EventConstants.topLevelTypes;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Version of `ReactBrowserEventEmitter` that works on the receiving side of a
|
|
32
|
-
* serialized worker boundary.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
// Shared default empty native event - conserve memory.
|
|
36
|
-
var EMPTY_NATIVE_EVENT = {};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Selects a subsequence of `Touch`es, without destroying `touches`.
|
|
40
|
-
*
|
|
41
|
-
* @param {Array<Touch>} touches Deserialized touch objects.
|
|
42
|
-
* @param {Array<number>} indices Indices by which to pull subsequence.
|
|
43
|
-
* @return {Array<Touch>} Subsequence of touch objects.
|
|
44
|
-
*/
|
|
45
|
-
var touchSubsequence = function (touches, indices) {
|
|
46
|
-
var ret = [];
|
|
47
|
-
for (var i = 0; i < indices.length; i++) {
|
|
48
|
-
ret.push(touches[indices[i]]);
|
|
49
|
-
}
|
|
50
|
-
return ret;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* TODO: Pool all of this.
|
|
55
|
-
*
|
|
56
|
-
* Destroys `touches` by removing touch objects at indices `indices`. This is
|
|
57
|
-
* to maintain compatibility with W3C touch "end" events, where the active
|
|
58
|
-
* touches don't include the set that has just been "ended".
|
|
59
|
-
*
|
|
60
|
-
* @param {Array<Touch>} touches Deserialized touch objects.
|
|
61
|
-
* @param {Array<number>} indices Indices to remove from `touches`.
|
|
62
|
-
* @return {Array<Touch>} Subsequence of removed touch objects.
|
|
63
|
-
*/
|
|
64
|
-
var removeTouchesAtIndices = function (touches, indices) {
|
|
65
|
-
var rippedOut = [];
|
|
66
|
-
// use an unsafe downcast to alias to nullable elements,
|
|
67
|
-
// so we can delete and then compact.
|
|
68
|
-
var temp = touches;
|
|
69
|
-
for (var i = 0; i < indices.length; i++) {
|
|
70
|
-
var index = indices[i];
|
|
71
|
-
rippedOut.push(touches[index]);
|
|
72
|
-
temp[index] = null;
|
|
73
|
-
}
|
|
74
|
-
var fillAt = 0;
|
|
75
|
-
for (var j = 0; j < temp.length; j++) {
|
|
76
|
-
var cur = temp[j];
|
|
77
|
-
if (cur !== null) {
|
|
78
|
-
temp[fillAt++] = cur;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
temp.length = fillAt;
|
|
82
|
-
return rippedOut;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* `ReactNativeEventEmitter` is used to attach top-level event listeners. For example:
|
|
87
|
-
*
|
|
88
|
-
* ReactNativeEventEmitter.putListener('myID', 'onClick', myFunction);
|
|
89
|
-
*
|
|
90
|
-
* This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
|
|
91
|
-
*
|
|
92
|
-
* @internal
|
|
93
|
-
*/
|
|
94
|
-
var ReactNativeEventEmitter = _extends({}, ReactEventEmitterMixin, {
|
|
95
|
-
|
|
96
|
-
registrationNames: EventPluginRegistry.registrationNameModules,
|
|
97
|
-
|
|
98
|
-
putListener: EventPluginHub.putListener,
|
|
99
|
-
|
|
100
|
-
getListener: EventPluginHub.getListener,
|
|
101
|
-
|
|
102
|
-
deleteListener: EventPluginHub.deleteListener,
|
|
103
|
-
|
|
104
|
-
deleteAllListeners: EventPluginHub.deleteAllListeners,
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Internal version of `receiveEvent` in terms of normalized (non-tag)
|
|
108
|
-
* `rootNodeID`.
|
|
109
|
-
*
|
|
110
|
-
* @see receiveEvent.
|
|
111
|
-
*
|
|
112
|
-
* @param {rootNodeID} rootNodeID React root node ID that event occurred on.
|
|
113
|
-
* @param {TopLevelType} topLevelType Top level type of event.
|
|
114
|
-
* @param {object} nativeEventParam Object passed from native.
|
|
115
|
-
*/
|
|
116
|
-
_receiveRootNodeIDEvent: function (rootNodeID, topLevelType, nativeEventParam) {
|
|
117
|
-
var nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT;
|
|
118
|
-
var inst = ReactNativeComponentTree.getInstanceFromNode(rootNodeID);
|
|
119
|
-
if (!inst) {
|
|
120
|
-
// If the original instance is already gone, we don't have to dispatch
|
|
121
|
-
// any events.
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
ReactUpdates.batchedUpdates(function () {
|
|
125
|
-
ReactNativeEventEmitter.handleTopLevel(topLevelType, inst, nativeEvent, nativeEvent.target);
|
|
126
|
-
});
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Publicly exposed method on module for native objc to invoke when a top
|
|
131
|
-
* level event is extracted.
|
|
132
|
-
* @param {rootNodeID} rootNodeID React root node ID that event occurred on.
|
|
133
|
-
* @param {TopLevelType} topLevelType Top level type of event.
|
|
134
|
-
* @param {object} nativeEventParam Object passed from native.
|
|
135
|
-
*/
|
|
136
|
-
receiveEvent: function (tag, topLevelType, nativeEventParam) {
|
|
137
|
-
var rootNodeID = tag;
|
|
138
|
-
ReactNativeEventEmitter._receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam);
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Simple multi-wrapper around `receiveEvent` that is intended to receive an
|
|
143
|
-
* efficient representation of `Touch` objects, and other information that
|
|
144
|
-
* can be used to construct W3C compliant `Event` and `Touch` lists.
|
|
145
|
-
*
|
|
146
|
-
* This may create dispatch behavior that differs than web touch handling. We
|
|
147
|
-
* loop through each of the changed touches and receive it as a single event.
|
|
148
|
-
* So two `touchStart`/`touchMove`s that occur simultaneously are received as
|
|
149
|
-
* two separate touch event dispatches - when they arguably should be one.
|
|
150
|
-
*
|
|
151
|
-
* This implementation reuses the `Touch` objects themselves as the `Event`s
|
|
152
|
-
* since we dispatch an event for each touch (though that might not be spec
|
|
153
|
-
* compliant). The main purpose of reusing them is to save allocations.
|
|
154
|
-
*
|
|
155
|
-
* TODO: Dispatch multiple changed touches in one event. The bubble path
|
|
156
|
-
* could be the first common ancestor of all the `changedTouches`.
|
|
157
|
-
*
|
|
158
|
-
* One difference between this behavior and W3C spec: cancelled touches will
|
|
159
|
-
* not appear in `.touches`, or in any future `.touches`, though they may
|
|
160
|
-
* still be "actively touching the surface".
|
|
161
|
-
*
|
|
162
|
-
* Web desktop polyfills only need to construct a fake touch event with
|
|
163
|
-
* identifier 0, also abandoning traditional click handlers.
|
|
164
|
-
*/
|
|
165
|
-
receiveTouches: function (eventTopLevelType, touches, changedIndices) {
|
|
166
|
-
var changedTouches = eventTopLevelType === topLevelTypes.topTouchEnd || eventTopLevelType === topLevelTypes.topTouchCancel ? removeTouchesAtIndices(touches, changedIndices) : touchSubsequence(touches, changedIndices);
|
|
167
|
-
|
|
168
|
-
for (var jj = 0; jj < changedTouches.length; jj++) {
|
|
169
|
-
var touch = changedTouches[jj];
|
|
170
|
-
// Touch objects can fulfill the role of `DOM` `Event` objects if we set
|
|
171
|
-
// the `changedTouches`/`touches`. This saves allocations.
|
|
172
|
-
touch.changedTouches = changedTouches;
|
|
173
|
-
touch.touches = touches;
|
|
174
|
-
var nativeEvent = touch;
|
|
175
|
-
var rootNodeID = null;
|
|
176
|
-
var target = nativeEvent.target;
|
|
177
|
-
if (target !== null && target !== undefined) {
|
|
178
|
-
if (target < ReactNativeTagHandles.tagsStartAt) {
|
|
179
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
180
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'A view is reporting that a touch occured on tag zero.') : void 0;
|
|
181
|
-
}
|
|
182
|
-
} else {
|
|
183
|
-
rootNodeID = target;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
ReactNativeEventEmitter._receiveRootNodeIDEvent(rootNodeID, eventTopLevelType, nativeEvent);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
module.exports = ReactNativeEventEmitter;
|