ReactNative sync (c3718c4...abce30f): the one about the Prepack optimizations

Reviewed By: sophiebits

Differential Revision: D5626312

fbshipit-source-id: f8158ccb14f991b681fba34fb23933042266939d
This commit is contained in:
Brian Vaughn 2017-09-14 18:01:25 -07:00 committed by Facebook Github Bot
parent 6c2c2ecd8c
commit e9780bdc0f
10 changed files with 972 additions and 6127 deletions

View File

@ -101,25 +101,29 @@ var TextAttributes = merge(RenderableAttributes, {
// Native Components
var NativeSurfaceView = createReactNativeComponentClass({
validAttributes: SurfaceViewAttributes,
uiViewClassName: 'ARTSurfaceView',
});
var NativeSurfaceView = createReactNativeComponentClass('ARTSurfaceView',
() => ({
validAttributes: SurfaceViewAttributes,
uiViewClassName: 'ARTSurfaceView',
}));
var NativeGroup = createReactNativeComponentClass({
validAttributes: GroupAttributes,
uiViewClassName: 'ARTGroup',
});
var NativeGroup = createReactNativeComponentClass('ARTGroup',
() => ({
validAttributes: GroupAttributes,
uiViewClassName: 'ARTGroup',
}));
var NativeShape = createReactNativeComponentClass({
validAttributes: ShapeAttributes,
uiViewClassName: 'ARTShape',
});
var NativeShape = createReactNativeComponentClass('ARTShape',
() => ({
validAttributes: ShapeAttributes,
uiViewClassName: 'ARTShape',
}));
var NativeText = createReactNativeComponentClass({
validAttributes: TextAttributes,
uiViewClassName: 'ARTText',
});
var NativeText = createReactNativeComponentClass('ARTText',
() => ({
validAttributes: TextAttributes,
uiViewClassName: 'ARTText',
}));
// Utilities

View File

@ -13,7 +13,6 @@
const ReactNativeStyleAttributes = require('ReactNativeStyleAttributes');
const UIManager = require('UIManager');
const UnimplementedView = require('UnimplementedView');
const createReactNativeComponentClass = require('createReactNativeComponentClass');
const insetsDiffer = require('insetsDiffer');
@ -26,6 +25,7 @@ const verifyPropTypes = require('verifyPropTypes');
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
* found when Flow v0.54 was deployed. To see the error delete this comment and
* run Flow. */
const invariant = require('fbjs/lib/invariant');
const warning = require('fbjs/lib/warning');
/**
@ -50,77 +50,86 @@ function requireNativeComponent(
componentInterface?: ?ComponentInterface,
extraConfig?: ?{nativeOnly?: Object},
): React$ComponentType<any> | string {
const viewConfig = UIManager[viewName];
if (!viewConfig || !viewConfig.NativeProps) {
warning(false, 'Native component for "%s" does not exist', viewName);
return UnimplementedView;
}
// Don't load the ViewConfig from UIManager until it's needed for rendering.
// Lazy-loading this can help avoid Prepack deopts.
function getViewConfig() {
const viewConfig = UIManager[viewName];
viewConfig.uiViewClassName = viewName;
viewConfig.validAttributes = {};
// ReactNative `View.propTypes` have been deprecated in favor of
// `ViewPropTypes`. In their place a temporary getter has been added with a
// deprecated warning message. Avoid triggering that warning here by using
// temporary workaround, __propTypesSecretDontUseThesePlease.
// TODO (bvaughn) Revert this particular change any time after April 1
if (componentInterface) {
viewConfig.propTypes =
typeof componentInterface.__propTypesSecretDontUseThesePlease === 'object'
? componentInterface.__propTypesSecretDontUseThesePlease
: componentInterface.propTypes;
} else {
viewConfig.propTypes = null;
}
let baseModuleName = viewConfig.baseModuleName;
let nativeProps = { ...viewConfig.NativeProps };
while (baseModuleName) {
const baseModule = UIManager[baseModuleName];
if (!baseModule) {
warning(false, 'Base module "%s" does not exist', baseModuleName);
baseModuleName = null;
} else {
nativeProps = { ...nativeProps, ...baseModule.NativeProps };
baseModuleName = baseModule.baseModuleName;
}
}
for (const key in nativeProps) {
let useAttribute = false;
const attribute = {};
const differ = TypeToDifferMap[nativeProps[key]];
if (differ) {
attribute.diff = differ;
useAttribute = true;
}
const processor = TypeToProcessorMap[nativeProps[key]];
if (processor) {
attribute.process = processor;
useAttribute = true;
}
viewConfig.validAttributes[key] = useAttribute ? attribute : true;
}
// Unfortunately, the current set up puts the style properties on the top
// level props object. We also need to add the nested form for API
// compatibility. This allows these props on both the top level and the
// nested style level. TODO: Move these to nested declarations on the
// native side.
viewConfig.validAttributes.style = ReactNativeStyleAttributes;
if (__DEV__) {
componentInterface && verifyPropTypes(
componentInterface,
viewConfig,
extraConfig && extraConfig.nativeOnly
invariant(
viewConfig != null &&
!viewConfig.NativeProps != null,
'Native component for "%s" does not exist',
viewName
);
viewConfig.uiViewClassName = viewName;
viewConfig.validAttributes = {};
// ReactNative `View.propTypes` have been deprecated in favor of
// `ViewPropTypes`. In their place a temporary getter has been added with a
// deprecated warning message. Avoid triggering that warning here by using
// temporary workaround, __propTypesSecretDontUseThesePlease.
// TODO (bvaughn) Revert this particular change any time after April 1
if (componentInterface) {
viewConfig.propTypes =
typeof componentInterface.__propTypesSecretDontUseThesePlease === 'object'
? componentInterface.__propTypesSecretDontUseThesePlease
: componentInterface.propTypes;
} else {
viewConfig.propTypes = null;
}
let baseModuleName = viewConfig.baseModuleName;
let nativeProps = { ...viewConfig.NativeProps };
while (baseModuleName) {
const baseModule = UIManager[baseModuleName];
if (!baseModule) {
warning(false, 'Base module "%s" does not exist', baseModuleName);
baseModuleName = null;
} else {
nativeProps = { ...nativeProps, ...baseModule.NativeProps };
baseModuleName = baseModule.baseModuleName;
}
}
for (const key in nativeProps) {
let useAttribute = false;
const attribute = {};
const differ = TypeToDifferMap[nativeProps[key]];
if (differ) {
attribute.diff = differ;
useAttribute = true;
}
const processor = TypeToProcessorMap[nativeProps[key]];
if (processor) {
attribute.process = processor;
useAttribute = true;
}
viewConfig.validAttributes[key] = useAttribute ? attribute : true;
}
// Unfortunately, the current set up puts the style properties on the top
// level props object. We also need to add the nested form for API
// compatibility. This allows these props on both the top level and the
// nested style level. TODO: Move these to nested declarations on the
// native side.
viewConfig.validAttributes.style = ReactNativeStyleAttributes;
if (__DEV__) {
componentInterface && verifyPropTypes(
componentInterface,
viewConfig,
extraConfig && extraConfig.nativeOnly
);
}
return viewConfig;
}
return createReactNativeComponentClass(viewConfig);
return createReactNativeComponentClass(viewName, getViewConfig);
}
const TypeToDifferMap = {

View File

@ -1 +1 @@
c3718c48f01fa6c2e04bd47226061769484c951b
abce30f771e07670b3efac6ffdcab1a7139556a9

View File

@ -14,7 +14,7 @@
__DEV__ && function() {
var invariant = require("fbjs/lib/invariant"), require$$0 = require("fbjs/lib/warning"), ExceptionsManager = require("ExceptionsManager"), emptyObject = require("fbjs/lib/emptyObject"), react = require("react"), checkPropTypes = require("prop-types/checkPropTypes"), shallowEqual = require("fbjs/lib/shallowEqual"), deepDiffer = require("deepDiffer"), flattenStyle = require("flattenStyle"), TextInputState = require("TextInputState"), UIManager = require("UIManager"), deepFreezeAndThrowOnMutationInDev = require("deepFreezeAndThrowOnMutationInDev");
require("InitializeCore");
var RCTEventEmitter = require("RCTEventEmitter"), emptyFunction = require("fbjs/lib/emptyFunction"), ExecutionEnvironment = require("fbjs/lib/ExecutionEnvironment"), performanceNow = require("fbjs/lib/performanceNow"), defaultShowDialog = function(capturedError) {
var RCTEventEmitter = require("RCTEventEmitter"), emptyFunction = require("fbjs/lib/emptyFunction"), Platform = require("Platform"), ExecutionEnvironment = require("fbjs/lib/ExecutionEnvironment"), performanceNow = require("fbjs/lib/performanceNow"), defaultShowDialog = function(capturedError) {
return !0;
}, showDialog = defaultShowDialog;
function logCapturedError(capturedError) {
@ -92,7 +92,7 @@ __DEV__ && function() {
var evtType = "react-" + (name || "invokeguardedcallback");
window.addEventListener("error", onError), fakeNode.addEventListener(evtType, callCallback, !1);
var evt = document.createEvent("Event");
evt.initEvent(evtType, !1, !1), fakeNode.dispatchEvent(evt), didError ? (didSetError ? isCrossOriginError && (error = new Error("A cross-origin error was thrown. React doesn't have access to " + "the actual error because it catches errors using a global " + 'error handler, in order to preserve the "Pause on exceptions" ' + "behavior of the DevTools. This is only an issue in DEV-mode; " + "in production, React uses a normal try-catch statement.\n\n" + "If you are using React from a CDN, ensure that the <script> tag " + "has a `crossorigin` attribute, and that it is served with the " + "`Access-Control-Allow-Origin: *` HTTP header. " + "See https://fb.me/react-cdn-crossorigin")) : error = new Error("An error was thrown inside one of your components, but React " + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + "your browser. Try triggering the error in production mode, " + "or switching to a modern browser. If you suspect that this is " + "actually an issue with React, please file an issue."),
evt.initEvent(evtType, !1, !1), fakeNode.dispatchEvent(evt), didError ? (didSetError ? isCrossOriginError && (error = new Error("A cross-origin error was thrown. React doesn't have access to " + "the actual error object in development. " + "See https://fb.me/react-crossorigin-error for more information.")) : error = new Error("An error was thrown inside one of your components, but React " + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + "your browser. Try triggering the error in production mode, " + "or switching to a modern browser. If you suspect that this is " + "actually an issue with React, please file an issue."),
ReactErrorUtils._hasCaughtError = !0, ReactErrorUtils._caughtError = error) : (ReactErrorUtils._hasCaughtError = !1,
ReactErrorUtils._caughtError = null), window.removeEventListener("error", onError);
};
@ -284,7 +284,7 @@ __DEV__ && function() {
return instanceCache[tag] || null;
}
function getTagFromInstance(inst) {
var tag = "number" != typeof inst.tag ? inst._rootNodeID : inst.stateNode._nativeTag;
var tag = inst.stateNode._nativeTag;
return invariant(tag, "All native instances should have a tag."), tag;
}
function getFiberCurrentPropsFromNode(stateNode) {
@ -304,8 +304,7 @@ __DEV__ && function() {
getFiberCurrentPropsFromNode: getFiberCurrentPropsFromNode,
updateFiberProps: updateFiberProps
}, ReactNativeComponentTree_1 = ReactNativeComponentTree, commonjsGlobal = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}, ReactFeatureFlags = {
disableNewFiberFeatures: !1,
enableAsyncSubtreeAPI: !1
enableAsyncSubtreeAPI: !0
}, ReactFeatureFlags_1 = ReactFeatureFlags, ReactTypeOfSideEffect = {
NoEffect: 0,
PerformedWork: 1,
@ -336,7 +335,7 @@ __DEV__ && function() {
CoroutineHandlerPhase: 8,
YieldComponent: 9,
Fragment: 10
}, CallbackEffect = ReactTypeOfSideEffect.Callback, NoWork = ReactPriorityLevel.NoWork, SynchronousPriority = ReactPriorityLevel.SynchronousPriority, TaskPriority = ReactPriorityLevel.TaskPriority, ClassComponent = ReactTypeOfWork.ClassComponent, HostRoot = ReactTypeOfWork.HostRoot, warning$2 = require$$0;
}, CallbackEffect = ReactTypeOfSideEffect.Callback, NoWork = ReactPriorityLevel.NoWork, SynchronousPriority = ReactPriorityLevel.SynchronousPriority, TaskPriority = ReactPriorityLevel.TaskPriority, ClassComponent = ReactTypeOfWork.ClassComponent, HostRoot = ReactTypeOfWork.HostRoot, warning$2 = require$$0, _queue1 = void 0, _queue2 = void 0;
function comparePriority(a, b) {
return a !== TaskPriority && a !== SynchronousPriority || b !== TaskPriority && b !== SynchronousPriority ? a === NoWork && b !== NoWork ? -255 : a !== NoWork && b === NoWork ? 255 : a - b : 0;
}
@ -374,11 +373,12 @@ __DEV__ && function() {
var alternateFiber = fiber.alternate, queue1 = fiber.updateQueue;
null === queue1 && (queue1 = fiber.updateQueue = createUpdateQueue());
var queue2 = void 0;
return null !== alternateFiber ? null === (queue2 = alternateFiber.updateQueue) && (queue2 = alternateFiber.updateQueue = createUpdateQueue()) : queue2 = null,
[ queue1, queue2 !== queue1 ? queue2 : null ];
null !== alternateFiber ? null === (queue2 = alternateFiber.updateQueue) && (queue2 = alternateFiber.updateQueue = createUpdateQueue()) : queue2 = null,
_queue1 = queue1, _queue2 = queue2 !== queue1 ? queue2 : null;
}
function insertUpdate(fiber, update) {
var _ensureUpdateQueues = ensureUpdateQueues(fiber), queue1 = _ensureUpdateQueues[0], queue2 = _ensureUpdateQueues[1];
ensureUpdateQueues(fiber);
var queue1 = _queue1, queue2 = _queue2;
(queue1.isProcessing || null !== queue2 && queue2.isProcessing) && warning$2(!1, "An update (setState, replaceState, or forceUpdate) was scheduled " + "from inside an update function. Update functions should be pure, " + "with zero side-effects. Consider using componentDidUpdate or a " + "callback.");
var insertAfter1 = findInsertionPosition(queue1, update), insertBefore1 = null !== insertAfter1 ? insertAfter1.next : queue1.first;
if (null === queue2) return insertUpdateIntoQueue(queue1, update, insertAfter1, insertBefore1),
@ -441,7 +441,7 @@ __DEV__ && function() {
next: null
}, update2 = insertUpdate(fiber, update);
if (isTopLevelUnmount) {
var _ensureUpdateQueues2 = ensureUpdateQueues(fiber), queue1 = _ensureUpdateQueues2[0], queue2 = _ensureUpdateQueues2[1];
var queue1 = _queue1, queue2 = _queue2;
null !== queue1 && null !== update.next && (update.next = null, queue1.last = update),
null !== queue2 && null !== update2 && null !== update2.next && (update2.next = null,
queue2.last = update);
@ -513,16 +513,16 @@ __DEV__ && function() {
}
var getComponentName_1 = getComponentName$1, ReactInstanceMap = {
remove: function(key) {
key._reactInternalInstance = void 0;
key._reactInternalFiber = void 0;
},
get: function(key) {
return key._reactInternalInstance;
return key._reactInternalFiber;
},
has: function(key) {
return void 0 !== key._reactInternalInstance;
return void 0 !== key._reactInternalFiber;
},
set: function(key, value) {
key._reactInternalInstance = value;
key._reactInternalFiber = value;
}
}, ReactInstanceMap_1 = ReactInstanceMap, ReactInternals = react.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, ReactGlobalSharedState = {
ReactCurrentOwner: ReactInternals.ReactCurrentOwner
@ -946,32 +946,18 @@ __DEV__ && function() {
} catch (e) {
hasBadMapPolyfill = !0;
}
var debugCounter = 1, createFiber = function(tag, key, internalContextTag) {
var fiber = {
tag: tag,
key: key,
type: null,
stateNode: null,
return: null,
child: null,
sibling: null,
index: 0,
ref: null,
pendingProps: null,
memoizedProps: null,
updateQueue: null,
memoizedState: null,
internalContextTag: internalContextTag,
effectTag: NoEffect$1,
nextEffect: null,
firstEffect: null,
lastEffect: null,
pendingWorkPriority: NoWork$1,
alternate: null
};
return fiber._debugID = debugCounter++, fiber._debugSource = null, fiber._debugOwner = null,
fiber._debugIsCurrentlyTiming = !1, hasBadMapPolyfill || "function" != typeof Object.preventExtensions || Object.preventExtensions(fiber),
fiber;
var debugCounter = 1;
function FiberNode(tag, key, internalContextTag) {
this.tag = tag, this.key = key, this.type = null, this.stateNode = null, this.return = null,
this.child = null, this.sibling = null, this.index = 0, this.ref = null, this.pendingProps = null,
this.memoizedProps = null, this.updateQueue = null, this.memoizedState = null, this.internalContextTag = internalContextTag,
this.effectTag = NoEffect$1, this.nextEffect = null, this.firstEffect = null, this.lastEffect = null,
this.pendingWorkPriority = NoWork$1, this.alternate = null, this._debugID = debugCounter++,
this._debugSource = null, this._debugOwner = null, this._debugIsCurrentlyTiming = !1,
hasBadMapPolyfill || "function" != typeof Object.preventExtensions || Object.preventExtensions(this);
}
var createFiber = function(tag, key, internalContextTag) {
return new FiberNode(tag, key, internalContextTag);
};
function shouldConstruct(Component) {
return !(!Component.prototype || !Component.prototype.isReactComponent);
@ -1264,8 +1250,7 @@ __DEV__ && function() {
}
throwOnInvalidObjectType(returnFiber, newChild);
}
return ReactFeatureFlags_1.disableNewFiberFeatures || "function" != typeof newChild || warnOnFunctionType(),
null;
return "function" == typeof newChild && warnOnFunctionType(), null;
}
function updateSlot(returnFiber, oldFiber, newChild, priority) {
var key = null !== oldFiber ? oldFiber.key : null;
@ -1287,8 +1272,7 @@ __DEV__ && function() {
if (isArray(newChild) || getIteratorFn(newChild)) return null !== key ? null : updateFragment(returnFiber, oldFiber, newChild, priority);
throwOnInvalidObjectType(returnFiber, newChild);
}
return ReactFeatureFlags_1.disableNewFiberFeatures || "function" != typeof newChild || warnOnFunctionType(),
null;
return "function" == typeof newChild && warnOnFunctionType(), null;
}
function updateFromMap(existingChildren, returnFiber, newIdx, newChild, priority) {
if ("string" == typeof newChild || "number" == typeof newChild) {
@ -1313,8 +1297,7 @@ __DEV__ && function() {
}
throwOnInvalidObjectType(returnFiber, newChild);
}
return ReactFeatureFlags_1.disableNewFiberFeatures || "function" != typeof newChild || warnOnFunctionType(),
null;
return "function" == typeof newChild && warnOnFunctionType(), null;
}
function warnOnInvalidKey(child, knownKeys) {
if ("object" != typeof child || null === child) return knownKeys;
@ -1496,14 +1479,8 @@ __DEV__ && function() {
return created.return = returnFiber, created;
}
function reconcileChildFibers(returnFiber, currentFirstChild, newChild, priority) {
var disableNewFiberFeatures = ReactFeatureFlags_1.disableNewFiberFeatures, isObject = "object" == typeof newChild && null !== newChild;
if (isObject) if (disableNewFiberFeatures) switch (newChild.$$typeof) {
case REACT_ELEMENT_TYPE:
return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, priority));
case REACT_PORTAL_TYPE$1:
return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, priority));
} else switch (newChild.$$typeof) {
var isObject = "object" == typeof newChild && null !== newChild;
if (isObject) switch (newChild.$$typeof) {
case REACT_ELEMENT_TYPE:
return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, priority));
@ -1516,28 +1493,17 @@ __DEV__ && function() {
case REACT_PORTAL_TYPE$1:
return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, priority));
}
if (disableNewFiberFeatures) switch (returnFiber.tag) {
case ClassComponent$7:
if (returnFiber.stateNode.render._isMockFunction && void 0 === newChild) break;
var Component = returnFiber.type;
invariant(null === newChild || !1 === newChild, "%s.render(): A valid React element (or null) must be returned. " + "You may have returned undefined, an array or some other " + "invalid object.", Component.displayName || Component.name || "Component");
break;
case FunctionalComponent$2:
var _Component = returnFiber.type;
invariant(null === newChild || !1 === newChild, "%s(...): A valid React element (or null) must be returned. " + "You may have returned undefined, an array or some other " + "invalid object.", _Component.displayName || _Component.name || "Component");
}
if ("string" == typeof newChild || "number" == typeof newChild) return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, "" + newChild, priority));
if (isArray(newChild)) return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, priority);
if (getIteratorFn(newChild)) return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, priority);
if (isObject && throwOnInvalidObjectType(returnFiber, newChild), disableNewFiberFeatures || "function" != typeof newChild || warnOnFunctionType(),
!disableNewFiberFeatures && void 0 === newChild) switch (returnFiber.tag) {
if (isObject && throwOnInvalidObjectType(returnFiber, newChild), "function" == typeof newChild && warnOnFunctionType(),
void 0 === newChild) switch (returnFiber.tag) {
case ClassComponent$7:
if (returnFiber.stateNode.render._isMockFunction) break;
case FunctionalComponent$2:
var _Component2 = returnFiber.type;
invariant(!1, "%s(...): Nothing was returned from render. This usually means a " + "return statement is missing. Or, to render nothing, " + "return null.", _Component2.displayName || _Component2.name || "Component");
var Component = returnFiber.type;
invariant(!1, "%s(...): Nothing was returned from render. This usually means a " + "return statement is missing. Or, to render nothing, " + "return null.", Component.displayName || Component.name || "Component");
}
return deleteRemainingChildren(returnFiber, currentFirstChild);
}
@ -1558,9 +1524,16 @@ __DEV__ && function() {
reconcileChildFibersInPlace: reconcileChildFibersInPlace$1,
mountChildFibersInPlace: mountChildFibersInPlace$1,
cloneChildFibers: cloneChildFibers$1
}, Update$1 = ReactTypeOfSideEffect.Update, AsyncUpdates$1 = ReactTypeOfInternalContext.AsyncUpdates, cacheContext$1 = ReactFiberContext.cacheContext, getMaskedContext$2 = ReactFiberContext.getMaskedContext, getUnmaskedContext$2 = ReactFiberContext.getUnmaskedContext, isContextConsumer$1 = ReactFiberContext.isContextConsumer, addUpdate$1 = ReactFiberUpdateQueue.addUpdate, addReplaceUpdate$1 = ReactFiberUpdateQueue.addReplaceUpdate, addForceUpdate$1 = ReactFiberUpdateQueue.addForceUpdate, beginUpdateQueue$2 = ReactFiberUpdateQueue.beginUpdateQueue, _require5 = ReactFiberContext, hasContextChanged$2 = _require5.hasContextChanged, isMounted$1 = ReactFiberTreeReflection.isMounted, isArray$1 = Array.isArray, _require7$1 = ReactDebugFiberPerf_1, startPhaseTimer$1 = _require7$1.startPhaseTimer, stopPhaseTimer$1 = _require7$1.stopPhaseTimer, warning$9 = require$$0, warnOnInvalidCallback = function(callback, callerName) {
}, Update$1 = ReactTypeOfSideEffect.Update, AsyncUpdates$1 = ReactTypeOfInternalContext.AsyncUpdates, cacheContext$1 = ReactFiberContext.cacheContext, getMaskedContext$2 = ReactFiberContext.getMaskedContext, getUnmaskedContext$2 = ReactFiberContext.getUnmaskedContext, isContextConsumer$1 = ReactFiberContext.isContextConsumer, addUpdate$1 = ReactFiberUpdateQueue.addUpdate, addReplaceUpdate$1 = ReactFiberUpdateQueue.addReplaceUpdate, addForceUpdate$1 = ReactFiberUpdateQueue.addForceUpdate, beginUpdateQueue$2 = ReactFiberUpdateQueue.beginUpdateQueue, _require5 = ReactFiberContext, hasContextChanged$2 = _require5.hasContextChanged, isMounted$1 = ReactFiberTreeReflection.isMounted, fakeInternalInstance = {}, isArray$1 = Array.isArray, _require7$1 = ReactDebugFiberPerf_1, startPhaseTimer$1 = _require7$1.startPhaseTimer, stopPhaseTimer$1 = _require7$1.stopPhaseTimer, warning$9 = require$$0, warnOnInvalidCallback = function(callback, callerName) {
warning$9(null === callback || "function" == typeof callback, "%s(...): Expected the last optional `callback` argument to be a " + "function. Instead received: %s.", callerName, callback);
}, ReactFiberClassComponent = function(scheduleUpdate, getPriorityContext, memoizeProps, memoizeState) {
};
Object.defineProperty(fakeInternalInstance, "_processChildContext", {
enumerable: !1,
value: function() {
invariant(!1, "_processChildContext is not available in React 16+. This likely " + "means you have multiple copies of React and are attempting to nest " + "a React 15 tree inside a React 16 tree using " + "unstable_renderSubtreeIntoContainer, which isn't supported. Try " + "to make sure you have only one copy of React (and ideally, switch " + "to ReactDOM.unstable_createPortal).");
}
}), Object.freeze(fakeInternalInstance);
var ReactFiberClassComponent = function(scheduleUpdate, getPriorityContext, memoizeProps, memoizeState) {
var updater = {
isMounted: isMounted$1,
enqueueSetState: function(instance, partialState, callback) {
@ -1620,7 +1593,8 @@ __DEV__ && function() {
instance.props = workInProgress.memoizedProps, instance.state = workInProgress.memoizedState;
}
function adoptClassInstance(workInProgress, instance) {
instance.updater = updater, workInProgress.stateNode = instance, ReactInstanceMap_1.set(instance, workInProgress);
instance.updater = updater, workInProgress.stateNode = instance, ReactInstanceMap_1.set(instance, workInProgress),
instance._reactInternalInstance = fakeInternalInstance;
}
function constructClassInstance(workInProgress, props) {
var ctor = workInProgress.type, unmaskedContext = getUnmaskedContext$2(workInProgress), needsContext = isContextConsumer$1(workInProgress), context = needsContext ? getMaskedContext$2(workInProgress, unmaskedContext) : emptyObject, instance = new ctor(props, context);
@ -2044,8 +2018,8 @@ __DEV__ && function() {
onCommitUnmount: onCommitUnmount_1
}, ClassComponent$9 = ReactTypeOfWork.ClassComponent, HostRoot$8 = ReactTypeOfWork.HostRoot, HostComponent$8 = ReactTypeOfWork.HostComponent, HostText$6 = ReactTypeOfWork.HostText, HostPortal$7 = ReactTypeOfWork.HostPortal, CoroutineComponent$4 = ReactTypeOfWork.CoroutineComponent, commitCallbacks$1 = ReactFiberUpdateQueue.commitCallbacks, onCommitUnmount = ReactFiberDevToolsHook.onCommitUnmount, invokeGuardedCallback$2 = ReactErrorUtils_1.invokeGuardedCallback, hasCaughtError$1 = ReactErrorUtils_1.hasCaughtError, clearCaughtError$1 = ReactErrorUtils_1.clearCaughtError, Placement$5 = ReactTypeOfSideEffect.Placement, Update$3 = ReactTypeOfSideEffect.Update, Callback$1 = ReactTypeOfSideEffect.Callback, ContentReset$2 = ReactTypeOfSideEffect.ContentReset, _require5$1 = ReactDebugFiberPerf_1, startPhaseTimer$2 = _require5$1.startPhaseTimer, stopPhaseTimer$2 = _require5$1.stopPhaseTimer, ReactFiberCommitWork = function(config, captureError) {
var commitMount = config.commitMount, commitUpdate = config.commitUpdate, resetTextContent = config.resetTextContent, commitTextUpdate = config.commitTextUpdate, appendChild = config.appendChild, appendChildToContainer = config.appendChildToContainer, insertBefore = config.insertBefore, insertInContainerBefore = config.insertInContainerBefore, removeChild = config.removeChild, removeChildFromContainer = config.removeChildFromContainer, getPublicInstance = config.getPublicInstance, callComponentWillUnmountWithTimerInDev = function(current, instance) {
startPhaseTimer$2(current, "componentWillUnmount"), instance.componentWillUnmount(),
stopPhaseTimer$2();
startPhaseTimer$2(current, "componentWillUnmount"), instance.props = current.memoizedProps,
instance.state = current.memoizedState, instance.componentWillUnmount(), stopPhaseTimer$2();
};
function safelyCallComponentWillUnmount(current, instance) {
if (invokeGuardedCallback$2(null, callComponentWillUnmountWithTimerInDev, null, current, instance),
@ -2215,9 +2189,11 @@ __DEV__ && function() {
case ClassComponent$9:
var instance = finishedWork.stateNode;
if (finishedWork.effectTag & Update$3) if (null === current) startPhaseTimer$2(finishedWork, "componentDidMount"),
instance.props = finishedWork.memoizedProps, instance.state = finishedWork.memoizedState,
instance.componentDidMount(), stopPhaseTimer$2(); else {
var prevProps = current.memoizedProps, prevState = current.memoizedState;
startPhaseTimer$2(finishedWork, "componentDidUpdate"), instance.componentDidUpdate(prevProps, prevState),
startPhaseTimer$2(finishedWork, "componentDidUpdate"), instance.props = finishedWork.memoizedProps,
instance.state = finishedWork.memoizedState, instance.componentDidUpdate(prevProps, prevState),
stopPhaseTimer$2();
}
return void (finishedWork.effectTag & Callback$1 && null !== finishedWork.updateQueue && commitCallbacks$1(finishedWork, finishedWork.updateQueue, instance));
@ -2446,7 +2422,7 @@ __DEV__ && function() {
warning$6(!1, "Cannot update during an existing state transition (such as within " + "`render` or another component's constructor). Render methods should " + "be a pure function of props and state; constructor side-effects are " + "an anti-pattern, but can be moved to `componentWillMount`.");
}
}, timeHeuristicForUnitOfWork = 1, ReactFiberScheduler = function(config) {
var hostContext = ReactFiberHostContext(config), hydrationContext = ReactFiberHydrationContext(config), popHostContainer = hostContext.popHostContainer, popHostContext = hostContext.popHostContext, resetHostContainer = hostContext.resetHostContainer, _ReactFiberBeginWork = ReactFiberBeginWork(config, hostContext, hydrationContext, scheduleUpdate, getPriorityContext), beginWork = _ReactFiberBeginWork.beginWork, beginFailedWork = _ReactFiberBeginWork.beginFailedWork, _ReactFiberCompleteWo = ReactFiberCompleteWork(config, hostContext, hydrationContext), completeWork = _ReactFiberCompleteWo.completeWork, _ReactFiberCommitWork = ReactFiberCommitWork(config, captureError), commitPlacement = _ReactFiberCommitWork.commitPlacement, commitDeletion = _ReactFiberCommitWork.commitDeletion, commitWork = _ReactFiberCommitWork.commitWork, commitLifeCycles = _ReactFiberCommitWork.commitLifeCycles, commitAttachRef = _ReactFiberCommitWork.commitAttachRef, commitDetachRef = _ReactFiberCommitWork.commitDetachRef, scheduleDeferredCallback = config.scheduleDeferredCallback, useSyncScheduling = config.useSyncScheduling, prepareForCommit = config.prepareForCommit, resetAfterCommit = config.resetAfterCommit, priorityContext = NoWork$2, isPerformingWork = !1, deadlineHasExpired = !1, isBatchingUpdates = !1, isUnbatchingUpdates = !1, nextUnitOfWork = null, nextPriorityLevel = NoWork$2, nextEffect = null, pendingCommit = null, nextScheduledRoot = null, lastScheduledRoot = null, isCallbackScheduled = !1, capturedErrors = null, failedBoundaries = null, commitPhaseBoundaries = null, firstUncaughtError = null, didFatal = !1, isCommitting = !1, isUnmounting = !1, NESTED_UPDATE_LIMIT = 1e3, nestedUpdateCount = 0;
var hostContext = ReactFiberHostContext(config), hydrationContext = ReactFiberHydrationContext(config), popHostContainer = hostContext.popHostContainer, popHostContext = hostContext.popHostContext, resetHostContainer = hostContext.resetHostContainer, _ReactFiberBeginWork = ReactFiberBeginWork(config, hostContext, hydrationContext, scheduleUpdate, getPriorityContext), beginWork = _ReactFiberBeginWork.beginWork, beginFailedWork = _ReactFiberBeginWork.beginFailedWork, _ReactFiberCompleteWo = ReactFiberCompleteWork(config, hostContext, hydrationContext), completeWork = _ReactFiberCompleteWo.completeWork, _ReactFiberCommitWork = ReactFiberCommitWork(config, captureError), commitPlacement = _ReactFiberCommitWork.commitPlacement, commitDeletion = _ReactFiberCommitWork.commitDeletion, commitWork = _ReactFiberCommitWork.commitWork, commitLifeCycles = _ReactFiberCommitWork.commitLifeCycles, commitAttachRef = _ReactFiberCommitWork.commitAttachRef, commitDetachRef = _ReactFiberCommitWork.commitDetachRef, scheduleDeferredCallback = config.scheduleDeferredCallback, useSyncScheduling = config.useSyncScheduling, prepareForCommit = config.prepareForCommit, resetAfterCommit = config.resetAfterCommit, priorityContext = NoWork$2, isPerformingWork = !1, deadlineHasExpired = !1, isBatchingUpdates = !1, isUnbatchingUpdates = !1, nextUnitOfWork = null, nextPriorityLevel = NoWork$2, nextEffect = null, pendingCommit = null, nextScheduledRoot = null, lastScheduledRoot = null, isCallbackScheduled = !1, capturedErrors = null, failedBoundaries = null, commitPhaseBoundaries = null, firstUncaughtError = null, didFatal = !1, isCommitting = !1, isUnmounting = !1, NESTED_UPDATE_LIMIT = 1e3, nestedUpdateCount = 0, nextRenderedTree = null;
function resetContextStack() {
reset$1(), resetContext$1(), resetHostContainer();
}
@ -2461,8 +2437,9 @@ __DEV__ && function() {
for (var root = nextScheduledRoot, highestPriorityRoot = null, highestPriorityLevel = NoWork$2; null !== root; ) root.current.pendingWorkPriority !== NoWork$2 && (highestPriorityLevel === NoWork$2 || highestPriorityLevel > root.current.pendingWorkPriority) && (highestPriorityLevel = root.current.pendingWorkPriority,
highestPriorityRoot = root), root = root.nextScheduledRoot;
if (null !== highestPriorityRoot) return nextPriorityLevel = highestPriorityLevel,
resetContextStack(), void (nextUnitOfWork = createWorkInProgress$1(highestPriorityRoot.current, highestPriorityLevel));
nextPriorityLevel = NoWork$2, nextUnitOfWork = null;
resetContextStack(), nextUnitOfWork = createWorkInProgress$1(highestPriorityRoot.current, highestPriorityLevel),
void (highestPriorityRoot !== nextRenderedTree && (nestedUpdateCount = 0, nextRenderedTree = highestPriorityRoot));
nextPriorityLevel = NoWork$2, nextUnitOfWork = null, nextRenderedTree = null;
}
function commitAllHostEffects() {
for (;null !== nextEffect; ) {
@ -2629,7 +2606,7 @@ __DEV__ && function() {
}
function performWork(minPriorityLevel, deadline) {
startWorkLoopTimer(), invariant(!isPerformingWork, "performWork was called recursively. This error is likely caused " + "by a bug in React. Please file an issue."),
isPerformingWork = !0, nestedUpdateCount = 0;
isPerformingWork = !0;
var previousPriorityContext = priorityContext, didError = !1, error = null;
for (invokeGuardedCallback$1(null, workLoop, null, minPriorityLevel, deadline),
hasCaughtError() && (didError = !0, error = clearCaughtError()); didError; ) {
@ -2653,7 +2630,8 @@ __DEV__ && function() {
isCallbackScheduled = !0);
var errorToThrow = firstUncaughtError;
if (isPerformingWork = !1, deadlineHasExpired = !1, didFatal = !1, firstUncaughtError = null,
capturedErrors = null, failedBoundaries = null, stopWorkLoopTimer(), null !== errorToThrow) throw errorToThrow;
capturedErrors = null, failedBoundaries = null, nextRenderedTree = null, nestedUpdateCount = 0,
stopWorkLoopTimer(), null !== errorToThrow) throw errorToThrow;
}
function captureError(failedWork, error) {
ReactCurrentOwner$1.current = null, ReactDebugCurrentFiber$3.resetCurrentFiber();
@ -3006,7 +2984,7 @@ __DEV__ && function() {
}, ReactNativeFiberHostComponent.prototype.setNativeProps = function(nativeProps) {
warnForStyleProps(nativeProps, this.viewConfig.validAttributes);
var updatePayload = ReactNativeAttributePayload_1.create(nativeProps, this.viewConfig.validAttributes);
UIManager.updateView(this._nativeTag, this.viewConfig.uiViewClassName, updatePayload);
null != updatePayload && UIManager.updateView(this._nativeTag, this.viewConfig.uiViewClassName, updatePayload);
}, ReactNativeFiberHostComponent;
}(), ReactNativeFiberHostComponent_1 = ReactNativeFiberHostComponent, INITIAL_TAG_COUNT = 1, ReactNativeTagHandles = {
tagsStartAt: INITIAL_TAG_COUNT,
@ -3022,15 +3000,19 @@ __DEV__ && function() {
reactTagIsNativeTopRootID: function(reactTag) {
return reactTag % 10 == 1;
}
}, ReactNativeTagHandles_1 = ReactNativeTagHandles, viewConfigs = new Map(), ReactNativeViewConfigRegistry = {
register: function(viewConfig) {
var name = viewConfig.uiViewClassName;
return invariant(!viewConfigs.has(name), "Tried to register two views with the same name %s", name),
viewConfigs.set(name, viewConfig), name;
}, ReactNativeTagHandles_1 = ReactNativeTagHandles, viewConfigCallbacks = new Map(), viewConfigs = new Map(), ReactNativeViewConfigRegistry = {
register: function(name, callback) {
return invariant(!viewConfigCallbacks.has(name), "Tried to register two views with the same name %s", name),
viewConfigCallbacks.set(name, callback), name;
},
get: function(name) {
var config = viewConfigs.get(name);
return invariant(config, "View config not found for name %s", name), config;
var viewConfig = void 0;
if (viewConfigs.has(name)) viewConfig = viewConfigs.get(name); else {
var callback = viewConfigCallbacks.get(name);
invariant("function" == typeof callback, "View config not found for name %s", name),
viewConfigCallbacks.set(name, null), viewConfig = callback(), viewConfigs.set(name, viewConfig);
}
return invariant(viewConfig, "View config not found for name %s", name), viewConfig;
}
}, ReactNativeViewConfigRegistry_1 = ReactNativeViewConfigRegistry, precacheFiberNode$1 = ReactNativeComponentTree_1.precacheFiberNode, uncacheFiberNode$1 = ReactNativeComponentTree_1.uncacheFiberNode, updateFiberProps$1 = ReactNativeComponentTree_1.updateFiberProps;
function recursivelyUncacheFiberNode(node) {
@ -3106,7 +3088,7 @@ __DEV__ && function() {
var viewConfig = instance.viewConfig;
updateFiberProps$1(instance._nativeTag, newProps);
var updatePayload = ReactNativeAttributePayload_1.diff(oldProps, newProps, viewConfig.validAttributes);
UIManager.updateView(instance._nativeTag, viewConfig.uiViewClassName, updatePayload);
null != updatePayload && UIManager.updateView(instance._nativeTag, viewConfig.uiViewClassName, updatePayload);
},
createInstance: function(type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
var tag = ReactNativeTagHandles_1.allocateTag(), viewConfig = ReactNativeViewConfigRegistry_1.get(type);
@ -3232,21 +3214,17 @@ __DEV__ && function() {
};
var ReactNativeFiberInspector = {
getInspectorDataForViewTag: getInspectorDataForViewTag
}, ReactVersion = "16.0.0-beta.5", ReactNativeFeatureFlags = require("ReactNativeFeatureFlags"), ReactCurrentOwner$3 = ReactGlobalSharedState_1.ReactCurrentOwner, injectedFindNode = ReactNativeFeatureFlags.useFiber ? function(fiber) {
return ReactNativeFiberRenderer.findHostInstance(fiber);
} : function(instance) {
return instance;
};
}, ReactVersion = "16.0.0-beta.5", ReactCurrentOwner$3 = ReactGlobalSharedState_1.ReactCurrentOwner, warning$11 = require$$0;
function findNodeHandle(componentOrHandle) {
var owner = ReactCurrentOwner$3.current;
if (null !== owner && (require$$0(owner._warnedAboutRefsInRender, "%s is accessing findNodeHandle inside its render(). " + "render() should be a pure function of props and state. It should " + "never access something that requires stale data from the previous " + "render, such as refs. Move this logic to componentDidMount and " + "componentDidUpdate instead.", owner.getName() || "A component"),
owner._warnedAboutRefsInRender = !0), null == componentOrHandle) return null;
if (null !== owner && null !== owner.stateNode && (warning$11(owner.stateNode._warnedAboutRefsInRender, "%s is accessing findNodeHandle inside its render(). " + "render() should be a pure function of props and state. It should " + "never access something that requires stale data from the previous " + "render, such as refs. Move this logic to componentDidMount and " + "componentDidUpdate instead.", getComponentName_1(owner) || "A component"),
owner.stateNode._warnedAboutRefsInRender = !0), null == componentOrHandle) return null;
if ("number" == typeof componentOrHandle) return componentOrHandle;
var component = componentOrHandle, internalInstance = ReactInstanceMap_1.get(component);
return internalInstance ? injectedFindNode(internalInstance) : component || (invariant("object" == typeof component && ("_rootNodeID" in component || "_nativeTag" in component) || null != component.render && "function" == typeof component.render, "findNodeHandle(...): Argument is not a component " + "(type: %s, keys: %s)", typeof component, Object.keys(component)),
return internalInstance ? ReactNativeFiberRenderer.findHostInstance(internalInstance) : component || (invariant("object" == typeof component && "_nativeTag" in component || null != component.render && "function" == typeof component.render, "findNodeHandle(...): Argument is not a component " + "(type: %s, keys: %s)", typeof component, Object.keys(component)),
void invariant(!1, "findNodeHandle(...): Unable to find node handle for unmounted " + "component."));
}
var findNodeHandle_1 = findNodeHandle, findNumericNodeHandleFiber = function(componentOrHandle) {
var findNodeHandle_1 = findNodeHandle, findNumericNodeHandle = function(componentOrHandle) {
var instance = findNodeHandle_1(componentOrHandle);
return null == instance || "number" == typeof instance ? instance : instance._nativeTag;
}, eventPluginOrder = null, namesToPlugins = {};
@ -3360,7 +3338,7 @@ __DEV__ && function() {
var _props = currentElement.props;
if (listener = _props[registrationName], shouldPreventMouseEvent(registrationName, currentElement.type, _props)) return null;
}
return invariant(!listener || "function" == typeof listener, "Expected %s listener to be a function, instead got type %s", registrationName, typeof listener),
return invariant(!listener || "function" == typeof listener, "Expected `%s` listener to be a function, instead got a value of `%s` type.", registrationName, typeof listener),
listener;
},
extractEvents: function(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
@ -3434,13 +3412,13 @@ __DEV__ && function() {
getParentInstance: getParentInstance,
traverseTwoPhase: traverseTwoPhase,
traverseEnterLeave: traverseEnterLeave
}, getListener = EventPluginHub_1.getListener, warning$11 = require$$0;
}, getListener = EventPluginHub_1.getListener, warning$13 = require$$0;
function listenerAtPhase(inst, event, propagationPhase) {
var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
return getListener(inst, registrationName);
}
function accumulateDirectionalDispatches(inst, phase, event) {
warning$11(inst, "Dispatching inst must not be null");
warning$13(inst, "Dispatching inst must not be null");
var listener = listenerAtPhase(inst, event, phase);
listener && (event._dispatchListeners = accumulateInto_1(event._dispatchListeners, listener),
event._dispatchInstances = accumulateInto_1(event._dispatchInstances, inst));
@ -3481,7 +3459,7 @@ __DEV__ && function() {
accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
accumulateDirectDispatches: accumulateDirectDispatches,
accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
}, EventPropagators_1 = EventPropagators, didWarnForAddedNewProperty = !1, isProxySupported = "function" == typeof Proxy, EVENT_POOL_SIZE = 10, warning$12 = require$$0, shouldBeReleasedProperties = [ "dispatchConfig", "_targetInst", "nativeEvent", "isDefaultPrevented", "isPropagationStopped", "_dispatchListeners", "_dispatchInstances" ], EventInterface = {
}, EventPropagators_1 = EventPropagators, didWarnForAddedNewProperty = !1, isProxySupported = "function" == typeof Proxy, EVENT_POOL_SIZE = 10, warning$14 = require$$0, shouldBeReleasedProperties = [ "dispatchConfig", "_targetInst", "nativeEvent", "isDefaultPrevented", "isPropagationStopped", "_dispatchListeners", "_dispatchInstances" ], EventInterface = {
type: null,
target: null,
currentTarget: emptyFunction.thatReturnsNull,
@ -3545,7 +3523,7 @@ __DEV__ && function() {
apply: function(constructor, that, args) {
return new Proxy(constructor.apply(that, args), {
set: function(target, prop, value) {
return "isPersistent" === prop || target.constructor.Interface.hasOwnProperty(prop) || -1 !== shouldBeReleasedProperties.indexOf(prop) || (warning$12(didWarnForAddedNewProperty || target.isPersistent(), "This synthetic event is reused for performance reasons. If you're " + "seeing this, you're adding a new property in the synthetic event object. " + "The property is never released. See " + "https://fb.me/react-event-pooling for more information."),
return "isPersistent" === prop || target.constructor.Interface.hasOwnProperty(prop) || -1 !== shouldBeReleasedProperties.indexOf(prop) || (warning$14(didWarnForAddedNewProperty || target.isPersistent(), "This synthetic event is reused for performance reasons. If you're " + "seeing this, you're adding a new property in the synthetic event object. " + "The property is never released. See " + "https://fb.me/react-event-pooling for more information."),
didWarnForAddedNewProperty = !0), target[prop] = value, !0;
}
});
@ -3568,7 +3546,7 @@ __DEV__ && function() {
getVal;
}
function warn(action, result) {
warning$12(!1, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + "If you must keep the original synthetic event around, use event.persist(). " + "See https://fb.me/react-event-pooling for more information.", action, propName, result);
warning$14(!1, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + "If you must keep the original synthetic event around, use event.persist(). " + "See https://fb.me/react-event-pooling for more information.", action, propName, result);
}
}
function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
@ -3588,14 +3566,292 @@ __DEV__ && function() {
function addEventPoolingTo(EventConstructor) {
EventConstructor.eventPool = [], EventConstructor.getPooled = getPooledEvent, EventConstructor.release = releasePooledEvent;
}
var customBubblingEventTypes = UIManager.customBubblingEventTypes, customDirectEventTypes = UIManager.customDirectEventTypes, allTypesByEventName = {};
for (var bubblingTypeName in customBubblingEventTypes) allTypesByEventName[bubblingTypeName] = customBubblingEventTypes[bubblingTypeName];
for (var directTypeName in customDirectEventTypes) require$$0(!customBubblingEventTypes[directTypeName], "Event cannot be both direct and bubbling: %s", directTypeName),
allTypesByEventName[directTypeName] = customDirectEventTypes[directTypeName];
var COMMON_BUBBLING_EVENT_TYPES = {
topBlur: {
phasedRegistrationNames: {
captured: "onBlurCapture",
bubbled: "onBlur"
}
},
topChange: {
phasedRegistrationNames: {
captured: "onChangeCapture",
bubbled: "onChange"
}
},
topEndEditing: {
phasedRegistrationNames: {
captured: "onEndEditingCapture",
bubbled: "onEndEditing"
}
},
topFocus: {
phasedRegistrationNames: {
captured: "onFocusCapture",
bubbled: "onFocus"
}
},
topSubmitEditing: {
phasedRegistrationNames: {
captured: "onSubmitEditingCapture",
bubbled: "onSubmitEditing"
}
},
topTouchEnd: {
phasedRegistrationNames: {
captured: "onTouchEndCapture",
bubbled: "onTouchEnd"
}
},
topTouchMove: {
phasedRegistrationNames: {
captured: "onTouchMoveCapture",
bubbled: "onTouchMove"
}
},
topTouchStart: {
phasedRegistrationNames: {
captured: "onTouchStartCapture",
bubbled: "onTouchStart"
}
}
}, COMMON_DIRECT_EVENT_TYPES = {
topError: {
registrationName: "onError"
},
topLayout: {
registrationName: "onLayout"
},
topLoad: {
registrationName: "onLoad"
},
topLoadEnd: {
registrationName: "onLoadEnd"
},
topLoadStart: {
registrationName: "onLoadStart"
},
topLoadingError: {
registrationName: "onLoadingError"
},
topLoadingFinish: {
registrationName: "onLoadingFinish"
},
topLoadingStart: {
registrationName: "onLoadingStart"
},
topMessage: {
registrationName: "onMessage"
},
topMomentumScrollBegin: {
registrationName: "onMomentumScrollBegin"
},
topMomentumScrollEnd: {
registrationName: "onMomentumScrollEnd"
},
topRefresh: {
registrationName: "onRefresh"
},
topScroll: {
registrationName: "onScroll"
},
topScrollAnimationEnd: {
registrationName: "onScrollAnimationEnd"
},
topScrollBeginDrag: {
registrationName: "onScrollBeginDrag"
},
topScrollEndDrag: {
registrationName: "onScrollEndDrag"
},
topSelectionChange: {
registrationName: "onSelectionChange"
},
topShow: {
registrationName: "onShow"
}
}, ANDROID_BUBBLING_EVENT_TYPES = Object.assign({}, COMMON_BUBBLING_EVENT_TYPES, {
topSelect: {
phasedRegistrationNames: {
bubbled: "onSelect",
captured: "onSelectCapture"
}
},
topTextInput: {
phasedRegistrationNames: {
bubbled: "onTextInput",
captured: "onTextInputCapture"
}
}
}), ANDROID_DIRECT_EVENT_TYPES = Object.assign({}, COMMON_DIRECT_EVENT_TYPES, {
topContentSizeChange: {
registrationName: "onContentSizeChange"
},
topDrawerClosed: {
registrationName: "onDrawerClose"
},
topDrawerOpened: {
registrationName: "onDrawerOpen"
},
topDrawerSlide: {
registrationName: "onDrawerSlide"
},
topDrawerStateChanged: {
registrationName: "onDrawerStateChanged"
},
topPageScroll: {
registrationName: "onPageScroll"
},
topPageScrollStateChanged: {
registrationName: "onPageScrollStateChanged"
},
topPageSelected: {
registrationName: "onPageSelected"
},
topRequestClose: {
registrationName: "onRequestClose"
},
topSlidingComplete: {
registrationName: "onSlidingComplete"
},
topVideoProgress: {
registrationName: "onProgress"
},
topVideoSizeDetected: {
registrationName: "onVideoSizeDetected"
},
topVideoStateChange: {
registrationName: "onStateChange"
},
topZoom: {
registrationName: "onZoom"
}
}), IOS_BUBBLING_EVENT_TYPES = Object.assign({}, COMMON_BUBBLING_EVENT_TYPES, {
topAnnotationBlur: {
phasedRegistrationNames: {
captured: "onAnnotationBlurCapture",
bubbled: "onAnnotationBlur"
}
},
topAnnotationDragStateChange: {
phasedRegistrationNames: {
captured: "onAnnotationDragStateChangeCapture",
bubbled: "onAnnotationDragStateChange"
}
},
topAnnotationFocus: {
phasedRegistrationNames: {
captured: "onAnnotationFocusCapture",
bubbled: "onAnnotationFocus"
}
},
topContentSizeChange: {
phasedRegistrationNames: {
captured: "onContentSizeChangeCapture",
bubbled: "onContentSizeChange"
}
},
topKeyPress: {
phasedRegistrationNames: {
captured: "onKeyPressCapture",
bubbled: "onKeyPress"
}
},
topLeftButtonPress: {
phasedRegistrationNames: {
captured: "onLeftButtonPressCapture",
bubbled: "onLeftButtonPress"
}
},
topNavigationComplete: {
phasedRegistrationNames: {
captured: "onNavigationCompleteCapture",
bubbled: "onNavigationComplete"
}
},
topPress: {
phasedRegistrationNames: {
captured: "onPressCapture",
bubbled: "onPress"
}
},
topRightButtonPress: {
phasedRegistrationNames: {
captured: "onRightButtonPressCapture",
bubbled: "onRightButtonPress"
}
},
topSlidingComplete: {
phasedRegistrationNames: {
captured: "onSlidingCompleteCapture",
bubbled: "onSlidingComplete"
}
},
topTouchCancel: {
phasedRegistrationNames: {
captured: "onTouchCancelCapture",
bubbled: "onTouchCancel"
}
},
topValueChange: {
phasedRegistrationNames: {
captured: "onValueChangeCapture",
bubbled: "onValueChange"
}
}
}), IOS_DIRECT_EVENT_TYPES = Object.assign({}, COMMON_DIRECT_EVENT_TYPES, {
topAccessibilityTap: {
registrationName: "onAccessibilityTap"
},
topMagicTap: {
registrationName: "onMagicTap"
},
topNavigationProgress: {
registrationName: "onNavigationProgress"
},
topOrientationChange: {
registrationName: "onOrientationChange"
},
topPartialLoad: {
registrationName: "onPartialLoad"
},
topProgress: {
registrationName: "onProgress"
},
topShouldStartLoadWithRequest: {
registrationName: "onShouldStartLoadWithRequest"
},
topSnapshotReady: {
registrationName: "onSnapshotReady"
},
topStateChange: {
registrationName: "onStateChange"
},
topTextInput: {
registrationName: "onTextInput"
},
topTextLayout: {
registrationName: "onTextLayout"
}
}), ReactNativeEventTypes = void 0;
ReactNativeEventTypes = "ios" === Platform.OS ? {
customBubblingEventTypes: IOS_BUBBLING_EVENT_TYPES,
customDirectEventTypes: IOS_DIRECT_EVENT_TYPES
} : "android" === Platform.OS ? {
customBubblingEventTypes: ANDROID_BUBBLING_EVENT_TYPES,
customDirectEventTypes: ANDROID_DIRECT_EVENT_TYPES
} : {
customBubblingEventTypes: emptyObject,
customDirectEventTypes: emptyObject
};
var ReactNativeEventTypes_1 = ReactNativeEventTypes, customBubblingEventTypes = ReactNativeEventTypes_1.customBubblingEventTypes, customDirectEventTypes = ReactNativeEventTypes_1.customDirectEventTypes, warning$12 = require$$0;
for (var directTypeName in customDirectEventTypes) warning$12(!customBubblingEventTypes[directTypeName], "Event cannot be both direct and bubbling: %s", directTypeName);
var ReactNativeBridgeEventPlugin = {
eventTypes: Object.assign({}, customBubblingEventTypes, customDirectEventTypes),
extractEvents: function(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var bubbleDispatchConfig = customBubblingEventTypes[topLevelType], directDispatchConfig = customDirectEventTypes[topLevelType], event = SyntheticEvent_1.getPooled(bubbleDispatchConfig || directDispatchConfig, targetInst, nativeEvent, nativeEventTarget);
var bubbleDispatchConfig = customBubblingEventTypes[topLevelType], directDispatchConfig = customDirectEventTypes[topLevelType];
invariant(bubbleDispatchConfig || directDispatchConfig, 'Unsupported top level event type "%s" dispatched', topLevelType);
var event = SyntheticEvent_1.getPooled(bubbleDispatchConfig || directDispatchConfig, targetInst, nativeEvent, nativeEventTarget);
if (bubbleDispatchConfig) EventPropagators_1.accumulateTwoPhaseDispatches(event); else {
if (!directDispatchConfig) return null;
EventPropagators_1.accumulateDirectDispatches(event);
@ -3610,7 +3866,7 @@ __DEV__ && function() {
handleTopLevel: function(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
runEventQueueInBatch(EventPluginHub_1.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget));
}
}, ReactEventEmitterMixin_1 = ReactEventEmitterMixin, EMPTY_NATIVE_EVENT = {}, touchSubsequence = function(touches, indices) {
}, ReactEventEmitterMixin_1 = ReactEventEmitterMixin, warning$15 = require$$0, EMPTY_NATIVE_EVENT = {}, touchSubsequence = function(touches, indices) {
for (var ret = [], i = 0; i < indices.length; i++) ret.push(touches[indices[i]]);
return ret;
}, removeTouchesAtIndices = function(touches, indices) {
@ -3632,8 +3888,7 @@ __DEV__ && function() {
ReactNativeEventEmitter.handleTopLevel(topLevelType, inst, nativeEvent, nativeEvent.target);
});
},
receiveEvent: function(tag, topLevelType, nativeEventParam) {
var rootNodeID = tag;
receiveEvent: function(rootNodeID, topLevelType, nativeEventParam) {
ReactNativeEventEmitter._receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam);
},
receiveTouches: function(eventTopLevelType, touches, changedIndices) {
@ -3641,14 +3896,14 @@ __DEV__ && function() {
var touch = changedTouches[jj];
touch.changedTouches = changedTouches, touch.touches = touches;
var nativeEvent = touch, rootNodeID = null, target = nativeEvent.target;
null !== target && void 0 !== target && (target < ReactNativeTagHandles_1.tagsStartAt ? require$$0(!1, "A view is reporting that a touch occurred on tag zero.") : rootNodeID = target),
null !== target && void 0 !== target && (target < ReactNativeTagHandles_1.tagsStartAt ? warning$15(!1, "A view is reporting that a touch occurred on tag zero.") : rootNodeID = target),
ReactNativeEventEmitter._receiveRootNodeIDEvent(rootNodeID, eventTopLevelType, nativeEvent);
}
}
}), ReactNativeEventEmitter_1 = ReactNativeEventEmitter, ReactNativeEventPluginOrder = [ "ResponderEventPlugin", "ReactNativeBridgeEventPlugin" ], ReactNativeEventPluginOrder_1 = ReactNativeEventPluginOrder, ReactNativeGlobalResponderHandler = {
onChange: function(from, to, blockNativeResponder) {
if (null !== to) {
var tag = "number" != typeof to.tag ? to._rootNodeID : to.stateNode._nativeTag;
var tag = to.stateNode._nativeTag;
UIManager.setJSResponder(tag, blockNativeResponder);
} else UIManager.clearJSResponder();
}
@ -3661,7 +3916,7 @@ __DEV__ && function() {
return SyntheticEvent_1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent_1.augmentClass(ResponderSyntheticEvent, ResponderEventInterface);
var ResponderSyntheticEvent_1 = ResponderSyntheticEvent, isEndish$2 = EventPluginUtils_1.isEndish, isMoveish$2 = EventPluginUtils_1.isMoveish, isStartish$2 = EventPluginUtils_1.isStartish, warning$13 = require$$0, MAX_TOUCH_BANK = 20, touchBank = [], touchHistory = {
var ResponderSyntheticEvent_1 = ResponderSyntheticEvent, isEndish$2 = EventPluginUtils_1.isEndish, isMoveish$2 = EventPluginUtils_1.isMoveish, isStartish$2 = EventPluginUtils_1.isStartish, warning$16 = require$$0, MAX_TOUCH_BANK = 20, touchBank = [], touchHistory = {
touchBank: touchBank,
numberActiveTouches: 0,
indexOfSingleActiveTouch: -1,
@ -3693,7 +3948,7 @@ __DEV__ && function() {
}
function getTouchIdentifier(_ref) {
var identifier = _ref.identifier;
return invariant(null != identifier, "Touch object is missing identifier."), warning$13(identifier <= MAX_TOUCH_BANK, "Touch identifier %s is greater than maximum supported %s which causes " + "performance issues backfilling array locations for all of the indices.", identifier, MAX_TOUCH_BANK),
return invariant(null != identifier, "Touch object is missing identifier."), warning$16(identifier <= MAX_TOUCH_BANK, "Touch identifier %s is greater than maximum supported %s which causes " + "performance issues backfilling array locations for all of the indices.", identifier, MAX_TOUCH_BANK),
identifier;
}
function recordTouchStart(touch) {
@ -3741,7 +3996,7 @@ __DEV__ && function() {
}
}
var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
warning$13(null != activeRecord && activeRecord.touchActive, "Cannot find single active touch.");
warning$16(null != activeRecord && activeRecord.touchActive, "Cannot find single active touch.");
}
},
touchHistory: touchHistory
@ -3890,7 +4145,6 @@ __DEV__ && function() {
ResponderEventPlugin: ResponderEventPlugin_1,
ReactNativeBridgeEventPlugin: ReactNativeBridgeEventPlugin_1
});
var DevOnlyStubShim = null;
function _classCallCheck$2(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}
@ -3909,7 +4163,7 @@ __DEV__ && function() {
}
}), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass);
}
var ReactNativeFeatureFlags$1 = require("ReactNativeFeatureFlags"), mountSafeCallback$2 = NativeMethodsMixinUtils.mountSafeCallback, findNumericNodeHandle = ReactNativeFeatureFlags$1.useFiber ? findNumericNodeHandleFiber : DevOnlyStubShim, ReactNativeComponent = function(_React$Component) {
var mountSafeCallback$2 = NativeMethodsMixinUtils.mountSafeCallback, ReactNativeComponent = function(_React$Component) {
_inherits(ReactNativeComponent, _React$Component);
function ReactNativeComponent() {
return _classCallCheck$2(this, ReactNativeComponent), _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
@ -3925,82 +4179,44 @@ __DEV__ && function() {
}, ReactNativeComponent.prototype.measureLayout = function(relativeToNativeNode, onSuccess, onFail) {
UIManager.measureLayout(findNumericNodeHandle(this), relativeToNativeNode, mountSafeCallback$2(this, onFail), mountSafeCallback$2(this, onSuccess));
}, ReactNativeComponent.prototype.setNativeProps = function(nativeProps) {
injectedSetNativeProps(this, nativeProps);
}, ReactNativeComponent;
}(react.Component);
function setNativePropsFiber(componentOrHandle, nativeProps) {
var maybeInstance = void 0;
try {
maybeInstance = findNodeHandle_1(componentOrHandle);
} catch (error) {}
if (null != maybeInstance) {
var viewConfig = maybeInstance.viewConfig, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload);
}
}
function setNativePropsStack(componentOrHandle, nativeProps) {
var maybeInstance = findNodeHandle_1(componentOrHandle);
if (null != maybeInstance) {
var viewConfig = void 0;
if (void 0 !== maybeInstance.viewConfig) viewConfig = maybeInstance.viewConfig; else if (void 0 !== maybeInstance._instance && void 0 !== maybeInstance._instance.viewConfig) viewConfig = maybeInstance._instance.viewConfig; else {
for (;void 0 !== maybeInstance._renderedComponent; ) maybeInstance = maybeInstance._renderedComponent;
viewConfig = maybeInstance.viewConfig;
var maybeInstance = void 0;
try {
maybeInstance = findNodeHandle_1(this);
} catch (error) {}
if (null != maybeInstance) {
var viewConfig = maybeInstance.viewConfig, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
null != updatePayload && UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload);
}
var tag = "function" == typeof maybeInstance.getHostNode ? maybeInstance.getHostNode() : maybeInstance._rootNodeID, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
UIManager.updateView(tag, viewConfig.uiViewClassName, updatePayload);
}
}
var injectedSetNativeProps = void 0;
injectedSetNativeProps = ReactNativeFeatureFlags$1.useFiber ? setNativePropsFiber : setNativePropsStack;
var ReactNativeComponent_1 = ReactNativeComponent, ReactNativeFeatureFlags$2 = require("ReactNativeFeatureFlags"), mountSafeCallback$3 = NativeMethodsMixinUtils.mountSafeCallback, throwOnStylesProp$1 = NativeMethodsMixinUtils.throwOnStylesProp, warnForStyleProps$2 = NativeMethodsMixinUtils.warnForStyleProps, findNumericNodeHandle$1 = ReactNativeFeatureFlags$2.useFiber ? findNumericNodeHandleFiber : DevOnlyStubShim, NativeMethodsMixin = {
}, ReactNativeComponent;
}(react.Component), ReactNativeComponent_1 = ReactNativeComponent, mountSafeCallback$3 = NativeMethodsMixinUtils.mountSafeCallback, throwOnStylesProp$1 = NativeMethodsMixinUtils.throwOnStylesProp, warnForStyleProps$2 = NativeMethodsMixinUtils.warnForStyleProps, NativeMethodsMixin = {
measure: function(callback) {
UIManager.measure(findNumericNodeHandle$1(this), mountSafeCallback$3(this, callback));
UIManager.measure(findNumericNodeHandle(this), mountSafeCallback$3(this, callback));
},
measureInWindow: function(callback) {
UIManager.measureInWindow(findNumericNodeHandle$1(this), mountSafeCallback$3(this, callback));
UIManager.measureInWindow(findNumericNodeHandle(this), mountSafeCallback$3(this, callback));
},
measureLayout: function(relativeToNativeNode, onSuccess, onFail) {
UIManager.measureLayout(findNumericNodeHandle$1(this), relativeToNativeNode, mountSafeCallback$3(this, onFail), mountSafeCallback$3(this, onSuccess));
UIManager.measureLayout(findNumericNodeHandle(this), relativeToNativeNode, mountSafeCallback$3(this, onFail), mountSafeCallback$3(this, onSuccess));
},
setNativeProps: function(nativeProps) {
injectedSetNativeProps$1(this, nativeProps);
var maybeInstance = void 0;
try {
maybeInstance = findNodeHandle_1(this);
} catch (error) {}
if (null != maybeInstance) {
var viewConfig = maybeInstance.viewConfig;
warnForStyleProps$2(nativeProps, viewConfig.validAttributes);
var updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
null != updatePayload && UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload);
}
},
focus: function() {
TextInputState.focusTextInput(findNumericNodeHandle$1(this));
TextInputState.focusTextInput(findNumericNodeHandle(this));
},
blur: function() {
TextInputState.blurTextInput(findNumericNodeHandle$1(this));
TextInputState.blurTextInput(findNumericNodeHandle(this));
}
};
function setNativePropsFiber$1(componentOrHandle, nativeProps) {
var maybeInstance = void 0;
try {
maybeInstance = findNodeHandle_1(componentOrHandle);
} catch (error) {}
if (null != maybeInstance) {
var viewConfig = maybeInstance.viewConfig;
warnForStyleProps$2(nativeProps, viewConfig.validAttributes);
var updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload);
}
}
function setNativePropsStack$1(componentOrHandle, nativeProps) {
var maybeInstance = findNodeHandle_1(componentOrHandle);
if (null != maybeInstance) {
var viewConfig = void 0;
if (void 0 !== maybeInstance.viewConfig) viewConfig = maybeInstance.viewConfig; else if (void 0 !== maybeInstance._instance && void 0 !== maybeInstance._instance.viewConfig) viewConfig = maybeInstance._instance.viewConfig; else {
for (;void 0 !== maybeInstance._renderedComponent; ) maybeInstance = maybeInstance._renderedComponent;
viewConfig = maybeInstance.viewConfig;
}
var tag = "function" == typeof maybeInstance.getHostNode ? maybeInstance.getHostNode() : maybeInstance._rootNodeID;
warnForStyleProps$2(nativeProps, viewConfig.validAttributes);
var updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
UIManager.updateView(tag, viewConfig.uiViewClassName, updatePayload);
}
}
var injectedSetNativeProps$1 = void 0;
injectedSetNativeProps$1 = ReactNativeFeatureFlags$2.useFiber ? setNativePropsFiber$1 : setNativePropsStack$1;
var NativeMethodsMixin_DEV = NativeMethodsMixin;
}, NativeMethodsMixin_DEV = NativeMethodsMixin;
invariant(!NativeMethodsMixin_DEV.componentWillMount && !NativeMethodsMixin_DEV.componentWillReceiveProps, "Do not override existing functions."),
NativeMethodsMixin_DEV.componentWillMount = function() {
throwOnStylesProp$1(this, this.props);
@ -4040,15 +4256,15 @@ __DEV__ && function() {
return TouchHistoryMath.centroidDimension(touchHistory, 0, !1, !0);
},
noCentroid: -1
}, TouchHistoryMath_1 = TouchHistoryMath, createReactNativeComponentClassFiber = function(viewConfig) {
return ReactNativeViewConfigRegistry_1.register(viewConfig);
}, createReactNativeComponentClassFiber_1 = createReactNativeComponentClassFiber, ReactNativeFeatureFlags$3 = require("ReactNativeFeatureFlags"), createReactNativeComponentClass = ReactNativeFeatureFlags$3.useFiber ? createReactNativeComponentClassFiber_1 : DevOnlyStubShim, ReactNativeFeatureFlags$4 = require("ReactNativeFeatureFlags"), findNumericNodeHandle$2 = ReactNativeFeatureFlags$4.useFiber ? findNumericNodeHandleFiber : DevOnlyStubShim;
}, TouchHistoryMath_1 = TouchHistoryMath, createReactNativeComponentClass = function(name, callback) {
return ReactNativeViewConfigRegistry_1.register(name, callback);
}, createReactNativeComponentClass_1 = createReactNativeComponentClass;
function takeSnapshot(view, options) {
return "number" != typeof view && "window" !== view && (view = findNumericNodeHandle$2(view) || "window"),
return "number" != typeof view && "window" !== view && (view = findNumericNodeHandle(view) || "window"),
UIManager.__takeSnapshot(view, options);
}
var takeSnapshot_1 = takeSnapshot, ReactInvalidSetStateWarningHook = {}, warning$15 = require$$0, processingChildContext = !1, warnInvalidSetState = function() {
warning$15(!processingChildContext, "setState(...): Cannot call setState() inside getChildContext()");
var takeSnapshot_1 = takeSnapshot, ReactInvalidSetStateWarningHook = {}, warning$18 = require$$0, processingChildContext = !1, warnInvalidSetState = function() {
warning$18(!processingChildContext, "setState(...): Cannot call setState() inside getChildContext()");
};
ReactInvalidSetStateWarningHook = {
onBeginProcessingChildContext: function() {
@ -4073,11 +4289,11 @@ __DEV__ && function() {
return history;
}
};
var ReactHostOperationHistoryHook_1 = ReactHostOperationHistoryHook, ReactComponentTreeHook = ReactGlobalSharedState_1.ReactComponentTreeHook, warning$14 = require$$0, ReactDebugTool = null, hooks = [], didHookThrowForEvent = {}, callHook = function(event, fn, context, arg1, arg2, arg3, arg4, arg5) {
var ReactHostOperationHistoryHook_1 = ReactHostOperationHistoryHook, ReactComponentTreeHook = ReactGlobalSharedState_1.ReactComponentTreeHook, warning$17 = require$$0, ReactDebugTool = null, hooks = [], didHookThrowForEvent = {}, callHook = function(event, fn, context, arg1, arg2, arg3, arg4, arg5) {
try {
fn.call(context, arg1, arg2, arg3, arg4, arg5);
} catch (e) {
warning$14(didHookThrowForEvent[event], "Exception thrown by hook while handling %s: %s", event, e + "\n" + e.stack),
warning$17(didHookThrowForEvent[event], "Exception thrown by hook while handling %s: %s", event, e + "\n" + e.stack),
didHookThrowForEvent[event] = !0;
}
}, emitEvent = function(event, arg1, arg2, arg3, arg4, arg5) {
@ -4114,13 +4330,13 @@ __DEV__ && function() {
}
clearHistory(), currentFlushStartTime = performanceNow(), currentFlushMeasurements = [];
}, checkDebugID = function(debugID) {
arguments.length > 1 && void 0 !== arguments[1] && arguments[1] && 0 === debugID || debugID || warning$14(!1, "ReactDebugTool: debugID may not be empty.");
arguments.length > 1 && void 0 !== arguments[1] && arguments[1] && 0 === debugID || debugID || warning$17(!1, "ReactDebugTool: debugID may not be empty.");
}, beginLifeCycleTimer = function(debugID, timerType) {
0 !== currentFlushNesting && (currentTimerType && !lifeCycleTimerHasWarned && (warning$14(!1, "There is an internal error in the React performance measurement code." + "\n\nDid not expect %s timer to start while %s timer is still in " + "progress for %s instance.", timerType, currentTimerType || "no", debugID === currentTimerDebugID ? "the same" : "another"),
0 !== currentFlushNesting && (currentTimerType && !lifeCycleTimerHasWarned && (warning$17(!1, "There is an internal error in the React performance measurement code." + "\n\nDid not expect %s timer to start while %s timer is still in " + "progress for %s instance.", timerType, currentTimerType || "no", debugID === currentTimerDebugID ? "the same" : "another"),
lifeCycleTimerHasWarned = !0), currentTimerStartTime = performanceNow(), currentTimerNestedFlushDuration = 0,
currentTimerDebugID = debugID, currentTimerType = timerType);
}, endLifeCycleTimer = function(debugID, timerType) {
0 !== currentFlushNesting && (currentTimerType === timerType || lifeCycleTimerHasWarned || (warning$14(!1, "There is an internal error in the React performance measurement code. " + "We did not expect %s timer to stop while %s timer is still in " + "progress for %s instance. Please report this as a bug in React.", timerType, currentTimerType || "no", debugID === currentTimerDebugID ? "the same" : "another"),
0 !== currentFlushNesting && (currentTimerType === timerType || lifeCycleTimerHasWarned || (warning$17(!1, "There is an internal error in the React performance measurement code. " + "We did not expect %s timer to stop while %s timer is still in " + "progress for %s instance. Please report this as a bug in React.", timerType, currentTimerType || "no", debugID === currentTimerDebugID ? "the same" : "another"),
lifeCycleTimerHasWarned = !0), isProfiling && currentFlushMeasurements.push({
timerType: timerType,
instanceID: debugID,
@ -4476,7 +4692,7 @@ __DEV__ && function() {
ReactFiberErrorLogger.injection.injectDialog(ReactNativeFiberErrorDialog_1.showDialog);
var ReactNativeFiber = {
NativeComponent: ReactNativeComponent_1,
findNodeHandle: findNumericNodeHandleFiber,
findNodeHandle: findNumericNodeHandle,
render: function(element, containerTag, callback) {
var root = roots.get(containerTag);
return root || (root = ReactNativeFiberRenderer.createContainer(containerTag), roots.set(containerTag, root)),
@ -4503,7 +4719,7 @@ __DEV__ && function() {
ReactNativeComponentTree: ReactNativeComponentTree_1,
ReactNativePropRegistry: ReactNativePropRegistry_1,
TouchHistoryMath: TouchHistoryMath_1,
createReactNativeComponentClass: createReactNativeComponentClass,
createReactNativeComponentClass: createReactNativeComponentClass_1,
takeSnapshot: takeSnapshot_1
}
};
@ -4515,7 +4731,8 @@ __DEV__ && function() {
findHostInstanceByFiber: ReactNativeFiberRenderer.findHostInstance,
getInspectorDataForViewTag: ReactNativeFiberInspector.getInspectorDataForViewTag,
bundleType: 1,
version: ReactVersion
version: ReactVersion,
rendererPackageName: "react-native"
});
var ReactNativeFiberEntry = ReactNativeFiber;
module.exports = ReactNativeFiberEntry;

View File

@ -13,13 +13,9 @@
var invariant = require("fbjs/lib/invariant"), ExceptionsManager = require("ExceptionsManager"), emptyObject = require("fbjs/lib/emptyObject"), react = require("react"), shallowEqual = require("fbjs/lib/shallowEqual"), deepDiffer = require("deepDiffer"), flattenStyle = require("flattenStyle"), TextInputState = require("TextInputState"), UIManager = require("UIManager");
require("deepFreezeAndThrowOnMutationInDev");
require("deepFreezeAndThrowOnMutationInDev"), require("InitializeCore");
var warning = require("fbjs/lib/warning");
require("InitializeCore");
var RCTEventEmitter = require("RCTEventEmitter"), emptyFunction = require("fbjs/lib/emptyFunction"), defaultShowDialog = function(capturedError) {
var RCTEventEmitter = require("RCTEventEmitter"), emptyFunction = require("fbjs/lib/emptyFunction"), Platform = require("Platform"), defaultShowDialog = function(capturedError) {
return !0;
}, showDialog = defaultShowDialog;
@ -288,7 +284,7 @@ function getInstanceFromTag(tag) {
}
function getTagFromInstance(inst) {
var tag = "number" != typeof inst.tag ? inst._rootNodeID : inst.stateNode._nativeTag;
var tag = inst.stateNode._nativeTag;
return invariant(tag, "All native instances should have a tag."), tag;
}
@ -311,8 +307,7 @@ var ReactNativeComponentTree = {
getFiberCurrentPropsFromNode: getFiberCurrentPropsFromNode,
updateFiberProps: updateFiberProps
}, ReactNativeComponentTree_1 = ReactNativeComponentTree, commonjsGlobal = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}, ReactFeatureFlags = {
disableNewFiberFeatures: !1,
enableAsyncSubtreeAPI: !1
enableAsyncSubtreeAPI: !0
}, ReactFeatureFlags_1 = ReactFeatureFlags, ReactTypeOfSideEffect = {
NoEffect: 0,
PerformedWork: 1,
@ -343,7 +338,7 @@ var ReactNativeComponentTree = {
CoroutineHandlerPhase: 8,
YieldComponent: 9,
Fragment: 10
}, CallbackEffect = ReactTypeOfSideEffect.Callback, NoWork = ReactPriorityLevel.NoWork, SynchronousPriority = ReactPriorityLevel.SynchronousPriority, TaskPriority = ReactPriorityLevel.TaskPriority, ClassComponent = ReactTypeOfWork.ClassComponent, HostRoot = ReactTypeOfWork.HostRoot;
}, CallbackEffect = ReactTypeOfSideEffect.Callback, NoWork = ReactPriorityLevel.NoWork, SynchronousPriority = ReactPriorityLevel.SynchronousPriority, TaskPriority = ReactPriorityLevel.TaskPriority, ClassComponent = ReactTypeOfWork.ClassComponent, HostRoot = ReactTypeOfWork.HostRoot, _queue1 = void 0, _queue2 = void 0;
function comparePriority(a, b) {
return a !== TaskPriority && a !== SynchronousPriority || b !== TaskPriority && b !== SynchronousPriority ? a === NoWork && b !== NoWork ? -255 : a !== NoWork && b === NoWork ? 255 : a - b : 0;
@ -386,12 +381,13 @@ function ensureUpdateQueues(fiber) {
var alternateFiber = fiber.alternate, queue1 = fiber.updateQueue;
null === queue1 && (queue1 = fiber.updateQueue = createUpdateQueue());
var queue2 = void 0;
return null !== alternateFiber ? null === (queue2 = alternateFiber.updateQueue) && (queue2 = alternateFiber.updateQueue = createUpdateQueue()) : queue2 = null,
[ queue1, queue2 !== queue1 ? queue2 : null ];
null !== alternateFiber ? null === (queue2 = alternateFiber.updateQueue) && (queue2 = alternateFiber.updateQueue = createUpdateQueue()) : queue2 = null,
_queue1 = queue1, _queue2 = queue2 !== queue1 ? queue2 : null;
}
function insertUpdate(fiber, update) {
var _ensureUpdateQueues = ensureUpdateQueues(fiber), queue1 = _ensureUpdateQueues[0], queue2 = _ensureUpdateQueues[1], insertAfter1 = findInsertionPosition(queue1, update), insertBefore1 = null !== insertAfter1 ? insertAfter1.next : queue1.first;
ensureUpdateQueues(fiber);
var queue1 = _queue1, queue2 = _queue2, insertAfter1 = findInsertionPosition(queue1, update), insertBefore1 = null !== insertAfter1 ? insertAfter1.next : queue1.first;
if (null === queue2) return insertUpdateIntoQueue(queue1, update, insertAfter1, insertBefore1),
null;
var insertAfter2 = findInsertionPosition(queue2, update), insertBefore2 = null !== insertAfter2 ? insertAfter2.next : queue2.first;
@ -461,7 +457,7 @@ function addTopLevelUpdate$1(fiber, partialState, callback, priorityLevel) {
next: null
}, update2 = insertUpdate(fiber, update);
if (isTopLevelUnmount) {
var _ensureUpdateQueues2 = ensureUpdateQueues(fiber), queue1 = _ensureUpdateQueues2[0], queue2 = _ensureUpdateQueues2[1];
var queue1 = _queue1, queue2 = _queue2;
null !== queue1 && null !== update.next && (update.next = null, queue1.last = update),
null !== queue2 && null !== update2 && null !== update2.next && (update2.next = null,
queue2.last = update);
@ -540,16 +536,16 @@ function getComponentName$1(instanceOrFiber) {
var getComponentName_1 = getComponentName$1, ReactInstanceMap = {
remove: function(key) {
key._reactInternalInstance = void 0;
key._reactInternalFiber = void 0;
},
get: function(key) {
return key._reactInternalInstance;
return key._reactInternalFiber;
},
has: function(key) {
return void 0 !== key._reactInternalInstance;
return void 0 !== key._reactInternalFiber;
},
set: function(key, value) {
key._reactInternalInstance = value;
key._reactInternalFiber = value;
}
}, ReactInstanceMap_1 = ReactInstanceMap, ReactInternals = react.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, ReactGlobalSharedState = {
ReactCurrentOwner: ReactInternals.ReactCurrentOwner
@ -778,29 +774,18 @@ var processChildContext_1 = processChildContext$1, pushContextProvider = functio
}, ReactTypeOfInternalContext = {
NoContext: 0,
AsyncUpdates: 1
}, IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent, ClassComponent$3 = ReactTypeOfWork.ClassComponent, HostRoot$3 = ReactTypeOfWork.HostRoot, HostComponent$2 = ReactTypeOfWork.HostComponent, HostText$1 = ReactTypeOfWork.HostText, HostPortal$1 = ReactTypeOfWork.HostPortal, CoroutineComponent = ReactTypeOfWork.CoroutineComponent, YieldComponent = ReactTypeOfWork.YieldComponent, Fragment = ReactTypeOfWork.Fragment, NoWork$1 = ReactPriorityLevel.NoWork, NoContext = ReactTypeOfInternalContext.NoContext, NoEffect$1 = ReactTypeOfSideEffect.NoEffect, createFiber = function(tag, key, internalContextTag) {
return {
tag: tag,
key: key,
type: null,
stateNode: null,
return: null,
child: null,
sibling: null,
index: 0,
ref: null,
pendingProps: null,
memoizedProps: null,
updateQueue: null,
memoizedState: null,
internalContextTag: internalContextTag,
effectTag: NoEffect$1,
nextEffect: null,
firstEffect: null,
lastEffect: null,
pendingWorkPriority: NoWork$1,
alternate: null
};
}, IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent, ClassComponent$3 = ReactTypeOfWork.ClassComponent, HostRoot$3 = ReactTypeOfWork.HostRoot, HostComponent$2 = ReactTypeOfWork.HostComponent, HostText$1 = ReactTypeOfWork.HostText, HostPortal$1 = ReactTypeOfWork.HostPortal, CoroutineComponent = ReactTypeOfWork.CoroutineComponent, YieldComponent = ReactTypeOfWork.YieldComponent, Fragment = ReactTypeOfWork.Fragment, NoWork$1 = ReactPriorityLevel.NoWork, NoContext = ReactTypeOfInternalContext.NoContext, NoEffect$1 = ReactTypeOfSideEffect.NoEffect;
function FiberNode(tag, key, internalContextTag) {
this.tag = tag, this.key = key, this.type = null, this.stateNode = null, this.return = null,
this.child = null, this.sibling = null, this.index = 0, this.ref = null, this.pendingProps = null,
this.memoizedProps = null, this.updateQueue = null, this.memoizedState = null, this.internalContextTag = internalContextTag,
this.effectTag = NoEffect$1, this.nextEffect = null, this.firstEffect = null, this.lastEffect = null,
this.pendingWorkPriority = NoWork$1, this.alternate = null;
}
var createFiber = function(tag, key, internalContextTag) {
return new FiberNode(tag, key, internalContextTag);
};
function shouldConstruct(Component) {
@ -1304,14 +1289,8 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
return created.return = returnFiber, created;
}
function reconcileChildFibers(returnFiber, currentFirstChild, newChild, priority) {
var disableNewFiberFeatures = ReactFeatureFlags_1.disableNewFiberFeatures, isObject = "object" == typeof newChild && null !== newChild;
if (isObject) if (disableNewFiberFeatures) switch (newChild.$$typeof) {
case REACT_ELEMENT_TYPE:
return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, priority));
case REACT_PORTAL_TYPE$1:
return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, priority));
} else switch (newChild.$$typeof) {
var isObject = "object" == typeof newChild && null !== newChild;
if (isObject) switch (newChild.$$typeof) {
case REACT_ELEMENT_TYPE:
return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, priority));
@ -1324,24 +1303,14 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
case REACT_PORTAL_TYPE$1:
return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, priority));
}
if (disableNewFiberFeatures) switch (returnFiber.tag) {
case ClassComponent$7:
var Component = returnFiber.type;
invariant(null === newChild || !1 === newChild, "%s.render(): A valid React element (or null) must be returned. " + "You may have returned undefined, an array or some other " + "invalid object.", Component.displayName || Component.name || "Component");
break;
case FunctionalComponent$2:
var _Component = returnFiber.type;
invariant(null === newChild || !1 === newChild, "%s(...): A valid React element (or null) must be returned. " + "You may have returned undefined, an array or some other " + "invalid object.", _Component.displayName || _Component.name || "Component");
}
if ("string" == typeof newChild || "number" == typeof newChild) return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, "" + newChild, priority));
if (isArray(newChild)) return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, priority);
if (getIteratorFn(newChild)) return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, priority);
if (isObject && throwOnInvalidObjectType(returnFiber, newChild), !disableNewFiberFeatures && void 0 === newChild) switch (returnFiber.tag) {
if (isObject && throwOnInvalidObjectType(returnFiber, newChild), void 0 === newChild) switch (returnFiber.tag) {
case ClassComponent$7:
case FunctionalComponent$2:
var _Component2 = returnFiber.type;
invariant(!1, "%s(...): Nothing was returned from render. This usually means a " + "return statement is missing. Or, to render nothing, " + "return null.", _Component2.displayName || _Component2.name || "Component");
var Component = returnFiber.type;
invariant(!1, "%s(...): Nothing was returned from render. This usually means a " + "return statement is missing. Or, to render nothing, " + "return null.", Component.displayName || Component.name || "Component");
}
return deleteRemainingChildren(returnFiber, currentFirstChild);
}
@ -1756,14 +1725,14 @@ var reconcileChildFibers$1 = ChildReconciler(!0, !0), reconcileChildFibersInPlac
return {
completeWork: completeWork
};
}, warning$11, onCommitFiberRoot = null, onCommitFiberUnmount = null, hasLoggedError = !1;
}, onCommitFiberRoot = null, onCommitFiberUnmount = null, hasLoggedError = !1;
function catchErrors(fn) {
return function(arg) {
try {
return fn(arg);
} catch (err) {
1 || hasLoggedError || (hasLoggedError = !0, warning$11(!1, "React DevTools encountered an error: %s", err));
1 || hasLoggedError || (hasLoggedError = !0);
}
};
}
@ -1799,6 +1768,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
var commitMount = config.commitMount, commitUpdate = config.commitUpdate, resetTextContent = config.resetTextContent, commitTextUpdate = config.commitTextUpdate, appendChild = config.appendChild, appendChildToContainer = config.appendChildToContainer, insertBefore = config.insertBefore, insertInContainerBefore = config.insertInContainerBefore, removeChild = config.removeChild, removeChildFromContainer = config.removeChildFromContainer, getPublicInstance = config.getPublicInstance;
function safelyCallComponentWillUnmount(current, instance) {
try {
instance.props = current.memoizedProps, instance.state = current.memoizedState,
instance.componentWillUnmount();
} catch (unmountError) {
captureError(current, unmountError);
@ -1967,8 +1937,10 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
switch (finishedWork.tag) {
case ClassComponent$9:
var instance = finishedWork.stateNode;
if (finishedWork.effectTag & Update$3) if (null === current) instance.componentDidMount(); else {
if (finishedWork.effectTag & Update$3) if (null === current) instance.props = finishedWork.memoizedProps,
instance.state = finishedWork.memoizedState, instance.componentDidMount(); else {
var prevProps = current.memoizedProps, prevState = current.memoizedState;
instance.props = finishedWork.memoizedProps, instance.state = finishedWork.memoizedState,
instance.componentDidUpdate(prevProps, prevState);
}
return void (finishedWork.effectTag & Callback$1 && null !== finishedWork.updateQueue && commitCallbacks$1(finishedWork, finishedWork.updateQueue, instance));
@ -2156,7 +2128,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
popHydrationState: popHydrationState
};
}, popContextProvider$1 = ReactFiberContext.popContextProvider, reset$1 = ReactFiberStack.reset, getStackAddendumByWorkInProgressFiber = ReactFiberComponentTreeHook.getStackAddendumByWorkInProgressFiber, logCapturedError$1 = ReactFiberErrorLogger.logCapturedError, ReactCurrentOwner$1 = ReactGlobalSharedState_1.ReactCurrentOwner, createWorkInProgress$1 = ReactFiber.createWorkInProgress, largerPriority$1 = ReactFiber.largerPriority, onCommitRoot = ReactFiberDevToolsHook.onCommitRoot, NoWork$2 = ReactPriorityLevel.NoWork, SynchronousPriority$1 = ReactPriorityLevel.SynchronousPriority, TaskPriority$1 = ReactPriorityLevel.TaskPriority, HighPriority = ReactPriorityLevel.HighPriority, LowPriority = ReactPriorityLevel.LowPriority, OffscreenPriority = ReactPriorityLevel.OffscreenPriority, AsyncUpdates = ReactTypeOfInternalContext.AsyncUpdates, PerformedWork = ReactTypeOfSideEffect.PerformedWork, Placement$1 = ReactTypeOfSideEffect.Placement, Update = ReactTypeOfSideEffect.Update, PlacementAndUpdate = ReactTypeOfSideEffect.PlacementAndUpdate, Deletion = ReactTypeOfSideEffect.Deletion, ContentReset = ReactTypeOfSideEffect.ContentReset, Callback = ReactTypeOfSideEffect.Callback, Err = ReactTypeOfSideEffect.Err, Ref = ReactTypeOfSideEffect.Ref, HostRoot$4 = ReactTypeOfWork.HostRoot, HostComponent$3 = ReactTypeOfWork.HostComponent, HostPortal$2 = ReactTypeOfWork.HostPortal, ClassComponent$4 = ReactTypeOfWork.ClassComponent, getUpdatePriority$1 = ReactFiberUpdateQueue.getUpdatePriority, _require14 = ReactFiberContext, resetContext$1 = _require14.resetContext, ReactFiberInstrumentation$1, timeHeuristicForUnitOfWork = 1, ReactFiberScheduler = function(config) {
var hostContext = ReactFiberHostContext(config), hydrationContext = ReactFiberHydrationContext(config), popHostContainer = hostContext.popHostContainer, popHostContext = hostContext.popHostContext, resetHostContainer = hostContext.resetHostContainer, _ReactFiberBeginWork = ReactFiberBeginWork(config, hostContext, hydrationContext, scheduleUpdate, getPriorityContext), beginWork = _ReactFiberBeginWork.beginWork, beginFailedWork = _ReactFiberBeginWork.beginFailedWork, _ReactFiberCompleteWo = ReactFiberCompleteWork(config, hostContext, hydrationContext), completeWork = _ReactFiberCompleteWo.completeWork, _ReactFiberCommitWork = ReactFiberCommitWork(config, captureError), commitPlacement = _ReactFiberCommitWork.commitPlacement, commitDeletion = _ReactFiberCommitWork.commitDeletion, commitWork = _ReactFiberCommitWork.commitWork, commitLifeCycles = _ReactFiberCommitWork.commitLifeCycles, commitAttachRef = _ReactFiberCommitWork.commitAttachRef, commitDetachRef = _ReactFiberCommitWork.commitDetachRef, scheduleDeferredCallback = config.scheduleDeferredCallback, useSyncScheduling = config.useSyncScheduling, prepareForCommit = config.prepareForCommit, resetAfterCommit = config.resetAfterCommit, priorityContext = NoWork$2, isPerformingWork = !1, deadlineHasExpired = !1, isBatchingUpdates = !1, isUnbatchingUpdates = !1, nextUnitOfWork = null, nextPriorityLevel = NoWork$2, nextEffect = null, pendingCommit = null, nextScheduledRoot = null, lastScheduledRoot = null, isCallbackScheduled = !1, capturedErrors = null, failedBoundaries = null, commitPhaseBoundaries = null, firstUncaughtError = null, didFatal = !1, isCommitting = !1, isUnmounting = !1, NESTED_UPDATE_LIMIT = 1e3, nestedUpdateCount = 0;
var hostContext = ReactFiberHostContext(config), hydrationContext = ReactFiberHydrationContext(config), popHostContainer = hostContext.popHostContainer, popHostContext = hostContext.popHostContext, resetHostContainer = hostContext.resetHostContainer, _ReactFiberBeginWork = ReactFiberBeginWork(config, hostContext, hydrationContext, scheduleUpdate, getPriorityContext), beginWork = _ReactFiberBeginWork.beginWork, beginFailedWork = _ReactFiberBeginWork.beginFailedWork, _ReactFiberCompleteWo = ReactFiberCompleteWork(config, hostContext, hydrationContext), completeWork = _ReactFiberCompleteWo.completeWork, _ReactFiberCommitWork = ReactFiberCommitWork(config, captureError), commitPlacement = _ReactFiberCommitWork.commitPlacement, commitDeletion = _ReactFiberCommitWork.commitDeletion, commitWork = _ReactFiberCommitWork.commitWork, commitLifeCycles = _ReactFiberCommitWork.commitLifeCycles, commitAttachRef = _ReactFiberCommitWork.commitAttachRef, commitDetachRef = _ReactFiberCommitWork.commitDetachRef, scheduleDeferredCallback = config.scheduleDeferredCallback, useSyncScheduling = config.useSyncScheduling, prepareForCommit = config.prepareForCommit, resetAfterCommit = config.resetAfterCommit, priorityContext = NoWork$2, isPerformingWork = !1, deadlineHasExpired = !1, isBatchingUpdates = !1, isUnbatchingUpdates = !1, nextUnitOfWork = null, nextPriorityLevel = NoWork$2, nextEffect = null, pendingCommit = null, nextScheduledRoot = null, lastScheduledRoot = null, isCallbackScheduled = !1, capturedErrors = null, failedBoundaries = null, commitPhaseBoundaries = null, firstUncaughtError = null, didFatal = !1, isCommitting = !1, isUnmounting = !1, NESTED_UPDATE_LIMIT = 1e3, nestedUpdateCount = 0, nextRenderedTree = null;
function resetContextStack() {
reset$1(), resetContext$1(), resetHostContainer();
}
@ -2171,8 +2143,9 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
for (var root = nextScheduledRoot, highestPriorityRoot = null, highestPriorityLevel = NoWork$2; null !== root; ) root.current.pendingWorkPriority !== NoWork$2 && (highestPriorityLevel === NoWork$2 || highestPriorityLevel > root.current.pendingWorkPriority) && (highestPriorityLevel = root.current.pendingWorkPriority,
highestPriorityRoot = root), root = root.nextScheduledRoot;
if (null !== highestPriorityRoot) return nextPriorityLevel = highestPriorityLevel,
resetContextStack(), void (nextUnitOfWork = createWorkInProgress$1(highestPriorityRoot.current, highestPriorityLevel));
nextPriorityLevel = NoWork$2, nextUnitOfWork = null;
resetContextStack(), nextUnitOfWork = createWorkInProgress$1(highestPriorityRoot.current, highestPriorityLevel),
void (highestPriorityRoot !== nextRenderedTree && (nestedUpdateCount = 0, nextRenderedTree = highestPriorityRoot));
nextPriorityLevel = NoWork$2, nextUnitOfWork = null, nextRenderedTree = null;
}
function commitAllHostEffects() {
for (;null !== nextEffect; ) {
@ -2337,7 +2310,7 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
}
function performWork(minPriorityLevel, deadline) {
invariant(!isPerformingWork, "performWork was called recursively. This error is likely caused " + "by a bug in React. Please file an issue."),
isPerformingWork = !0, nestedUpdateCount = 0;
isPerformingWork = !0;
var previousPriorityContext = priorityContext, didError = !1, error = null;
try {
workLoop(minPriorityLevel, deadline);
@ -2370,7 +2343,8 @@ var injectInternals_1 = injectInternals$1, onCommitRoot_1 = onCommitRoot$1, onCo
isCallbackScheduled = !0);
var errorToThrow = firstUncaughtError;
if (isPerformingWork = !1, deadlineHasExpired = !1, didFatal = !1, firstUncaughtError = null,
capturedErrors = null, failedBoundaries = null, null !== errorToThrow) throw errorToThrow;
capturedErrors = null, failedBoundaries = null, nextRenderedTree = null, nestedUpdateCount = 0,
null !== errorToThrow) throw errorToThrow;
}
function captureError(failedWork, error) {
ReactCurrentOwner$1.current = null;
@ -2782,7 +2756,7 @@ var mountSafeCallback = NativeMethodsMixinUtils.mountSafeCallback, ReactNativeFi
UIManager.measureLayout(this._nativeTag, relativeToNativeNode, mountSafeCallback(this, onFail), mountSafeCallback(this, onSuccess));
}, ReactNativeFiberHostComponent.prototype.setNativeProps = function(nativeProps) {
var updatePayload = ReactNativeAttributePayload_1.create(nativeProps, this.viewConfig.validAttributes);
UIManager.updateView(this._nativeTag, this.viewConfig.uiViewClassName, updatePayload);
null != updatePayload && UIManager.updateView(this._nativeTag, this.viewConfig.uiViewClassName, updatePayload);
}, ReactNativeFiberHostComponent;
}(), ReactNativeFiberHostComponent_1 = ReactNativeFiberHostComponent, INITIAL_TAG_COUNT = 1, ReactNativeTagHandles = {
tagsStartAt: INITIAL_TAG_COUNT,
@ -2798,15 +2772,19 @@ var mountSafeCallback = NativeMethodsMixinUtils.mountSafeCallback, ReactNativeFi
reactTagIsNativeTopRootID: function(reactTag) {
return reactTag % 10 == 1;
}
}, ReactNativeTagHandles_1 = ReactNativeTagHandles, viewConfigs = new Map(), ReactNativeViewConfigRegistry = {
register: function(viewConfig) {
var name = viewConfig.uiViewClassName;
return invariant(!viewConfigs.has(name), "Tried to register two views with the same name %s", name),
viewConfigs.set(name, viewConfig), name;
}, ReactNativeTagHandles_1 = ReactNativeTagHandles, viewConfigCallbacks = new Map(), viewConfigs = new Map(), ReactNativeViewConfigRegistry = {
register: function(name, callback) {
return invariant(!viewConfigCallbacks.has(name), "Tried to register two views with the same name %s", name),
viewConfigCallbacks.set(name, callback), name;
},
get: function(name) {
var config = viewConfigs.get(name);
return invariant(config, "View config not found for name %s", name), config;
var viewConfig = void 0;
if (viewConfigs.has(name)) viewConfig = viewConfigs.get(name); else {
var callback = viewConfigCallbacks.get(name);
invariant("function" == typeof callback, "View config not found for name %s", name),
viewConfigCallbacks.set(name, null), viewConfig = callback(), viewConfigs.set(name, viewConfig);
}
return invariant(viewConfig, "View config not found for name %s", name), viewConfig;
}
}, ReactNativeViewConfigRegistry_1 = ReactNativeViewConfigRegistry, precacheFiberNode$1 = ReactNativeComponentTree_1.precacheFiberNode, uncacheFiberNode$1 = ReactNativeComponentTree_1.uncacheFiberNode, updateFiberProps$1 = ReactNativeComponentTree_1.updateFiberProps;
@ -2838,7 +2816,7 @@ var NativeRenderer = ReactFiberReconciler({
var viewConfig = instance.viewConfig;
updateFiberProps$1(instance._nativeTag, newProps);
var updatePayload = ReactNativeAttributePayload_1.diff(oldProps, newProps, viewConfig.validAttributes);
UIManager.updateView(instance._nativeTag, viewConfig.uiViewClassName, updatePayload);
null != updatePayload && UIManager.updateView(instance._nativeTag, viewConfig.uiViewClassName, updatePayload);
},
createInstance: function(type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
var tag = ReactNativeTagHandles_1.allocateTag(), viewConfig = ReactNativeViewConfigRegistry_1.get(type), updatePayload = ReactNativeAttributePayload_1.create(props, viewConfig.validAttributes);
@ -2915,21 +2893,17 @@ getInspectorDataForViewTag = function() {
var ReactNativeFiberInspector = {
getInspectorDataForViewTag: getInspectorDataForViewTag
}, ReactVersion = "16.0.0-beta.5", ReactNativeFeatureFlags = require("ReactNativeFeatureFlags"), injectedFindNode = ReactNativeFeatureFlags.useFiber ? function(fiber) {
return ReactNativeFiberRenderer.findHostInstance(fiber);
} : function(instance) {
return instance;
};
}, ReactVersion = "16.0.0-beta.5";
function findNodeHandle(componentOrHandle) {
if (null == componentOrHandle) return null;
if ("number" == typeof componentOrHandle) return componentOrHandle;
var component = componentOrHandle, internalInstance = ReactInstanceMap_1.get(component);
return internalInstance ? injectedFindNode(internalInstance) : component || (invariant("object" == typeof component && ("_rootNodeID" in component || "_nativeTag" in component) || null != component.render && "function" == typeof component.render, "findNodeHandle(...): Argument is not a component " + "(type: %s, keys: %s)", typeof component, Object.keys(component)),
return internalInstance ? ReactNativeFiberRenderer.findHostInstance(internalInstance) : component || (invariant("object" == typeof component && "_nativeTag" in component || null != component.render && "function" == typeof component.render, "findNodeHandle(...): Argument is not a component " + "(type: %s, keys: %s)", typeof component, Object.keys(component)),
void invariant(!1, "findNodeHandle(...): Unable to find node handle for unmounted " + "component."));
}
var findNodeHandle_1 = findNodeHandle, findNumericNodeHandleFiber = function(componentOrHandle) {
var findNodeHandle_1 = findNodeHandle, findNumericNodeHandle = function(componentOrHandle) {
var instance = findNodeHandle_1(componentOrHandle);
return null == instance || "number" == typeof instance ? instance : instance._nativeTag;
}, eventPluginOrder = null, namesToPlugins = {};
@ -3051,7 +3025,7 @@ var EventPluginHub = {
var _props = currentElement.props;
if (listener = _props[registrationName], shouldPreventMouseEvent(registrationName, currentElement.type, _props)) return null;
}
return invariant(!listener || "function" == typeof listener, "Expected %s listener to be a function, instead got type %s", registrationName, typeof listener),
return invariant(!listener || "function" == typeof listener, "Expected `%s` listener to be a function, instead got a value of `%s` type.", registrationName, typeof listener),
listener;
},
extractEvents: function(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
@ -3267,17 +3241,292 @@ function addEventPoolingTo(EventConstructor) {
EventConstructor.eventPool = [], EventConstructor.getPooled = getPooledEvent, EventConstructor.release = releasePooledEvent;
}
var customBubblingEventTypes = UIManager.customBubblingEventTypes, customDirectEventTypes = UIManager.customDirectEventTypes, allTypesByEventName = {};
var COMMON_BUBBLING_EVENT_TYPES = {
topBlur: {
phasedRegistrationNames: {
captured: "onBlurCapture",
bubbled: "onBlur"
}
},
topChange: {
phasedRegistrationNames: {
captured: "onChangeCapture",
bubbled: "onChange"
}
},
topEndEditing: {
phasedRegistrationNames: {
captured: "onEndEditingCapture",
bubbled: "onEndEditing"
}
},
topFocus: {
phasedRegistrationNames: {
captured: "onFocusCapture",
bubbled: "onFocus"
}
},
topSubmitEditing: {
phasedRegistrationNames: {
captured: "onSubmitEditingCapture",
bubbled: "onSubmitEditing"
}
},
topTouchEnd: {
phasedRegistrationNames: {
captured: "onTouchEndCapture",
bubbled: "onTouchEnd"
}
},
topTouchMove: {
phasedRegistrationNames: {
captured: "onTouchMoveCapture",
bubbled: "onTouchMove"
}
},
topTouchStart: {
phasedRegistrationNames: {
captured: "onTouchStartCapture",
bubbled: "onTouchStart"
}
}
}, COMMON_DIRECT_EVENT_TYPES = {
topError: {
registrationName: "onError"
},
topLayout: {
registrationName: "onLayout"
},
topLoad: {
registrationName: "onLoad"
},
topLoadEnd: {
registrationName: "onLoadEnd"
},
topLoadStart: {
registrationName: "onLoadStart"
},
topLoadingError: {
registrationName: "onLoadingError"
},
topLoadingFinish: {
registrationName: "onLoadingFinish"
},
topLoadingStart: {
registrationName: "onLoadingStart"
},
topMessage: {
registrationName: "onMessage"
},
topMomentumScrollBegin: {
registrationName: "onMomentumScrollBegin"
},
topMomentumScrollEnd: {
registrationName: "onMomentumScrollEnd"
},
topRefresh: {
registrationName: "onRefresh"
},
topScroll: {
registrationName: "onScroll"
},
topScrollAnimationEnd: {
registrationName: "onScrollAnimationEnd"
},
topScrollBeginDrag: {
registrationName: "onScrollBeginDrag"
},
topScrollEndDrag: {
registrationName: "onScrollEndDrag"
},
topSelectionChange: {
registrationName: "onSelectionChange"
},
topShow: {
registrationName: "onShow"
}
}, ANDROID_BUBBLING_EVENT_TYPES = Object.assign({}, COMMON_BUBBLING_EVENT_TYPES, {
topSelect: {
phasedRegistrationNames: {
bubbled: "onSelect",
captured: "onSelectCapture"
}
},
topTextInput: {
phasedRegistrationNames: {
bubbled: "onTextInput",
captured: "onTextInputCapture"
}
}
}), ANDROID_DIRECT_EVENT_TYPES = Object.assign({}, COMMON_DIRECT_EVENT_TYPES, {
topContentSizeChange: {
registrationName: "onContentSizeChange"
},
topDrawerClosed: {
registrationName: "onDrawerClose"
},
topDrawerOpened: {
registrationName: "onDrawerOpen"
},
topDrawerSlide: {
registrationName: "onDrawerSlide"
},
topDrawerStateChanged: {
registrationName: "onDrawerStateChanged"
},
topPageScroll: {
registrationName: "onPageScroll"
},
topPageScrollStateChanged: {
registrationName: "onPageScrollStateChanged"
},
topPageSelected: {
registrationName: "onPageSelected"
},
topRequestClose: {
registrationName: "onRequestClose"
},
topSlidingComplete: {
registrationName: "onSlidingComplete"
},
topVideoProgress: {
registrationName: "onProgress"
},
topVideoSizeDetected: {
registrationName: "onVideoSizeDetected"
},
topVideoStateChange: {
registrationName: "onStateChange"
},
topZoom: {
registrationName: "onZoom"
}
}), IOS_BUBBLING_EVENT_TYPES = Object.assign({}, COMMON_BUBBLING_EVENT_TYPES, {
topAnnotationBlur: {
phasedRegistrationNames: {
captured: "onAnnotationBlurCapture",
bubbled: "onAnnotationBlur"
}
},
topAnnotationDragStateChange: {
phasedRegistrationNames: {
captured: "onAnnotationDragStateChangeCapture",
bubbled: "onAnnotationDragStateChange"
}
},
topAnnotationFocus: {
phasedRegistrationNames: {
captured: "onAnnotationFocusCapture",
bubbled: "onAnnotationFocus"
}
},
topContentSizeChange: {
phasedRegistrationNames: {
captured: "onContentSizeChangeCapture",
bubbled: "onContentSizeChange"
}
},
topKeyPress: {
phasedRegistrationNames: {
captured: "onKeyPressCapture",
bubbled: "onKeyPress"
}
},
topLeftButtonPress: {
phasedRegistrationNames: {
captured: "onLeftButtonPressCapture",
bubbled: "onLeftButtonPress"
}
},
topNavigationComplete: {
phasedRegistrationNames: {
captured: "onNavigationCompleteCapture",
bubbled: "onNavigationComplete"
}
},
topPress: {
phasedRegistrationNames: {
captured: "onPressCapture",
bubbled: "onPress"
}
},
topRightButtonPress: {
phasedRegistrationNames: {
captured: "onRightButtonPressCapture",
bubbled: "onRightButtonPress"
}
},
topSlidingComplete: {
phasedRegistrationNames: {
captured: "onSlidingCompleteCapture",
bubbled: "onSlidingComplete"
}
},
topTouchCancel: {
phasedRegistrationNames: {
captured: "onTouchCancelCapture",
bubbled: "onTouchCancel"
}
},
topValueChange: {
phasedRegistrationNames: {
captured: "onValueChangeCapture",
bubbled: "onValueChange"
}
}
}), IOS_DIRECT_EVENT_TYPES = Object.assign({}, COMMON_DIRECT_EVENT_TYPES, {
topAccessibilityTap: {
registrationName: "onAccessibilityTap"
},
topMagicTap: {
registrationName: "onMagicTap"
},
topNavigationProgress: {
registrationName: "onNavigationProgress"
},
topOrientationChange: {
registrationName: "onOrientationChange"
},
topPartialLoad: {
registrationName: "onPartialLoad"
},
topProgress: {
registrationName: "onProgress"
},
topShouldStartLoadWithRequest: {
registrationName: "onShouldStartLoadWithRequest"
},
topSnapshotReady: {
registrationName: "onSnapshotReady"
},
topStateChange: {
registrationName: "onStateChange"
},
topTextInput: {
registrationName: "onTextInput"
},
topTextLayout: {
registrationName: "onTextLayout"
}
}), ReactNativeEventTypes = void 0;
for (var bubblingTypeName in customBubblingEventTypes) allTypesByEventName[bubblingTypeName] = customBubblingEventTypes[bubblingTypeName];
ReactNativeEventTypes = "ios" === Platform.OS ? {
customBubblingEventTypes: IOS_BUBBLING_EVENT_TYPES,
customDirectEventTypes: IOS_DIRECT_EVENT_TYPES
} : "android" === Platform.OS ? {
customBubblingEventTypes: ANDROID_BUBBLING_EVENT_TYPES,
customDirectEventTypes: ANDROID_DIRECT_EVENT_TYPES
} : {
customBubblingEventTypes: emptyObject,
customDirectEventTypes: emptyObject
};
for (var directTypeName in customDirectEventTypes) warning(!customBubblingEventTypes[directTypeName], "Event cannot be both direct and bubbling: %s", directTypeName),
allTypesByEventName[directTypeName] = customDirectEventTypes[directTypeName];
var ReactNativeBridgeEventPlugin = {
var ReactNativeEventTypes_1 = ReactNativeEventTypes, customBubblingEventTypes = ReactNativeEventTypes_1.customBubblingEventTypes, customDirectEventTypes = ReactNativeEventTypes_1.customDirectEventTypes, ReactNativeBridgeEventPlugin = {
eventTypes: Object.assign({}, customBubblingEventTypes, customDirectEventTypes),
extractEvents: function(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var bubbleDispatchConfig = customBubblingEventTypes[topLevelType], directDispatchConfig = customDirectEventTypes[topLevelType], event = SyntheticEvent_1.getPooled(bubbleDispatchConfig || directDispatchConfig, targetInst, nativeEvent, nativeEventTarget);
var bubbleDispatchConfig = customBubblingEventTypes[topLevelType], directDispatchConfig = customDirectEventTypes[topLevelType];
invariant(bubbleDispatchConfig || directDispatchConfig, 'Unsupported top level event type "%s" dispatched', topLevelType);
var event = SyntheticEvent_1.getPooled(bubbleDispatchConfig || directDispatchConfig, targetInst, nativeEvent, nativeEventTarget);
if (bubbleDispatchConfig) EventPropagators_1.accumulateTwoPhaseDispatches(event); else {
if (!directDispatchConfig) return null;
EventPropagators_1.accumulateDirectDispatches(event);
@ -3316,8 +3565,7 @@ var ReactEventEmitterMixin = {
ReactNativeEventEmitter.handleTopLevel(topLevelType, inst, nativeEvent, nativeEvent.target);
});
},
receiveEvent: function(tag, topLevelType, nativeEventParam) {
var rootNodeID = tag;
receiveEvent: function(rootNodeID, topLevelType, nativeEventParam) {
ReactNativeEventEmitter._receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam);
},
receiveTouches: function(eventTopLevelType, touches, changedIndices) {
@ -3332,7 +3580,7 @@ var ReactEventEmitterMixin = {
}), ReactNativeEventEmitter_1 = ReactNativeEventEmitter, ReactNativeEventPluginOrder = [ "ResponderEventPlugin", "ReactNativeBridgeEventPlugin" ], ReactNativeEventPluginOrder_1 = ReactNativeEventPluginOrder, ReactNativeGlobalResponderHandler = {
onChange: function(from, to, blockNativeResponder) {
if (null !== to) {
var tag = "number" != typeof to.tag ? to._rootNodeID : to.stateNode._nativeTag;
var tag = to.stateNode._nativeTag;
UIManager.setJSResponder(tag, blockNativeResponder);
} else UIManager.clearJSResponder();
}
@ -3348,7 +3596,7 @@ function ResponderSyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, na
SyntheticEvent_1.augmentClass(ResponderSyntheticEvent, ResponderEventInterface);
var ResponderSyntheticEvent_1 = ResponderSyntheticEvent, isEndish$2 = EventPluginUtils_1.isEndish, isMoveish$2 = EventPluginUtils_1.isMoveish, isStartish$2 = EventPluginUtils_1.isStartish, warning$15, MAX_TOUCH_BANK = 20, touchBank = [], touchHistory = {
var ResponderSyntheticEvent_1 = ResponderSyntheticEvent, isEndish$2 = EventPluginUtils_1.isEndish, isMoveish$2 = EventPluginUtils_1.isMoveish, isStartish$2 = EventPluginUtils_1.isStartish, MAX_TOUCH_BANK = 20, touchBank = [], touchHistory = {
touchBank: touchBank,
numberActiveTouches: 0,
indexOfSingleActiveTouch: -1,
@ -3384,8 +3632,7 @@ function resetTouchRecord(touchRecord, touch) {
function getTouchIdentifier(_ref) {
var identifier = _ref.identifier;
return invariant(null != identifier, "Touch object is missing identifier."),
identifier;
return invariant(null != identifier, "Touch object is missing identifier."), identifier;
}
function recordTouchStart(touch) {
@ -3591,8 +3838,6 @@ EventPluginHub_1.injection.injectEventPluginsByName({
ReactNativeBridgeEventPlugin: ReactNativeBridgeEventPlugin_1
});
var DevOnlyStubShim = null;
function _classCallCheck$2(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}
@ -3614,7 +3859,7 @@ function _inherits(subClass, superClass) {
}), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass);
}
var ReactNativeFeatureFlags$1 = require("ReactNativeFeatureFlags"), mountSafeCallback$2 = NativeMethodsMixinUtils.mountSafeCallback, findNumericNodeHandle = ReactNativeFeatureFlags$1.useFiber ? findNumericNodeHandleFiber : DevOnlyStubShim, ReactNativeComponent = function(_React$Component) {
var mountSafeCallback$2 = NativeMethodsMixinUtils.mountSafeCallback, ReactNativeComponent = function(_React$Component) {
_inherits(ReactNativeComponent, _React$Component);
function ReactNativeComponent() {
return _classCallCheck$2(this, ReactNativeComponent), _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
@ -3630,88 +3875,42 @@ var ReactNativeFeatureFlags$1 = require("ReactNativeFeatureFlags"), mountSafeCal
}, ReactNativeComponent.prototype.measureLayout = function(relativeToNativeNode, onSuccess, onFail) {
UIManager.measureLayout(findNumericNodeHandle(this), relativeToNativeNode, mountSafeCallback$2(this, onFail), mountSafeCallback$2(this, onSuccess));
}, ReactNativeComponent.prototype.setNativeProps = function(nativeProps) {
injectedSetNativeProps(this, nativeProps);
}, ReactNativeComponent;
}(react.Component);
function setNativePropsFiber(componentOrHandle, nativeProps) {
var maybeInstance = void 0;
try {
maybeInstance = findNodeHandle_1(componentOrHandle);
} catch (error) {}
if (null != maybeInstance) {
var viewConfig = maybeInstance.viewConfig, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload);
}
}
function setNativePropsStack(componentOrHandle, nativeProps) {
var maybeInstance = findNodeHandle_1(componentOrHandle);
if (null != maybeInstance) {
var viewConfig = void 0;
if (void 0 !== maybeInstance.viewConfig) viewConfig = maybeInstance.viewConfig; else if (void 0 !== maybeInstance._instance && void 0 !== maybeInstance._instance.viewConfig) viewConfig = maybeInstance._instance.viewConfig; else {
for (;void 0 !== maybeInstance._renderedComponent; ) maybeInstance = maybeInstance._renderedComponent;
viewConfig = maybeInstance.viewConfig;
var maybeInstance = void 0;
try {
maybeInstance = findNodeHandle_1(this);
} catch (error) {}
if (null != maybeInstance) {
var viewConfig = maybeInstance.viewConfig, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
null != updatePayload && UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload);
}
var tag = "function" == typeof maybeInstance.getHostNode ? maybeInstance.getHostNode() : maybeInstance._rootNodeID, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
UIManager.updateView(tag, viewConfig.uiViewClassName, updatePayload);
}
}
var injectedSetNativeProps = void 0;
injectedSetNativeProps = ReactNativeFeatureFlags$1.useFiber ? setNativePropsFiber : setNativePropsStack;
var ReactNativeComponent_1 = ReactNativeComponent, ReactNativeFeatureFlags$2 = require("ReactNativeFeatureFlags"), mountSafeCallback$3 = NativeMethodsMixinUtils.mountSafeCallback, findNumericNodeHandle$1 = ReactNativeFeatureFlags$2.useFiber ? findNumericNodeHandleFiber : DevOnlyStubShim, NativeMethodsMixin = {
}, ReactNativeComponent;
}(react.Component), ReactNativeComponent_1 = ReactNativeComponent, mountSafeCallback$3 = NativeMethodsMixinUtils.mountSafeCallback, NativeMethodsMixin = {
measure: function(callback) {
UIManager.measure(findNumericNodeHandle$1(this), mountSafeCallback$3(this, callback));
UIManager.measure(findNumericNodeHandle(this), mountSafeCallback$3(this, callback));
},
measureInWindow: function(callback) {
UIManager.measureInWindow(findNumericNodeHandle$1(this), mountSafeCallback$3(this, callback));
UIManager.measureInWindow(findNumericNodeHandle(this), mountSafeCallback$3(this, callback));
},
measureLayout: function(relativeToNativeNode, onSuccess, onFail) {
UIManager.measureLayout(findNumericNodeHandle$1(this), relativeToNativeNode, mountSafeCallback$3(this, onFail), mountSafeCallback$3(this, onSuccess));
UIManager.measureLayout(findNumericNodeHandle(this), relativeToNativeNode, mountSafeCallback$3(this, onFail), mountSafeCallback$3(this, onSuccess));
},
setNativeProps: function(nativeProps) {
injectedSetNativeProps$1(this, nativeProps);
var maybeInstance = void 0;
try {
maybeInstance = findNodeHandle_1(this);
} catch (error) {}
if (null != maybeInstance) {
var viewConfig = maybeInstance.viewConfig, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
null != updatePayload && UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload);
}
},
focus: function() {
TextInputState.focusTextInput(findNumericNodeHandle$1(this));
TextInputState.focusTextInput(findNumericNodeHandle(this));
},
blur: function() {
TextInputState.blurTextInput(findNumericNodeHandle$1(this));
TextInputState.blurTextInput(findNumericNodeHandle(this));
}
};
function setNativePropsFiber$1(componentOrHandle, nativeProps) {
var maybeInstance = void 0;
try {
maybeInstance = findNodeHandle_1(componentOrHandle);
} catch (error) {}
if (null != maybeInstance) {
var viewConfig = maybeInstance.viewConfig, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload);
}
}
function setNativePropsStack$1(componentOrHandle, nativeProps) {
var maybeInstance = findNodeHandle_1(componentOrHandle);
if (null != maybeInstance) {
var viewConfig = void 0;
if (void 0 !== maybeInstance.viewConfig) viewConfig = maybeInstance.viewConfig; else if (void 0 !== maybeInstance._instance && void 0 !== maybeInstance._instance.viewConfig) viewConfig = maybeInstance._instance.viewConfig; else {
for (;void 0 !== maybeInstance._renderedComponent; ) maybeInstance = maybeInstance._renderedComponent;
viewConfig = maybeInstance.viewConfig;
}
var tag = "function" == typeof maybeInstance.getHostNode ? maybeInstance.getHostNode() : maybeInstance._rootNodeID, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes);
UIManager.updateView(tag, viewConfig.uiViewClassName, updatePayload);
}
}
var injectedSetNativeProps$1 = void 0;
injectedSetNativeProps$1 = ReactNativeFeatureFlags$2.useFiber ? setNativePropsFiber$1 : setNativePropsStack$1;
var NativeMethodsMixin_1 = NativeMethodsMixin, TouchHistoryMath = {
}, NativeMethodsMixin_1 = NativeMethodsMixin, TouchHistoryMath = {
centroidDimension: function(touchHistory, touchesChangedAfter, isXAxis, ofCurrent) {
var touchBank = touchHistory.touchBank, total = 0, count = 0, oneTouchData = 1 === touchHistory.numberActiveTouches ? touchHistory.touchBank[touchHistory.indexOfSingleActiveTouch] : null;
if (null !== oneTouchData) oneTouchData.touchActive && oneTouchData.currentTimeStamp > touchesChangedAfter && (total += ofCurrent && isXAxis ? oneTouchData.currentPageX : ofCurrent && !isXAxis ? oneTouchData.currentPageY : !ofCurrent && isXAxis ? oneTouchData.previousPageX : oneTouchData.previousPageY,
@ -3744,12 +3943,12 @@ var NativeMethodsMixin_1 = NativeMethodsMixin, TouchHistoryMath = {
return TouchHistoryMath.centroidDimension(touchHistory, 0, !1, !0);
},
noCentroid: -1
}, TouchHistoryMath_1 = TouchHistoryMath, createReactNativeComponentClassFiber = function(viewConfig) {
return ReactNativeViewConfigRegistry_1.register(viewConfig);
}, createReactNativeComponentClassFiber_1 = createReactNativeComponentClassFiber, ReactNativeFeatureFlags$3 = require("ReactNativeFeatureFlags"), createReactNativeComponentClass = ReactNativeFeatureFlags$3.useFiber ? createReactNativeComponentClassFiber_1 : DevOnlyStubShim, ReactNativeFeatureFlags$4 = require("ReactNativeFeatureFlags"), findNumericNodeHandle$2 = ReactNativeFeatureFlags$4.useFiber ? findNumericNodeHandleFiber : DevOnlyStubShim;
}, TouchHistoryMath_1 = TouchHistoryMath, createReactNativeComponentClass = function(name, callback) {
return ReactNativeViewConfigRegistry_1.register(name, callback);
}, createReactNativeComponentClass_1 = createReactNativeComponentClass;
function takeSnapshot(view, options) {
return "number" != typeof view && "window" !== view && (view = findNumericNodeHandle$2(view) || "window"),
return "number" != typeof view && "window" !== view && (view = findNumericNodeHandle(view) || "window"),
UIManager.__takeSnapshot(view, options);
}
@ -3763,7 +3962,7 @@ ReactFiberErrorLogger.injection.injectDialog(ReactNativeFiberErrorDialog_1.showD
var ReactNativeFiber = {
NativeComponent: ReactNativeComponent_1,
findNodeHandle: findNumericNodeHandleFiber,
findNodeHandle: findNumericNodeHandle,
render: function(element, containerTag, callback) {
var root = roots.get(containerTag);
return root || (root = ReactNativeFiberRenderer.createContainer(containerTag), roots.set(containerTag, root)),
@ -3790,7 +3989,7 @@ var ReactNativeFiber = {
ReactNativeComponentTree: ReactNativeComponentTree_1,
ReactNativePropRegistry: ReactNativePropRegistry_1,
TouchHistoryMath: TouchHistoryMath_1,
createReactNativeComponentClass: createReactNativeComponentClass,
createReactNativeComponentClass: createReactNativeComponentClass_1,
takeSnapshot: takeSnapshot_1
}
};
@ -3800,7 +3999,8 @@ injectInternals({
findHostInstanceByFiber: ReactNativeFiberRenderer.findHostInstance,
getInspectorDataForViewTag: ReactNativeFiberInspector.getInspectorDataForViewTag,
bundleType: 0,
version: ReactVersion
version: ReactVersion,
rendererPackageName: "react-native"
});
var ReactNativeFiberEntry = ReactNativeFiber;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -11,20 +11,14 @@
*/
'use strict';
const ReactNativeFeatureFlags = require('ReactNativeFeatureFlags');
import type {ReactNativeType} from 'ReactNativeTypes';
let ReactNative;
if (__DEV__) {
ReactNative = ReactNativeFeatureFlags.useFiber
? require('ReactNativeFiber-dev')
: require('ReactNativeStack-dev');
ReactNative = require('ReactNativeFiber-dev');
} else {
ReactNative = ReactNativeFeatureFlags.useFiber
? require('ReactNativeFiber-prod')
: require('ReactNativeStack-prod');
ReactNative = require('ReactNativeFiber-prod');
}
module.exports = (ReactNative: ReactNativeType);

View File

@ -11,11 +11,6 @@
*/
'use strict';
/* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This comment
* suppresses an error when upgrading Flow's support for React. To see the
* error delete this comment and run Flow. */
import type React from 'react';
export type MeasureOnSuccessCallback = (
x: number,
y: number,
@ -39,6 +34,14 @@ export type MeasureLayoutOnSuccessCallback = (
height: number,
) => void;
export type ReactNativeBaseComponentViewConfig = {
validAttributes: Object,
uiViewClassName: string,
propTypes?: Object,
};
export type ViewConfigGetter = () => ReactNativeBaseComponentViewConfig;
/**
* This type keeps ReactNativeFiberHostComponent and NativeMethodsMixin in sync.
* It can also provide types for ReactNative applications that use NMM or refs.
@ -56,16 +59,11 @@ export type NativeMethodsMixinType = {
setNativeProps(nativeProps: Object): void,
};
type ReactNativeBaseComponentViewConfig = {
validAttributes: Object,
uiViewClassName: string,
propTypes?: Object,
};
type SecretInternalsType = {
NativeMethodsMixin: NativeMethodsMixinType,
createReactNativeComponentClass(
viewConfig: ReactNativeBaseComponentViewConfig,
name: string,
callback: ViewConfigGetter,
): any,
ReactNativeComponentTree: any,
ReactNativePropRegistry: any,
@ -81,7 +79,7 @@ export type ReactNativeType = {
NativeComponent: any,
findNodeHandle(componentOrHandle: any): ?number,
render(
element: React.Element<any>,
element: React$Element<any>,
containerTag: any,
callback: ?Function,
): any,

View File

@ -51,8 +51,8 @@ const viewConfig = {
* `Text` supports nesting, styling, and touch handling.
*
* In the following example, the nested title and body text will inherit the
* `fontFamily` from `styles.baseText`, but the title provides its own
* additional styles. The title and body willstack on top of each other on
* `fontFamily` from `styles.baseText`, but the title provides its own
* additional styles. The title and body willstack on top of each other on
* account of the literal newlines:
*
* ```ReactNativeWebPlayer
@ -95,16 +95,16 @@ const viewConfig = {
* // skip this line if using Create React Native App
* AppRegistry.registerComponent('TextInANest', () => TextInANest);
* ```
*
*
* ## Nested text
*
* Both iOS and Android allow you to display formatted text by annotating
* ranges of a string with specific formatting like bold or colored text
* (`NSAttributedString` on iOS, `SpannableString` on Android). In practice,
* this is very tedious. For React Native, we decided to use web paradigm for
*
* Both iOS and Android allow you to display formatted text by annotating
* ranges of a string with specific formatting like bold or colored text
* (`NSAttributedString` on iOS, `SpannableString` on Android). In practice,
* this is very tedious. For React Native, we decided to use web paradigm for
* this where you can nest text to achieve the same effect.
*
*
*
*
* ```ReactNativeWebPlayer
* import React, { Component } from 'react';
* import { AppRegistry, Text } from 'react-native';
@ -121,28 +121,28 @@ const viewConfig = {
* );
* }
* }
*
*
* // skip this line if using Create React Native App
* AppRegistry.registerComponent('AwesomeProject', () => BoldAndBeautiful);
* ```
*
* Behind the scenes, React Native converts this to a flat `NSAttributedString`
*
* Behind the scenes, React Native converts this to a flat `NSAttributedString`
* or `SpannableString` that contains the following information:
*
*
* ```javascript
* "I am bold and red"
* 0-9: bold
* 9-17: bold, red
* ```
*
*
* ## Nested views (iOS only)
*
*
* On iOS, you can nest views within your Text component. Here's an example:
*
*
* ```ReactNativeWebPlayer
* import React, { Component } from 'react';
* import { AppRegistry, Text, View } from 'react-native';
*
*
* export default class BlueIsCool extends Component {
* render() {
* return (
@ -154,20 +154,20 @@ const viewConfig = {
* );
* }
* }
*
*
* // skip this line if using Create React Native App
* AppRegistry.registerComponent('AwesomeProject', () => BlueIsCool);
* ```
*
*
* > In order to use this feature, you must give the view a `width` and a `height`.
*
*
* ## Containers
*
* The `<Text>` element is special relative to layout: everything inside is no
* longer using the flexbox layout but using text layout. This means that
* elements inside of a `<Text>` are no longer rectangles, but wrap when they
*
* The `<Text>` element is special relative to layout: everything inside is no
* longer using the flexbox layout but using text layout. This means that
* elements inside of a `<Text>` are no longer rectangles, but wrap when they
* see the end of the line.
*
*
* ```javascript
* <Text>
* <Text>First part and </Text>
@ -177,7 +177,7 @@ const viewConfig = {
* // |First part |
* // |and second |
* // |part |
*
*
* <View>
* <Text>First part and </Text>
* <Text>second part</Text>
@ -189,10 +189,10 @@ const viewConfig = {
* ```
*
* ## Limited Style Inheritance
*
* On the web, the usual way to set a font family and size for the entire
*
* On the web, the usual way to set a font family and size for the entire
* document is to take advantage of inherited CSS properties like so:
*
*
* ```css
* html {
* font-family: 'lucida grande', tahoma, verdana, arial, sans-serif;
@ -201,20 +201,20 @@ const viewConfig = {
* }
* ```
*
* All elements in the document will inherit this font unless they or one of
* All elements in the document will inherit this font unless they or one of
* their parents specifies a new rule.
*
* In React Native, we are more strict about it: **you must wrap all the text
*
* In React Native, we are more strict about it: **you must wrap all the text
* nodes inside of a `<Text>` component**. You cannot have a text node directly
* under a `<View>`.
*
*
*
* ```javascript
* // BAD: will raise exception, can't have a text node as child of a <View>
* <View>
* Some text
* </View>
*
*
* // GOOD
* <View>
* <Text>
@ -222,24 +222,24 @@ const viewConfig = {
* </Text>
* </View>
* ```
*
* You also lose the ability to set up a default font for an entire subtree.
* The recommended way to use consistent fonts and sizes across your
* application is to create a component `MyAppText` that includes them and use
* this component across your app. You can also use this component to make more
*
* You also lose the ability to set up a default font for an entire subtree.
* The recommended way to use consistent fonts and sizes across your
* application is to create a component `MyAppText` that includes them and use
* this component across your app. You can also use this component to make more
* specific components like `MyAppHeaderText` for other kinds of text.
*
*
* ```javascript
* <View>
* <MyAppText>Text styled with the default font for the entire application</MyAppText>
* <MyAppHeaderText>Text styled as a header</MyAppHeaderText>
* </View>
* ```
*
* Assuming that `MyAppText` is a component that simply renders out its
* children into a `Text` component with styling, then `MyAppHeaderText` can be
*
* Assuming that `MyAppText` is a component that simply renders out its
* children into a `Text` component with styling, then `MyAppHeaderText` can be
* defined as follows:
*
*
* ```javascript
* class MyAppHeaderText extends Component {
* render() {
@ -251,14 +251,14 @@ const viewConfig = {
* }
* }
* ```
*
* Composing `MyAppText` in this way ensures that we get the styles from a
* top-level component, but leaves us the ability to add / override them in
*
* Composing `MyAppText` in this way ensures that we get the styles from a
* top-level component, but leaves us the ability to add / override them in
* specific use cases.
*
* React Native still has the concept of style inheritance, but limited to text
*
* React Native still has the concept of style inheritance, but limited to text
* subtrees. In this case, the second part will be both bold and red.
*
*
* ```javascript
* <Text style={{fontWeight: 'bold'}}>
* I am bold
@ -267,22 +267,22 @@ const viewConfig = {
* </Text>
* </Text>
* ```
*
*
* We believe that this more constrained way to style text will yield better
* apps:
*
* - (Developer) React components are designed with strong isolation in mind:
* You should be able to drop a component anywhere in your application,
* trusting that as long as the props are the same, it will look and behave the
* same way. Text properties that could inherit from outside of the props would
*
* - (Developer) React components are designed with strong isolation in mind:
* You should be able to drop a component anywhere in your application,
* trusting that as long as the props are the same, it will look and behave the
* same way. Text properties that could inherit from outside of the props would
* break this isolation.
*
* - (Implementor) The implementation of React Native is also simplified. We do
* not need to have a `fontFamily` field on every single element, and we do not
* need to potentially traverse the tree up to the root every time we display a
* text node. The style inheritance is only encoded inside of the native Text
*
* - (Implementor) The implementation of React Native is also simplified. We do
* not need to have a `fontFamily` field on every single element, and we do not
* need to potentially traverse the tree up to the root every time we display a
* text node. The style inheritance is only encoded inside of the native Text
* component and doesn't leak to other components or the system itself.
*
*
*/
// $FlowFixMe(>=0.41.0)
@ -570,16 +570,19 @@ type RectOffset = {
var PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
var RCTText = createReactNativeComponentClass(viewConfig);
var RCTText = createReactNativeComponentClass(
viewConfig.uiViewClassName,
() => viewConfig
);
var RCTVirtualText = RCTText;
if (Platform.OS === 'android') {
RCTVirtualText = createReactNativeComponentClass({
RCTVirtualText = createReactNativeComponentClass('RCTVirtualText', () => ({
validAttributes: mergeFast(ReactNativeViewAttributes.UIView, {
isHighlighted: true,
}),
uiViewClassName: 'RCTVirtualText',
});
}));
}
module.exports = Text;