react-native
Version:
A framework for building native apps using React
1,453 lines (1,452 loc) • 251 kB
JavaScript
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @noflow
* @providesModule ReactFabric-profiling
* @preventMunge
* @generated
*/
"use strict";
require("InitializeCore");
var ReactNativeViewConfigRegistry = require("ReactNativeViewConfigRegistry"),
UIManager = require("UIManager"),
React = require("react"),
deepDiffer = require("deepDiffer"),
flattenStyle = require("flattenStyle"),
TextInputState = require("TextInputState"),
FabricUIManager = require("FabricUIManager"),
Scheduler = require("scheduler"),
tracing = require("scheduler/tracing"),
ExceptionsManager = require("ExceptionsManager");
function ReactError(message) {
message = Error(message);
message.name = "Invariant Violation";
return message;
}
var eventPluginOrder = null,
namesToPlugins = {};
function recomputePluginOrdering() {
if (eventPluginOrder)
for (var pluginName in namesToPlugins) {
var pluginModule = namesToPlugins[pluginName],
pluginIndex = eventPluginOrder.indexOf(pluginName);
if (!(-1 < pluginIndex))
throw ReactError(
"EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" +
pluginName +
"`."
);
if (!plugins[pluginIndex]) {
if (!pluginModule.extractEvents)
throw ReactError(
"EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" +
pluginName +
"` does not."
);
plugins[pluginIndex] = pluginModule;
pluginIndex = pluginModule.eventTypes;
for (var eventName in pluginIndex) {
var JSCompiler_inline_result = void 0;
var dispatchConfig = pluginIndex[eventName],
pluginModule$jscomp$0 = pluginModule,
eventName$jscomp$0 = eventName;
if (eventNameDispatchConfigs.hasOwnProperty(eventName$jscomp$0))
throw ReactError(
"EventPluginHub: More than one plugin attempted to publish the same event name, `" +
eventName$jscomp$0 +
"`."
);
eventNameDispatchConfigs[eventName$jscomp$0] = dispatchConfig;
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
if (phasedRegistrationNames) {
for (JSCompiler_inline_result in phasedRegistrationNames)
phasedRegistrationNames.hasOwnProperty(
JSCompiler_inline_result
) &&
publishRegistrationName(
phasedRegistrationNames[JSCompiler_inline_result],
pluginModule$jscomp$0,
eventName$jscomp$0
);
JSCompiler_inline_result = !0;
} else
dispatchConfig.registrationName
? (publishRegistrationName(
dispatchConfig.registrationName,
pluginModule$jscomp$0,
eventName$jscomp$0
),
(JSCompiler_inline_result = !0))
: (JSCompiler_inline_result = !1);
if (!JSCompiler_inline_result)
throw ReactError(
"EventPluginRegistry: Failed to publish event `" +
eventName +
"` for plugin `" +
pluginName +
"`."
);
}
}
}
}
function publishRegistrationName(registrationName, pluginModule) {
if (registrationNameModules[registrationName])
throw ReactError(
"EventPluginHub: More than one plugin attempted to publish the same registration name, `" +
registrationName +
"`."
);
registrationNameModules[registrationName] = pluginModule;
}
var plugins = [],
eventNameDispatchConfigs = {},
registrationNameModules = {};
function invokeGuardedCallbackImpl(name, func, context, a, b, c, d, e, f) {
var funcArgs = Array.prototype.slice.call(arguments, 3);
try {
func.apply(context, funcArgs);
} catch (error) {
this.onError(error);
}
}
var hasError = !1,
caughtError = null,
hasRethrowError = !1,
rethrowError = null,
reporter = {
onError: function(error) {
hasError = !0;
caughtError = error;
}
};
function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) {
hasError = !1;
caughtError = null;
invokeGuardedCallbackImpl.apply(reporter, arguments);
}
function invokeGuardedCallbackAndCatchFirstError(
name,
func,
context,
a,
b,
c,
d,
e,
f
) {
invokeGuardedCallback.apply(this, arguments);
if (hasError) {
if (hasError) {
var error = caughtError;
hasError = !1;
caughtError = null;
} else
throw ReactError(
"clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue."
);
hasRethrowError || ((hasRethrowError = !0), (rethrowError = error));
}
}
var getFiberCurrentPropsFromNode = null,
getInstanceFromNode = null,
getNodeFromInstance = null;
function executeDispatch(event, listener, inst) {
var type = event.type || "unknown-event";
event.currentTarget = getNodeFromInstance(inst);
invokeGuardedCallbackAndCatchFirstError(type, listener, void 0, event);
event.currentTarget = null;
}
function executeDirectDispatch(event) {
var dispatchListener = event._dispatchListeners,
dispatchInstance = event._dispatchInstances;
if (Array.isArray(dispatchListener))
throw ReactError("executeDirectDispatch(...): Invalid `event`.");
event.currentTarget = dispatchListener
? getNodeFromInstance(dispatchInstance)
: null;
dispatchListener = dispatchListener ? dispatchListener(event) : null;
event.currentTarget = null;
event._dispatchListeners = null;
event._dispatchInstances = null;
return dispatchListener;
}
function accumulateInto(current, next) {
if (null == next)
throw ReactError(
"accumulateInto(...): Accumulated items must not be null or undefined."
);
if (null == current) return next;
if (Array.isArray(current)) {
if (Array.isArray(next)) return current.push.apply(current, next), current;
current.push(next);
return current;
}
return Array.isArray(next) ? [current].concat(next) : [current, next];
}
function forEachAccumulated(arr, cb, scope) {
Array.isArray(arr) ? arr.forEach(cb, scope) : arr && cb.call(scope, arr);
}
var eventQueue = null;
function executeDispatchesAndReleaseTopLevel(e) {
if (e) {
var dispatchListeners = e._dispatchListeners,
dispatchInstances = e._dispatchInstances;
if (Array.isArray(dispatchListeners))
for (
var i = 0;
i < dispatchListeners.length && !e.isPropagationStopped();
i++
)
executeDispatch(e, dispatchListeners[i], dispatchInstances[i]);
else
dispatchListeners &&
executeDispatch(e, dispatchListeners, dispatchInstances);
e._dispatchListeners = null;
e._dispatchInstances = null;
e.isPersistent() || e.constructor.release(e);
}
}
var injection = {
injectEventPluginOrder: function(injectedEventPluginOrder) {
if (eventPluginOrder)
throw ReactError(
"EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React."
);
eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
recomputePluginOrdering();
},
injectEventPluginsByName: function(injectedNamesToPlugins) {
var isOrderingDirty = !1,
pluginName;
for (pluginName in injectedNamesToPlugins)
if (injectedNamesToPlugins.hasOwnProperty(pluginName)) {
var pluginModule = injectedNamesToPlugins[pluginName];
if (
!namesToPlugins.hasOwnProperty(pluginName) ||
namesToPlugins[pluginName] !== pluginModule
) {
if (namesToPlugins[pluginName])
throw ReactError(
"EventPluginRegistry: Cannot inject two different event plugins using the same name, `" +
pluginName +
"`."
);
namesToPlugins[pluginName] = pluginModule;
isOrderingDirty = !0;
}
}
isOrderingDirty && recomputePluginOrdering();
}
};
function getListener(inst, registrationName) {
var listener = inst.stateNode;
if (!listener) return null;
var props = getFiberCurrentPropsFromNode(listener);
if (!props) return null;
listener = props[registrationName];
a: switch (registrationName) {
case "onClick":
case "onClickCapture":
case "onDoubleClick":
case "onDoubleClickCapture":
case "onMouseDown":
case "onMouseDownCapture":
case "onMouseMove":
case "onMouseMoveCapture":
case "onMouseUp":
case "onMouseUpCapture":
(props = !props.disabled) ||
((inst = inst.type),
(props = !(
"button" === inst ||
"input" === inst ||
"select" === inst ||
"textarea" === inst
)));
inst = !props;
break a;
default:
inst = !1;
}
if (inst) return null;
if (listener && "function" !== typeof listener)
throw ReactError(
"Expected `" +
registrationName +
"` listener to be a function, instead got a value of `" +
typeof listener +
"` type."
);
return listener;
}
function getParent(inst) {
do inst = inst.return;
while (inst && 5 !== inst.tag);
return inst ? inst : null;
}
function traverseTwoPhase(inst, fn, arg) {
for (var path = []; inst; ) path.push(inst), (inst = getParent(inst));
for (inst = path.length; 0 < inst--; ) fn(path[inst], "captured", arg);
for (inst = 0; inst < path.length; inst++) fn(path[inst], "bubbled", arg);
}
function accumulateDirectionalDispatches(inst, phase, event) {
if (
(phase = getListener(
inst,
event.dispatchConfig.phasedRegistrationNames[phase]
))
)
(event._dispatchListeners = accumulateInto(
event._dispatchListeners,
phase
)),
(event._dispatchInstances = accumulateInto(
event._dispatchInstances,
inst
));
}
function accumulateTwoPhaseDispatchesSingle(event) {
event &&
event.dispatchConfig.phasedRegistrationNames &&
traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
}
function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
var targetInst = event._targetInst;
targetInst = targetInst ? getParent(targetInst) : null;
traverseTwoPhase(targetInst, accumulateDirectionalDispatches, event);
}
}
function accumulateDirectDispatchesSingle(event) {
if (event && event.dispatchConfig.registrationName) {
var inst = event._targetInst;
if (inst && event && event.dispatchConfig.registrationName) {
var listener = getListener(inst, event.dispatchConfig.registrationName);
listener &&
((event._dispatchListeners = accumulateInto(
event._dispatchListeners,
listener
)),
(event._dispatchInstances = accumulateInto(
event._dispatchInstances,
inst
)));
}
}
}
function functionThatReturnsTrue() {
return !0;
}
function functionThatReturnsFalse() {
return !1;
}
function SyntheticEvent(
dispatchConfig,
targetInst,
nativeEvent,
nativeEventTarget
) {
this.dispatchConfig = dispatchConfig;
this._targetInst = targetInst;
this.nativeEvent = nativeEvent;
dispatchConfig = this.constructor.Interface;
for (var propName in dispatchConfig)
dispatchConfig.hasOwnProperty(propName) &&
((targetInst = dispatchConfig[propName])
? (this[propName] = targetInst(nativeEvent))
: "target" === propName
? (this.target = nativeEventTarget)
: (this[propName] = nativeEvent[propName]));
this.isDefaultPrevented = (null != nativeEvent.defaultPrevented
? nativeEvent.defaultPrevented
: !1 === nativeEvent.returnValue)
? functionThatReturnsTrue
: functionThatReturnsFalse;
this.isPropagationStopped = functionThatReturnsFalse;
return this;
}
Object.assign(SyntheticEvent.prototype, {
preventDefault: function() {
this.defaultPrevented = !0;
var event = this.nativeEvent;
event &&
(event.preventDefault
? event.preventDefault()
: "unknown" !== typeof event.returnValue && (event.returnValue = !1),
(this.isDefaultPrevented = functionThatReturnsTrue));
},
stopPropagation: function() {
var event = this.nativeEvent;
event &&
(event.stopPropagation
? event.stopPropagation()
: "unknown" !== typeof event.cancelBubble && (event.cancelBubble = !0),
(this.isPropagationStopped = functionThatReturnsTrue));
},
persist: function() {
this.isPersistent = functionThatReturnsTrue;
},
isPersistent: functionThatReturnsFalse,
destructor: function() {
var Interface = this.constructor.Interface,
propName;
for (propName in Interface) this[propName] = null;
this.nativeEvent = this._targetInst = this.dispatchConfig = null;
this.isPropagationStopped = this.isDefaultPrevented = functionThatReturnsFalse;
this._dispatchInstances = this._dispatchListeners = null;
}
});
SyntheticEvent.Interface = {
type: null,
target: null,
currentTarget: function() {
return null;
},
eventPhase: null,
bubbles: null,
cancelable: null,
timeStamp: function(event) {
return event.timeStamp || Date.now();
},
defaultPrevented: null,
isTrusted: null
};
SyntheticEvent.extend = function(Interface) {
function E() {}
function Class() {
return Super.apply(this, arguments);
}
var Super = this;
E.prototype = Super.prototype;
var prototype = new E();
Object.assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;
Class.Interface = Object.assign({}, Super.Interface, Interface);
Class.extend = Super.extend;
addEventPoolingTo(Class);
return Class;
};
addEventPoolingTo(SyntheticEvent);
function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
if (this.eventPool.length) {
var instance = this.eventPool.pop();
this.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst);
return instance;
}
return new this(dispatchConfig, targetInst, nativeEvent, nativeInst);
}
function releasePooledEvent(event) {
if (!(event instanceof this))
throw ReactError(
"Trying to release an event instance into a pool of a different type."
);
event.destructor();
10 > this.eventPool.length && this.eventPool.push(event);
}
function addEventPoolingTo(EventConstructor) {
EventConstructor.eventPool = [];
EventConstructor.getPooled = getPooledEvent;
EventConstructor.release = releasePooledEvent;
}
var ResponderSyntheticEvent = SyntheticEvent.extend({
touchHistory: function() {
return null;
}
});
function isStartish(topLevelType) {
return "topTouchStart" === topLevelType;
}
function isMoveish(topLevelType) {
return "topTouchMove" === topLevelType;
}
var startDependencies = ["topTouchStart"],
moveDependencies = ["topTouchMove"],
endDependencies = ["topTouchCancel", "topTouchEnd"],
touchBank = [],
touchHistory = {
touchBank: touchBank,
numberActiveTouches: 0,
indexOfSingleActiveTouch: -1,
mostRecentTimeStamp: 0
};
function timestampForTouch(touch) {
return touch.timeStamp || touch.timestamp;
}
function getTouchIdentifier(_ref) {
_ref = _ref.identifier;
if (null == _ref) throw ReactError("Touch object is missing identifier.");
return _ref;
}
function recordTouchStart(touch) {
var identifier = getTouchIdentifier(touch),
touchRecord = touchBank[identifier];
touchRecord
? ((touchRecord.touchActive = !0),
(touchRecord.startPageX = touch.pageX),
(touchRecord.startPageY = touch.pageY),
(touchRecord.startTimeStamp = timestampForTouch(touch)),
(touchRecord.currentPageX = touch.pageX),
(touchRecord.currentPageY = touch.pageY),
(touchRecord.currentTimeStamp = timestampForTouch(touch)),
(touchRecord.previousPageX = touch.pageX),
(touchRecord.previousPageY = touch.pageY),
(touchRecord.previousTimeStamp = timestampForTouch(touch)))
: ((touchRecord = {
touchActive: !0,
startPageX: touch.pageX,
startPageY: touch.pageY,
startTimeStamp: timestampForTouch(touch),
currentPageX: touch.pageX,
currentPageY: touch.pageY,
currentTimeStamp: timestampForTouch(touch),
previousPageX: touch.pageX,
previousPageY: touch.pageY,
previousTimeStamp: timestampForTouch(touch)
}),
(touchBank[identifier] = touchRecord));
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
}
function recordTouchMove(touch) {
var touchRecord = touchBank[getTouchIdentifier(touch)];
touchRecord
? ((touchRecord.touchActive = !0),
(touchRecord.previousPageX = touchRecord.currentPageX),
(touchRecord.previousPageY = touchRecord.currentPageY),
(touchRecord.previousTimeStamp = touchRecord.currentTimeStamp),
(touchRecord.currentPageX = touch.pageX),
(touchRecord.currentPageY = touch.pageY),
(touchRecord.currentTimeStamp = timestampForTouch(touch)),
(touchHistory.mostRecentTimeStamp = timestampForTouch(touch)))
: console.error(
"Cannot record touch move without a touch start.\nTouch Move: %s\n",
"Touch Bank: %s",
printTouch(touch),
printTouchBank()
);
}
function recordTouchEnd(touch) {
var touchRecord = touchBank[getTouchIdentifier(touch)];
touchRecord
? ((touchRecord.touchActive = !1),
(touchRecord.previousPageX = touchRecord.currentPageX),
(touchRecord.previousPageY = touchRecord.currentPageY),
(touchRecord.previousTimeStamp = touchRecord.currentTimeStamp),
(touchRecord.currentPageX = touch.pageX),
(touchRecord.currentPageY = touch.pageY),
(touchRecord.currentTimeStamp = timestampForTouch(touch)),
(touchHistory.mostRecentTimeStamp = timestampForTouch(touch)))
: console.error(
"Cannot record touch end without a touch start.\nTouch End: %s\n",
"Touch Bank: %s",
printTouch(touch),
printTouchBank()
);
}
function printTouch(touch) {
return JSON.stringify({
identifier: touch.identifier,
pageX: touch.pageX,
pageY: touch.pageY,
timestamp: timestampForTouch(touch)
});
}
function printTouchBank() {
var printed = JSON.stringify(touchBank.slice(0, 20));
20 < touchBank.length &&
(printed += " (original size: " + touchBank.length + ")");
return printed;
}
var ResponderTouchHistoryStore = {
recordTouchTrack: function(topLevelType, nativeEvent) {
if (isMoveish(topLevelType))
nativeEvent.changedTouches.forEach(recordTouchMove);
else if (isStartish(topLevelType))
nativeEvent.changedTouches.forEach(recordTouchStart),
(touchHistory.numberActiveTouches = nativeEvent.touches.length),
1 === touchHistory.numberActiveTouches &&
(touchHistory.indexOfSingleActiveTouch =
nativeEvent.touches[0].identifier);
else if (
"topTouchEnd" === topLevelType ||
"topTouchCancel" === topLevelType
)
if (
(nativeEvent.changedTouches.forEach(recordTouchEnd),
(touchHistory.numberActiveTouches = nativeEvent.touches.length),
1 === touchHistory.numberActiveTouches)
)
for (topLevelType = 0; topLevelType < touchBank.length; topLevelType++)
if (
((nativeEvent = touchBank[topLevelType]),
null != nativeEvent && nativeEvent.touchActive)
) {
touchHistory.indexOfSingleActiveTouch = topLevelType;
break;
}
},
touchHistory: touchHistory
};
function accumulate(current, next) {
if (null == next)
throw ReactError(
"accumulate(...): Accumulated items must not be null or undefined."
);
return null == current
? next
: Array.isArray(current)
? current.concat(next)
: Array.isArray(next)
? [current].concat(next)
: [current, next];
}
var responderInst = null,
trackedTouchCount = 0;
function changeResponder(nextResponderInst, blockHostResponder) {
var oldResponderInst = responderInst;
responderInst = nextResponderInst;
if (null !== ResponderEventPlugin.GlobalResponderHandler)
ResponderEventPlugin.GlobalResponderHandler.onChange(
oldResponderInst,
nextResponderInst,
blockHostResponder
);
}
var eventTypes$1 = {
startShouldSetResponder: {
phasedRegistrationNames: {
bubbled: "onStartShouldSetResponder",
captured: "onStartShouldSetResponderCapture"
},
dependencies: startDependencies
},
scrollShouldSetResponder: {
phasedRegistrationNames: {
bubbled: "onScrollShouldSetResponder",
captured: "onScrollShouldSetResponderCapture"
},
dependencies: ["topScroll"]
},
selectionChangeShouldSetResponder: {
phasedRegistrationNames: {
bubbled: "onSelectionChangeShouldSetResponder",
captured: "onSelectionChangeShouldSetResponderCapture"
},
dependencies: ["topSelectionChange"]
},
moveShouldSetResponder: {
phasedRegistrationNames: {
bubbled: "onMoveShouldSetResponder",
captured: "onMoveShouldSetResponderCapture"
},
dependencies: moveDependencies
},
responderStart: {
registrationName: "onResponderStart",
dependencies: startDependencies
},
responderMove: {
registrationName: "onResponderMove",
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: []
}
},
ResponderEventPlugin = {
_getResponder: function() {
return responderInst;
},
eventTypes: eventTypes$1,
extractEvents: function(
topLevelType,
targetInst,
nativeEvent,
nativeEventTarget
) {
if (isStartish(topLevelType)) trackedTouchCount += 1;
else if (
"topTouchEnd" === topLevelType ||
"topTouchCancel" === topLevelType
)
if (0 <= trackedTouchCount) --trackedTouchCount;
else
return (
console.error(
"Ended a touch event which was not counted in `trackedTouchCount`."
),
null
);
ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent);
if (
targetInst &&
(("topScroll" === topLevelType && !nativeEvent.responderIgnoreScroll) ||
(0 < trackedTouchCount && "topSelectionChange" === topLevelType) ||
isStartish(topLevelType) ||
isMoveish(topLevelType))
) {
var JSCompiler_temp = isStartish(topLevelType)
? eventTypes$1.startShouldSetResponder
: isMoveish(topLevelType)
? eventTypes$1.moveShouldSetResponder
: "topSelectionChange" === topLevelType
? eventTypes$1.selectionChangeShouldSetResponder
: eventTypes$1.scrollShouldSetResponder;
if (responderInst)
b: {
var JSCompiler_temp$jscomp$0 = responderInst;
for (
var depthA = 0, tempA = JSCompiler_temp$jscomp$0;
tempA;
tempA = getParent(tempA)
)
depthA++;
tempA = 0;
for (var tempB = targetInst; tempB; tempB = getParent(tempB))
tempA++;
for (; 0 < depthA - tempA; )
(JSCompiler_temp$jscomp$0 = getParent(JSCompiler_temp$jscomp$0)),
depthA--;
for (; 0 < tempA - depthA; )
(targetInst = getParent(targetInst)), tempA--;
for (; depthA--; ) {
if (
JSCompiler_temp$jscomp$0 === targetInst ||
JSCompiler_temp$jscomp$0 === targetInst.alternate
)
break b;
JSCompiler_temp$jscomp$0 = getParent(JSCompiler_temp$jscomp$0);
targetInst = getParent(targetInst);
}
JSCompiler_temp$jscomp$0 = null;
}
else JSCompiler_temp$jscomp$0 = targetInst;
targetInst = JSCompiler_temp$jscomp$0 === responderInst;
JSCompiler_temp$jscomp$0 = ResponderSyntheticEvent.getPooled(
JSCompiler_temp,
JSCompiler_temp$jscomp$0,
nativeEvent,
nativeEventTarget
);
JSCompiler_temp$jscomp$0.touchHistory =
ResponderTouchHistoryStore.touchHistory;
targetInst
? forEachAccumulated(
JSCompiler_temp$jscomp$0,
accumulateTwoPhaseDispatchesSingleSkipTarget
)
: forEachAccumulated(
JSCompiler_temp$jscomp$0,
accumulateTwoPhaseDispatchesSingle
);
b: {
JSCompiler_temp = JSCompiler_temp$jscomp$0._dispatchListeners;
targetInst = JSCompiler_temp$jscomp$0._dispatchInstances;
if (Array.isArray(JSCompiler_temp))
for (
depthA = 0;
depthA < JSCompiler_temp.length &&
!JSCompiler_temp$jscomp$0.isPropagationStopped();
depthA++
) {
if (
JSCompiler_temp[depthA](
JSCompiler_temp$jscomp$0,
targetInst[depthA]
)
) {
JSCompiler_temp = targetInst[depthA];
break b;
}
}
else if (
JSCompiler_temp &&
JSCompiler_temp(JSCompiler_temp$jscomp$0, targetInst)
) {
JSCompiler_temp = targetInst;
break b;
}
JSCompiler_temp = null;
}
JSCompiler_temp$jscomp$0._dispatchInstances = null;
JSCompiler_temp$jscomp$0._dispatchListeners = null;
JSCompiler_temp$jscomp$0.isPersistent() ||
JSCompiler_temp$jscomp$0.constructor.release(
JSCompiler_temp$jscomp$0
);
JSCompiler_temp && JSCompiler_temp !== responderInst
? ((JSCompiler_temp$jscomp$0 = void 0),
(targetInst = ResponderSyntheticEvent.getPooled(
eventTypes$1.responderGrant,
JSCompiler_temp,
nativeEvent,
nativeEventTarget
)),
(targetInst.touchHistory = ResponderTouchHistoryStore.touchHistory),
forEachAccumulated(targetInst, accumulateDirectDispatchesSingle),
(depthA = !0 === executeDirectDispatch(targetInst)),
responderInst
? ((tempA = ResponderSyntheticEvent.getPooled(
eventTypes$1.responderTerminationRequest,
responderInst,
nativeEvent,
nativeEventTarget
)),
(tempA.touchHistory = ResponderTouchHistoryStore.touchHistory),
forEachAccumulated(tempA, accumulateDirectDispatchesSingle),
(tempB =
!tempA._dispatchListeners || executeDirectDispatch(tempA)),
tempA.isPersistent() || tempA.constructor.release(tempA),
tempB
? ((tempA = ResponderSyntheticEvent.getPooled(
eventTypes$1.responderTerminate,
responderInst,
nativeEvent,
nativeEventTarget
)),
(tempA.touchHistory =
ResponderTouchHistoryStore.touchHistory),
forEachAccumulated(tempA, accumulateDirectDispatchesSingle),
(JSCompiler_temp$jscomp$0 = accumulate(
JSCompiler_temp$jscomp$0,
[targetInst, tempA]
)),
changeResponder(JSCompiler_temp, depthA))
: ((JSCompiler_temp = ResponderSyntheticEvent.getPooled(
eventTypes$1.responderReject,
JSCompiler_temp,
nativeEvent,
nativeEventTarget
)),
(JSCompiler_temp.touchHistory =
ResponderTouchHistoryStore.touchHistory),
forEachAccumulated(
JSCompiler_temp,
accumulateDirectDispatchesSingle
),
(JSCompiler_temp$jscomp$0 = accumulate(
JSCompiler_temp$jscomp$0,
JSCompiler_temp
))))
: ((JSCompiler_temp$jscomp$0 = accumulate(
JSCompiler_temp$jscomp$0,
targetInst
)),
changeResponder(JSCompiler_temp, depthA)),
(JSCompiler_temp = JSCompiler_temp$jscomp$0))
: (JSCompiler_temp = null);
} else JSCompiler_temp = null;
JSCompiler_temp$jscomp$0 = responderInst && isStartish(topLevelType);
targetInst = responderInst && isMoveish(topLevelType);
depthA =
responderInst &&
("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType);
if (
(JSCompiler_temp$jscomp$0 = JSCompiler_temp$jscomp$0
? eventTypes$1.responderStart
: targetInst
? eventTypes$1.responderMove
: depthA
? eventTypes$1.responderEnd
: null)
)
(JSCompiler_temp$jscomp$0 = ResponderSyntheticEvent.getPooled(
JSCompiler_temp$jscomp$0,
responderInst,
nativeEvent,
nativeEventTarget
)),
(JSCompiler_temp$jscomp$0.touchHistory =
ResponderTouchHistoryStore.touchHistory),
forEachAccumulated(
JSCompiler_temp$jscomp$0,
accumulateDirectDispatchesSingle
),
(JSCompiler_temp = accumulate(
JSCompiler_temp,
JSCompiler_temp$jscomp$0
));
JSCompiler_temp$jscomp$0 =
responderInst && "topTouchCancel" === topLevelType;
if (
(topLevelType =
responderInst &&
!JSCompiler_temp$jscomp$0 &&
("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType))
)
a: {
if ((topLevelType = nativeEvent.touches) && 0 !== topLevelType.length)
for (targetInst = 0; targetInst < topLevelType.length; targetInst++)
if (
((depthA = topLevelType[targetInst].target),
null !== depthA && void 0 !== depthA && 0 !== depthA)
) {
tempA = getInstanceFromNode(depthA);
b: {
for (depthA = responderInst; tempA; ) {
if (depthA === tempA || depthA === tempA.alternate) {
depthA = !0;
break b;
}
tempA = getParent(tempA);
}
depthA = !1;
}
if (depthA) {
topLevelType = !1;
break a;
}
}
topLevelType = !0;
}
if (
(topLevelType = JSCompiler_temp$jscomp$0
? eventTypes$1.responderTerminate
: topLevelType
? eventTypes$1.responderRelease
: null)
)
(nativeEvent = ResponderSyntheticEvent.getPooled(
topLevelType,
responderInst,
nativeEvent,
nativeEventTarget
)),
(nativeEvent.touchHistory = ResponderTouchHistoryStore.touchHistory),
forEachAccumulated(nativeEvent, accumulateDirectDispatchesSingle),
(JSCompiler_temp = accumulate(JSCompiler_temp, nativeEvent)),
changeResponder(null);
return JSCompiler_temp;
},
GlobalResponderHandler: null,
injection: {
injectGlobalResponderHandler: function(GlobalResponderHandler) {
ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler;
}
}
},
ReactNativeBridgeEventPlugin = {
eventTypes: ReactNativeViewConfigRegistry.eventTypes,
extractEvents: function(
topLevelType,
targetInst,
nativeEvent,
nativeEventTarget
) {
if (null == targetInst) return null;
var bubbleDispatchConfig =
ReactNativeViewConfigRegistry.customBubblingEventTypes[topLevelType],
directDispatchConfig =
ReactNativeViewConfigRegistry.customDirectEventTypes[topLevelType];
if (!bubbleDispatchConfig && !directDispatchConfig)
throw ReactError(
'Unsupported top level event type "' + topLevelType + '" dispatched'
);
topLevelType = SyntheticEvent.getPooled(
bubbleDispatchConfig || directDispatchConfig,
targetInst,
nativeEvent,
nativeEventTarget
);
if (bubbleDispatchConfig)
forEachAccumulated(topLevelType, accumulateTwoPhaseDispatchesSingle);
else if (directDispatchConfig)
forEachAccumulated(topLevelType, accumulateDirectDispatchesSingle);
else return null;
return topLevelType;
}
};
injection.injectEventPluginOrder([
"ResponderEventPlugin",
"ReactNativeBridgeEventPlugin"
]);
injection.injectEventPluginsByName({
ResponderEventPlugin: ResponderEventPlugin,
ReactNativeBridgeEventPlugin: ReactNativeBridgeEventPlugin
});
function getInstanceFromInstance(instanceHandle) {
return instanceHandle;
}
getFiberCurrentPropsFromNode = function(inst) {
return inst.canonical.currentProps;
};
getInstanceFromNode = getInstanceFromInstance;
getNodeFromInstance = function(inst) {
inst = inst.stateNode.canonical._nativeTag;
if (!inst) throw ReactError("All native instances should have a tag.");
return inst;
};
ResponderEventPlugin.injection.injectGlobalResponderHandler({
onChange: function(from, to, blockNativeResponder) {
null !== to
? UIManager.setJSResponder(
to.stateNode.canonical._nativeTag,
blockNativeResponder
)
: UIManager.clearJSResponder();
}
});
var ReactSharedInternals =
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
ReactSharedInternals.hasOwnProperty("ReactCurrentDispatcher") ||
(ReactSharedInternals.ReactCurrentDispatcher = { current: null });
var hasSymbol = "function" === typeof Symbol && Symbol.for,
REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103,
REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106,
REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107,
REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108,
REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114,
REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109,
REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110,
REACT_CONCURRENT_MODE_TYPE = hasSymbol
? Symbol.for("react.concurrent_mode")
: 60111,
REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112,
REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113,
REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115,
REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116;
hasSymbol && Symbol.for("react.event_component");
hasSymbol && Symbol.for("react.event_target");
hasSymbol && Symbol.for("react.event_target.touch_hit");
var MAYBE_ITERATOR_SYMBOL = "function" === typeof Symbol && Symbol.iterator;
function getIteratorFn(maybeIterable) {
if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
maybeIterable =
(MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
maybeIterable["@@iterator"];
return "function" === typeof maybeIterable ? maybeIterable : null;
}
function getComponentName(type) {
if (null == type) return null;
if ("function" === typeof type) return type.displayName || type.name || null;
if ("string" === typeof type) return type;
switch (type) {
case REACT_CONCURRENT_MODE_TYPE:
return "ConcurrentMode";
case REACT_FRAGMENT_TYPE:
return "Fragment";
case REACT_PORTAL_TYPE:
return "Portal";
case REACT_PROFILER_TYPE:
return "Profiler";
case REACT_STRICT_MODE_TYPE:
return "StrictMode";
case REACT_SUSPENSE_TYPE:
return "Suspense";
}
if ("object" === typeof type)
switch (type.$$typeof) {
case REACT_CONTEXT_TYPE:
return "Context.Consumer";
case REACT_PROVIDER_TYPE:
return "Context.Provider";
case REACT_FORWARD_REF_TYPE:
var innerType = type.render;
innerType = innerType.displayName || innerType.name || "";
return (
type.displayName ||
("" !== innerType ? "ForwardRef(" + innerType + ")" : "ForwardRef")
);
case REACT_MEMO_TYPE:
return getComponentName(type.type);
case REACT_LAZY_TYPE:
if ((type = 1 === type._status ? type._result : null))
return getComponentName(type);
}
return null;
}
function isFiberMountedImpl(fiber) {
var node = fiber;
if (fiber.alternate) for (; node.return; ) node = node.return;
else {
if (0 !== (node.effectTag & 2)) return 1;
for (; node.return; )
if (((node = node.return), 0 !== (node.effectTag & 2))) return 1;
}
return 3 === node.tag ? 2 : 3;
}
function assertIsMounted(fiber) {
if (2 !== isFiberMountedImpl(fiber))
throw ReactError("Unable to find node on an unmounted component.");
}
function findCurrentFiberUsingSlowPath(fiber) {
var alternate = fiber.alternate;
if (!alternate) {
alternate = isFiberMountedImpl(fiber);
if (3 === alternate)
throw ReactError("Unable to find node on an unmounted component.");
return 1 === alternate ? null : fiber;
}
for (var a = fiber, b = alternate; ; ) {
var parentA = a.return;
if (null === parentA) break;
var parentB = parentA.alternate;
if (null === parentB) {
b = parentA.return;
if (null !== b) {
a = b;
continue;
}
break;
}
if (parentA.child === parentB.child) {
for (parentB = parentA.child; parentB; ) {
if (parentB === a) return assertIsMounted(parentA), fiber;
if (parentB === b) return assertIsMounted(parentA), alternate;
parentB = parentB.sibling;
}
throw ReactError("Unable to find node on an unmounted component.");
}
if (a.return !== b.return) (a = parentA), (b = parentB);
else {
for (var didFindChild = !1, _child = parentA.child; _child; ) {
if (_child === a) {
didFindChild = !0;
a = parentA;
b = parentB;
break;
}
if (_child === b) {
didFindChild = !0;
b = parentA;
a = parentB;
break;
}
_child = _child.sibling;
}
if (!didFindChild) {
for (_child = parentB.child; _child; ) {
if (_child === a) {
didFindChild = !0;
a = parentB;
b = parentA;
break;
}
if (_child === b) {
didFindChild = !0;
b = parentB;
a = parentA;
break;
}
_child = _child.sibling;
}
if (!didFindChild)
throw ReactError(
"Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue."
);
}
}
if (a.alternate !== b)
throw ReactError(
"Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue."
);
}
if (3 !== a.tag)
throw ReactError("Unable to find node on an unmounted component.");
return a.stateNode.current === a ? fiber : alternate;
}
function findCurrentHostFiber(parent) {
parent = findCurrentFiberUsingSlowPath(parent);
if (!parent) return null;
for (var node = parent; ; ) {
if (5 === node.tag || 6 === node.tag) return node;
if (node.child) (node.child.return = node), (node = node.child);
else {
if (node === parent) break;
for (; !node.sibling; ) {
if (!node.return || node.return === parent) return null;
node = node.return;
}
node.sibling.return = node.return;
node = node.sibling;
}
}
return null;
}
function mountSafeCallback_NOT_REALLY_SAFE(context, callback) {
return function() {
if (
callback &&
("boolean" !== typeof context.__isMounted || context.__isMounted)
)
return callback.apply(context, arguments);
};
}
var emptyObject = {},
removedKeys = null,
removedKeyCount = 0;
function restoreDeletedValuesInNestedArray(
updatePayload,
node,
validAttributes
) {
if (Array.isArray(node))
for (var i = node.length; i-- && 0 < removedKeyCount; )
restoreDeletedValuesInNestedArray(
updatePayload,
node[i],
validAttributes
);
else if (node && 0 < removedKeyCount)
for (i in removedKeys)
if (removedKeys[i]) {
var nextProp = node[i];
if (void 0 !== nextProp) {
var attributeConfig = validAttributes[i];
if (attributeConfig) {
"function" === typeof nextProp && (nextProp = !0);
"undefined" === typeof nextProp && (nextProp = null);
if ("object" !== typeof attributeConfig)
updatePayload[i] = nextProp;
else if (
"function" === typeof attributeConfig.diff ||
"function" === typeof attributeConfig.process
)
(nextProp =
"function" === typeof attributeConfig.process
? attributeConfig.process(nextProp)
: nextProp),
(updatePayload[i] = nextProp);
removedKeys[i] = !1;
removedKeyCount--;
}
}
}
}
function diffNestedProperty(
updatePayload,
prevProp,
nextProp,
validAttributes
) {
if (!updatePayload && prevProp === nextProp) return updatePayload;
if (!prevProp || !nextProp)
return nextProp
? addNestedProperty(updatePayload, nextProp, validAttributes)
: prevProp
? clearNestedProperty(updatePayload, prevProp, validAttributes)
: updatePayload;
if (!Array.isArray(prevProp) && !Array.isArray(nextProp))
return diffProperties(updatePayload, prevProp, nextProp, validAttributes);
if (Array.isArray(prevProp) && Array.isArray(nextProp)) {
var minLength =
prevProp.length < nextProp.length ? prevProp.length : nextProp.length,
i;
for (i = 0; i < minLength; i++)
updatePayload = diffNestedProperty(
updatePayload,
prevProp[i],
nextProp[i],
validAttributes
);
for (; i < prevProp.length; i++)
updatePayload = clearNestedProperty(
updatePayload,
prevProp[i],
validAttributes
);
for (; i < nextProp.length; i++)
updatePayload = addNestedProperty(
updatePayload,
nextProp[i],
validAttributes
);
return updatePayload;
}
return Array.isArray(prevProp)
? diffProperties(
updatePayload,
flattenStyle(prevProp),
nextProp,
validAttributes
)
: diffProperties(
updatePayload,
prevProp,
flattenStyle(nextProp),
validAttributes
);
}
function addNestedProperty(updatePayload, nextProp, validAttributes) {
if (!nextProp) return updatePayload;
if (!Array.isArray(nextProp))
return diffProperties(
updatePayload,
emptyObject,
nextProp,
validAttributes
);
for (var i = 0; i < nextProp.length; i++)
updatePayload = addNestedProperty(
updatePayload,
nextProp[i],
validAttributes
);
return updatePayload;
}
function clearNestedProperty(updatePayload, prevProp, validAttributes) {
if (!prevProp) return updatePayload;
if (!Array.isArray(prevProp))
return diffProperties(
updatePayload,
prevProp,
emptyObject,
validAttributes
);
for (var i = 0; i < prevProp.length; i++)
updatePayload = clearNestedProperty(
updatePayload,
prevProp[i],
validAttributes
);
return updatePayload;
}
function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
var attributeConfig, propKey;
for (propKey in nextProps)
if ((attributeConfig = validAttributes[propKey])) {
var prevProp = prevProps[propKey];
var nextProp = nextProps[propKey];
"function" === typeof nextProp &&
((nextProp = !0), "function" === typeof prevProp && (prevProp = !0));
"undefined" === typeof nextProp &&
((nextProp = null),
"undefined" === typeof prevProp && (prevProp = null));
removedKeys && (removedKeys[propKey] = !1);
if (updatePayload && void 0 !== updatePayload[propKey])
if ("object" !== typeof attributeConfig)
updatePayload[propKey] = nextProp;
else {
if (
"function" === typeof attributeConfig.diff ||
"function" === typeof attributeConfig.process
)
(attributeConfig =
"function" === typeof attributeConfig.process
? attributeConfig.process(nextProp)
: nextProp),
(updatePayload[propKey] = attributeConfig);
}
else if (prevProp !== nextProp)
if ("object" !== typeof attributeConfig)
("object" !== typeof nextProp ||
null === nextProp ||
deepDiffer(prevProp, nextProp)) &&
((updatePayload || (updatePayload = {}))[propKey] = nextProp);
else if (
"function" === typeof attributeConfig.diff ||
"function" === typeof attributeConfig.process
) {
if (
void 0 === prevProp ||
("function" === typeof attributeConfig.diff
? attributeConfig.diff(prevProp, nextProp)
: "object" !== typeof nextProp ||
null === nextProp ||
deepDiffer(prevProp, nextProp))
)
(attributeConfig =
"function" === typeof attributeConfig.process
? attributeConfig.process(nextProp)
: nextProp),
((updatePayload || (updatePayload = {}))[
propKey
] = attributeConfig);
} else
(removedKeys = null),
(removedKeyCount = 0),
(updatePayload = diffNestedProperty(
updatePayload,
prevProp,
nextProp,
attributeConfig
)),
0 < removedKeyCount &&
updatePayload &&
(restoreDeletedValuesInNestedArray(
updatePayload,
nextProp,
attributeConfig
),
(removedKeys = null));
}
for (var _propKey in prevProps)
void 0 === nextProps[_propKey] &&
(!(attributeConfig = validAttributes[_propKey]) ||
(updatePayload && void 0 !== updatePayload[_propKey]) ||
((prevProp = prevProps[_propKey]),
void 0 !== prevProp &&
("object" !== typeof attributeConfig ||
"function" === typeof attributeConfig.diff ||
"function" === typeof attributeConfig.process
? (((updatePayload || (updatePayload = {}))[_propKey] = null),
removedKeys || (removedKeys = {}),
removedKeys[_propKey] ||
((removedKeys[_propKey] = !0), removedKeyCount++))
: (updatePayload = clearNestedProperty(
updatePayload,
prevProp,
attributeConfig
)))));
return updatePayload;
}
var restoreTarget = null,
restoreQueue = null;
function restoreStateOfTarget(target) {
if (getInstanceFromNode(target))
throw ReactError(
"setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue."
);
}
function _batchedUpdatesImpl(fn, bookkeeping) {
return fn(bookkeeping);
}
function _flushInteractiveUpdatesImpl() {}
var isBatching = !1;
function batchedUpdates(fn, bookkeeping) {
if (isBatching) return fn(bookkeeping);
isBatching = !0;
try {
return _batchedUpdatesImpl(fn, bookkeeping);
} finally {
if (((isBatching = !1), null !== restoreTarget || null !== restoreQueue))
if (
(_flushInteractiveUpdatesImpl(),
restoreTarget &&
((bookkeeping = restoreTarget),
(fn = restoreQueue),
(restoreQueue = restoreTarget = null),
restoreStateOfTarget(bookkeeping),
fn))
)
for (bookkeeping = 0; bookkeeping < fn.length; bookkeeping++)
restoreStateOfTarget(fn[bookkeeping]);
}
}
function dispatchEvent(target, topLevelType, nativeEvent) {
batchedUpdates(function() {
var events = nativeEvent.target;
for (var events$jscomp$0 =