React sync for revisions bde4b16...de84d5c

Reviewed By: bvaughn

Differential Revision: D8018924

fbshipit-source-id: 1092ad70ebe95aee70ec3ea9a8edfb6ac46a66c4
This commit is contained in:
Tim Yung 2018-05-15 16:35:11 -07:00 committed by Facebook Github Bot
parent 6c58035ae6
commit 2f4ca831bf
5 changed files with 444 additions and 858 deletions

View File

@ -1 +1 @@
bde4b1659fd4aea796482f24d40c2e834fca635f de84d5c1079b12455058ee177fb3ff97cc0fb8d0

View File

@ -523,21 +523,6 @@ var injection$1 = {
} }
}; };
function isEndish(topLevelType) {
return (
topLevelType === "topMouseUp" ||
topLevelType === "topTouchEnd" ||
topLevelType === "topTouchCancel"
);
}
function isMoveish(topLevelType) {
return topLevelType === "topMouseMove" || topLevelType === "topTouchMove";
}
function isStartish(topLevelType) {
return topLevelType === "topMouseDown" || topLevelType === "topTouchStart";
}
var validateEventDispatches = void 0; var validateEventDispatches = void 0;
{ {
validateEventDispatches = function(event) { validateEventDispatches = function(event) {
@ -807,9 +792,7 @@ var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
var HostComponent = 5; var HostComponent = 5;
var HostText = 6; var HostText = 6;
var CallComponent = 7;
var CallHandlerPhase = 8;
var ReturnComponent = 9;
var Fragment = 10; var Fragment = 10;
var Mode = 11; var Mode = 11;
var ContextConsumer = 12; var ContextConsumer = 12;
@ -1386,6 +1369,29 @@ var ResponderSyntheticEvent = SyntheticEvent$1.extend({
} }
}); });
var TOP_TOUCH_START = "topTouchStart";
var TOP_TOUCH_MOVE = "topTouchMove";
var TOP_TOUCH_END = "topTouchEnd";
var TOP_TOUCH_CANCEL = "topTouchCancel";
var TOP_SCROLL = "topScroll";
var TOP_SELECTION_CHANGE = "topSelectionChange";
function isStartish(topLevelType) {
return topLevelType === TOP_TOUCH_START;
}
function isMoveish(topLevelType) {
return topLevelType === TOP_TOUCH_MOVE;
}
function isEndish(topLevelType) {
return topLevelType === TOP_TOUCH_END || topLevelType === TOP_TOUCH_CANCEL;
}
var startDependencies = [TOP_TOUCH_START];
var moveDependencies = [TOP_TOUCH_MOVE];
var endDependencies = [TOP_TOUCH_CANCEL, TOP_TOUCH_END];
/** /**
* Tracks the position and time of each active touch by `touch.identifier`. We * Tracks the position and time of each active touch by `touch.identifier`. We
* should typically only see IDs in the range of 1-20 because IDs get recycled * should typically only see IDs in the range of 1-20 because IDs get recycled
@ -1608,11 +1614,6 @@ var responderInst = null;
*/ */
var trackedTouchCount = 0; var trackedTouchCount = 0;
/**
* Last reported number of active touches.
*/
var previousActiveTouches = 0;
var changeResponder = function(nextResponderInst, blockHostResponder) { var changeResponder = function(nextResponderInst, blockHostResponder) {
var oldResponderInst = responderInst; var oldResponderInst = responderInst;
responderInst = nextResponderInst; responderInst = nextResponderInst;
@ -1634,7 +1635,8 @@ var eventTypes$1 = {
phasedRegistrationNames: { phasedRegistrationNames: {
bubbled: "onStartShouldSetResponder", bubbled: "onStartShouldSetResponder",
captured: "onStartShouldSetResponderCapture" captured: "onStartShouldSetResponderCapture"
} },
dependencies: startDependencies
}, },
/** /**
@ -1650,7 +1652,8 @@ var eventTypes$1 = {
phasedRegistrationNames: { phasedRegistrationNames: {
bubbled: "onScrollShouldSetResponder", bubbled: "onScrollShouldSetResponder",
captured: "onScrollShouldSetResponderCapture" captured: "onScrollShouldSetResponderCapture"
} },
dependencies: [TOP_SCROLL]
}, },
/** /**
@ -1664,7 +1667,8 @@ var eventTypes$1 = {
phasedRegistrationNames: { phasedRegistrationNames: {
bubbled: "onSelectionChangeShouldSetResponder", bubbled: "onSelectionChangeShouldSetResponder",
captured: "onSelectionChangeShouldSetResponderCapture" captured: "onSelectionChangeShouldSetResponderCapture"
} },
dependencies: [TOP_SELECTION_CHANGE]
}, },
/** /**
@ -1675,22 +1679,45 @@ var eventTypes$1 = {
phasedRegistrationNames: { phasedRegistrationNames: {
bubbled: "onMoveShouldSetResponder", bubbled: "onMoveShouldSetResponder",
captured: "onMoveShouldSetResponderCapture" captured: "onMoveShouldSetResponderCapture"
} },
dependencies: moveDependencies
}, },
/** /**
* Direct responder events dispatched directly to responder. Do not bubble. * Direct responder events dispatched directly to responder. Do not bubble.
*/ */
responderStart: { registrationName: "onResponderStart" }, responderStart: {
responderMove: { registrationName: "onResponderMove" }, registrationName: "onResponderStart",
responderEnd: { registrationName: "onResponderEnd" }, dependencies: startDependencies
responderRelease: { registrationName: "onResponderRelease" },
responderTerminationRequest: {
registrationName: "onResponderTerminationRequest"
}, },
responderGrant: { registrationName: "onResponderGrant" }, responderMove: {
responderReject: { registrationName: "onResponderReject" }, registrationName: "onResponderMove",
responderTerminate: { registrationName: "onResponderTerminate" } dependencies: moveDependencies
},
responderEnd: {
registrationName: "onResponderEnd",
dependencies: endDependencies
},
responderRelease: {
registrationName: "onResponderRelease",
dependencies: endDependencies
},
responderTerminationRequest: {
registrationName: "onResponderTerminationRequest",
dependencies: []
},
responderGrant: {
registrationName: "onResponderGrant",
dependencies: []
},
responderReject: {
registrationName: "onResponderReject",
dependencies: []
},
responderTerminate: {
registrationName: "onResponderTerminate",
dependencies: []
}
}; };
/** /**
@ -1893,7 +1920,7 @@ function setResponderAndExtractTransfer(
? eventTypes$1.startShouldSetResponder ? eventTypes$1.startShouldSetResponder
: isMoveish(topLevelType) : isMoveish(topLevelType)
? eventTypes$1.moveShouldSetResponder ? eventTypes$1.moveShouldSetResponder
: topLevelType === "topSelectionChange" : topLevelType === TOP_SELECTION_CHANGE
? eventTypes$1.selectionChangeShouldSetResponder ? eventTypes$1.selectionChangeShouldSetResponder
: eventTypes$1.scrollShouldSetResponder; : eventTypes$1.scrollShouldSetResponder;
@ -1998,8 +2025,8 @@ function canTriggerTransfer(topLevelType, topLevelInst, nativeEvent) {
// responderIgnoreScroll: We are trying to migrate away from specifically // responderIgnoreScroll: We are trying to migrate away from specifically
// tracking native scroll events here and responderIgnoreScroll indicates we // tracking native scroll events here and responderIgnoreScroll indicates we
// will send topTouchCancel to handle canceling touch events instead // will send topTouchCancel to handle canceling touch events instead
((topLevelType === "topScroll" && !nativeEvent.responderIgnoreScroll) || ((topLevelType === TOP_SCROLL && !nativeEvent.responderIgnoreScroll) ||
(trackedTouchCount > 0 && topLevelType === "topSelectionChange") || (trackedTouchCount > 0 && topLevelType === TOP_SELECTION_CHANGE) ||
isStartish(topLevelType) || isStartish(topLevelType) ||
isMoveish(topLevelType)) isMoveish(topLevelType))
); );
@ -2105,7 +2132,7 @@ var ResponderEventPlugin = {
} }
var isResponderTerminate = var isResponderTerminate =
responderInst && topLevelType === "topTouchCancel"; responderInst && topLevelType === TOP_TOUCH_CANCEL;
var isResponderRelease = var isResponderRelease =
responderInst && responderInst &&
!isResponderTerminate && !isResponderTerminate &&
@ -2127,23 +2154,10 @@ var ResponderEventPlugin = {
changeResponder(null); changeResponder(null);
} }
var numberActiveTouches =
ResponderTouchHistoryStore.touchHistory.numberActiveTouches;
if (
ResponderEventPlugin.GlobalInteractionHandler &&
numberActiveTouches !== previousActiveTouches
) {
ResponderEventPlugin.GlobalInteractionHandler.onChange(
numberActiveTouches
);
}
previousActiveTouches = numberActiveTouches;
return extracted; return extracted;
}, },
GlobalResponderHandler: null, GlobalResponderHandler: null,
GlobalInteractionHandler: null,
injection: { injection: {
/** /**
@ -2153,14 +2167,6 @@ var ResponderEventPlugin = {
*/ */
injectGlobalResponderHandler: function(GlobalResponderHandler) { injectGlobalResponderHandler: function(GlobalResponderHandler) {
ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler; ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler;
},
/**
* @param {{onChange: (numberActiveTouches) => void} GlobalInteractionHandler
* Object that handles any change in the number of active touches.
*/
injectGlobalInteractionHandler: function(GlobalInteractionHandler) {
ResponderEventPlugin.GlobalInteractionHandler = GlobalInteractionHandler;
} }
} }
}; };
@ -2320,8 +2326,6 @@ injection.injectEventPluginsByName({
var hasSymbol = typeof Symbol === "function" && Symbol.for; var hasSymbol = typeof Symbol === "function" && Symbol.for;
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 0xeac7; var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 0xeac7;
var REACT_CALL_TYPE = hasSymbol ? Symbol.for("react.call") : 0xeac8;
var REACT_RETURN_TYPE = hasSymbol ? Symbol.for("react.return") : 0xeac9;
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 0xeaca; var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 0xeaca;
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 0xeacb; var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 0xeacb;
var REACT_STRICT_MODE_TYPE = hasSymbol var REACT_STRICT_MODE_TYPE = hasSymbol
@ -3335,8 +3339,6 @@ function getComponentName(fiber) {
switch (type) { switch (type) {
case REACT_ASYNC_MODE_TYPE: case REACT_ASYNC_MODE_TYPE:
return "AsyncMode"; return "AsyncMode";
case REACT_CALL_TYPE:
return "ReactCall";
case REACT_CONTEXT_TYPE: case REACT_CONTEXT_TYPE:
return "Context.Consumer"; return "Context.Consumer";
case REACT_FRAGMENT_TYPE: case REACT_FRAGMENT_TYPE:
@ -3347,8 +3349,6 @@ function getComponentName(fiber) {
return "Profiler(" + fiber.pendingProps.id + ")"; return "Profiler(" + fiber.pendingProps.id + ")";
case REACT_PROVIDER_TYPE: case REACT_PROVIDER_TYPE:
return "Context.Provider"; return "Context.Provider";
case REACT_RETURN_TYPE:
return "ReactReturn";
case REACT_STRICT_MODE_TYPE: case REACT_STRICT_MODE_TYPE:
return "StrictMode"; return "StrictMode";
} }
@ -3908,12 +3908,6 @@ function createFiberFromElement(element, mode, expirationTime) {
break; break;
case REACT_PROFILER_TYPE: case REACT_PROFILER_TYPE:
return createFiberFromProfiler(pendingProps, mode, expirationTime, key); return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
case REACT_CALL_TYPE:
fiberTag = CallComponent;
break;
case REACT_RETURN_TYPE:
fiberTag = ReturnComponent;
break;
case REACT_TIMEOUT_TYPE: case REACT_TIMEOUT_TYPE:
fiberTag = TimeoutComponent; fiberTag = TimeoutComponent;
// Suspense does not require async, but its children should be strict // Suspense does not require async, but its children should be strict
@ -4879,8 +4873,6 @@ var shouldIgnoreFiber = function(fiber) {
case HostComponent: case HostComponent:
case HostText: case HostText:
case HostPortal: case HostPortal:
case CallComponent:
case ReturnComponent:
case Fragment: case Fragment:
case ContextProvider: case ContextProvider:
case ContextConsumer: case ContextConsumer:
@ -8716,44 +8708,6 @@ var ReactFiberBeginWork = function(
} }
} }
function updateCallComponent(current, workInProgress, renderExpirationTime) {
var nextProps = workInProgress.pendingProps;
if (hasLegacyContextChanged()) {
// Normally we can bail out on props equality but if context has changed
// we don't do the bailout and we have to reuse existing props instead.
} else if (workInProgress.memoizedProps === nextProps) {
nextProps = workInProgress.memoizedProps;
// TODO: When bailing out, we might need to return the stateNode instead
// of the child. To check it for work.
// return bailoutOnAlreadyFinishedWork(current, workInProgress);
}
var nextChildren = nextProps.children;
// The following is a fork of reconcileChildrenAtExpirationTime but using
// stateNode to store the child.
if (current === null) {
workInProgress.stateNode = mountChildFibers(
workInProgress,
workInProgress.stateNode,
nextChildren,
renderExpirationTime
);
} else {
workInProgress.stateNode = reconcileChildFibers(
workInProgress,
current.stateNode,
nextChildren,
renderExpirationTime
);
}
memoizeProps(workInProgress, nextProps);
// This doesn't take arbitrary time so we could synchronously just begin
// eagerly do the work of workInProgress.child as an optimization.
return workInProgress.stateNode;
}
function updateTimeoutComponent( function updateTimeoutComponent(
current, current,
workInProgress, workInProgress,
@ -9230,20 +9184,6 @@ var ReactFiberBeginWork = function(
); );
case HostText: case HostText:
return updateHostText(current, workInProgress); return updateHostText(current, workInProgress);
case CallHandlerPhase:
// This is a restart. Reset the tag to the initial phase.
workInProgress.tag = CallComponent;
// Intentionally fall through since this is now the same.
case CallComponent:
return updateCallComponent(
current,
workInProgress,
renderExpirationTime
);
case ReturnComponent:
// A return component is just a placeholder, we can just run through the
// next one immediately.
return null;
case TimeoutComponent: case TimeoutComponent:
return updateTimeoutComponent( return updateTimeoutComponent(
current, current,
@ -9330,75 +9270,6 @@ var ReactFiberCompleteWork = function(
workInProgress.effectTag |= Ref; workInProgress.effectTag |= Ref;
} }
function appendAllReturns(returns, workInProgress) {
var node = workInProgress.stateNode;
if (node) {
node.return = workInProgress;
}
while (node !== null) {
if (
node.tag === HostComponent ||
node.tag === HostText ||
node.tag === HostPortal
) {
invariant(false, "A call cannot have host component children.");
} else if (node.tag === ReturnComponent) {
returns.push(node.pendingProps.value);
} else if (node.child !== null) {
node.child.return = node;
node = node.child;
continue;
}
while (node.sibling === null) {
if (node.return === null || node.return === workInProgress) {
return;
}
node = node.return;
}
node.sibling.return = node.return;
node = node.sibling;
}
}
function moveCallToHandlerPhase(
current,
workInProgress,
renderExpirationTime
) {
var props = workInProgress.memoizedProps;
invariant(
props,
"Should be resolved by now. This error is likely caused by a bug in " +
"React. Please file an issue."
);
// First step of the call has completed. Now we need to do the second.
// TODO: It would be nice to have a multi stage call represented by a
// single component, or at least tail call optimize nested ones. Currently
// that requires additional fields that we don't want to add to the fiber.
// So this requires nested handlers.
// Note: This doesn't mutate the alternate node. I don't think it needs to
// since this stage is reset for every pass.
workInProgress.tag = CallHandlerPhase;
// Build up the returns.
// TODO: Compare this to a generator or opaque helpers like Children.
var returns = [];
appendAllReturns(returns, workInProgress);
var fn = props.handler;
var childProps = props.props;
var nextChildren = fn(childProps, returns);
var currentFirstChild = current !== null ? current.child : null;
workInProgress.child = reconcileChildFibers(
workInProgress,
currentFirstChild,
nextChildren,
renderExpirationTime
);
return workInProgress.child;
}
function appendAllChildren(parent, workInProgress) { function appendAllChildren(parent, workInProgress) {
// We only have the top Fiber that was created but we need recurse down its // We only have the top Fiber that was created but we need recurse down its
// children to find all the terminal nodes. // children to find all the terminal nodes.
@ -9792,19 +9663,6 @@ var ReactFiberCompleteWork = function(
} }
return null; return null;
} }
case CallComponent:
return moveCallToHandlerPhase(
current,
workInProgress,
renderExpirationTime
);
case CallHandlerPhase:
// Reset the tag to now be a first phase call.
workInProgress.tag = CallComponent;
return null;
case ReturnComponent:
// Does nothing.
return null;
case ForwardRef: case ForwardRef:
return null; return null;
case TimeoutComponent: case TimeoutComponent:
@ -10285,10 +10143,6 @@ var ReactFiberCommitWork = function(
safelyDetachRef(current); safelyDetachRef(current);
return; return;
} }
case CallComponent: {
commitNestedUnmounts(current.stateNode);
return;
}
case HostPortal: { case HostPortal: {
// TODO: this is recursive. // TODO: this is recursive.
// We are also not using this parent because // We are also not using this parent because
@ -10428,7 +10282,7 @@ var ReactFiberCommitWork = function(
commitUpdate = mutation.commitUpdate, commitUpdate = mutation.commitUpdate,
resetTextContent = mutation.resetTextContent, resetTextContent = mutation.resetTextContent,
commitTextUpdate = mutation.commitTextUpdate, commitTextUpdate = mutation.commitTextUpdate,
appendChild = mutation.appendChild, appendChild$$1 = mutation.appendChild,
appendChildToContainer = mutation.appendChildToContainer, appendChildToContainer = mutation.appendChildToContainer,
insertBefore = mutation.insertBefore, insertBefore = mutation.insertBefore,
insertInContainerBefore = mutation.insertInContainerBefore, insertInContainerBefore = mutation.insertInContainerBefore,
@ -10547,7 +10401,7 @@ var ReactFiberCommitWork = function(
if (isContainer) { if (isContainer) {
appendChildToContainer(parent, node.stateNode); appendChildToContainer(parent, node.stateNode);
} else { } else {
appendChild(parent, node.stateNode); appendChild$$1(parent, node.stateNode);
} }
} }
} else if (node.tag === HostPortal) { } else if (node.tag === HostPortal) {
@ -13027,12 +12881,17 @@ var ReactFiberScheduler = function(config) {
var next = void 0; var next = void 0;
if (enableProfilerTimer) { if (enableProfilerTimer) {
startBaseRenderTimer(); if (workInProgress.mode & ProfileMode) {
startBaseRenderTimer();
}
next = beginWork(current, workInProgress, nextRenderExpirationTime); next = beginWork(current, workInProgress, nextRenderExpirationTime);
// Update "base" time if the render wasn't bailed out on. if (workInProgress.mode & ProfileMode) {
recordElapsedBaseRenderTimeIfRunning(workInProgress); // Update "base" time if the render wasn't bailed out on.
stopBaseRenderTimerIfRunning(); recordElapsedBaseRenderTimeIfRunning(workInProgress);
stopBaseRenderTimerIfRunning();
}
} else { } else {
next = beginWork(current, workInProgress, nextRenderExpirationTime); next = beginWork(current, workInProgress, nextRenderExpirationTime);
} }
@ -13822,13 +13681,13 @@ var ReactFiberScheduler = function(config) {
var finishedWork = root.finishedWork; var finishedWork = root.finishedWork;
if (finishedWork !== null) { if (finishedWork !== null) {
// This root is already complete. We can commit it. // This root is already complete. We can commit it.
completeRoot(root, finishedWork, expirationTime); completeRoot$$1(root, finishedWork, expirationTime);
} else { } else {
root.finishedWork = null; root.finishedWork = null;
finishedWork = renderRoot(root, expirationTime, false); finishedWork = renderRoot(root, expirationTime, false);
if (finishedWork !== null) { if (finishedWork !== null) {
// We've completed the root. Commit it. // We've completed the root. Commit it.
completeRoot(root, finishedWork, expirationTime); completeRoot$$1(root, finishedWork, expirationTime);
} }
} }
} else { } else {
@ -13836,7 +13695,7 @@ var ReactFiberScheduler = function(config) {
var _finishedWork = root.finishedWork; var _finishedWork = root.finishedWork;
if (_finishedWork !== null) { if (_finishedWork !== null) {
// This root is already complete. We can commit it. // This root is already complete. We can commit it.
completeRoot(root, _finishedWork, expirationTime); completeRoot$$1(root, _finishedWork, expirationTime);
} else { } else {
root.finishedWork = null; root.finishedWork = null;
_finishedWork = renderRoot(root, expirationTime, true); _finishedWork = renderRoot(root, expirationTime, true);
@ -13845,7 +13704,7 @@ var ReactFiberScheduler = function(config) {
// before committing. // before committing.
if (!shouldYield()) { if (!shouldYield()) {
// Still time left. Commit the root. // Still time left. Commit the root.
completeRoot(root, _finishedWork, expirationTime); completeRoot$$1(root, _finishedWork, expirationTime);
} else { } else {
// There's no time left. Mark this root as complete. We'll come // There's no time left. Mark this root as complete. We'll come
// back and commit it later. // back and commit it later.
@ -13864,7 +13723,7 @@ var ReactFiberScheduler = function(config) {
isRendering = false; isRendering = false;
} }
function completeRoot(root, finishedWork, expirationTime) { function completeRoot$$1(root, finishedWork, expirationTime) {
// Check if there's a batch that matches this expiration time. // Check if there's a batch that matches this expiration time.
var firstBatch = root.firstBatch; var firstBatch = root.firstBatch;
if (firstBatch !== null && firstBatch._expirationTime <= expirationTime) { if (firstBatch !== null && firstBatch._expirationTime <= expirationTime) {
@ -14434,7 +14293,7 @@ var ReactFabricHostComponent = (function() {
return ReactFabricHostComponent; return ReactFabricHostComponent;
})(); })();
var ReacFabricHostConfig = { var ReactFabricHostConfig = {
appendInitialChild: function(parentInstance, child) { appendInitialChild: function(parentInstance, child) {
FabricUIManager.appendChild(parentInstance.node, child.node); FabricUIManager.appendChild(parentInstance.node, child.node);
}, },
@ -14470,7 +14329,7 @@ var ReacFabricHostConfig = {
viewConfig.uiViewClassName, // viewName viewConfig.uiViewClassName, // viewName
rootContainerInstance, // rootTag rootContainerInstance, // rootTag
updatePayload, // props updatePayload, // props
internalInstanceHandle internalInstanceHandle // internalInstanceHandle
); );
var component = new ReactFabricHostComponent(tag, viewConfig, props); var component = new ReactFabricHostComponent(tag, viewConfig, props);
@ -14499,7 +14358,7 @@ var ReacFabricHostConfig = {
"RCTRawText", // viewName "RCTRawText", // viewName
rootContainerInstance, // rootTag rootContainerInstance, // rootTag
{ text: text }, // props { text: text }, // props
internalInstanceHandle internalInstanceHandle // instance handle
); );
return { return {
@ -14593,18 +14452,26 @@ var ReacFabricHostConfig = {
var clone = void 0; var clone = void 0;
if (keepChildren) { if (keepChildren) {
if (updatePayload !== null) { if (updatePayload !== null) {
clone = FabricUIManager.cloneNodeWithNewProps(node, updatePayload); clone = FabricUIManager.cloneNodeWithNewProps(
node,
updatePayload,
internalInstanceHandle
);
} else { } else {
clone = FabricUIManager.cloneNode(node); clone = FabricUIManager.cloneNode(node, internalInstanceHandle);
} }
} else { } else {
if (updatePayload !== null) { if (updatePayload !== null) {
clone = FabricUIManager.cloneNodeWithNewChildrenAndProps( clone = FabricUIManager.cloneNodeWithNewChildrenAndProps(
node, node,
updatePayload updatePayload,
internalInstanceHandle
); );
} else { } else {
clone = FabricUIManager.cloneNodeWithNewChildren(node); clone = FabricUIManager.cloneNodeWithNewChildren(
node,
internalInstanceHandle
);
} }
} }
return { return {
@ -14625,7 +14492,7 @@ var ReacFabricHostConfig = {
} }
}; };
var ReactFabricRenderer = reactReconciler(ReacFabricHostConfig); var ReactFabricRenderer = reactReconciler(ReactFabricHostConfig);
// Module provided by RN: // Module provided by RN:
var getInspectorDataForViewTag = void 0; var getInspectorDataForViewTag = void 0;
@ -14816,7 +14683,7 @@ var ReactFabric = {
// Used as a mixin in many createClass-based components // Used as a mixin in many createClass-based components
NativeMethodsMixin: NativeMethodsMixin(findNodeHandle, findHostInstance), NativeMethodsMixin: NativeMethodsMixin(findNodeHandle, findHostInstance),
// Used by react-native-github/Libraries/ components // Used by react-native-github/Libraries/ components
ReactNativeComponentTree: ReactNativeComponentTree ReactNativeComponentTree: ReactNativeComponentTree // ScrollResponder
} }
}; };

View File

@ -100,19 +100,6 @@ var plugins = [],
getFiberCurrentPropsFromNode = null, getFiberCurrentPropsFromNode = null,
getInstanceFromNode = null, getInstanceFromNode = null,
getNodeFromInstance = null; getNodeFromInstance = null;
function isEndish(topLevelType) {
return (
"topMouseUp" === topLevelType ||
"topTouchEnd" === topLevelType ||
"topTouchCancel" === topLevelType
);
}
function isMoveish(topLevelType) {
return "topMouseMove" === topLevelType || "topTouchMove" === topLevelType;
}
function isStartish(topLevelType) {
return "topMouseDown" === topLevelType || "topTouchStart" === topLevelType;
}
function executeDirectDispatch(event) { function executeDirectDispatch(event) {
var dispatchListener = event._dispatchListeners, var dispatchListener = event._dispatchListeners,
dispatchInstance = event._dispatchInstances; dispatchInstance = event._dispatchInstances;
@ -382,10 +369,19 @@ function addEventPoolingTo(EventConstructor) {
EventConstructor.release = releasePooledEvent; EventConstructor.release = releasePooledEvent;
} }
var ResponderSyntheticEvent = SyntheticEvent.extend({ var ResponderSyntheticEvent = SyntheticEvent.extend({
touchHistory: function() { touchHistory: function() {
return null; return null;
} }
}), });
function isStartish(topLevelType) {
return "topTouchStart" === topLevelType;
}
function isMoveish(topLevelType) {
return "topTouchMove" === topLevelType;
}
var startDependencies = ["topTouchStart"],
moveDependencies = ["topTouchMove"],
endDependencies = ["topTouchCancel", "topTouchEnd"],
touchBank = [], touchBank = [],
touchHistory = { touchHistory = {
touchBank: touchBank, touchBank: touchBank,
@ -491,19 +487,22 @@ var ResponderTouchHistoryStore = {
(touchHistory.indexOfSingleActiveTouch = (touchHistory.indexOfSingleActiveTouch =
nativeEvent.touches[0].identifier); nativeEvent.touches[0].identifier);
else if ( else if (
isEndish(topLevelType) && "topTouchEnd" === topLevelType ||
(nativeEvent.changedTouches.forEach(recordTouchEnd), "topTouchCancel" === topLevelType
(touchHistory.numberActiveTouches = nativeEvent.touches.length),
1 === touchHistory.numberActiveTouches)
) )
for (topLevelType = 0; topLevelType < touchBank.length; topLevelType++) if (
if ( (nativeEvent.changedTouches.forEach(recordTouchEnd),
((nativeEvent = touchBank[topLevelType]), (touchHistory.numberActiveTouches = nativeEvent.touches.length),
null != nativeEvent && nativeEvent.touchActive) 1 === touchHistory.numberActiveTouches)
) { )
touchHistory.indexOfSingleActiveTouch = topLevelType; for (topLevelType = 0; topLevelType < touchBank.length; topLevelType++)
break; if (
} ((nativeEvent = touchBank[topLevelType]),
null != nativeEvent && nativeEvent.touchActive)
) {
touchHistory.indexOfSingleActiveTouch = topLevelType;
break;
}
}, },
touchHistory: touchHistory touchHistory: touchHistory
}; };
@ -519,8 +518,7 @@ function accumulate(current, next) {
: Array.isArray(next) ? [current].concat(next) : [current, next]; : Array.isArray(next) ? [current].concat(next) : [current, next];
} }
var responderInst = null, var responderInst = null,
trackedTouchCount = 0, trackedTouchCount = 0;
previousActiveTouches = 0;
function changeResponder(nextResponderInst, blockHostResponder) { function changeResponder(nextResponderInst, blockHostResponder) {
var oldResponderInst = responderInst; var oldResponderInst = responderInst;
responderInst = nextResponderInst; responderInst = nextResponderInst;
@ -536,36 +534,59 @@ var eventTypes$1 = {
phasedRegistrationNames: { phasedRegistrationNames: {
bubbled: "onStartShouldSetResponder", bubbled: "onStartShouldSetResponder",
captured: "onStartShouldSetResponderCapture" captured: "onStartShouldSetResponderCapture"
} },
dependencies: startDependencies
}, },
scrollShouldSetResponder: { scrollShouldSetResponder: {
phasedRegistrationNames: { phasedRegistrationNames: {
bubbled: "onScrollShouldSetResponder", bubbled: "onScrollShouldSetResponder",
captured: "onScrollShouldSetResponderCapture" captured: "onScrollShouldSetResponderCapture"
} },
dependencies: ["topScroll"]
}, },
selectionChangeShouldSetResponder: { selectionChangeShouldSetResponder: {
phasedRegistrationNames: { phasedRegistrationNames: {
bubbled: "onSelectionChangeShouldSetResponder", bubbled: "onSelectionChangeShouldSetResponder",
captured: "onSelectionChangeShouldSetResponderCapture" captured: "onSelectionChangeShouldSetResponderCapture"
} },
dependencies: ["topSelectionChange"]
}, },
moveShouldSetResponder: { moveShouldSetResponder: {
phasedRegistrationNames: { phasedRegistrationNames: {
bubbled: "onMoveShouldSetResponder", bubbled: "onMoveShouldSetResponder",
captured: "onMoveShouldSetResponderCapture" captured: "onMoveShouldSetResponderCapture"
} },
dependencies: moveDependencies
},
responderStart: {
registrationName: "onResponderStart",
dependencies: startDependencies
},
responderMove: {
registrationName: "onResponderMove",
dependencies: moveDependencies
},
responderEnd: {
registrationName: "onResponderEnd",
dependencies: endDependencies
},
responderRelease: {
registrationName: "onResponderRelease",
dependencies: endDependencies
}, },
responderStart: { registrationName: "onResponderStart" },
responderMove: { registrationName: "onResponderMove" },
responderEnd: { registrationName: "onResponderEnd" },
responderRelease: { registrationName: "onResponderRelease" },
responderTerminationRequest: { responderTerminationRequest: {
registrationName: "onResponderTerminationRequest" registrationName: "onResponderTerminationRequest",
dependencies: []
}, },
responderGrant: { registrationName: "onResponderGrant" }, responderGrant: { registrationName: "onResponderGrant", dependencies: [] },
responderReject: { registrationName: "onResponderReject" }, responderReject: {
responderTerminate: { registrationName: "onResponderTerminate" } registrationName: "onResponderReject",
dependencies: []
},
responderTerminate: {
registrationName: "onResponderTerminate",
dependencies: []
}
}, },
ResponderEventPlugin = { ResponderEventPlugin = {
_getResponder: function() { _getResponder: function() {
@ -579,7 +600,10 @@ var eventTypes$1 = {
nativeEventTarget nativeEventTarget
) { ) {
if (isStartish(topLevelType)) trackedTouchCount += 1; if (isStartish(topLevelType)) trackedTouchCount += 1;
else if (isEndish(topLevelType)) else if (
"topTouchEnd" === topLevelType ||
"topTouchCancel" === topLevelType
)
if (0 <= trackedTouchCount) --trackedTouchCount; if (0 <= trackedTouchCount) --trackedTouchCount;
else else
return ( return (
@ -749,7 +773,9 @@ var eventTypes$1 = {
} else JSCompiler_temp = null; } else JSCompiler_temp = null;
JSCompiler_temp$jscomp$0 = responderInst && isStartish(topLevelType); JSCompiler_temp$jscomp$0 = responderInst && isStartish(topLevelType);
targetInst = responderInst && isMoveish(topLevelType); targetInst = responderInst && isMoveish(topLevelType);
depthA = responderInst && isEndish(topLevelType); depthA =
responderInst &&
("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType);
if ( if (
(JSCompiler_temp$jscomp$0 = JSCompiler_temp$jscomp$0 (JSCompiler_temp$jscomp$0 = JSCompiler_temp$jscomp$0
? eventTypes$1.responderStart ? eventTypes$1.responderStart
@ -777,7 +803,9 @@ var eventTypes$1 = {
responderInst && "topTouchCancel" === topLevelType; responderInst && "topTouchCancel" === topLevelType;
if ( if (
(topLevelType = (topLevelType =
responderInst && !JSCompiler_temp$jscomp$0 && isEndish(topLevelType)) responderInst &&
!JSCompiler_temp$jscomp$0 &&
("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType))
) )
a: { a: {
if ((topLevelType = nativeEvent.touches) && 0 !== topLevelType.length) if ((topLevelType = nativeEvent.touches) && 0 !== topLevelType.length)
@ -819,23 +847,12 @@ var eventTypes$1 = {
forEachAccumulated(nativeEvent, accumulateDirectDispatchesSingle), forEachAccumulated(nativeEvent, accumulateDirectDispatchesSingle),
(JSCompiler_temp = accumulate(JSCompiler_temp, nativeEvent)), (JSCompiler_temp = accumulate(JSCompiler_temp, nativeEvent)),
changeResponder(null); changeResponder(null);
nativeEvent = ResponderTouchHistoryStore.touchHistory.numberActiveTouches;
if (
ResponderEventPlugin.GlobalInteractionHandler &&
nativeEvent !== previousActiveTouches
)
ResponderEventPlugin.GlobalInteractionHandler.onChange(nativeEvent);
previousActiveTouches = nativeEvent;
return JSCompiler_temp; return JSCompiler_temp;
}, },
GlobalResponderHandler: null, GlobalResponderHandler: null,
GlobalInteractionHandler: null,
injection: { injection: {
injectGlobalResponderHandler: function(GlobalResponderHandler) { injectGlobalResponderHandler: function(GlobalResponderHandler) {
ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler; ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler;
},
injectGlobalInteractionHandler: function(GlobalInteractionHandler) {
ResponderEventPlugin.GlobalInteractionHandler = GlobalInteractionHandler;
} }
} }
}, },
@ -922,8 +939,6 @@ injection.injectEventPluginsByName({
}); });
var hasSymbol = "function" === typeof Symbol && Symbol.for, var hasSymbol = "function" === typeof Symbol && Symbol.for,
REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103, REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103,
REACT_CALL_TYPE = hasSymbol ? Symbol.for("react.call") : 60104,
REACT_RETURN_TYPE = hasSymbol ? Symbol.for("react.return") : 60105,
REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106, REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106,
REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107, REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107,
REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108, REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108,
@ -1213,8 +1228,6 @@ function getComponentName(fiber) {
switch (type) { switch (type) {
case REACT_ASYNC_MODE_TYPE: case REACT_ASYNC_MODE_TYPE:
return "AsyncMode"; return "AsyncMode";
case REACT_CALL_TYPE:
return "ReactCall";
case REACT_CONTEXT_TYPE: case REACT_CONTEXT_TYPE:
return "Context.Consumer"; return "Context.Consumer";
case REACT_FRAGMENT_TYPE: case REACT_FRAGMENT_TYPE:
@ -1225,8 +1238,6 @@ function getComponentName(fiber) {
return "Profiler(" + fiber.pendingProps.id + ")"; return "Profiler(" + fiber.pendingProps.id + ")";
case REACT_PROVIDER_TYPE: case REACT_PROVIDER_TYPE:
return "Context.Provider"; return "Context.Provider";
case REACT_RETURN_TYPE:
return "ReactReturn";
case REACT_STRICT_MODE_TYPE: case REACT_STRICT_MODE_TYPE:
return "StrictMode"; return "StrictMode";
} }
@ -1444,12 +1455,6 @@ function createFiberFromElement(element, mode, expirationTime) {
(type.stateNode = { duration: 0, startTime: 0 }), (type.stateNode = { duration: 0, startTime: 0 }),
type type
); );
case REACT_CALL_TYPE:
fiberTag = 7;
break;
case REACT_RETURN_TYPE:
fiberTag = 9;
break;
case REACT_TIMEOUT_TYPE: case REACT_TIMEOUT_TYPE:
fiberTag = 16; fiberTag = 16;
mode |= 2; mode |= 2;
@ -3377,34 +3382,6 @@ function ReactFiberBeginWork(
(workInProgress.memoizedProps = workInProgress.pendingProps), (workInProgress.memoizedProps = workInProgress.pendingProps),
null null
); );
case 8:
workInProgress.tag = 7;
case 7:
return (
(props = workInProgress.pendingProps),
hasLegacyContextChanged() ||
workInProgress.memoizedProps !== props ||
(props = workInProgress.memoizedProps),
(fn = props.children),
(workInProgress.stateNode =
null === current
? mountChildFibers(
workInProgress,
workInProgress.stateNode,
fn,
renderExpirationTime
)
: reconcileChildFibers(
workInProgress,
current.stateNode,
fn,
renderExpirationTime
)),
(workInProgress.memoizedProps = props),
workInProgress.stateNode
);
case 9:
return null;
case 16: case 16:
return null; return null;
case 4: case 4:
@ -3687,7 +3664,7 @@ function ReactFiberCompleteWork(
}; };
} else invariant(!1, "Noop reconciler is disabled."); } else invariant(!1, "Noop reconciler is disabled.");
return { return {
completeWork: function(current, workInProgress, renderExpirationTime) { completeWork: function(current, workInProgress) {
var newProps = workInProgress.pendingProps; var newProps = workInProgress.pendingProps;
switch (workInProgress.tag) { switch (workInProgress.tag) {
case 1: case 1:
@ -3707,8 +3684,8 @@ function ReactFiberCompleteWork(
return null; return null;
case 5: case 5:
popHostContext(workInProgress); popHostContext(workInProgress);
renderExpirationTime = getRootHostContainer(); var rootContainerInstance = getRootHostContainer(),
var type = workInProgress.type; type = workInProgress.type;
if (null !== current && null != workInProgress.stateNode) { if (null !== current && null != workInProgress.stateNode) {
var oldProps = current.memoizedProps, var oldProps = current.memoizedProps,
instance = workInProgress.stateNode, instance = workInProgress.stateNode,
@ -3718,7 +3695,7 @@ function ReactFiberCompleteWork(
type, type,
oldProps, oldProps,
newProps, newProps,
renderExpirationTime, rootContainerInstance,
currentHostContext currentHostContext
); );
updateHostComponent( updateHostComponent(
@ -3728,7 +3705,7 @@ function ReactFiberCompleteWork(
type, type,
oldProps, oldProps,
newProps, newProps,
renderExpirationTime, rootContainerInstance,
currentHostContext currentHostContext
); );
current.ref !== workInProgress.ref && current.ref !== workInProgress.ref &&
@ -3746,13 +3723,13 @@ function ReactFiberCompleteWork(
popHydrationState(workInProgress) popHydrationState(workInProgress)
? prepareToHydrateHostInstance( ? prepareToHydrateHostInstance(
workInProgress, workInProgress,
renderExpirationTime, rootContainerInstance,
current current
) && markUpdate(workInProgress) ) && markUpdate(workInProgress)
: ((oldProps = createInstance( : ((oldProps = createInstance(
type, type,
newProps, newProps,
renderExpirationTime, rootContainerInstance,
current, current,
workInProgress workInProgress
)), )),
@ -3761,7 +3738,7 @@ function ReactFiberCompleteWork(
oldProps, oldProps,
type, type,
newProps, newProps,
renderExpirationTime, rootContainerInstance,
current current
) && markUpdate(workInProgress), ) && markUpdate(workInProgress),
(workInProgress.stateNode = oldProps)); (workInProgress.stateNode = oldProps));
@ -3785,69 +3762,19 @@ function ReactFiberCompleteWork(
), ),
null null
); );
current = getRootHostContainer(); rootContainerInstance = getRootHostContainer();
renderExpirationTime = getHostContext(); type = getHostContext();
popHydrationState(workInProgress) popHydrationState(workInProgress)
? prepareToHydrateHostTextInstance(workInProgress) && ? prepareToHydrateHostTextInstance(workInProgress) &&
markUpdate(workInProgress) markUpdate(workInProgress)
: (workInProgress.stateNode = createTextInstance( : (workInProgress.stateNode = createTextInstance(
newProps, newProps,
current, rootContainerInstance,
renderExpirationTime, type,
workInProgress workInProgress
)); ));
} }
return null; return null;
case 7:
newProps = workInProgress.memoizedProps;
invariant(
newProps,
"Should be resolved by now. This error is likely caused by a bug in React. Please file an issue."
);
workInProgress.tag = 8;
type = [];
a: {
if ((oldProps = workInProgress.stateNode))
oldProps.return = workInProgress;
for (; null !== oldProps; ) {
if (
5 === oldProps.tag ||
6 === oldProps.tag ||
4 === oldProps.tag
)
invariant(!1, "A call cannot have host component children.");
else if (9 === oldProps.tag)
type.push(oldProps.pendingProps.value);
else if (null !== oldProps.child) {
oldProps.child.return = oldProps;
oldProps = oldProps.child;
continue;
}
for (; null === oldProps.sibling; ) {
if (
null === oldProps.return ||
oldProps.return === workInProgress
)
break a;
oldProps = oldProps.return;
}
oldProps.sibling.return = oldProps.return;
oldProps = oldProps.sibling;
}
}
oldProps = newProps.handler;
newProps = oldProps(newProps.props, type);
workInProgress.child = reconcileChildFibers(
workInProgress,
null !== current ? current.child : null,
newProps,
renderExpirationTime
);
return workInProgress.child;
case 8:
return (workInProgress.tag = 7), null;
case 9:
return null;
case 14: case 14:
return null; return null;
case 16: case 16:
@ -4059,43 +3986,6 @@ function ReactFiberCommitWork(config, captureError) {
? current(null) ? current(null)
: (current.current = null)); : (current.current = null));
} }
function commitNestedUnmounts(root) {
for (var node = root; ; ) {
var current = node;
"function" === typeof onCommitUnmount && onCommitUnmount(current);
switch (current.tag) {
case 2:
safelyDetachRef(current);
var _instance6 = current.stateNode;
if ("function" === typeof _instance6.componentWillUnmount)
try {
(_instance6.props = current.memoizedProps),
(_instance6.state = current.memoizedState),
_instance6.componentWillUnmount();
} catch (unmountError) {
captureError(current, unmountError);
}
break;
case 5:
safelyDetachRef(current);
break;
case 7:
commitNestedUnmounts(current.stateNode);
break;
case 4:
persistence && emptyPortalContainer(current);
}
if (null === node.child || (mutation && 4 === node.tag)) {
if (node === root) break;
for (; null === node.sibling; ) {
if (null === node.return || node.return === root) return;
node = node.return;
}
node.sibling.return = node.return;
node = node.sibling;
} else (node.child.return = node), (node = node.child);
}
}
var getPublicInstance = config.getPublicInstance, var getPublicInstance = config.getPublicInstance,
mutation = config.mutation, mutation = config.mutation,
persistence = config.persistence, persistence = config.persistence,
@ -4137,12 +4027,45 @@ function ReactFiberCommitWork(config, captureError) {
return { return {
commitResetTextContent: function() {}, commitResetTextContent: function() {},
commitPlacement: function() {}, commitPlacement: function() {},
commitDeletion: function(current) { commitDeletion: function(current$jscomp$0) {
commitNestedUnmounts(current); a: for (var node = current$jscomp$0; ; ) {
current.return = null; var current = node;
current.child = null; "function" === typeof onCommitUnmount && onCommitUnmount(current);
current.alternate && switch (current.tag) {
((current.alternate.child = null), (current.alternate.return = null)); case 2:
safelyDetachRef(current);
var _instance6 = current.stateNode;
if ("function" === typeof _instance6.componentWillUnmount)
try {
(_instance6.props = current.memoizedProps),
(_instance6.state = current.memoizedState),
_instance6.componentWillUnmount();
} catch (unmountError) {
captureError(current, unmountError);
}
break;
case 5:
safelyDetachRef(current);
break;
case 4:
persistence && emptyPortalContainer(current);
}
if (null === node.child || (mutation && 4 === node.tag)) {
if (node === current$jscomp$0) break;
for (; null === node.sibling; ) {
if (null === node.return || node.return === current$jscomp$0)
break a;
node = node.return;
}
node.sibling.return = node.return;
node = node.sibling;
} else (node.child.return = node), (node = node.child);
}
current$jscomp$0.return = null;
current$jscomp$0.child = null;
current$jscomp$0.alternate &&
((current$jscomp$0.alternate.child = null),
(current$jscomp$0.alternate.return = null));
}, },
commitWork: function(current, finishedWork) { commitWork: function(current, finishedWork) {
commitContainer(finishedWork); commitContainer(finishedWork);
@ -5182,22 +5105,23 @@ function ReactFiberScheduler(config) {
isAsync isAsync
? ((isAsync = root.finishedWork), ? ((isAsync = root.finishedWork),
null !== isAsync null !== isAsync
? completeRoot(root, isAsync, expirationTime) ? completeRoot$$1(root, isAsync, expirationTime)
: ((root.finishedWork = null), : ((root.finishedWork = null),
(isAsync = renderRoot(root, expirationTime, !0)), (isAsync = renderRoot(root, expirationTime, !0)),
null !== isAsync && null !== isAsync &&
(shouldYield() (shouldYield()
? (root.finishedWork = isAsync) ? (root.finishedWork = isAsync)
: completeRoot(root, isAsync, expirationTime)))) : completeRoot$$1(root, isAsync, expirationTime))))
: ((isAsync = root.finishedWork), : ((isAsync = root.finishedWork),
null !== isAsync null !== isAsync
? completeRoot(root, isAsync, expirationTime) ? completeRoot$$1(root, isAsync, expirationTime)
: ((root.finishedWork = null), : ((root.finishedWork = null),
(isAsync = renderRoot(root, expirationTime, !1)), (isAsync = renderRoot(root, expirationTime, !1)),
null !== isAsync && completeRoot(root, isAsync, expirationTime))); null !== isAsync &&
completeRoot$$1(root, isAsync, expirationTime)));
isRendering = !1; isRendering = !1;
} }
function completeRoot(root, finishedWork, expirationTime) { function completeRoot$$1(root, finishedWork, expirationTime) {
var firstBatch = root.firstBatch; var firstBatch = root.firstBatch;
if ( if (
null !== firstBatch && null !== firstBatch &&
@ -5909,14 +5833,22 @@ var nextReactTag = 2,
return { return {
node: keepChildren node: keepChildren
? null !== updatePayload ? null !== updatePayload
? FabricUIManager.cloneNodeWithNewProps(type, updatePayload) ? FabricUIManager.cloneNodeWithNewProps(
: FabricUIManager.cloneNode(type) type,
updatePayload,
internalInstanceHandle
)
: FabricUIManager.cloneNode(type, internalInstanceHandle)
: null !== updatePayload : null !== updatePayload
? FabricUIManager.cloneNodeWithNewChildrenAndProps( ? FabricUIManager.cloneNodeWithNewChildrenAndProps(
type, type,
updatePayload updatePayload,
internalInstanceHandle
) )
: FabricUIManager.cloneNodeWithNewChildren(type), : FabricUIManager.cloneNodeWithNewChildren(
type,
internalInstanceHandle
),
canonical: instance.canonical canonical: instance.canonical
}; };
}, },

View File

@ -523,21 +523,6 @@ var injection$1 = {
} }
}; };
function isEndish(topLevelType) {
return (
topLevelType === "topMouseUp" ||
topLevelType === "topTouchEnd" ||
topLevelType === "topTouchCancel"
);
}
function isMoveish(topLevelType) {
return topLevelType === "topMouseMove" || topLevelType === "topTouchMove";
}
function isStartish(topLevelType) {
return topLevelType === "topMouseDown" || topLevelType === "topTouchStart";
}
var validateEventDispatches = void 0; var validateEventDispatches = void 0;
{ {
validateEventDispatches = function(event) { validateEventDispatches = function(event) {
@ -961,9 +946,7 @@ var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
var HostComponent = 5; var HostComponent = 5;
var HostText = 6; var HostText = 6;
var CallComponent = 7;
var CallHandlerPhase = 8;
var ReturnComponent = 9;
var Fragment = 10; var Fragment = 10;
var Mode = 11; var Mode = 11;
var ContextConsumer = 12; var ContextConsumer = 12;
@ -1540,6 +1523,29 @@ var ResponderSyntheticEvent = SyntheticEvent$1.extend({
} }
}); });
var TOP_TOUCH_START = "topTouchStart";
var TOP_TOUCH_MOVE = "topTouchMove";
var TOP_TOUCH_END = "topTouchEnd";
var TOP_TOUCH_CANCEL = "topTouchCancel";
var TOP_SCROLL = "topScroll";
var TOP_SELECTION_CHANGE = "topSelectionChange";
function isStartish(topLevelType) {
return topLevelType === TOP_TOUCH_START;
}
function isMoveish(topLevelType) {
return topLevelType === TOP_TOUCH_MOVE;
}
function isEndish(topLevelType) {
return topLevelType === TOP_TOUCH_END || topLevelType === TOP_TOUCH_CANCEL;
}
var startDependencies = [TOP_TOUCH_START];
var moveDependencies = [TOP_TOUCH_MOVE];
var endDependencies = [TOP_TOUCH_CANCEL, TOP_TOUCH_END];
/** /**
* Tracks the position and time of each active touch by `touch.identifier`. We * Tracks the position and time of each active touch by `touch.identifier`. We
* should typically only see IDs in the range of 1-20 because IDs get recycled * should typically only see IDs in the range of 1-20 because IDs get recycled
@ -1762,11 +1768,6 @@ var responderInst = null;
*/ */
var trackedTouchCount = 0; var trackedTouchCount = 0;
/**
* Last reported number of active touches.
*/
var previousActiveTouches = 0;
var changeResponder = function(nextResponderInst, blockHostResponder) { var changeResponder = function(nextResponderInst, blockHostResponder) {
var oldResponderInst = responderInst; var oldResponderInst = responderInst;
responderInst = nextResponderInst; responderInst = nextResponderInst;
@ -1788,7 +1789,8 @@ var eventTypes$1 = {
phasedRegistrationNames: { phasedRegistrationNames: {
bubbled: "onStartShouldSetResponder", bubbled: "onStartShouldSetResponder",
captured: "onStartShouldSetResponderCapture" captured: "onStartShouldSetResponderCapture"
} },
dependencies: startDependencies
}, },
/** /**
@ -1804,7 +1806,8 @@ var eventTypes$1 = {
phasedRegistrationNames: { phasedRegistrationNames: {
bubbled: "onScrollShouldSetResponder", bubbled: "onScrollShouldSetResponder",
captured: "onScrollShouldSetResponderCapture" captured: "onScrollShouldSetResponderCapture"
} },
dependencies: [TOP_SCROLL]
}, },
/** /**
@ -1818,7 +1821,8 @@ var eventTypes$1 = {
phasedRegistrationNames: { phasedRegistrationNames: {
bubbled: "onSelectionChangeShouldSetResponder", bubbled: "onSelectionChangeShouldSetResponder",
captured: "onSelectionChangeShouldSetResponderCapture" captured: "onSelectionChangeShouldSetResponderCapture"
} },
dependencies: [TOP_SELECTION_CHANGE]
}, },
/** /**
@ -1829,22 +1833,45 @@ var eventTypes$1 = {
phasedRegistrationNames: { phasedRegistrationNames: {
bubbled: "onMoveShouldSetResponder", bubbled: "onMoveShouldSetResponder",
captured: "onMoveShouldSetResponderCapture" captured: "onMoveShouldSetResponderCapture"
} },
dependencies: moveDependencies
}, },
/** /**
* Direct responder events dispatched directly to responder. Do not bubble. * Direct responder events dispatched directly to responder. Do not bubble.
*/ */
responderStart: { registrationName: "onResponderStart" }, responderStart: {
responderMove: { registrationName: "onResponderMove" }, registrationName: "onResponderStart",
responderEnd: { registrationName: "onResponderEnd" }, dependencies: startDependencies
responderRelease: { registrationName: "onResponderRelease" },
responderTerminationRequest: {
registrationName: "onResponderTerminationRequest"
}, },
responderGrant: { registrationName: "onResponderGrant" }, responderMove: {
responderReject: { registrationName: "onResponderReject" }, registrationName: "onResponderMove",
responderTerminate: { registrationName: "onResponderTerminate" } dependencies: moveDependencies
},
responderEnd: {
registrationName: "onResponderEnd",
dependencies: endDependencies
},
responderRelease: {
registrationName: "onResponderRelease",
dependencies: endDependencies
},
responderTerminationRequest: {
registrationName: "onResponderTerminationRequest",
dependencies: []
},
responderGrant: {
registrationName: "onResponderGrant",
dependencies: []
},
responderReject: {
registrationName: "onResponderReject",
dependencies: []
},
responderTerminate: {
registrationName: "onResponderTerminate",
dependencies: []
}
}; };
/** /**
@ -2047,7 +2074,7 @@ function setResponderAndExtractTransfer(
? eventTypes$1.startShouldSetResponder ? eventTypes$1.startShouldSetResponder
: isMoveish(topLevelType) : isMoveish(topLevelType)
? eventTypes$1.moveShouldSetResponder ? eventTypes$1.moveShouldSetResponder
: topLevelType === "topSelectionChange" : topLevelType === TOP_SELECTION_CHANGE
? eventTypes$1.selectionChangeShouldSetResponder ? eventTypes$1.selectionChangeShouldSetResponder
: eventTypes$1.scrollShouldSetResponder; : eventTypes$1.scrollShouldSetResponder;
@ -2152,8 +2179,8 @@ function canTriggerTransfer(topLevelType, topLevelInst, nativeEvent) {
// responderIgnoreScroll: We are trying to migrate away from specifically // responderIgnoreScroll: We are trying to migrate away from specifically
// tracking native scroll events here and responderIgnoreScroll indicates we // tracking native scroll events here and responderIgnoreScroll indicates we
// will send topTouchCancel to handle canceling touch events instead // will send topTouchCancel to handle canceling touch events instead
((topLevelType === "topScroll" && !nativeEvent.responderIgnoreScroll) || ((topLevelType === TOP_SCROLL && !nativeEvent.responderIgnoreScroll) ||
(trackedTouchCount > 0 && topLevelType === "topSelectionChange") || (trackedTouchCount > 0 && topLevelType === TOP_SELECTION_CHANGE) ||
isStartish(topLevelType) || isStartish(topLevelType) ||
isMoveish(topLevelType)) isMoveish(topLevelType))
); );
@ -2259,7 +2286,7 @@ var ResponderEventPlugin = {
} }
var isResponderTerminate = var isResponderTerminate =
responderInst && topLevelType === "topTouchCancel"; responderInst && topLevelType === TOP_TOUCH_CANCEL;
var isResponderRelease = var isResponderRelease =
responderInst && responderInst &&
!isResponderTerminate && !isResponderTerminate &&
@ -2281,23 +2308,10 @@ var ResponderEventPlugin = {
changeResponder(null); changeResponder(null);
} }
var numberActiveTouches =
ResponderTouchHistoryStore.touchHistory.numberActiveTouches;
if (
ResponderEventPlugin.GlobalInteractionHandler &&
numberActiveTouches !== previousActiveTouches
) {
ResponderEventPlugin.GlobalInteractionHandler.onChange(
numberActiveTouches
);
}
previousActiveTouches = numberActiveTouches;
return extracted; return extracted;
}, },
GlobalResponderHandler: null, GlobalResponderHandler: null,
GlobalInteractionHandler: null,
injection: { injection: {
/** /**
@ -2307,14 +2321,6 @@ var ResponderEventPlugin = {
*/ */
injectGlobalResponderHandler: function(GlobalResponderHandler) { injectGlobalResponderHandler: function(GlobalResponderHandler) {
ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler; ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler;
},
/**
* @param {{onChange: (numberActiveTouches) => void} GlobalInteractionHandler
* Object that handles any change in the number of active touches.
*/
injectGlobalInteractionHandler: function(GlobalInteractionHandler) {
ResponderEventPlugin.GlobalInteractionHandler = GlobalInteractionHandler;
} }
} }
}; };
@ -2752,8 +2758,6 @@ var ReactDebugCurrentFrame = ReactInternals.ReactDebugCurrentFrame;
var hasSymbol = typeof Symbol === "function" && Symbol.for; var hasSymbol = typeof Symbol === "function" && Symbol.for;
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 0xeac7; var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 0xeac7;
var REACT_CALL_TYPE = hasSymbol ? Symbol.for("react.call") : 0xeac8;
var REACT_RETURN_TYPE = hasSymbol ? Symbol.for("react.return") : 0xeac9;
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 0xeaca; var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 0xeaca;
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 0xeacb; var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 0xeacb;
var REACT_STRICT_MODE_TYPE = hasSymbol var REACT_STRICT_MODE_TYPE = hasSymbol
@ -2796,8 +2800,6 @@ function getComponentName(fiber) {
switch (type) { switch (type) {
case REACT_ASYNC_MODE_TYPE: case REACT_ASYNC_MODE_TYPE:
return "AsyncMode"; return "AsyncMode";
case REACT_CALL_TYPE:
return "ReactCall";
case REACT_CONTEXT_TYPE: case REACT_CONTEXT_TYPE:
return "Context.Consumer"; return "Context.Consumer";
case REACT_FRAGMENT_TYPE: case REACT_FRAGMENT_TYPE:
@ -2808,8 +2810,6 @@ function getComponentName(fiber) {
return "Profiler(" + fiber.pendingProps.id + ")"; return "Profiler(" + fiber.pendingProps.id + ")";
case REACT_PROVIDER_TYPE: case REACT_PROVIDER_TYPE:
return "Context.Provider"; return "Context.Provider";
case REACT_RETURN_TYPE:
return "ReactReturn";
case REACT_STRICT_MODE_TYPE: case REACT_STRICT_MODE_TYPE:
return "StrictMode"; return "StrictMode";
} }
@ -3120,7 +3120,7 @@ var enablePersistentReconciler = false;
var enableUserTimingAPI = true; var enableUserTimingAPI = true;
var replayFailedUnitOfWorkWithInvokeGuardedCallback = true; var replayFailedUnitOfWorkWithInvokeGuardedCallback = true;
var warnAboutDeprecatedLifecycles = false; var warnAboutDeprecatedLifecycles = false;
var enableProfilerTimer = false; var enableProfilerTimer = true;
var fireGetDerivedStateFromPropsOnStateUpdates = true; var fireGetDerivedStateFromPropsOnStateUpdates = true;
// Only used in www builds. // Only used in www builds.
@ -3367,12 +3367,6 @@ function createFiberFromElement(element, mode, expirationTime) {
break; break;
case REACT_PROFILER_TYPE: case REACT_PROFILER_TYPE:
return createFiberFromProfiler(pendingProps, mode, expirationTime, key); return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
case REACT_CALL_TYPE:
fiberTag = CallComponent;
break;
case REACT_RETURN_TYPE:
fiberTag = ReturnComponent;
break;
case REACT_TIMEOUT_TYPE: case REACT_TIMEOUT_TYPE:
fiberTag = TimeoutComponent; fiberTag = TimeoutComponent;
// Suspense does not require async, but its children should be strict // Suspense does not require async, but its children should be strict
@ -4338,8 +4332,6 @@ var shouldIgnoreFiber = function(fiber) {
case HostComponent: case HostComponent:
case HostText: case HostText:
case HostPortal: case HostPortal:
case CallComponent:
case ReturnComponent:
case Fragment: case Fragment:
case ContextProvider: case ContextProvider:
case ContextConsumer: case ContextConsumer:
@ -8175,44 +8167,6 @@ var ReactFiberBeginWork = function(
} }
} }
function updateCallComponent(current, workInProgress, renderExpirationTime) {
var nextProps = workInProgress.pendingProps;
if (hasLegacyContextChanged()) {
// Normally we can bail out on props equality but if context has changed
// we don't do the bailout and we have to reuse existing props instead.
} else if (workInProgress.memoizedProps === nextProps) {
nextProps = workInProgress.memoizedProps;
// TODO: When bailing out, we might need to return the stateNode instead
// of the child. To check it for work.
// return bailoutOnAlreadyFinishedWork(current, workInProgress);
}
var nextChildren = nextProps.children;
// The following is a fork of reconcileChildrenAtExpirationTime but using
// stateNode to store the child.
if (current === null) {
workInProgress.stateNode = mountChildFibers(
workInProgress,
workInProgress.stateNode,
nextChildren,
renderExpirationTime
);
} else {
workInProgress.stateNode = reconcileChildFibers(
workInProgress,
current.stateNode,
nextChildren,
renderExpirationTime
);
}
memoizeProps(workInProgress, nextProps);
// This doesn't take arbitrary time so we could synchronously just begin
// eagerly do the work of workInProgress.child as an optimization.
return workInProgress.stateNode;
}
function updateTimeoutComponent( function updateTimeoutComponent(
current, current,
workInProgress, workInProgress,
@ -8689,20 +8643,6 @@ var ReactFiberBeginWork = function(
); );
case HostText: case HostText:
return updateHostText(current, workInProgress); return updateHostText(current, workInProgress);
case CallHandlerPhase:
// This is a restart. Reset the tag to the initial phase.
workInProgress.tag = CallComponent;
// Intentionally fall through since this is now the same.
case CallComponent:
return updateCallComponent(
current,
workInProgress,
renderExpirationTime
);
case ReturnComponent:
// A return component is just a placeholder, we can just run through the
// next one immediately.
return null;
case TimeoutComponent: case TimeoutComponent:
return updateTimeoutComponent( return updateTimeoutComponent(
current, current,
@ -8789,75 +8729,6 @@ var ReactFiberCompleteWork = function(
workInProgress.effectTag |= Ref; workInProgress.effectTag |= Ref;
} }
function appendAllReturns(returns, workInProgress) {
var node = workInProgress.stateNode;
if (node) {
node.return = workInProgress;
}
while (node !== null) {
if (
node.tag === HostComponent ||
node.tag === HostText ||
node.tag === HostPortal
) {
invariant(false, "A call cannot have host component children.");
} else if (node.tag === ReturnComponent) {
returns.push(node.pendingProps.value);
} else if (node.child !== null) {
node.child.return = node;
node = node.child;
continue;
}
while (node.sibling === null) {
if (node.return === null || node.return === workInProgress) {
return;
}
node = node.return;
}
node.sibling.return = node.return;
node = node.sibling;
}
}
function moveCallToHandlerPhase(
current,
workInProgress,
renderExpirationTime
) {
var props = workInProgress.memoizedProps;
invariant(
props,
"Should be resolved by now. This error is likely caused by a bug in " +
"React. Please file an issue."
);
// First step of the call has completed. Now we need to do the second.
// TODO: It would be nice to have a multi stage call represented by a
// single component, or at least tail call optimize nested ones. Currently
// that requires additional fields that we don't want to add to the fiber.
// So this requires nested handlers.
// Note: This doesn't mutate the alternate node. I don't think it needs to
// since this stage is reset for every pass.
workInProgress.tag = CallHandlerPhase;
// Build up the returns.
// TODO: Compare this to a generator or opaque helpers like Children.
var returns = [];
appendAllReturns(returns, workInProgress);
var fn = props.handler;
var childProps = props.props;
var nextChildren = fn(childProps, returns);
var currentFirstChild = current !== null ? current.child : null;
workInProgress.child = reconcileChildFibers(
workInProgress,
currentFirstChild,
nextChildren,
renderExpirationTime
);
return workInProgress.child;
}
function appendAllChildren(parent, workInProgress) { function appendAllChildren(parent, workInProgress) {
// We only have the top Fiber that was created but we need recurse down its // We only have the top Fiber that was created but we need recurse down its
// children to find all the terminal nodes. // children to find all the terminal nodes.
@ -9251,19 +9122,6 @@ var ReactFiberCompleteWork = function(
} }
return null; return null;
} }
case CallComponent:
return moveCallToHandlerPhase(
current,
workInProgress,
renderExpirationTime
);
case CallHandlerPhase:
// Reset the tag to now be a first phase call.
workInProgress.tag = CallComponent;
return null;
case ReturnComponent:
// Does nothing.
return null;
case ForwardRef: case ForwardRef:
return null; return null;
case TimeoutComponent: case TimeoutComponent:
@ -9744,10 +9602,6 @@ var ReactFiberCommitWork = function(
safelyDetachRef(current); safelyDetachRef(current);
return; return;
} }
case CallComponent: {
commitNestedUnmounts(current.stateNode);
return;
}
case HostPortal: { case HostPortal: {
// TODO: this is recursive. // TODO: this is recursive.
// We are also not using this parent because // We are also not using this parent because
@ -12486,12 +12340,17 @@ var ReactFiberScheduler = function(config) {
var next = void 0; var next = void 0;
if (enableProfilerTimer) { if (enableProfilerTimer) {
startBaseRenderTimer(); if (workInProgress.mode & ProfileMode) {
startBaseRenderTimer();
}
next = beginWork(current, workInProgress, nextRenderExpirationTime); next = beginWork(current, workInProgress, nextRenderExpirationTime);
// Update "base" time if the render wasn't bailed out on. if (workInProgress.mode & ProfileMode) {
recordElapsedBaseRenderTimeIfRunning(workInProgress); // Update "base" time if the render wasn't bailed out on.
stopBaseRenderTimerIfRunning(); recordElapsedBaseRenderTimeIfRunning(workInProgress);
stopBaseRenderTimerIfRunning();
}
} else { } else {
next = beginWork(current, workInProgress, nextRenderExpirationTime); next = beginWork(current, workInProgress, nextRenderExpirationTime);
} }
@ -14476,7 +14335,7 @@ var ReactNativeHostConfig = {
tag, // reactTag tag, // reactTag
viewConfig.uiViewClassName, // viewName viewConfig.uiViewClassName, // viewName
rootContainerInstance, // rootTag rootContainerInstance, // rootTag
updatePayload updatePayload // props
); );
var component = new ReactNativeFiberHostComponent(tag, viewConfig); var component = new ReactNativeFiberHostComponent(tag, viewConfig);
@ -14505,7 +14364,7 @@ var ReactNativeHostConfig = {
tag, // reactTag tag, // reactTag
"RCTRawText", // viewName "RCTRawText", // viewName
rootContainerInstance, // rootTag rootContainerInstance, // rootTag
{ text: text } { text: text } // props
); );
precacheFiberNode(internalInstanceHandle, tag); precacheFiberNode(internalInstanceHandle, tag);
@ -14533,7 +14392,7 @@ var ReactNativeHostConfig = {
UIManager.setChildren( UIManager.setChildren(
parentInstance._nativeTag, // containerTag parentInstance._nativeTag, // containerTag
nativeTags nativeTags // reactTags
); );
return false; return false;
@ -14613,7 +14472,7 @@ var ReactNativeHostConfig = {
[children.length - 1], // moveToIndices [children.length - 1], // moveToIndices
[], // addChildReactTags [], // addChildReactTags
[], // addAtIndices [], // addAtIndices
[] [] // removeAtIndices
); );
} else { } else {
children.push(child); children.push(child);
@ -14624,7 +14483,7 @@ var ReactNativeHostConfig = {
[], // moveToIndices [], // moveToIndices
[childTag], // addChildReactTags [childTag], // addChildReactTags
[children.length - 1], // addAtIndices [children.length - 1], // addAtIndices
[] [] // removeAtIndices
); );
} }
}, },
@ -14632,14 +14491,14 @@ var ReactNativeHostConfig = {
var childTag = typeof child === "number" ? child : child._nativeTag; var childTag = typeof child === "number" ? child : child._nativeTag;
UIManager.setChildren( UIManager.setChildren(
parentInstance, // containerTag parentInstance, // containerTag
[childTag] [childTag] // reactTags
); );
}, },
commitTextUpdate: function(textInstance, oldText, newText) { commitTextUpdate: function(textInstance, oldText, newText) {
UIManager.updateView( UIManager.updateView(
textInstance, // reactTag textInstance, // reactTag
"RCTRawText", // viewName "RCTRawText", // viewName
{ text: newText } { text: newText } // props
); );
}, },
commitMount: function(instance, type, newProps, internalInstanceHandle) { commitMount: function(instance, type, newProps, internalInstanceHandle) {
@ -14666,7 +14525,7 @@ var ReactNativeHostConfig = {
UIManager.updateView( UIManager.updateView(
instance._nativeTag, // reactTag instance._nativeTag, // reactTag
viewConfig.uiViewClassName, // viewName viewConfig.uiViewClassName, // viewName
updatePayload updatePayload // props
); );
} }
}, },
@ -14686,7 +14545,7 @@ var ReactNativeHostConfig = {
[beforeChildIndex], // moveToIndices [beforeChildIndex], // moveToIndices
[], // addChildReactTags [], // addChildReactTags
[], // addAtIndices [], // addAtIndices
[] [] // removeAtIndices
); );
} else { } else {
var _beforeChildIndex = children.indexOf(beforeChild); var _beforeChildIndex = children.indexOf(beforeChild);
@ -14700,7 +14559,7 @@ var ReactNativeHostConfig = {
[], // moveToIndices [], // moveToIndices
[childTag], // addChildReactTags [childTag], // addChildReactTags
[_beforeChildIndex], // addAtIndices [_beforeChildIndex], // addAtIndices
[] [] // removeAtIndices
); );
} }
}, },
@ -14727,7 +14586,7 @@ var ReactNativeHostConfig = {
[], // moveToIndices [], // moveToIndices
[], // addChildReactTags [], // addChildReactTags
[], // addAtIndices [], // addAtIndices
[index] [index] // removeAtIndices
); );
}, },
removeChildFromContainer: function(parentInstance, child) { removeChildFromContainer: function(parentInstance, child) {
@ -14738,7 +14597,7 @@ var ReactNativeHostConfig = {
[], // moveToIndices [], // moveToIndices
[], // addChildReactTags [], // addChildReactTags
[], // addAtIndices [], // addAtIndices
[0] [0] // removeAtIndices
); );
}, },
resetTextContent: function(instance) { resetTextContent: function(instance) {

View File

@ -164,19 +164,6 @@ var plugins = [],
getFiberCurrentPropsFromNode = null, getFiberCurrentPropsFromNode = null,
getInstanceFromNode = null, getInstanceFromNode = null,
getNodeFromInstance = null; getNodeFromInstance = null;
function isEndish(topLevelType) {
return (
"topMouseUp" === topLevelType ||
"topTouchEnd" === topLevelType ||
"topTouchCancel" === topLevelType
);
}
function isMoveish(topLevelType) {
return "topMouseMove" === topLevelType || "topTouchMove" === topLevelType;
}
function isStartish(topLevelType) {
return "topMouseDown" === topLevelType || "topTouchStart" === topLevelType;
}
function executeDispatch(event, simulated, listener, inst) { function executeDispatch(event, simulated, listener, inst) {
simulated = event.type || "unknown-event"; simulated = event.type || "unknown-event";
event.currentTarget = getNodeFromInstance(inst); event.currentTarget = getNodeFromInstance(inst);
@ -477,10 +464,19 @@ function addEventPoolingTo(EventConstructor) {
EventConstructor.release = releasePooledEvent; EventConstructor.release = releasePooledEvent;
} }
var ResponderSyntheticEvent = SyntheticEvent.extend({ var ResponderSyntheticEvent = SyntheticEvent.extend({
touchHistory: function() { touchHistory: function() {
return null; return null;
} }
}), });
function isStartish(topLevelType) {
return "topTouchStart" === topLevelType;
}
function isMoveish(topLevelType) {
return "topTouchMove" === topLevelType;
}
var startDependencies = ["topTouchStart"],
moveDependencies = ["topTouchMove"],
endDependencies = ["topTouchCancel", "topTouchEnd"],
touchBank = [], touchBank = [],
touchHistory = { touchHistory = {
touchBank: touchBank, touchBank: touchBank,
@ -586,19 +582,22 @@ var ResponderTouchHistoryStore = {
(touchHistory.indexOfSingleActiveTouch = (touchHistory.indexOfSingleActiveTouch =
nativeEvent.touches[0].identifier); nativeEvent.touches[0].identifier);
else if ( else if (
isEndish(topLevelType) && "topTouchEnd" === topLevelType ||
(nativeEvent.changedTouches.forEach(recordTouchEnd), "topTouchCancel" === topLevelType
(touchHistory.numberActiveTouches = nativeEvent.touches.length),
1 === touchHistory.numberActiveTouches)
) )
for (topLevelType = 0; topLevelType < touchBank.length; topLevelType++) if (
if ( (nativeEvent.changedTouches.forEach(recordTouchEnd),
((nativeEvent = touchBank[topLevelType]), (touchHistory.numberActiveTouches = nativeEvent.touches.length),
null != nativeEvent && nativeEvent.touchActive) 1 === touchHistory.numberActiveTouches)
) { )
touchHistory.indexOfSingleActiveTouch = topLevelType; for (topLevelType = 0; topLevelType < touchBank.length; topLevelType++)
break; if (
} ((nativeEvent = touchBank[topLevelType]),
null != nativeEvent && nativeEvent.touchActive)
) {
touchHistory.indexOfSingleActiveTouch = topLevelType;
break;
}
}, },
touchHistory: touchHistory touchHistory: touchHistory
}; };
@ -614,8 +613,7 @@ function accumulate(current, next) {
: Array.isArray(next) ? [current].concat(next) : [current, next]; : Array.isArray(next) ? [current].concat(next) : [current, next];
} }
var responderInst = null, var responderInst = null,
trackedTouchCount = 0, trackedTouchCount = 0;
previousActiveTouches = 0;
function changeResponder(nextResponderInst, blockHostResponder) { function changeResponder(nextResponderInst, blockHostResponder) {
var oldResponderInst = responderInst; var oldResponderInst = responderInst;
responderInst = nextResponderInst; responderInst = nextResponderInst;
@ -631,36 +629,59 @@ var eventTypes$1 = {
phasedRegistrationNames: { phasedRegistrationNames: {
bubbled: "onStartShouldSetResponder", bubbled: "onStartShouldSetResponder",
captured: "onStartShouldSetResponderCapture" captured: "onStartShouldSetResponderCapture"
} },
dependencies: startDependencies
}, },
scrollShouldSetResponder: { scrollShouldSetResponder: {
phasedRegistrationNames: { phasedRegistrationNames: {
bubbled: "onScrollShouldSetResponder", bubbled: "onScrollShouldSetResponder",
captured: "onScrollShouldSetResponderCapture" captured: "onScrollShouldSetResponderCapture"
} },
dependencies: ["topScroll"]
}, },
selectionChangeShouldSetResponder: { selectionChangeShouldSetResponder: {
phasedRegistrationNames: { phasedRegistrationNames: {
bubbled: "onSelectionChangeShouldSetResponder", bubbled: "onSelectionChangeShouldSetResponder",
captured: "onSelectionChangeShouldSetResponderCapture" captured: "onSelectionChangeShouldSetResponderCapture"
} },
dependencies: ["topSelectionChange"]
}, },
moveShouldSetResponder: { moveShouldSetResponder: {
phasedRegistrationNames: { phasedRegistrationNames: {
bubbled: "onMoveShouldSetResponder", bubbled: "onMoveShouldSetResponder",
captured: "onMoveShouldSetResponderCapture" captured: "onMoveShouldSetResponderCapture"
} },
dependencies: moveDependencies
},
responderStart: {
registrationName: "onResponderStart",
dependencies: startDependencies
},
responderMove: {
registrationName: "onResponderMove",
dependencies: moveDependencies
},
responderEnd: {
registrationName: "onResponderEnd",
dependencies: endDependencies
},
responderRelease: {
registrationName: "onResponderRelease",
dependencies: endDependencies
}, },
responderStart: { registrationName: "onResponderStart" },
responderMove: { registrationName: "onResponderMove" },
responderEnd: { registrationName: "onResponderEnd" },
responderRelease: { registrationName: "onResponderRelease" },
responderTerminationRequest: { responderTerminationRequest: {
registrationName: "onResponderTerminationRequest" registrationName: "onResponderTerminationRequest",
dependencies: []
}, },
responderGrant: { registrationName: "onResponderGrant" }, responderGrant: { registrationName: "onResponderGrant", dependencies: [] },
responderReject: { registrationName: "onResponderReject" }, responderReject: {
responderTerminate: { registrationName: "onResponderTerminate" } registrationName: "onResponderReject",
dependencies: []
},
responderTerminate: {
registrationName: "onResponderTerminate",
dependencies: []
}
}, },
ResponderEventPlugin = { ResponderEventPlugin = {
_getResponder: function() { _getResponder: function() {
@ -674,7 +695,10 @@ var eventTypes$1 = {
nativeEventTarget nativeEventTarget
) { ) {
if (isStartish(topLevelType)) trackedTouchCount += 1; if (isStartish(topLevelType)) trackedTouchCount += 1;
else if (isEndish(topLevelType)) else if (
"topTouchEnd" === topLevelType ||
"topTouchCancel" === topLevelType
)
if (0 <= trackedTouchCount) --trackedTouchCount; if (0 <= trackedTouchCount) --trackedTouchCount;
else else
return ( return (
@ -844,7 +868,9 @@ var eventTypes$1 = {
} else JSCompiler_temp = null; } else JSCompiler_temp = null;
JSCompiler_temp$jscomp$0 = responderInst && isStartish(topLevelType); JSCompiler_temp$jscomp$0 = responderInst && isStartish(topLevelType);
targetInst = responderInst && isMoveish(topLevelType); targetInst = responderInst && isMoveish(topLevelType);
depthA = responderInst && isEndish(topLevelType); depthA =
responderInst &&
("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType);
if ( if (
(JSCompiler_temp$jscomp$0 = JSCompiler_temp$jscomp$0 (JSCompiler_temp$jscomp$0 = JSCompiler_temp$jscomp$0
? eventTypes$1.responderStart ? eventTypes$1.responderStart
@ -872,7 +898,9 @@ var eventTypes$1 = {
responderInst && "topTouchCancel" === topLevelType; responderInst && "topTouchCancel" === topLevelType;
if ( if (
(topLevelType = (topLevelType =
responderInst && !JSCompiler_temp$jscomp$0 && isEndish(topLevelType)) responderInst &&
!JSCompiler_temp$jscomp$0 &&
("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType))
) )
a: { a: {
if ((topLevelType = nativeEvent.touches) && 0 !== topLevelType.length) if ((topLevelType = nativeEvent.touches) && 0 !== topLevelType.length)
@ -914,23 +942,12 @@ var eventTypes$1 = {
forEachAccumulated(nativeEvent, accumulateDirectDispatchesSingle), forEachAccumulated(nativeEvent, accumulateDirectDispatchesSingle),
(JSCompiler_temp = accumulate(JSCompiler_temp, nativeEvent)), (JSCompiler_temp = accumulate(JSCompiler_temp, nativeEvent)),
changeResponder(null); changeResponder(null);
nativeEvent = ResponderTouchHistoryStore.touchHistory.numberActiveTouches;
if (
ResponderEventPlugin.GlobalInteractionHandler &&
nativeEvent !== previousActiveTouches
)
ResponderEventPlugin.GlobalInteractionHandler.onChange(nativeEvent);
previousActiveTouches = nativeEvent;
return JSCompiler_temp; return JSCompiler_temp;
}, },
GlobalResponderHandler: null, GlobalResponderHandler: null,
GlobalInteractionHandler: null,
injection: { injection: {
injectGlobalResponderHandler: function(GlobalResponderHandler) { injectGlobalResponderHandler: function(GlobalResponderHandler) {
ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler; ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler;
},
injectGlobalInteractionHandler: function(GlobalInteractionHandler) {
ResponderEventPlugin.GlobalInteractionHandler = GlobalInteractionHandler;
} }
} }
}, },
@ -1128,8 +1145,6 @@ var ReactCurrentOwner =
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,
hasSymbol = "function" === typeof Symbol && Symbol.for, hasSymbol = "function" === typeof Symbol && Symbol.for,
REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103, REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103,
REACT_CALL_TYPE = hasSymbol ? Symbol.for("react.call") : 60104,
REACT_RETURN_TYPE = hasSymbol ? Symbol.for("react.return") : 60105,
REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106, REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106,
REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107, REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107,
REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108, REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108,
@ -1155,8 +1170,6 @@ function getComponentName(fiber) {
switch (type) { switch (type) {
case REACT_ASYNC_MODE_TYPE: case REACT_ASYNC_MODE_TYPE:
return "AsyncMode"; return "AsyncMode";
case REACT_CALL_TYPE:
return "ReactCall";
case REACT_CONTEXT_TYPE: case REACT_CONTEXT_TYPE:
return "Context.Consumer"; return "Context.Consumer";
case REACT_FRAGMENT_TYPE: case REACT_FRAGMENT_TYPE:
@ -1167,8 +1180,6 @@ function getComponentName(fiber) {
return "Profiler(" + fiber.pendingProps.id + ")"; return "Profiler(" + fiber.pendingProps.id + ")";
case REACT_PROVIDER_TYPE: case REACT_PROVIDER_TYPE:
return "Context.Provider"; return "Context.Provider";
case REACT_RETURN_TYPE:
return "ReactReturn";
case REACT_STRICT_MODE_TYPE: case REACT_STRICT_MODE_TYPE:
return "StrictMode"; return "StrictMode";
} }
@ -1386,12 +1397,6 @@ function createFiberFromElement(element, mode, expirationTime) {
(type.stateNode = { duration: 0, startTime: 0 }), (type.stateNode = { duration: 0, startTime: 0 }),
type type
); );
case REACT_CALL_TYPE:
fiberTag = 7;
break;
case REACT_RETURN_TYPE:
fiberTag = 9;
break;
case REACT_TIMEOUT_TYPE: case REACT_TIMEOUT_TYPE:
fiberTag = 16; fiberTag = 16;
mode |= 2; mode |= 2;
@ -3319,34 +3324,6 @@ function ReactFiberBeginWork(
(workInProgress.memoizedProps = workInProgress.pendingProps), (workInProgress.memoizedProps = workInProgress.pendingProps),
null null
); );
case 8:
workInProgress.tag = 7;
case 7:
return (
(props = workInProgress.pendingProps),
hasLegacyContextChanged() ||
workInProgress.memoizedProps !== props ||
(props = workInProgress.memoizedProps),
(fn = props.children),
(workInProgress.stateNode =
null === current
? mountChildFibers(
workInProgress,
workInProgress.stateNode,
fn,
renderExpirationTime
)
: reconcileChildFibers(
workInProgress,
current.stateNode,
fn,
renderExpirationTime
)),
(workInProgress.memoizedProps = props),
workInProgress.stateNode
);
case 9:
return null;
case 16: case 16:
return null; return null;
case 4: case 4:
@ -3541,7 +3518,7 @@ function ReactFiberCompleteWork(
? invariant(!1, "Persistent reconciler is disabled.") ? invariant(!1, "Persistent reconciler is disabled.")
: invariant(!1, "Noop reconciler is disabled."); : invariant(!1, "Noop reconciler is disabled.");
return { return {
completeWork: function(current, workInProgress, renderExpirationTime) { completeWork: function(current, workInProgress) {
var newProps = workInProgress.pendingProps; var newProps = workInProgress.pendingProps;
switch (workInProgress.tag) { switch (workInProgress.tag) {
case 1: case 1:
@ -3561,8 +3538,8 @@ function ReactFiberCompleteWork(
return null; return null;
case 5: case 5:
popHostContext(workInProgress); popHostContext(workInProgress);
renderExpirationTime = getRootHostContainer(); var rootContainerInstance = getRootHostContainer(),
var type = workInProgress.type; type = workInProgress.type;
if (null !== current && null != workInProgress.stateNode) { if (null !== current && null != workInProgress.stateNode) {
var oldProps = current.memoizedProps, var oldProps = current.memoizedProps,
instance = workInProgress.stateNode, instance = workInProgress.stateNode,
@ -3572,7 +3549,7 @@ function ReactFiberCompleteWork(
type, type,
oldProps, oldProps,
newProps, newProps,
renderExpirationTime, rootContainerInstance,
currentHostContext currentHostContext
); );
updateHostComponent( updateHostComponent(
@ -3582,7 +3559,7 @@ function ReactFiberCompleteWork(
type, type,
oldProps, oldProps,
newProps, newProps,
renderExpirationTime, rootContainerInstance,
currentHostContext currentHostContext
); );
current.ref !== workInProgress.ref && current.ref !== workInProgress.ref &&
@ -3600,14 +3577,14 @@ function ReactFiberCompleteWork(
if (popHydrationState(workInProgress)) if (popHydrationState(workInProgress))
prepareToHydrateHostInstance( prepareToHydrateHostInstance(
workInProgress, workInProgress,
renderExpirationTime, rootContainerInstance,
current current
) && markUpdate(workInProgress); ) && markUpdate(workInProgress);
else { else {
oldProps = createInstance( oldProps = createInstance(
type, type,
newProps, newProps,
renderExpirationTime, rootContainerInstance,
current, current,
workInProgress workInProgress
); );
@ -3645,7 +3622,7 @@ function ReactFiberCompleteWork(
oldProps, oldProps,
type, type,
newProps, newProps,
renderExpirationTime, rootContainerInstance,
current current
) && markUpdate(workInProgress); ) && markUpdate(workInProgress);
workInProgress.stateNode = oldProps; workInProgress.stateNode = oldProps;
@ -3670,69 +3647,19 @@ function ReactFiberCompleteWork(
), ),
null null
); );
current = getRootHostContainer(); rootContainerInstance = getRootHostContainer();
renderExpirationTime = getHostContext(); type = getHostContext();
popHydrationState(workInProgress) popHydrationState(workInProgress)
? prepareToHydrateHostTextInstance(workInProgress) && ? prepareToHydrateHostTextInstance(workInProgress) &&
markUpdate(workInProgress) markUpdate(workInProgress)
: (workInProgress.stateNode = createTextInstance( : (workInProgress.stateNode = createTextInstance(
newProps, newProps,
current, rootContainerInstance,
renderExpirationTime, type,
workInProgress workInProgress
)); ));
} }
return null; return null;
case 7:
newProps = workInProgress.memoizedProps;
invariant(
newProps,
"Should be resolved by now. This error is likely caused by a bug in React. Please file an issue."
);
workInProgress.tag = 8;
type = [];
a: {
if ((oldProps = workInProgress.stateNode))
oldProps.return = workInProgress;
for (; null !== oldProps; ) {
if (
5 === oldProps.tag ||
6 === oldProps.tag ||
4 === oldProps.tag
)
invariant(!1, "A call cannot have host component children.");
else if (9 === oldProps.tag)
type.push(oldProps.pendingProps.value);
else if (null !== oldProps.child) {
oldProps.child.return = oldProps;
oldProps = oldProps.child;
continue;
}
for (; null === oldProps.sibling; ) {
if (
null === oldProps.return ||
oldProps.return === workInProgress
)
break a;
oldProps = oldProps.return;
}
oldProps.sibling.return = oldProps.return;
oldProps = oldProps.sibling;
}
}
oldProps = newProps.handler;
newProps = oldProps(newProps.props, type);
workInProgress.child = reconcileChildFibers(
workInProgress,
null !== current ? current.child : null,
newProps,
renderExpirationTime
);
return workInProgress.child;
case 8:
return (workInProgress.tag = 7), null;
case 9:
return null;
case 14: case 14:
return null; return null;
case 16: case 16:
@ -3833,28 +3760,10 @@ function ReactFiberCommitWork(config, captureError) {
case 5: case 5:
safelyDetachRef(current); safelyDetachRef(current);
break; break;
case 7:
commitNestedUnmounts(current.stateNode);
break;
case 4: case 4:
mutation && unmountHostComponents(current); mutation && unmountHostComponents(current);
} }
} }
function commitNestedUnmounts(root) {
for (var node = root; ; )
if (
(commitUnmount(node),
null === node.child || (mutation && 4 === node.tag))
) {
if (node === root) break;
for (; null === node.sibling; ) {
if (null === node.return || node.return === root) return;
node = node.return;
}
node.sibling.return = node.return;
node = node.sibling;
} else (node.child.return = node), (node = node.child);
}
function isHostParent(fiber) { function isHostParent(fiber) {
return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag;
} }
@ -3892,12 +3801,31 @@ function ReactFiberCommitWork(config, captureError) {
} }
currentParentIsValid = !0; currentParentIsValid = !0;
} }
if (5 === node.tag || 6 === node.tag) if (5 === node.tag || 6 === node.tag) {
commitNestedUnmounts(node), a: for (var root = node, node$jscomp$0 = root; ; )
currentParentIsContainer if (
? removeChildFromContainer(currentParent, node.stateNode) (commitUnmount(node$jscomp$0),
: removeChild(currentParent, node.stateNode); null === node$jscomp$0.child ||
else if ( (mutation && 4 === node$jscomp$0.tag))
) {
if (node$jscomp$0 === root) break;
for (; null === node$jscomp$0.sibling; ) {
if (
null === node$jscomp$0.return ||
node$jscomp$0.return === root
)
break a;
node$jscomp$0 = node$jscomp$0.return;
}
node$jscomp$0.sibling.return = node$jscomp$0.return;
node$jscomp$0 = node$jscomp$0.sibling;
} else
(node$jscomp$0.child.return = node$jscomp$0),
(node$jscomp$0 = node$jscomp$0.child);
currentParentIsContainer
? removeChildFromContainer(currentParent, node.stateNode)
: removeChild(currentParent, node.stateNode);
} else if (
(4 === node.tag (4 === node.tag
? (currentParent = node.stateNode.containerInfo) ? (currentParent = node.stateNode.containerInfo)
: commitUnmount(node), : commitUnmount(node),