React Native sync for revisions 19f6fe1...241c446

Summary:
This sync includes the following changes:
- **[57333ca33](https://github.com/facebook/react/commit/57333ca33 )**: Show first component stack in context warning (#17922) //<Dan Abramov>//
- **[cf0081263](https://github.com/facebook/react/commit/cf0081263 )**: Upgrade to jest 25 (#17896) //<Simen Bekkhus>//
- **[6faf6f5eb](https://github.com/facebook/react/commit/6faf6f5eb )**: Update to flow 0.97 (#17892) //<Nicolas Gallagher>//
- **[81e30c7ff](https://github.com/facebook/react/commit/81e30c7ff )**: Remove unused modules from legacy event responders (#17907) //<Nicolas Gallagher>//
- **[3c713d513](https://github.com/facebook/react/commit/3c713d513 )**: chore: update to latest release of babel (#17897) //<Simen Bekkhus>//
- **[3b3decf87](https://github.com/facebook/react/commit/3b3decf87 )**: add warning when owner and self are different for string refs (#17864) //<Luna Ruan>//
- **[6c00c5bba](https://github.com/facebook/react/commit/6c00c5bba )**: Update to flow-bin@0.89 (#17842) //<Nicolas Gallagher>//
- **[cf7a0c24d](https://github.com/facebook/react/commit/cf7a0c24d )**: Remove dynamic GKs for selective/train (#17888) //<Sebastian Markbåge>//
- **[c322f5913](https://github.com/facebook/react/commit/c322f5913 )**: Add unstable_renderSubtreeIntoContainer and unstable_createPortal feature flags (#17880) //<Dominic Gannaway>//
- **[f2fd484af](https://github.com/facebook/react/commit/f2fd484af )**: Add React.createFactory() deprecation warning (#17878) //<Dominic Gannaway>//
- **[0c04acaf8](https://github.com/facebook/react/commit/0c04acaf8 )**: Remove FB specific build (#17875) //<Sebastian Markbåge>//
- **[9fd760ce7](https://github.com/facebook/react/commit/9fd760ce7 )**: Add disable <textarea/> children flag (#17874) //<Dominic Gannaway>//
- **[a209a97ed](https://github.com/facebook/react/commit/a209a97ed )**: Add feature flag around React.createFactory (#17873) //<Dominic Gannaway>//
- **[95bd7aad7](https://github.com/facebook/react/commit/95bd7aad7 )**: Remove renderPhaseUpdates Map (#17625) //<Andrew Clark>//
- **[b43b36dd9](https://github.com/facebook/react/commit/b43b36dd9 )**: Remove ReactInstanceMap_DO_NOT_USE shim (#17861) //<Dominic Gannaway>//
- **[9e075d16b](https://github.com/facebook/react/commit/9e075d16b )**: [react-interactions] Remove deprecated Scope APIs + update Focus components/docs (#17859) //<Dominic Gannaway>//
- **[b6173e643](https://github.com/facebook/react/commit/b6173e643 )**: [react-interactions] Add DO_NOT_USE to Scope methods (#17835) //<Dominic Gannaway>//
- **[f4ca909e0](https://github.com/facebook/react/commit/f4ca909e0 )**: react-refresh@0.7.2 //<Dan>//
- **[255d9ac5f](https://github.com/facebook/react/commit/255d9ac5f )**: [Fresh] Fix edge case with early function call (#17824) //<Dan Abramov>//
- **[d8570ec6e](https://github.com/facebook/react/commit/d8570ec6e )**: Create ReactFabric.stopSurface and use that for bridgeless mode binding (#16164) //<Emily>//
- **[5d6129b5d](https://github.com/facebook/react/commit/5d6129b5d )**: Update ReactSuspenseList-test.internal.js (#17034) //<Ganapati V S>//
- **[3ac81a57f](https://github.com/facebook/react/commit/3ac81a57f )**: Update create-react-app note for eslint-plugin-react-hooks (#16982) //<Tao>//
- **[e70672149](https://github.com/facebook/react/commit/e70672149 )**: Update Flow to 0.84 (#17805) //<Dan Abramov>//
- **[b979db4e7](https://github.com/facebook/react/commit/b979db4e7 )**: Bump Prettier (#17811) //<Dan Abramov>//

Changelog:
[General][Changed] - React Native sync for revisions 19f6fe1...241c446

Reviewed By: yungsters

Differential Revision: D19623180

fbshipit-source-id: 3cdecb33aa66dfc21a2b347bf7f63a5b27fcf6ea
This commit is contained in:
Dan Abramov 2020-02-12 14:05:09 -08:00 коммит произвёл Facebook Github Bot
Родитель 66f89e2e36
Коммит aa41fd5e37
16 изменённых файлов: 4178 добавлений и 3071 удалений

Просмотреть файл

@ -1 +1 @@
19f6fe170ce920d7183a5620f4e218334c8bac62
241c4467eef7c2a8858c96d5dfe4e8ef84c47bad

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -348,8 +348,8 @@ function SyntheticEvent(
((targetInst = dispatchConfig[propName])
? (this[propName] = targetInst(nativeEvent))
: "target" === propName
? (this.target = nativeEventTarget)
: (this[propName] = nativeEvent[propName]));
? (this.target = nativeEventTarget)
: (this[propName] = nativeEvent[propName]));
this.isDefaultPrevented = (null != nativeEvent.defaultPrevented
? nativeEvent.defaultPrevented
: !1 === nativeEvent.returnValue)
@ -562,10 +562,10 @@ function accumulate(current, next) {
return null == current
? next
: Array.isArray(current)
? current.concat(next)
: Array.isArray(next)
? [current].concat(next)
: [current, next];
? current.concat(next)
: Array.isArray(next)
? [current].concat(next)
: [current, next];
}
var responderInst = null,
trackedTouchCount = 0;
@ -667,10 +667,10 @@ var eventTypes = {
var shouldSetEventType = isStartish(topLevelType)
? eventTypes.startShouldSetResponder
: isMoveish(topLevelType)
? eventTypes.moveShouldSetResponder
: "topSelectionChange" === topLevelType
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
? eventTypes.moveShouldSetResponder
: "topSelectionChange" === topLevelType
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
if (responderInst)
b: {
var JSCompiler_temp = responderInst;
@ -824,10 +824,10 @@ var eventTypes = {
(shouldSetEventType = shouldSetEventType
? eventTypes.responderStart
: JSCompiler_temp
? eventTypes.responderMove
: targetInst
? eventTypes.responderEnd
: null)
? eventTypes.responderMove
: targetInst
? eventTypes.responderEnd
: null)
)
(shouldSetEventType = ResponderSyntheticEvent.getPooled(
shouldSetEventType,
@ -890,8 +890,8 @@ var eventTypes = {
(topLevelType = shouldSetEventType
? eventTypes.responderTerminate
: topLevelType
? eventTypes.responderRelease
: null)
? eventTypes.responderRelease
: null)
)
(nativeEvent = ResponderSyntheticEvent.getPooled(
topLevelType,
@ -1267,8 +1267,8 @@ function diffNestedProperty(
return nextProp
? addNestedProperty(updatePayload, nextProp, validAttributes)
: prevProp
? clearNestedProperty(updatePayload, prevProp, validAttributes)
: updatePayload;
? clearNestedProperty(updatePayload, prevProp, validAttributes)
: updatePayload;
if (!Array.isArray(prevProp) && !Array.isArray(nextProp))
return diffProperties(updatePayload, prevProp, nextProp, validAttributes);
if (Array.isArray(prevProp) && Array.isArray(nextProp)) {
@ -1853,10 +1853,10 @@ function flushSyncCallbackQueueImpl() {
function is(x, y) {
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
}
var is$1 = "function" === typeof Object.is ? Object.is : is,
var objectIs = "function" === typeof Object.is ? Object.is : is,
hasOwnProperty = Object.prototype.hasOwnProperty;
function shallowEqual(objA, objB) {
if (is$1(objA, objB)) return !0;
if (objectIs(objA, objB)) return !0;
if (
"object" !== typeof objA ||
null === objA ||
@ -1870,7 +1870,7 @@ function shallowEqual(objA, objB) {
for (keysB = 0; keysB < keysA.length; keysB++)
if (
!hasOwnProperty.call(objB, keysA[keysB]) ||
!is$1(objA[keysA[keysB]], objB[keysA[keysB]])
!objectIs(objA[keysA[keysB]], objB[keysA[keysB]])
)
return !1;
return !0;
@ -2222,8 +2222,8 @@ function checkShouldComponentUpdate(
return "function" === typeof workInProgress.shouldComponentUpdate
? workInProgress.shouldComponentUpdate(newProps, newState, nextContext)
: ctor.prototype && ctor.prototype.isPureReactComponent
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
: !0;
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
: !0;
}
function constructClassInstance(workInProgress, ctor, props) {
var isLegacyContextConsumer = !1,
@ -3118,9 +3118,7 @@ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher,
currentlyRenderingFiber$1 = null,
currentHook = null,
workInProgressHook = null,
didScheduleRenderPhaseUpdate = !1,
renderPhaseUpdates = null,
numberOfReRenders = 0;
didScheduleRenderPhaseUpdate = !1;
function throwInvalidHookError() {
throw Error(
"Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem."
@ -3129,7 +3127,7 @@ function throwInvalidHookError() {
function areHookInputsEqual(nextDeps, prevDeps) {
if (null === prevDeps) return !1;
for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++)
if (!is$1(nextDeps[i], prevDeps[i])) return !1;
if (!objectIs(nextDeps[i], prevDeps[i])) return !1;
return !0;
}
function renderWithHooks(
@ -3150,36 +3148,32 @@ function renderWithHooks(
? HooksDispatcherOnMount
: HooksDispatcherOnUpdate;
current = Component(props, secondArg);
if (didScheduleRenderPhaseUpdate) {
do
(didScheduleRenderPhaseUpdate = !1),
(numberOfReRenders += 1),
(workInProgressHook = currentHook = null),
(workInProgress.updateQueue = null),
(ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdate),
(current = Component(props, secondArg));
while (didScheduleRenderPhaseUpdate);
renderPhaseUpdates = null;
numberOfReRenders = 0;
if (workInProgress.expirationTime === renderExpirationTime$1) {
nextRenderExpirationTime = 0;
do {
workInProgress.expirationTime = 0;
if (!(25 > nextRenderExpirationTime))
throw Error(
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
);
nextRenderExpirationTime += 1;
workInProgressHook = currentHook = null;
workInProgress.updateQueue = null;
ReactCurrentDispatcher$1.current = HooksDispatcherOnRerender;
current = Component(props, secondArg);
} while (workInProgress.expirationTime === renderExpirationTime$1);
}
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
workInProgress = null !== currentHook && null !== currentHook.next;
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
if (workInProgress)
throw Error(
"Rendered fewer hooks than expected. This may be caused by an accidental early return statement."
);
return current;
}
function resetHooks() {
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
renderPhaseUpdates = null;
numberOfReRenders = 0;
}
function mountWorkInProgressHook() {
var hook = {
memoizedState: null,
@ -3234,57 +3228,36 @@ function updateReducer(reducer) {
"Should have a queue. This is likely a bug in React. Please file an issue."
);
queue.lastRenderedReducer = reducer;
if (0 < numberOfReRenders) {
var _dispatch = queue.dispatch;
if (null !== renderPhaseUpdates) {
var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
if (void 0 !== firstRenderPhaseUpdate) {
renderPhaseUpdates.delete(queue);
var newState = hook.memoizedState;
do
(newState = reducer(newState, firstRenderPhaseUpdate.action)),
(firstRenderPhaseUpdate = firstRenderPhaseUpdate.next);
while (null !== firstRenderPhaseUpdate);
is$1(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
null === hook.baseQueue && (hook.baseState = newState);
queue.lastRenderedState = newState;
return [newState, _dispatch];
}
var current = currentHook,
baseQueue = current.baseQueue,
pendingQueue = queue.pending;
if (null !== pendingQueue) {
if (null !== baseQueue) {
var baseFirst = baseQueue.next;
baseQueue.next = pendingQueue.next;
pendingQueue.next = baseFirst;
}
return [hook.memoizedState, _dispatch];
}
newState = currentHook;
_dispatch = newState.baseQueue;
firstRenderPhaseUpdate = queue.pending;
if (null !== firstRenderPhaseUpdate) {
if (null !== _dispatch) {
var baseFirst = _dispatch.next;
_dispatch.next = firstRenderPhaseUpdate.next;
firstRenderPhaseUpdate.next = baseFirst;
}
newState.baseQueue = _dispatch = firstRenderPhaseUpdate;
current.baseQueue = baseQueue = pendingQueue;
queue.pending = null;
}
if (null !== _dispatch) {
_dispatch = _dispatch.next;
newState = newState.baseState;
var newBaseQueueLast = (baseFirst = firstRenderPhaseUpdate = null),
_update = _dispatch;
if (null !== baseQueue) {
baseQueue = baseQueue.next;
current = current.baseState;
var newBaseQueueLast = (baseFirst = pendingQueue = null),
update = baseQueue;
do {
var updateExpirationTime = _update.expirationTime;
var updateExpirationTime = update.expirationTime;
if (updateExpirationTime < renderExpirationTime$1) {
var clone = {
expirationTime: _update.expirationTime,
suspenseConfig: _update.suspenseConfig,
action: _update.action,
eagerReducer: _update.eagerReducer,
eagerState: _update.eagerState,
expirationTime: update.expirationTime,
suspenseConfig: update.suspenseConfig,
action: update.action,
eagerReducer: update.eagerReducer,
eagerState: update.eagerState,
next: null
};
null === newBaseQueueLast
? ((baseFirst = newBaseQueueLast = clone),
(firstRenderPhaseUpdate = newState))
? ((baseFirst = newBaseQueueLast = clone), (pendingQueue = current))
: (newBaseQueueLast = newBaseQueueLast.next = clone);
updateExpirationTime > currentlyRenderingFiber$1.expirationTime &&
((currentlyRenderingFiber$1.expirationTime = updateExpirationTime),
@ -3293,33 +3266,56 @@ function updateReducer(reducer) {
null !== newBaseQueueLast &&
(newBaseQueueLast = newBaseQueueLast.next = {
expirationTime: 1073741823,
suspenseConfig: _update.suspenseConfig,
action: _update.action,
eagerReducer: _update.eagerReducer,
eagerState: _update.eagerState,
suspenseConfig: update.suspenseConfig,
action: update.action,
eagerReducer: update.eagerReducer,
eagerState: update.eagerState,
next: null
}),
markRenderEventTimeAndConfig(
updateExpirationTime,
_update.suspenseConfig
update.suspenseConfig
),
(newState =
_update.eagerReducer === reducer
? _update.eagerState
: reducer(newState, _update.action));
_update = _update.next;
} while (null !== _update && _update !== _dispatch);
(current =
update.eagerReducer === reducer
? update.eagerState
: reducer(current, update.action));
update = update.next;
} while (null !== update && update !== baseQueue);
null === newBaseQueueLast
? (firstRenderPhaseUpdate = newState)
? (pendingQueue = current)
: (newBaseQueueLast.next = baseFirst);
is$1(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
hook.baseState = firstRenderPhaseUpdate;
objectIs(current, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = current;
hook.baseState = pendingQueue;
hook.baseQueue = newBaseQueueLast;
queue.lastRenderedState = newState;
queue.lastRenderedState = current;
}
return [hook.memoizedState, queue.dispatch];
}
function rerenderReducer(reducer) {
var hook = updateWorkInProgressHook(),
queue = hook.queue;
if (null === queue)
throw Error(
"Should have a queue. This is likely a bug in React. Please file an issue."
);
queue.lastRenderedReducer = reducer;
var dispatch = queue.dispatch,
lastRenderPhaseUpdate = queue.pending,
newState = hook.memoizedState;
if (null !== lastRenderPhaseUpdate) {
queue.pending = null;
var update = (lastRenderPhaseUpdate = lastRenderPhaseUpdate.next);
do (newState = reducer(newState, update.action)), (update = update.next);
while (update !== lastRenderPhaseUpdate);
objectIs(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
null === hook.baseQueue && (hook.baseState = newState);
queue.lastRenderedState = newState;
}
return [newState, dispatch];
}
function mountState(initialState) {
var hook = mountWorkInProgressHook();
"function" === typeof initialState && (initialState = initialState());
@ -3340,6 +3336,9 @@ function mountState(initialState) {
function updateState(initialState) {
return updateReducer(basicStateReducer, initialState);
}
function rerenderState(initialState) {
return rerenderReducer(basicStateReducer, initialState);
}
function pushEffect(tag, create, destroy, deps) {
tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null };
create = currentlyRenderingFiber$1.updateQueue;
@ -3356,6 +3355,9 @@ function pushEffect(tag, create, destroy, deps) {
(create.lastEffect = tag)));
return tag;
}
function updateRef() {
return updateWorkInProgressHook().memoizedState;
}
function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
var hook = mountWorkInProgressHook();
currentlyRenderingFiber$1.effectTag |= fiberEffectTag;
@ -3387,6 +3389,9 @@ function mountEffect(create, deps) {
function updateEffect(create, deps) {
return updateEffectImpl(516, 192, create, deps);
}
function updateLayoutEffect(create, deps) {
return updateEffectImpl(4, 36, create, deps);
}
function imperativeHandleEffect(create, ref) {
if ("function" === typeof ref)
return (
@ -3405,6 +3410,15 @@ function imperativeHandleEffect(create, ref) {
}
);
}
function updateImperativeHandle(ref, create, deps) {
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
return updateEffectImpl(
4,
36,
imperativeHandleEffect.bind(null, create, ref),
deps
);
}
function mountDebugValue() {}
function mountCallback(callback, deps) {
mountWorkInProgressHook().memoizedState = [
@ -3426,6 +3440,20 @@ function updateCallback(callback, deps) {
hook.memoizedState = [callback, deps];
return callback;
}
function updateMemo(nextCreate, deps) {
var hook = updateWorkInProgressHook();
deps = void 0 === deps ? null : deps;
var prevState = hook.memoizedState;
if (
null !== prevState &&
null !== deps &&
areHookInputsEqual(deps, prevState[1])
)
return prevState[0];
nextCreate = nextCreate();
hook.memoizedState = [nextCreate, deps];
return nextCreate;
}
function startTransition(setPending, config, callback) {
var priorityLevel = getCurrentPriorityLevel();
runWithPriority(98 > priorityLevel ? 98 : priorityLevel, function() {
@ -3442,62 +3470,42 @@ function startTransition(setPending, config, callback) {
});
}
function dispatchAction(fiber, queue, action) {
if (!(25 > numberOfReRenders))
throw Error(
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
);
var alternate = fiber.alternate;
var currentTime = requestCurrentTimeForUpdate(),
suspenseConfig = ReactCurrentBatchConfig.suspense;
currentTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
suspenseConfig = {
expirationTime: currentTime,
suspenseConfig: suspenseConfig,
action: action,
eagerReducer: null,
eagerState: null,
next: null
};
var pending = queue.pending;
null === pending
? (suspenseConfig.next = suspenseConfig)
: ((suspenseConfig.next = pending.next), (pending.next = suspenseConfig));
queue.pending = suspenseConfig;
pending = fiber.alternate;
if (
fiber === currentlyRenderingFiber$1 ||
(null !== alternate && alternate === currentlyRenderingFiber$1)
(null !== pending && pending === currentlyRenderingFiber$1)
)
if (
((didScheduleRenderPhaseUpdate = !0),
(fiber = {
expirationTime: renderExpirationTime$1,
suspenseConfig: null,
action: action,
eagerReducer: null,
eagerState: null,
next: null
}),
null === renderPhaseUpdates && (renderPhaseUpdates = new Map()),
(action = renderPhaseUpdates.get(queue)),
void 0 === action)
)
renderPhaseUpdates.set(queue, fiber);
else {
for (queue = action; null !== queue.next; ) queue = queue.next;
queue.next = fiber;
}
(didScheduleRenderPhaseUpdate = !0),
(suspenseConfig.expirationTime = renderExpirationTime$1),
(currentlyRenderingFiber$1.expirationTime = renderExpirationTime$1);
else {
var currentTime = requestCurrentTimeForUpdate(),
suspenseConfig = ReactCurrentBatchConfig.suspense;
currentTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
suspenseConfig = {
expirationTime: currentTime,
suspenseConfig: suspenseConfig,
action: action,
eagerReducer: null,
eagerState: null,
next: null
};
var pending = queue.pending;
null === pending
? (suspenseConfig.next = suspenseConfig)
: ((suspenseConfig.next = pending.next), (pending.next = suspenseConfig));
queue.pending = suspenseConfig;
if (
0 === fiber.expirationTime &&
(null === alternate || 0 === alternate.expirationTime) &&
((alternate = queue.lastRenderedReducer), null !== alternate)
(null === pending || 0 === pending.expirationTime) &&
((pending = queue.lastRenderedReducer), null !== pending)
)
try {
var currentState = queue.lastRenderedState,
eagerState = alternate(currentState, action);
suspenseConfig.eagerReducer = alternate;
eagerState = pending(currentState, action);
suspenseConfig.eagerReducer = pending;
suspenseConfig.eagerState = eagerState;
if (is$1(eagerState, currentState)) return;
if (objectIs(eagerState, currentState)) return;
} catch (error) {
} finally {
}
@ -3606,36 +3614,11 @@ var ContextOnlyDispatcher = {
useCallback: updateCallback,
useContext: readContext,
useEffect: updateEffect,
useImperativeHandle: function(ref, create, deps) {
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
return updateEffectImpl(
4,
36,
imperativeHandleEffect.bind(null, create, ref),
deps
);
},
useLayoutEffect: function(create, deps) {
return updateEffectImpl(4, 36, create, deps);
},
useMemo: function(nextCreate, deps) {
var hook = updateWorkInProgressHook();
deps = void 0 === deps ? null : deps;
var prevState = hook.memoizedState;
if (
null !== prevState &&
null !== deps &&
areHookInputsEqual(deps, prevState[1])
)
return prevState[0];
nextCreate = nextCreate();
hook.memoizedState = [nextCreate, deps];
return nextCreate;
},
useImperativeHandle: updateImperativeHandle,
useLayoutEffect: updateLayoutEffect,
useMemo: updateMemo,
useReducer: updateReducer,
useRef: function() {
return updateWorkInProgressHook().memoizedState;
},
useRef: updateRef,
useState: updateState,
useDebugValue: mountDebugValue,
useResponder: createDeprecatedResponderListener,
@ -3671,6 +3654,51 @@ var ContextOnlyDispatcher = {
];
}
},
HooksDispatcherOnRerender = {
readContext: readContext,
useCallback: updateCallback,
useContext: readContext,
useEffect: updateEffect,
useImperativeHandle: updateImperativeHandle,
useLayoutEffect: updateLayoutEffect,
useMemo: updateMemo,
useReducer: rerenderReducer,
useRef: updateRef,
useState: rerenderState,
useDebugValue: mountDebugValue,
useResponder: createDeprecatedResponderListener,
useDeferredValue: function(value, config) {
var _rerenderState = rerenderState(value),
prevValue = _rerenderState[0],
setValue = _rerenderState[1];
updateEffect(
function() {
var previousConfig = ReactCurrentBatchConfig$1.suspense;
ReactCurrentBatchConfig$1.suspense =
void 0 === config ? null : config;
try {
setValue(value);
} finally {
ReactCurrentBatchConfig$1.suspense = previousConfig;
}
},
[value, config]
);
return prevValue;
},
useTransition: function(config) {
var _rerenderState2 = rerenderState(!1),
isPending = _rerenderState2[0];
_rerenderState2 = _rerenderState2[1];
return [
updateCallback(startTransition.bind(null, _rerenderState2, config), [
_rerenderState2,
config
]),
isPending
];
}
},
hydrationParentFiber = null,
nextHydratableInstance = null,
isHydrating = !1;
@ -4696,8 +4724,8 @@ updateHostComponent$1 = function(current, workInProgress, type, newProps) {
? cloneNodeWithNewProps(recyclableInstance, newProps)
: cloneNode(recyclableInstance)
: null !== newProps
? cloneNodeWithNewChildrenAndProps(recyclableInstance, newProps)
: cloneNodeWithNewChildren(recyclableInstance),
? cloneNodeWithNewChildrenAndProps(recyclableInstance, newProps)
: cloneNodeWithNewChildren(recyclableInstance),
canonical: type.canonical
}),
(workInProgress.stateNode = type),
@ -5493,8 +5521,8 @@ function requestCurrentTimeForUpdate() {
return (executionContext & (RenderContext | CommitContext)) !== NoContext
? 1073741821 - ((now() / 10) | 0)
: 0 !== currentEventTime
? currentEventTime
: (currentEventTime = 1073741821 - ((now() / 10) | 0));
? currentEventTime
: (currentEventTime = 1073741821 - ((now() / 10) | 0));
}
function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
fiber = fiber.mode;
@ -5601,9 +5629,10 @@ function getNextRootExpirationTimeToWorkOn(root) {
if (0 !== lastExpiredTime) return lastExpiredTime;
lastExpiredTime = root.firstPendingTime;
if (!isRootSuspendedAtTime(root, lastExpiredTime)) return lastExpiredTime;
lastExpiredTime = root.lastPingedTime;
var lastPingedTime = root.lastPingedTime;
root = root.nextKnownPendingLevel;
return lastExpiredTime > root ? lastExpiredTime : root;
root = lastPingedTime > root ? lastPingedTime : root;
return 2 >= root && lastExpiredTime !== root ? 0 : root;
}
function ensureRootIsScheduled(root) {
if (0 !== root.lastExpiredTime)
@ -5625,18 +5654,18 @@ function ensureRootIsScheduled(root) {
1073741823 === expirationTime
? (priorityLevel = 99)
: 1 === expirationTime || 2 === expirationTime
? (priorityLevel = 95)
: ((priorityLevel =
10 * (1073741821 - expirationTime) -
10 * (1073741821 - priorityLevel)),
(priorityLevel =
0 >= priorityLevel
? 99
: 250 >= priorityLevel
? 98
: 5250 >= priorityLevel
? 97
: 95));
? (priorityLevel = 95)
: ((priorityLevel =
10 * (1073741821 - expirationTime) -
10 * (1073741821 - priorityLevel)),
(priorityLevel =
0 >= priorityLevel
? 99
: 250 >= priorityLevel
? 98
: 5250 >= priorityLevel
? 97
: 95));
if (null !== existingCallbackNode) {
var existingCallbackPriority = root.callbackPriority;
if (
@ -5786,35 +5815,34 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
10 * (1073741821 - workInProgressRootLatestSuspenseTimeout) -
now())
: 1073741823 === workInProgressRootLatestProcessedExpirationTime
? (prevExecutionContext = 0)
: ((prevExecutionContext =
10 *
(1073741821 -
workInProgressRootLatestProcessedExpirationTime) -
5e3),
(prevDispatcher = now()),
(expirationTime =
10 * (1073741821 - expirationTime) - prevDispatcher),
(prevExecutionContext =
prevDispatcher - prevExecutionContext),
0 > prevExecutionContext && (prevExecutionContext = 0),
(prevExecutionContext =
(120 > prevExecutionContext
? 120
: 480 > prevExecutionContext
? 480
: 1080 > prevExecutionContext
? 1080
: 1920 > prevExecutionContext
? 1920
: 3e3 > prevExecutionContext
? 3e3
: 4320 > prevExecutionContext
? 4320
: 1960 * ceil(prevExecutionContext / 1960)) -
prevExecutionContext),
expirationTime < prevExecutionContext &&
(prevExecutionContext = expirationTime));
? (prevExecutionContext = 0)
: ((prevExecutionContext =
10 *
(1073741821 -
workInProgressRootLatestProcessedExpirationTime) -
5e3),
(prevDispatcher = now()),
(expirationTime =
10 * (1073741821 - expirationTime) - prevDispatcher),
(prevExecutionContext = prevDispatcher - prevExecutionContext),
0 > prevExecutionContext && (prevExecutionContext = 0),
(prevExecutionContext =
(120 > prevExecutionContext
? 120
: 480 > prevExecutionContext
? 480
: 1080 > prevExecutionContext
? 1080
: 1920 > prevExecutionContext
? 1920
: 3e3 > prevExecutionContext
? 3e3
: 4320 > prevExecutionContext
? 4320
: 1960 * ceil(prevExecutionContext / 1960)) -
prevExecutionContext),
expirationTime < prevExecutionContext &&
(prevExecutionContext = expirationTime));
if (10 < prevExecutionContext) {
root.timeoutHandle = scheduleTimeout(
commitRoot.bind(null, root),
@ -5969,7 +5997,20 @@ function handleError(root$jscomp$0, thrownValue) {
do {
try {
resetContextDependencies();
resetHooks();
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
if (didScheduleRenderPhaseUpdate)
for (
var hook = currentlyRenderingFiber$1.memoizedState;
null !== hook;
) {
var queue = hook.queue;
null !== queue && (queue.pending = null);
hook = hook.next;
}
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
if (null === workInProgress || null === workInProgress.return)
return (
(workInProgressRootExitStatus = RootFatalErrored),
@ -6012,10 +6053,10 @@ function handleError(root$jscomp$0, thrownValue) {
void 0 === props.fallback
? !1
: !0 !== props.unstable_avoidThisFallback
? !0
: hasInvisibleParentBoundary
? !1
: !0;
? !0
: hasInvisibleParentBoundary
? !1
: !0;
}
}
if (JSCompiler_temp) {
@ -6542,10 +6583,7 @@ function pingSuspendedRoot(root, thenable, suspendedTime) {
: isRootSuspendedAtTime(root, suspendedTime) &&
((thenable = root.lastPingedTime),
(0 !== thenable && thenable < suspendedTime) ||
((root.lastPingedTime = suspendedTime),
root.finishedExpirationTime === suspendedTime &&
((root.finishedExpirationTime = 0), (root.finishedWork = null)),
ensureRootIsScheduled(root)));
((root.lastPingedTime = suspendedTime), ensureRootIsScheduled(root)));
}
function resolveRetryThenable(boundaryFiber, thenable) {
var retryCache = boundaryFiber.stateNode;
@ -6680,7 +6718,8 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) {
void 0 === renderState.$$typeof
) {
workInProgress.tag = 1;
resetHooks();
workInProgress.memoizedState = null;
workInProgress.updateQueue = null;
if (isContextProvider(updateExpirationTime)) {
var hasContext = !0;
pushContextProvider(workInProgress);
@ -6953,7 +6992,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) {
pushProvider(workInProgress, hasContext);
if (null !== getDerivedStateFromProps) {
var oldValue = getDerivedStateFromProps.value;
hasContext = is$1(oldValue, hasContext)
hasContext = objectIs(oldValue, hasContext)
? 0
: ("function" === typeof updateExpirationTime._calculateChangedBits
? updateExpirationTime._calculateChangedBits(
@ -7508,8 +7547,8 @@ function findNodeHandle(componentOrHandle) {
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical._nativeTag
: componentOrHandle._nativeTag;
? componentOrHandle.canonical._nativeTag
: componentOrHandle._nativeTag;
}
batchedUpdatesImpl = function(fn, a) {
var prevExecutionContext = executionContext;
@ -7632,8 +7671,8 @@ var roots = new Map(),
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical
: componentOrHandle;
? componentOrHandle.canonical
: componentOrHandle;
},
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
@ -7673,6 +7712,9 @@ var roots = new Map(),
return element;
},
unmountComponentAtNode: function(containerTag) {
this.stopSurface(containerTag);
},
stopSurface: function(containerTag) {
var root = roots.get(containerTag);
root &&
updateContainer(null, root, null, function() {
@ -7807,7 +7849,7 @@ var roots = new Map(),
throw Error("getInspectorDataForViewTag() is not available in production");
},
bundleType: 0,
version: "16.12.0-experimental-19f6fe170",
version: "16.12.0-experimental-241c4467e",
rendererPackageName: "react-native-renderer"
});
var ReactFabric$2 = { default: ReactFabric },

Просмотреть файл

@ -349,8 +349,8 @@ function SyntheticEvent(
((targetInst = dispatchConfig[propName])
? (this[propName] = targetInst(nativeEvent))
: "target" === propName
? (this.target = nativeEventTarget)
: (this[propName] = nativeEvent[propName]));
? (this.target = nativeEventTarget)
: (this[propName] = nativeEvent[propName]));
this.isDefaultPrevented = (null != nativeEvent.defaultPrevented
? nativeEvent.defaultPrevented
: !1 === nativeEvent.returnValue)
@ -563,10 +563,10 @@ function accumulate(current, next) {
return null == current
? next
: Array.isArray(current)
? current.concat(next)
: Array.isArray(next)
? [current].concat(next)
: [current, next];
? current.concat(next)
: Array.isArray(next)
? [current].concat(next)
: [current, next];
}
var responderInst = null,
trackedTouchCount = 0;
@ -668,10 +668,10 @@ var eventTypes = {
var shouldSetEventType = isStartish(topLevelType)
? eventTypes.startShouldSetResponder
: isMoveish(topLevelType)
? eventTypes.moveShouldSetResponder
: "topSelectionChange" === topLevelType
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
? eventTypes.moveShouldSetResponder
: "topSelectionChange" === topLevelType
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
if (responderInst)
b: {
var JSCompiler_temp = responderInst;
@ -825,10 +825,10 @@ var eventTypes = {
(shouldSetEventType = shouldSetEventType
? eventTypes.responderStart
: JSCompiler_temp
? eventTypes.responderMove
: targetInst
? eventTypes.responderEnd
: null)
? eventTypes.responderMove
: targetInst
? eventTypes.responderEnd
: null)
)
(shouldSetEventType = ResponderSyntheticEvent.getPooled(
shouldSetEventType,
@ -891,8 +891,8 @@ var eventTypes = {
(topLevelType = shouldSetEventType
? eventTypes.responderTerminate
: topLevelType
? eventTypes.responderRelease
: null)
? eventTypes.responderRelease
: null)
)
(nativeEvent = ResponderSyntheticEvent.getPooled(
topLevelType,
@ -1260,8 +1260,8 @@ function diffNestedProperty(
return nextProp
? addNestedProperty(updatePayload, nextProp, validAttributes)
: prevProp
? clearNestedProperty(updatePayload, prevProp, validAttributes)
: updatePayload;
? clearNestedProperty(updatePayload, prevProp, validAttributes)
: updatePayload;
if (!Array.isArray(prevProp) && !Array.isArray(nextProp))
return diffProperties(updatePayload, prevProp, nextProp, validAttributes);
if (Array.isArray(prevProp) && Array.isArray(nextProp)) {
@ -1844,10 +1844,10 @@ function flushSyncCallbackQueueImpl() {
function is(x, y) {
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
}
var is$1 = "function" === typeof Object.is ? Object.is : is,
var objectIs = "function" === typeof Object.is ? Object.is : is,
hasOwnProperty = Object.prototype.hasOwnProperty;
function shallowEqual(objA, objB) {
if (is$1(objA, objB)) return !0;
if (objectIs(objA, objB)) return !0;
if (
"object" !== typeof objA ||
null === objA ||
@ -1861,7 +1861,7 @@ function shallowEqual(objA, objB) {
for (keysB = 0; keysB < keysA.length; keysB++)
if (
!hasOwnProperty.call(objB, keysA[keysB]) ||
!is$1(objA[keysA[keysB]], objB[keysA[keysB]])
!objectIs(objA[keysA[keysB]], objB[keysA[keysB]])
)
return !1;
return !0;
@ -2213,8 +2213,8 @@ function checkShouldComponentUpdate(
return "function" === typeof workInProgress.shouldComponentUpdate
? workInProgress.shouldComponentUpdate(newProps, newState, nextContext)
: ctor.prototype && ctor.prototype.isPureReactComponent
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
: !0;
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
: !0;
}
function constructClassInstance(workInProgress, ctor, props) {
var isLegacyContextConsumer = !1,
@ -3109,9 +3109,7 @@ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher,
currentlyRenderingFiber$1 = null,
currentHook = null,
workInProgressHook = null,
didScheduleRenderPhaseUpdate = !1,
renderPhaseUpdates = null,
numberOfReRenders = 0;
didScheduleRenderPhaseUpdate = !1;
function throwInvalidHookError() {
throw Error(
"Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem."
@ -3120,7 +3118,7 @@ function throwInvalidHookError() {
function areHookInputsEqual(nextDeps, prevDeps) {
if (null === prevDeps) return !1;
for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++)
if (!is$1(nextDeps[i], prevDeps[i])) return !1;
if (!objectIs(nextDeps[i], prevDeps[i])) return !1;
return !0;
}
function renderWithHooks(
@ -3141,36 +3139,32 @@ function renderWithHooks(
? HooksDispatcherOnMount
: HooksDispatcherOnUpdate;
current = Component(props, secondArg);
if (didScheduleRenderPhaseUpdate) {
do
(didScheduleRenderPhaseUpdate = !1),
(numberOfReRenders += 1),
(workInProgressHook = currentHook = null),
(workInProgress.updateQueue = null),
(ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdate),
(current = Component(props, secondArg));
while (didScheduleRenderPhaseUpdate);
renderPhaseUpdates = null;
numberOfReRenders = 0;
if (workInProgress.expirationTime === renderExpirationTime$1) {
nextRenderExpirationTime = 0;
do {
workInProgress.expirationTime = 0;
if (!(25 > nextRenderExpirationTime))
throw Error(
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
);
nextRenderExpirationTime += 1;
workInProgressHook = currentHook = null;
workInProgress.updateQueue = null;
ReactCurrentDispatcher$1.current = HooksDispatcherOnRerender;
current = Component(props, secondArg);
} while (workInProgress.expirationTime === renderExpirationTime$1);
}
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
workInProgress = null !== currentHook && null !== currentHook.next;
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
if (workInProgress)
throw Error(
"Rendered fewer hooks than expected. This may be caused by an accidental early return statement."
);
return current;
}
function resetHooks() {
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
renderPhaseUpdates = null;
numberOfReRenders = 0;
}
function mountWorkInProgressHook() {
var hook = {
memoizedState: null,
@ -3225,57 +3219,36 @@ function updateReducer(reducer) {
"Should have a queue. This is likely a bug in React. Please file an issue."
);
queue.lastRenderedReducer = reducer;
if (0 < numberOfReRenders) {
var _dispatch = queue.dispatch;
if (null !== renderPhaseUpdates) {
var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
if (void 0 !== firstRenderPhaseUpdate) {
renderPhaseUpdates.delete(queue);
var newState = hook.memoizedState;
do
(newState = reducer(newState, firstRenderPhaseUpdate.action)),
(firstRenderPhaseUpdate = firstRenderPhaseUpdate.next);
while (null !== firstRenderPhaseUpdate);
is$1(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
null === hook.baseQueue && (hook.baseState = newState);
queue.lastRenderedState = newState;
return [newState, _dispatch];
}
var current = currentHook,
baseQueue = current.baseQueue,
pendingQueue = queue.pending;
if (null !== pendingQueue) {
if (null !== baseQueue) {
var baseFirst = baseQueue.next;
baseQueue.next = pendingQueue.next;
pendingQueue.next = baseFirst;
}
return [hook.memoizedState, _dispatch];
}
newState = currentHook;
_dispatch = newState.baseQueue;
firstRenderPhaseUpdate = queue.pending;
if (null !== firstRenderPhaseUpdate) {
if (null !== _dispatch) {
var baseFirst = _dispatch.next;
_dispatch.next = firstRenderPhaseUpdate.next;
firstRenderPhaseUpdate.next = baseFirst;
}
newState.baseQueue = _dispatch = firstRenderPhaseUpdate;
current.baseQueue = baseQueue = pendingQueue;
queue.pending = null;
}
if (null !== _dispatch) {
_dispatch = _dispatch.next;
newState = newState.baseState;
var newBaseQueueLast = (baseFirst = firstRenderPhaseUpdate = null),
_update = _dispatch;
if (null !== baseQueue) {
baseQueue = baseQueue.next;
current = current.baseState;
var newBaseQueueLast = (baseFirst = pendingQueue = null),
update = baseQueue;
do {
var updateExpirationTime = _update.expirationTime;
var updateExpirationTime = update.expirationTime;
if (updateExpirationTime < renderExpirationTime$1) {
var clone = {
expirationTime: _update.expirationTime,
suspenseConfig: _update.suspenseConfig,
action: _update.action,
eagerReducer: _update.eagerReducer,
eagerState: _update.eagerState,
expirationTime: update.expirationTime,
suspenseConfig: update.suspenseConfig,
action: update.action,
eagerReducer: update.eagerReducer,
eagerState: update.eagerState,
next: null
};
null === newBaseQueueLast
? ((baseFirst = newBaseQueueLast = clone),
(firstRenderPhaseUpdate = newState))
? ((baseFirst = newBaseQueueLast = clone), (pendingQueue = current))
: (newBaseQueueLast = newBaseQueueLast.next = clone);
updateExpirationTime > currentlyRenderingFiber$1.expirationTime &&
((currentlyRenderingFiber$1.expirationTime = updateExpirationTime),
@ -3284,33 +3257,56 @@ function updateReducer(reducer) {
null !== newBaseQueueLast &&
(newBaseQueueLast = newBaseQueueLast.next = {
expirationTime: 1073741823,
suspenseConfig: _update.suspenseConfig,
action: _update.action,
eagerReducer: _update.eagerReducer,
eagerState: _update.eagerState,
suspenseConfig: update.suspenseConfig,
action: update.action,
eagerReducer: update.eagerReducer,
eagerState: update.eagerState,
next: null
}),
markRenderEventTimeAndConfig(
updateExpirationTime,
_update.suspenseConfig
update.suspenseConfig
),
(newState =
_update.eagerReducer === reducer
? _update.eagerState
: reducer(newState, _update.action));
_update = _update.next;
} while (null !== _update && _update !== _dispatch);
(current =
update.eagerReducer === reducer
? update.eagerState
: reducer(current, update.action));
update = update.next;
} while (null !== update && update !== baseQueue);
null === newBaseQueueLast
? (firstRenderPhaseUpdate = newState)
? (pendingQueue = current)
: (newBaseQueueLast.next = baseFirst);
is$1(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
hook.baseState = firstRenderPhaseUpdate;
objectIs(current, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = current;
hook.baseState = pendingQueue;
hook.baseQueue = newBaseQueueLast;
queue.lastRenderedState = newState;
queue.lastRenderedState = current;
}
return [hook.memoizedState, queue.dispatch];
}
function rerenderReducer(reducer) {
var hook = updateWorkInProgressHook(),
queue = hook.queue;
if (null === queue)
throw Error(
"Should have a queue. This is likely a bug in React. Please file an issue."
);
queue.lastRenderedReducer = reducer;
var dispatch = queue.dispatch,
lastRenderPhaseUpdate = queue.pending,
newState = hook.memoizedState;
if (null !== lastRenderPhaseUpdate) {
queue.pending = null;
var update = (lastRenderPhaseUpdate = lastRenderPhaseUpdate.next);
do (newState = reducer(newState, update.action)), (update = update.next);
while (update !== lastRenderPhaseUpdate);
objectIs(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
null === hook.baseQueue && (hook.baseState = newState);
queue.lastRenderedState = newState;
}
return [newState, dispatch];
}
function mountState(initialState) {
var hook = mountWorkInProgressHook();
"function" === typeof initialState && (initialState = initialState());
@ -3331,6 +3327,9 @@ function mountState(initialState) {
function updateState(initialState) {
return updateReducer(basicStateReducer, initialState);
}
function rerenderState(initialState) {
return rerenderReducer(basicStateReducer, initialState);
}
function pushEffect(tag, create, destroy, deps) {
tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null };
create = currentlyRenderingFiber$1.updateQueue;
@ -3347,6 +3346,9 @@ function pushEffect(tag, create, destroy, deps) {
(create.lastEffect = tag)));
return tag;
}
function updateRef() {
return updateWorkInProgressHook().memoizedState;
}
function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
var hook = mountWorkInProgressHook();
currentlyRenderingFiber$1.effectTag |= fiberEffectTag;
@ -3378,6 +3380,9 @@ function mountEffect(create, deps) {
function updateEffect(create, deps) {
return updateEffectImpl(516, 192, create, deps);
}
function updateLayoutEffect(create, deps) {
return updateEffectImpl(4, 36, create, deps);
}
function imperativeHandleEffect(create, ref) {
if ("function" === typeof ref)
return (
@ -3396,6 +3401,15 @@ function imperativeHandleEffect(create, ref) {
}
);
}
function updateImperativeHandle(ref, create, deps) {
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
return updateEffectImpl(
4,
36,
imperativeHandleEffect.bind(null, create, ref),
deps
);
}
function mountDebugValue() {}
function mountCallback(callback, deps) {
mountWorkInProgressHook().memoizedState = [
@ -3417,6 +3431,20 @@ function updateCallback(callback, deps) {
hook.memoizedState = [callback, deps];
return callback;
}
function updateMemo(nextCreate, deps) {
var hook = updateWorkInProgressHook();
deps = void 0 === deps ? null : deps;
var prevState = hook.memoizedState;
if (
null !== prevState &&
null !== deps &&
areHookInputsEqual(deps, prevState[1])
)
return prevState[0];
nextCreate = nextCreate();
hook.memoizedState = [nextCreate, deps];
return nextCreate;
}
function startTransition(setPending, config, callback) {
var priorityLevel = getCurrentPriorityLevel();
runWithPriority(98 > priorityLevel ? 98 : priorityLevel, function() {
@ -3433,62 +3461,42 @@ function startTransition(setPending, config, callback) {
});
}
function dispatchAction(fiber, queue, action) {
if (!(25 > numberOfReRenders))
throw Error(
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
);
var alternate = fiber.alternate;
var currentTime = requestCurrentTimeForUpdate(),
suspenseConfig = ReactCurrentBatchConfig.suspense;
currentTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
suspenseConfig = {
expirationTime: currentTime,
suspenseConfig: suspenseConfig,
action: action,
eagerReducer: null,
eagerState: null,
next: null
};
var pending = queue.pending;
null === pending
? (suspenseConfig.next = suspenseConfig)
: ((suspenseConfig.next = pending.next), (pending.next = suspenseConfig));
queue.pending = suspenseConfig;
pending = fiber.alternate;
if (
fiber === currentlyRenderingFiber$1 ||
(null !== alternate && alternate === currentlyRenderingFiber$1)
(null !== pending && pending === currentlyRenderingFiber$1)
)
if (
((didScheduleRenderPhaseUpdate = !0),
(fiber = {
expirationTime: renderExpirationTime$1,
suspenseConfig: null,
action: action,
eagerReducer: null,
eagerState: null,
next: null
}),
null === renderPhaseUpdates && (renderPhaseUpdates = new Map()),
(action = renderPhaseUpdates.get(queue)),
void 0 === action)
)
renderPhaseUpdates.set(queue, fiber);
else {
for (queue = action; null !== queue.next; ) queue = queue.next;
queue.next = fiber;
}
(didScheduleRenderPhaseUpdate = !0),
(suspenseConfig.expirationTime = renderExpirationTime$1),
(currentlyRenderingFiber$1.expirationTime = renderExpirationTime$1);
else {
var currentTime = requestCurrentTimeForUpdate(),
suspenseConfig = ReactCurrentBatchConfig.suspense;
currentTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
suspenseConfig = {
expirationTime: currentTime,
suspenseConfig: suspenseConfig,
action: action,
eagerReducer: null,
eagerState: null,
next: null
};
var pending = queue.pending;
null === pending
? (suspenseConfig.next = suspenseConfig)
: ((suspenseConfig.next = pending.next), (pending.next = suspenseConfig));
queue.pending = suspenseConfig;
if (
0 === fiber.expirationTime &&
(null === alternate || 0 === alternate.expirationTime) &&
((alternate = queue.lastRenderedReducer), null !== alternate)
(null === pending || 0 === pending.expirationTime) &&
((pending = queue.lastRenderedReducer), null !== pending)
)
try {
var currentState = queue.lastRenderedState,
eagerState = alternate(currentState, action);
suspenseConfig.eagerReducer = alternate;
eagerState = pending(currentState, action);
suspenseConfig.eagerReducer = pending;
suspenseConfig.eagerState = eagerState;
if (is$1(eagerState, currentState)) return;
if (objectIs(eagerState, currentState)) return;
} catch (error) {
} finally {
}
@ -3597,36 +3605,11 @@ var ContextOnlyDispatcher = {
useCallback: updateCallback,
useContext: readContext,
useEffect: updateEffect,
useImperativeHandle: function(ref, create, deps) {
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
return updateEffectImpl(
4,
36,
imperativeHandleEffect.bind(null, create, ref),
deps
);
},
useLayoutEffect: function(create, deps) {
return updateEffectImpl(4, 36, create, deps);
},
useMemo: function(nextCreate, deps) {
var hook = updateWorkInProgressHook();
deps = void 0 === deps ? null : deps;
var prevState = hook.memoizedState;
if (
null !== prevState &&
null !== deps &&
areHookInputsEqual(deps, prevState[1])
)
return prevState[0];
nextCreate = nextCreate();
hook.memoizedState = [nextCreate, deps];
return nextCreate;
},
useImperativeHandle: updateImperativeHandle,
useLayoutEffect: updateLayoutEffect,
useMemo: updateMemo,
useReducer: updateReducer,
useRef: function() {
return updateWorkInProgressHook().memoizedState;
},
useRef: updateRef,
useState: updateState,
useDebugValue: mountDebugValue,
useResponder: createDeprecatedResponderListener,
@ -3662,6 +3645,51 @@ var ContextOnlyDispatcher = {
];
}
},
HooksDispatcherOnRerender = {
readContext: readContext,
useCallback: updateCallback,
useContext: readContext,
useEffect: updateEffect,
useImperativeHandle: updateImperativeHandle,
useLayoutEffect: updateLayoutEffect,
useMemo: updateMemo,
useReducer: rerenderReducer,
useRef: updateRef,
useState: rerenderState,
useDebugValue: mountDebugValue,
useResponder: createDeprecatedResponderListener,
useDeferredValue: function(value, config) {
var _rerenderState = rerenderState(value),
prevValue = _rerenderState[0],
setValue = _rerenderState[1];
updateEffect(
function() {
var previousConfig = ReactCurrentBatchConfig$1.suspense;
ReactCurrentBatchConfig$1.suspense =
void 0 === config ? null : config;
try {
setValue(value);
} finally {
ReactCurrentBatchConfig$1.suspense = previousConfig;
}
},
[value, config]
);
return prevValue;
},
useTransition: function(config) {
var _rerenderState2 = rerenderState(!1),
isPending = _rerenderState2[0];
_rerenderState2 = _rerenderState2[1];
return [
updateCallback(startTransition.bind(null, _rerenderState2, config), [
_rerenderState2,
config
]),
isPending
];
}
},
hydrationParentFiber = null,
nextHydratableInstance = null,
isHydrating = !1;
@ -4687,8 +4715,8 @@ updateHostComponent$1 = function(current, workInProgress, type, newProps) {
? cloneNodeWithNewProps(recyclableInstance, newProps)
: cloneNode(recyclableInstance)
: null !== newProps
? cloneNodeWithNewChildrenAndProps(recyclableInstance, newProps)
: cloneNodeWithNewChildren(recyclableInstance),
? cloneNodeWithNewChildrenAndProps(recyclableInstance, newProps)
: cloneNodeWithNewChildren(recyclableInstance),
canonical: type.canonical
}),
(workInProgress.stateNode = type),
@ -5484,8 +5512,8 @@ function requestCurrentTimeForUpdate() {
return (executionContext & (RenderContext | CommitContext)) !== NoContext
? 1073741821 - ((now() / 10) | 0)
: 0 !== currentEventTime
? currentEventTime
: (currentEventTime = 1073741821 - ((now() / 10) | 0));
? currentEventTime
: (currentEventTime = 1073741821 - ((now() / 10) | 0));
}
function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
fiber = fiber.mode;
@ -5592,9 +5620,10 @@ function getNextRootExpirationTimeToWorkOn(root) {
if (0 !== lastExpiredTime) return lastExpiredTime;
lastExpiredTime = root.firstPendingTime;
if (!isRootSuspendedAtTime(root, lastExpiredTime)) return lastExpiredTime;
lastExpiredTime = root.lastPingedTime;
var lastPingedTime = root.lastPingedTime;
root = root.nextKnownPendingLevel;
return lastExpiredTime > root ? lastExpiredTime : root;
root = lastPingedTime > root ? lastPingedTime : root;
return 2 >= root && lastExpiredTime !== root ? 0 : root;
}
function ensureRootIsScheduled(root) {
if (0 !== root.lastExpiredTime)
@ -5616,18 +5645,18 @@ function ensureRootIsScheduled(root) {
1073741823 === expirationTime
? (priorityLevel = 99)
: 1 === expirationTime || 2 === expirationTime
? (priorityLevel = 95)
: ((priorityLevel =
10 * (1073741821 - expirationTime) -
10 * (1073741821 - priorityLevel)),
(priorityLevel =
0 >= priorityLevel
? 99
: 250 >= priorityLevel
? 98
: 5250 >= priorityLevel
? 97
: 95));
? (priorityLevel = 95)
: ((priorityLevel =
10 * (1073741821 - expirationTime) -
10 * (1073741821 - priorityLevel)),
(priorityLevel =
0 >= priorityLevel
? 99
: 250 >= priorityLevel
? 98
: 5250 >= priorityLevel
? 97
: 95));
if (null !== existingCallbackNode) {
var existingCallbackPriority = root.callbackPriority;
if (
@ -5777,35 +5806,34 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
10 * (1073741821 - workInProgressRootLatestSuspenseTimeout) -
now())
: 1073741823 === workInProgressRootLatestProcessedExpirationTime
? (prevExecutionContext = 0)
: ((prevExecutionContext =
10 *
(1073741821 -
workInProgressRootLatestProcessedExpirationTime) -
5e3),
(prevDispatcher = now()),
(expirationTime =
10 * (1073741821 - expirationTime) - prevDispatcher),
(prevExecutionContext =
prevDispatcher - prevExecutionContext),
0 > prevExecutionContext && (prevExecutionContext = 0),
(prevExecutionContext =
(120 > prevExecutionContext
? 120
: 480 > prevExecutionContext
? 480
: 1080 > prevExecutionContext
? 1080
: 1920 > prevExecutionContext
? 1920
: 3e3 > prevExecutionContext
? 3e3
: 4320 > prevExecutionContext
? 4320
: 1960 * ceil(prevExecutionContext / 1960)) -
prevExecutionContext),
expirationTime < prevExecutionContext &&
(prevExecutionContext = expirationTime));
? (prevExecutionContext = 0)
: ((prevExecutionContext =
10 *
(1073741821 -
workInProgressRootLatestProcessedExpirationTime) -
5e3),
(prevDispatcher = now()),
(expirationTime =
10 * (1073741821 - expirationTime) - prevDispatcher),
(prevExecutionContext = prevDispatcher - prevExecutionContext),
0 > prevExecutionContext && (prevExecutionContext = 0),
(prevExecutionContext =
(120 > prevExecutionContext
? 120
: 480 > prevExecutionContext
? 480
: 1080 > prevExecutionContext
? 1080
: 1920 > prevExecutionContext
? 1920
: 3e3 > prevExecutionContext
? 3e3
: 4320 > prevExecutionContext
? 4320
: 1960 * ceil(prevExecutionContext / 1960)) -
prevExecutionContext),
expirationTime < prevExecutionContext &&
(prevExecutionContext = expirationTime));
if (10 < prevExecutionContext) {
root.timeoutHandle = scheduleTimeout(
commitRoot.bind(null, root),
@ -5960,7 +5988,20 @@ function handleError(root$jscomp$0, thrownValue) {
do {
try {
resetContextDependencies();
resetHooks();
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
if (didScheduleRenderPhaseUpdate)
for (
var hook = currentlyRenderingFiber$1.memoizedState;
null !== hook;
) {
var queue = hook.queue;
null !== queue && (queue.pending = null);
hook = hook.next;
}
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
if (null === workInProgress || null === workInProgress.return)
return (
(workInProgressRootExitStatus = RootFatalErrored),
@ -6003,10 +6044,10 @@ function handleError(root$jscomp$0, thrownValue) {
void 0 === props.fallback
? !1
: !0 !== props.unstable_avoidThisFallback
? !0
: hasInvisibleParentBoundary
? !1
: !0;
? !0
: hasInvisibleParentBoundary
? !1
: !0;
}
}
if (JSCompiler_temp) {
@ -6533,10 +6574,7 @@ function pingSuspendedRoot(root, thenable, suspendedTime) {
: isRootSuspendedAtTime(root, suspendedTime) &&
((thenable = root.lastPingedTime),
(0 !== thenable && thenable < suspendedTime) ||
((root.lastPingedTime = suspendedTime),
root.finishedExpirationTime === suspendedTime &&
((root.finishedExpirationTime = 0), (root.finishedWork = null)),
ensureRootIsScheduled(root)));
((root.lastPingedTime = suspendedTime), ensureRootIsScheduled(root)));
}
function resolveRetryThenable(boundaryFiber, thenable) {
var retryCache = boundaryFiber.stateNode;
@ -6671,7 +6709,8 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) {
void 0 === renderState.$$typeof
) {
workInProgress.tag = 1;
resetHooks();
workInProgress.memoizedState = null;
workInProgress.updateQueue = null;
if (isContextProvider(updateExpirationTime)) {
var hasContext = !0;
pushContextProvider(workInProgress);
@ -6944,7 +6983,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) {
pushProvider(workInProgress, hasContext);
if (null !== getDerivedStateFromProps) {
var oldValue = getDerivedStateFromProps.value;
hasContext = is$1(oldValue, hasContext)
hasContext = objectIs(oldValue, hasContext)
? 0
: ("function" === typeof updateExpirationTime._calculateChangedBits
? updateExpirationTime._calculateChangedBits(
@ -7499,8 +7538,8 @@ function findNodeHandle(componentOrHandle) {
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical._nativeTag
: componentOrHandle._nativeTag;
? componentOrHandle.canonical._nativeTag
: componentOrHandle._nativeTag;
}
batchedUpdatesImpl = function(fn, a) {
var prevExecutionContext = executionContext;
@ -7623,8 +7662,8 @@ var roots = new Map(),
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical
: componentOrHandle;
? componentOrHandle.canonical
: componentOrHandle;
},
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
@ -7664,6 +7703,9 @@ var roots = new Map(),
return element;
},
unmountComponentAtNode: function(containerTag) {
this.stopSurface(containerTag);
},
stopSurface: function(containerTag) {
var root = roots.get(containerTag);
root &&
updateContainer(null, root, null, function() {
@ -7798,7 +7840,7 @@ var roots = new Map(),
throw Error("getInspectorDataForViewTag() is not available in production");
},
bundleType: 0,
version: "16.12.0-19f6fe170",
version: "16.12.0-241c4467e",
rendererPackageName: "react-native-renderer"
});
var ReactFabric$2 = { default: ReactFabric },

Просмотреть файл

@ -349,8 +349,8 @@ function SyntheticEvent(
((targetInst = dispatchConfig[propName])
? (this[propName] = targetInst(nativeEvent))
: "target" === propName
? (this.target = nativeEventTarget)
: (this[propName] = nativeEvent[propName]));
? (this.target = nativeEventTarget)
: (this[propName] = nativeEvent[propName]));
this.isDefaultPrevented = (null != nativeEvent.defaultPrevented
? nativeEvent.defaultPrevented
: !1 === nativeEvent.returnValue)
@ -563,10 +563,10 @@ function accumulate(current, next) {
return null == current
? next
: Array.isArray(current)
? current.concat(next)
: Array.isArray(next)
? [current].concat(next)
: [current, next];
? current.concat(next)
: Array.isArray(next)
? [current].concat(next)
: [current, next];
}
var responderInst = null,
trackedTouchCount = 0;
@ -668,10 +668,10 @@ var eventTypes = {
var shouldSetEventType = isStartish(topLevelType)
? eventTypes.startShouldSetResponder
: isMoveish(topLevelType)
? eventTypes.moveShouldSetResponder
: "topSelectionChange" === topLevelType
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
? eventTypes.moveShouldSetResponder
: "topSelectionChange" === topLevelType
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
if (responderInst)
b: {
var JSCompiler_temp = responderInst;
@ -825,10 +825,10 @@ var eventTypes = {
(shouldSetEventType = shouldSetEventType
? eventTypes.responderStart
: JSCompiler_temp
? eventTypes.responderMove
: targetInst
? eventTypes.responderEnd
: null)
? eventTypes.responderMove
: targetInst
? eventTypes.responderEnd
: null)
)
(shouldSetEventType = ResponderSyntheticEvent.getPooled(
shouldSetEventType,
@ -891,8 +891,8 @@ var eventTypes = {
(topLevelType = shouldSetEventType
? eventTypes.responderTerminate
: topLevelType
? eventTypes.responderRelease
: null)
? eventTypes.responderRelease
: null)
)
(nativeEvent = ResponderSyntheticEvent.getPooled(
topLevelType,
@ -1268,8 +1268,8 @@ function diffNestedProperty(
return nextProp
? addNestedProperty(updatePayload, nextProp, validAttributes)
: prevProp
? clearNestedProperty(updatePayload, prevProp, validAttributes)
: updatePayload;
? clearNestedProperty(updatePayload, prevProp, validAttributes)
: updatePayload;
if (!Array.isArray(prevProp) && !Array.isArray(nextProp))
return diffProperties(updatePayload, prevProp, nextProp, validAttributes);
if (Array.isArray(prevProp) && Array.isArray(nextProp)) {
@ -1866,18 +1866,18 @@ function inferPriorityFromExpirationTime(currentTime, expirationTime) {
return 0 >= currentTime
? 99
: 250 >= currentTime
? 98
: 5250 >= currentTime
? 97
: 95;
? 98
: 5250 >= currentTime
? 97
: 95;
}
function is(x, y) {
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
}
var is$1 = "function" === typeof Object.is ? Object.is : is,
var objectIs = "function" === typeof Object.is ? Object.is : is,
hasOwnProperty = Object.prototype.hasOwnProperty;
function shallowEqual(objA, objB) {
if (is$1(objA, objB)) return !0;
if (objectIs(objA, objB)) return !0;
if (
"object" !== typeof objA ||
null === objA ||
@ -1891,7 +1891,7 @@ function shallowEqual(objA, objB) {
for (keysB = 0; keysB < keysA.length; keysB++)
if (
!hasOwnProperty.call(objB, keysA[keysB]) ||
!is$1(objA[keysA[keysB]], objB[keysA[keysB]])
!objectIs(objA[keysA[keysB]], objB[keysA[keysB]])
)
return !1;
return !0;
@ -2243,8 +2243,8 @@ function checkShouldComponentUpdate(
return "function" === typeof workInProgress.shouldComponentUpdate
? workInProgress.shouldComponentUpdate(newProps, newState, nextContext)
: ctor.prototype && ctor.prototype.isPureReactComponent
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
: !0;
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
: !0;
}
function constructClassInstance(workInProgress, ctor, props) {
var isLegacyContextConsumer = !1,
@ -3139,9 +3139,7 @@ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher,
currentlyRenderingFiber$1 = null,
currentHook = null,
workInProgressHook = null,
didScheduleRenderPhaseUpdate = !1,
renderPhaseUpdates = null,
numberOfReRenders = 0;
didScheduleRenderPhaseUpdate = !1;
function throwInvalidHookError() {
throw Error(
"Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem."
@ -3150,7 +3148,7 @@ function throwInvalidHookError() {
function areHookInputsEqual(nextDeps, prevDeps) {
if (null === prevDeps) return !1;
for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++)
if (!is$1(nextDeps[i], prevDeps[i])) return !1;
if (!objectIs(nextDeps[i], prevDeps[i])) return !1;
return !0;
}
function renderWithHooks(
@ -3171,36 +3169,32 @@ function renderWithHooks(
? HooksDispatcherOnMount
: HooksDispatcherOnUpdate;
current = Component(props, secondArg);
if (didScheduleRenderPhaseUpdate) {
do
(didScheduleRenderPhaseUpdate = !1),
(numberOfReRenders += 1),
(workInProgressHook = currentHook = null),
(workInProgress.updateQueue = null),
(ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdate),
(current = Component(props, secondArg));
while (didScheduleRenderPhaseUpdate);
renderPhaseUpdates = null;
numberOfReRenders = 0;
if (workInProgress.expirationTime === renderExpirationTime$1) {
nextRenderExpirationTime = 0;
do {
workInProgress.expirationTime = 0;
if (!(25 > nextRenderExpirationTime))
throw Error(
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
);
nextRenderExpirationTime += 1;
workInProgressHook = currentHook = null;
workInProgress.updateQueue = null;
ReactCurrentDispatcher$1.current = HooksDispatcherOnRerender;
current = Component(props, secondArg);
} while (workInProgress.expirationTime === renderExpirationTime$1);
}
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
workInProgress = null !== currentHook && null !== currentHook.next;
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
if (workInProgress)
throw Error(
"Rendered fewer hooks than expected. This may be caused by an accidental early return statement."
);
return current;
}
function resetHooks() {
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
renderPhaseUpdates = null;
numberOfReRenders = 0;
}
function mountWorkInProgressHook() {
var hook = {
memoizedState: null,
@ -3255,57 +3249,36 @@ function updateReducer(reducer) {
"Should have a queue. This is likely a bug in React. Please file an issue."
);
queue.lastRenderedReducer = reducer;
if (0 < numberOfReRenders) {
var _dispatch = queue.dispatch;
if (null !== renderPhaseUpdates) {
var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
if (void 0 !== firstRenderPhaseUpdate) {
renderPhaseUpdates.delete(queue);
var newState = hook.memoizedState;
do
(newState = reducer(newState, firstRenderPhaseUpdate.action)),
(firstRenderPhaseUpdate = firstRenderPhaseUpdate.next);
while (null !== firstRenderPhaseUpdate);
is$1(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
null === hook.baseQueue && (hook.baseState = newState);
queue.lastRenderedState = newState;
return [newState, _dispatch];
}
var current = currentHook,
baseQueue = current.baseQueue,
pendingQueue = queue.pending;
if (null !== pendingQueue) {
if (null !== baseQueue) {
var baseFirst = baseQueue.next;
baseQueue.next = pendingQueue.next;
pendingQueue.next = baseFirst;
}
return [hook.memoizedState, _dispatch];
}
newState = currentHook;
_dispatch = newState.baseQueue;
firstRenderPhaseUpdate = queue.pending;
if (null !== firstRenderPhaseUpdate) {
if (null !== _dispatch) {
var baseFirst = _dispatch.next;
_dispatch.next = firstRenderPhaseUpdate.next;
firstRenderPhaseUpdate.next = baseFirst;
}
newState.baseQueue = _dispatch = firstRenderPhaseUpdate;
current.baseQueue = baseQueue = pendingQueue;
queue.pending = null;
}
if (null !== _dispatch) {
_dispatch = _dispatch.next;
newState = newState.baseState;
var newBaseQueueLast = (baseFirst = firstRenderPhaseUpdate = null),
_update = _dispatch;
if (null !== baseQueue) {
baseQueue = baseQueue.next;
current = current.baseState;
var newBaseQueueLast = (baseFirst = pendingQueue = null),
update = baseQueue;
do {
var updateExpirationTime = _update.expirationTime;
var updateExpirationTime = update.expirationTime;
if (updateExpirationTime < renderExpirationTime$1) {
var clone = {
expirationTime: _update.expirationTime,
suspenseConfig: _update.suspenseConfig,
action: _update.action,
eagerReducer: _update.eagerReducer,
eagerState: _update.eagerState,
expirationTime: update.expirationTime,
suspenseConfig: update.suspenseConfig,
action: update.action,
eagerReducer: update.eagerReducer,
eagerState: update.eagerState,
next: null
};
null === newBaseQueueLast
? ((baseFirst = newBaseQueueLast = clone),
(firstRenderPhaseUpdate = newState))
? ((baseFirst = newBaseQueueLast = clone), (pendingQueue = current))
: (newBaseQueueLast = newBaseQueueLast.next = clone);
updateExpirationTime > currentlyRenderingFiber$1.expirationTime &&
((currentlyRenderingFiber$1.expirationTime = updateExpirationTime),
@ -3314,33 +3287,56 @@ function updateReducer(reducer) {
null !== newBaseQueueLast &&
(newBaseQueueLast = newBaseQueueLast.next = {
expirationTime: 1073741823,
suspenseConfig: _update.suspenseConfig,
action: _update.action,
eagerReducer: _update.eagerReducer,
eagerState: _update.eagerState,
suspenseConfig: update.suspenseConfig,
action: update.action,
eagerReducer: update.eagerReducer,
eagerState: update.eagerState,
next: null
}),
markRenderEventTimeAndConfig(
updateExpirationTime,
_update.suspenseConfig
update.suspenseConfig
),
(newState =
_update.eagerReducer === reducer
? _update.eagerState
: reducer(newState, _update.action));
_update = _update.next;
} while (null !== _update && _update !== _dispatch);
(current =
update.eagerReducer === reducer
? update.eagerState
: reducer(current, update.action));
update = update.next;
} while (null !== update && update !== baseQueue);
null === newBaseQueueLast
? (firstRenderPhaseUpdate = newState)
? (pendingQueue = current)
: (newBaseQueueLast.next = baseFirst);
is$1(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
hook.baseState = firstRenderPhaseUpdate;
objectIs(current, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = current;
hook.baseState = pendingQueue;
hook.baseQueue = newBaseQueueLast;
queue.lastRenderedState = newState;
queue.lastRenderedState = current;
}
return [hook.memoizedState, queue.dispatch];
}
function rerenderReducer(reducer) {
var hook = updateWorkInProgressHook(),
queue = hook.queue;
if (null === queue)
throw Error(
"Should have a queue. This is likely a bug in React. Please file an issue."
);
queue.lastRenderedReducer = reducer;
var dispatch = queue.dispatch,
lastRenderPhaseUpdate = queue.pending,
newState = hook.memoizedState;
if (null !== lastRenderPhaseUpdate) {
queue.pending = null;
var update = (lastRenderPhaseUpdate = lastRenderPhaseUpdate.next);
do (newState = reducer(newState, update.action)), (update = update.next);
while (update !== lastRenderPhaseUpdate);
objectIs(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
null === hook.baseQueue && (hook.baseState = newState);
queue.lastRenderedState = newState;
}
return [newState, dispatch];
}
function mountState(initialState) {
var hook = mountWorkInProgressHook();
"function" === typeof initialState && (initialState = initialState());
@ -3361,6 +3357,9 @@ function mountState(initialState) {
function updateState(initialState) {
return updateReducer(basicStateReducer, initialState);
}
function rerenderState(initialState) {
return rerenderReducer(basicStateReducer, initialState);
}
function pushEffect(tag, create, destroy, deps) {
tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null };
create = currentlyRenderingFiber$1.updateQueue;
@ -3377,6 +3376,9 @@ function pushEffect(tag, create, destroy, deps) {
(create.lastEffect = tag)));
return tag;
}
function updateRef() {
return updateWorkInProgressHook().memoizedState;
}
function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
var hook = mountWorkInProgressHook();
currentlyRenderingFiber$1.effectTag |= fiberEffectTag;
@ -3408,6 +3410,9 @@ function mountEffect(create, deps) {
function updateEffect(create, deps) {
return updateEffectImpl(516, 192, create, deps);
}
function updateLayoutEffect(create, deps) {
return updateEffectImpl(4, 36, create, deps);
}
function imperativeHandleEffect(create, ref) {
if ("function" === typeof ref)
return (
@ -3426,6 +3431,15 @@ function imperativeHandleEffect(create, ref) {
}
);
}
function updateImperativeHandle(ref, create, deps) {
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
return updateEffectImpl(
4,
36,
imperativeHandleEffect.bind(null, create, ref),
deps
);
}
function mountDebugValue() {}
function mountCallback(callback, deps) {
mountWorkInProgressHook().memoizedState = [
@ -3447,6 +3461,20 @@ function updateCallback(callback, deps) {
hook.memoizedState = [callback, deps];
return callback;
}
function updateMemo(nextCreate, deps) {
var hook = updateWorkInProgressHook();
deps = void 0 === deps ? null : deps;
var prevState = hook.memoizedState;
if (
null !== prevState &&
null !== deps &&
areHookInputsEqual(deps, prevState[1])
)
return prevState[0];
nextCreate = nextCreate();
hook.memoizedState = [nextCreate, deps];
return nextCreate;
}
function startTransition(setPending, config, callback) {
var priorityLevel = getCurrentPriorityLevel();
runWithPriority(98 > priorityLevel ? 98 : priorityLevel, function() {
@ -3463,62 +3491,42 @@ function startTransition(setPending, config, callback) {
});
}
function dispatchAction(fiber, queue, action) {
if (!(25 > numberOfReRenders))
throw Error(
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
);
var alternate = fiber.alternate;
var currentTime = requestCurrentTimeForUpdate(),
suspenseConfig = ReactCurrentBatchConfig.suspense;
currentTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
suspenseConfig = {
expirationTime: currentTime,
suspenseConfig: suspenseConfig,
action: action,
eagerReducer: null,
eagerState: null,
next: null
};
var pending = queue.pending;
null === pending
? (suspenseConfig.next = suspenseConfig)
: ((suspenseConfig.next = pending.next), (pending.next = suspenseConfig));
queue.pending = suspenseConfig;
pending = fiber.alternate;
if (
fiber === currentlyRenderingFiber$1 ||
(null !== alternate && alternate === currentlyRenderingFiber$1)
(null !== pending && pending === currentlyRenderingFiber$1)
)
if (
((didScheduleRenderPhaseUpdate = !0),
(fiber = {
expirationTime: renderExpirationTime$1,
suspenseConfig: null,
action: action,
eagerReducer: null,
eagerState: null,
next: null
}),
null === renderPhaseUpdates && (renderPhaseUpdates = new Map()),
(action = renderPhaseUpdates.get(queue)),
void 0 === action)
)
renderPhaseUpdates.set(queue, fiber);
else {
for (queue = action; null !== queue.next; ) queue = queue.next;
queue.next = fiber;
}
(didScheduleRenderPhaseUpdate = !0),
(suspenseConfig.expirationTime = renderExpirationTime$1),
(currentlyRenderingFiber$1.expirationTime = renderExpirationTime$1);
else {
var currentTime = requestCurrentTimeForUpdate(),
suspenseConfig = ReactCurrentBatchConfig.suspense;
currentTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
suspenseConfig = {
expirationTime: currentTime,
suspenseConfig: suspenseConfig,
action: action,
eagerReducer: null,
eagerState: null,
next: null
};
var pending = queue.pending;
null === pending
? (suspenseConfig.next = suspenseConfig)
: ((suspenseConfig.next = pending.next), (pending.next = suspenseConfig));
queue.pending = suspenseConfig;
if (
0 === fiber.expirationTime &&
(null === alternate || 0 === alternate.expirationTime) &&
((alternate = queue.lastRenderedReducer), null !== alternate)
(null === pending || 0 === pending.expirationTime) &&
((pending = queue.lastRenderedReducer), null !== pending)
)
try {
var currentState = queue.lastRenderedState,
eagerState = alternate(currentState, action);
suspenseConfig.eagerReducer = alternate;
eagerState = pending(currentState, action);
suspenseConfig.eagerReducer = pending;
suspenseConfig.eagerState = eagerState;
if (is$1(eagerState, currentState)) return;
if (objectIs(eagerState, currentState)) return;
} catch (error) {
} finally {
}
@ -3627,36 +3635,11 @@ var ContextOnlyDispatcher = {
useCallback: updateCallback,
useContext: readContext,
useEffect: updateEffect,
useImperativeHandle: function(ref, create, deps) {
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
return updateEffectImpl(
4,
36,
imperativeHandleEffect.bind(null, create, ref),
deps
);
},
useLayoutEffect: function(create, deps) {
return updateEffectImpl(4, 36, create, deps);
},
useMemo: function(nextCreate, deps) {
var hook = updateWorkInProgressHook();
deps = void 0 === deps ? null : deps;
var prevState = hook.memoizedState;
if (
null !== prevState &&
null !== deps &&
areHookInputsEqual(deps, prevState[1])
)
return prevState[0];
nextCreate = nextCreate();
hook.memoizedState = [nextCreate, deps];
return nextCreate;
},
useImperativeHandle: updateImperativeHandle,
useLayoutEffect: updateLayoutEffect,
useMemo: updateMemo,
useReducer: updateReducer,
useRef: function() {
return updateWorkInProgressHook().memoizedState;
},
useRef: updateRef,
useState: updateState,
useDebugValue: mountDebugValue,
useResponder: createDeprecatedResponderListener,
@ -3692,6 +3675,51 @@ var ContextOnlyDispatcher = {
];
}
},
HooksDispatcherOnRerender = {
readContext: readContext,
useCallback: updateCallback,
useContext: readContext,
useEffect: updateEffect,
useImperativeHandle: updateImperativeHandle,
useLayoutEffect: updateLayoutEffect,
useMemo: updateMemo,
useReducer: rerenderReducer,
useRef: updateRef,
useState: rerenderState,
useDebugValue: mountDebugValue,
useResponder: createDeprecatedResponderListener,
useDeferredValue: function(value, config) {
var _rerenderState = rerenderState(value),
prevValue = _rerenderState[0],
setValue = _rerenderState[1];
updateEffect(
function() {
var previousConfig = ReactCurrentBatchConfig$1.suspense;
ReactCurrentBatchConfig$1.suspense =
void 0 === config ? null : config;
try {
setValue(value);
} finally {
ReactCurrentBatchConfig$1.suspense = previousConfig;
}
},
[value, config]
);
return prevValue;
},
useTransition: function(config) {
var _rerenderState2 = rerenderState(!1),
isPending = _rerenderState2[0];
_rerenderState2 = _rerenderState2[1];
return [
updateCallback(startTransition.bind(null, _rerenderState2, config), [
_rerenderState2,
config
]),
isPending
];
}
},
now$1 = Scheduler.unstable_now,
commitTime = 0,
profilerStartTime = -1;
@ -4747,8 +4775,8 @@ updateHostComponent$1 = function(current, workInProgress, type, newProps) {
? cloneNodeWithNewProps(recyclableInstance, newProps)
: cloneNode(recyclableInstance)
: null !== newProps
? cloneNodeWithNewChildrenAndProps(recyclableInstance, newProps)
: cloneNodeWithNewChildren(recyclableInstance),
? cloneNodeWithNewChildrenAndProps(recyclableInstance, newProps)
: cloneNodeWithNewChildren(recyclableInstance),
canonical: type.canonical
}),
(workInProgress.stateNode = type),
@ -5568,8 +5596,8 @@ function requestCurrentTimeForUpdate() {
return (executionContext & (RenderContext | CommitContext)) !== NoContext
? 1073741821 - ((now() / 10) | 0)
: 0 !== currentEventTime
? currentEventTime
: (currentEventTime = 1073741821 - ((now() / 10) | 0));
? currentEventTime
: (currentEventTime = 1073741821 - ((now() / 10) | 0));
}
function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
fiber = fiber.mode;
@ -5679,9 +5707,10 @@ function getNextRootExpirationTimeToWorkOn(root) {
if (0 !== lastExpiredTime) return lastExpiredTime;
lastExpiredTime = root.firstPendingTime;
if (!isRootSuspendedAtTime(root, lastExpiredTime)) return lastExpiredTime;
lastExpiredTime = root.lastPingedTime;
var lastPingedTime = root.lastPingedTime;
root = root.nextKnownPendingLevel;
return lastExpiredTime > root ? lastExpiredTime : root;
root = lastPingedTime > root ? lastPingedTime : root;
return 2 >= root && lastExpiredTime !== root ? 0 : root;
}
function ensureRootIsScheduled(root) {
if (0 !== root.lastExpiredTime)
@ -5857,35 +5886,34 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
10 * (1073741821 - workInProgressRootLatestSuspenseTimeout) -
now())
: 1073741823 === workInProgressRootLatestProcessedExpirationTime
? (prevExecutionContext = 0)
: ((prevExecutionContext =
10 *
(1073741821 -
workInProgressRootLatestProcessedExpirationTime) -
5e3),
(prevDispatcher = now()),
(expirationTime =
10 * (1073741821 - expirationTime) - prevDispatcher),
(prevExecutionContext =
prevDispatcher - prevExecutionContext),
0 > prevExecutionContext && (prevExecutionContext = 0),
(prevExecutionContext =
(120 > prevExecutionContext
? 120
: 480 > prevExecutionContext
? 480
: 1080 > prevExecutionContext
? 1080
: 1920 > prevExecutionContext
? 1920
: 3e3 > prevExecutionContext
? 3e3
: 4320 > prevExecutionContext
? 4320
: 1960 * ceil(prevExecutionContext / 1960)) -
prevExecutionContext),
expirationTime < prevExecutionContext &&
(prevExecutionContext = expirationTime));
? (prevExecutionContext = 0)
: ((prevExecutionContext =
10 *
(1073741821 -
workInProgressRootLatestProcessedExpirationTime) -
5e3),
(prevDispatcher = now()),
(expirationTime =
10 * (1073741821 - expirationTime) - prevDispatcher),
(prevExecutionContext = prevDispatcher - prevExecutionContext),
0 > prevExecutionContext && (prevExecutionContext = 0),
(prevExecutionContext =
(120 > prevExecutionContext
? 120
: 480 > prevExecutionContext
? 480
: 1080 > prevExecutionContext
? 1080
: 1920 > prevExecutionContext
? 1920
: 3e3 > prevExecutionContext
? 3e3
: 4320 > prevExecutionContext
? 4320
: 1960 * ceil(prevExecutionContext / 1960)) -
prevExecutionContext),
expirationTime < prevExecutionContext &&
(prevExecutionContext = expirationTime));
if (10 < prevExecutionContext) {
root.timeoutHandle = scheduleTimeout(
commitRoot.bind(null, root),
@ -6044,7 +6072,20 @@ function handleError(root$jscomp$0, thrownValue) {
do {
try {
resetContextDependencies();
resetHooks();
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
if (didScheduleRenderPhaseUpdate)
for (
var hook = currentlyRenderingFiber$1.memoizedState;
null !== hook;
) {
var queue = hook.queue;
null !== queue && (queue.pending = null);
hook = hook.next;
}
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
if (null === workInProgress || null === workInProgress.return)
return (
(workInProgressRootExitStatus = RootFatalErrored),
@ -6089,10 +6130,10 @@ function handleError(root$jscomp$0, thrownValue) {
void 0 === props.fallback
? !1
: !0 !== props.unstable_avoidThisFallback
? !0
: hasInvisibleParentBoundary
? !1
: !0;
? !0
: hasInvisibleParentBoundary
? !1
: !0;
}
}
if (JSCompiler_temp) {
@ -6703,8 +6744,6 @@ function pingSuspendedRoot(root, thenable, suspendedTime) {
((thenable = root.lastPingedTime),
(0 !== thenable && thenable < suspendedTime) ||
((root.lastPingedTime = suspendedTime),
root.finishedExpirationTime === suspendedTime &&
((root.finishedExpirationTime = 0), (root.finishedWork = null)),
ensureRootIsScheduled(root),
schedulePendingInteractions(root, suspendedTime)));
}
@ -6847,7 +6886,8 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) {
void 0 === renderState.$$typeof
) {
workInProgress.tag = 1;
resetHooks();
workInProgress.memoizedState = null;
workInProgress.updateQueue = null;
if (isContextProvider(updateExpirationTime)) {
var hasContext = !0;
pushContextProvider(workInProgress);
@ -7121,7 +7161,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) {
pushProvider(workInProgress, hasContext);
if (null !== getDerivedStateFromProps) {
var oldValue = getDerivedStateFromProps.value;
hasContext = is$1(oldValue, hasContext)
hasContext = objectIs(oldValue, hasContext)
? 0
: ("function" === typeof updateExpirationTime._calculateChangedBits
? updateExpirationTime._calculateChangedBits(
@ -7773,8 +7813,8 @@ function findNodeHandle(componentOrHandle) {
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical._nativeTag
: componentOrHandle._nativeTag;
? componentOrHandle.canonical._nativeTag
: componentOrHandle._nativeTag;
}
batchedUpdatesImpl = function(fn, a) {
var prevExecutionContext = executionContext;
@ -7897,8 +7937,8 @@ var roots = new Map(),
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical
: componentOrHandle;
? componentOrHandle.canonical
: componentOrHandle;
},
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
@ -7940,6 +7980,9 @@ var roots = new Map(),
return element;
},
unmountComponentAtNode: function(containerTag) {
this.stopSurface(containerTag);
},
stopSurface: function(containerTag) {
var root = roots.get(containerTag);
root &&
updateContainer(null, root, null, function() {
@ -8074,7 +8117,7 @@ var roots = new Map(),
throw Error("getInspectorDataForViewTag() is not available in production");
},
bundleType: 0,
version: "16.12.0-experimental-19f6fe170",
version: "16.12.0-experimental-241c4467e",
rendererPackageName: "react-native-renderer"
});
var ReactFabric$2 = { default: ReactFabric },

Просмотреть файл

@ -350,8 +350,8 @@ function SyntheticEvent(
((targetInst = dispatchConfig[propName])
? (this[propName] = targetInst(nativeEvent))
: "target" === propName
? (this.target = nativeEventTarget)
: (this[propName] = nativeEvent[propName]));
? (this.target = nativeEventTarget)
: (this[propName] = nativeEvent[propName]));
this.isDefaultPrevented = (null != nativeEvent.defaultPrevented
? nativeEvent.defaultPrevented
: !1 === nativeEvent.returnValue)
@ -564,10 +564,10 @@ function accumulate(current, next) {
return null == current
? next
: Array.isArray(current)
? current.concat(next)
: Array.isArray(next)
? [current].concat(next)
: [current, next];
? current.concat(next)
: Array.isArray(next)
? [current].concat(next)
: [current, next];
}
var responderInst = null,
trackedTouchCount = 0;
@ -669,10 +669,10 @@ var eventTypes = {
var shouldSetEventType = isStartish(topLevelType)
? eventTypes.startShouldSetResponder
: isMoveish(topLevelType)
? eventTypes.moveShouldSetResponder
: "topSelectionChange" === topLevelType
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
? eventTypes.moveShouldSetResponder
: "topSelectionChange" === topLevelType
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
if (responderInst)
b: {
var JSCompiler_temp = responderInst;
@ -826,10 +826,10 @@ var eventTypes = {
(shouldSetEventType = shouldSetEventType
? eventTypes.responderStart
: JSCompiler_temp
? eventTypes.responderMove
: targetInst
? eventTypes.responderEnd
: null)
? eventTypes.responderMove
: targetInst
? eventTypes.responderEnd
: null)
)
(shouldSetEventType = ResponderSyntheticEvent.getPooled(
shouldSetEventType,
@ -892,8 +892,8 @@ var eventTypes = {
(topLevelType = shouldSetEventType
? eventTypes.responderTerminate
: topLevelType
? eventTypes.responderRelease
: null)
? eventTypes.responderRelease
: null)
)
(nativeEvent = ResponderSyntheticEvent.getPooled(
topLevelType,
@ -1261,8 +1261,8 @@ function diffNestedProperty(
return nextProp
? addNestedProperty(updatePayload, nextProp, validAttributes)
: prevProp
? clearNestedProperty(updatePayload, prevProp, validAttributes)
: updatePayload;
? clearNestedProperty(updatePayload, prevProp, validAttributes)
: updatePayload;
if (!Array.isArray(prevProp) && !Array.isArray(nextProp))
return diffProperties(updatePayload, prevProp, nextProp, validAttributes);
if (Array.isArray(prevProp) && Array.isArray(nextProp)) {
@ -1857,18 +1857,18 @@ function inferPriorityFromExpirationTime(currentTime, expirationTime) {
return 0 >= currentTime
? 99
: 250 >= currentTime
? 98
: 5250 >= currentTime
? 97
: 95;
? 98
: 5250 >= currentTime
? 97
: 95;
}
function is(x, y) {
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
}
var is$1 = "function" === typeof Object.is ? Object.is : is,
var objectIs = "function" === typeof Object.is ? Object.is : is,
hasOwnProperty = Object.prototype.hasOwnProperty;
function shallowEqual(objA, objB) {
if (is$1(objA, objB)) return !0;
if (objectIs(objA, objB)) return !0;
if (
"object" !== typeof objA ||
null === objA ||
@ -1882,7 +1882,7 @@ function shallowEqual(objA, objB) {
for (keysB = 0; keysB < keysA.length; keysB++)
if (
!hasOwnProperty.call(objB, keysA[keysB]) ||
!is$1(objA[keysA[keysB]], objB[keysA[keysB]])
!objectIs(objA[keysA[keysB]], objB[keysA[keysB]])
)
return !1;
return !0;
@ -2234,8 +2234,8 @@ function checkShouldComponentUpdate(
return "function" === typeof workInProgress.shouldComponentUpdate
? workInProgress.shouldComponentUpdate(newProps, newState, nextContext)
: ctor.prototype && ctor.prototype.isPureReactComponent
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
: !0;
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
: !0;
}
function constructClassInstance(workInProgress, ctor, props) {
var isLegacyContextConsumer = !1,
@ -3130,9 +3130,7 @@ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher,
currentlyRenderingFiber$1 = null,
currentHook = null,
workInProgressHook = null,
didScheduleRenderPhaseUpdate = !1,
renderPhaseUpdates = null,
numberOfReRenders = 0;
didScheduleRenderPhaseUpdate = !1;
function throwInvalidHookError() {
throw Error(
"Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem."
@ -3141,7 +3139,7 @@ function throwInvalidHookError() {
function areHookInputsEqual(nextDeps, prevDeps) {
if (null === prevDeps) return !1;
for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++)
if (!is$1(nextDeps[i], prevDeps[i])) return !1;
if (!objectIs(nextDeps[i], prevDeps[i])) return !1;
return !0;
}
function renderWithHooks(
@ -3162,36 +3160,32 @@ function renderWithHooks(
? HooksDispatcherOnMount
: HooksDispatcherOnUpdate;
current = Component(props, secondArg);
if (didScheduleRenderPhaseUpdate) {
do
(didScheduleRenderPhaseUpdate = !1),
(numberOfReRenders += 1),
(workInProgressHook = currentHook = null),
(workInProgress.updateQueue = null),
(ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdate),
(current = Component(props, secondArg));
while (didScheduleRenderPhaseUpdate);
renderPhaseUpdates = null;
numberOfReRenders = 0;
if (workInProgress.expirationTime === renderExpirationTime$1) {
nextRenderExpirationTime = 0;
do {
workInProgress.expirationTime = 0;
if (!(25 > nextRenderExpirationTime))
throw Error(
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
);
nextRenderExpirationTime += 1;
workInProgressHook = currentHook = null;
workInProgress.updateQueue = null;
ReactCurrentDispatcher$1.current = HooksDispatcherOnRerender;
current = Component(props, secondArg);
} while (workInProgress.expirationTime === renderExpirationTime$1);
}
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
workInProgress = null !== currentHook && null !== currentHook.next;
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
if (workInProgress)
throw Error(
"Rendered fewer hooks than expected. This may be caused by an accidental early return statement."
);
return current;
}
function resetHooks() {
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
renderPhaseUpdates = null;
numberOfReRenders = 0;
}
function mountWorkInProgressHook() {
var hook = {
memoizedState: null,
@ -3246,57 +3240,36 @@ function updateReducer(reducer) {
"Should have a queue. This is likely a bug in React. Please file an issue."
);
queue.lastRenderedReducer = reducer;
if (0 < numberOfReRenders) {
var _dispatch = queue.dispatch;
if (null !== renderPhaseUpdates) {
var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
if (void 0 !== firstRenderPhaseUpdate) {
renderPhaseUpdates.delete(queue);
var newState = hook.memoizedState;
do
(newState = reducer(newState, firstRenderPhaseUpdate.action)),
(firstRenderPhaseUpdate = firstRenderPhaseUpdate.next);
while (null !== firstRenderPhaseUpdate);
is$1(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
null === hook.baseQueue && (hook.baseState = newState);
queue.lastRenderedState = newState;
return [newState, _dispatch];
}
var current = currentHook,
baseQueue = current.baseQueue,
pendingQueue = queue.pending;
if (null !== pendingQueue) {
if (null !== baseQueue) {
var baseFirst = baseQueue.next;
baseQueue.next = pendingQueue.next;
pendingQueue.next = baseFirst;
}
return [hook.memoizedState, _dispatch];
}
newState = currentHook;
_dispatch = newState.baseQueue;
firstRenderPhaseUpdate = queue.pending;
if (null !== firstRenderPhaseUpdate) {
if (null !== _dispatch) {
var baseFirst = _dispatch.next;
_dispatch.next = firstRenderPhaseUpdate.next;
firstRenderPhaseUpdate.next = baseFirst;
}
newState.baseQueue = _dispatch = firstRenderPhaseUpdate;
current.baseQueue = baseQueue = pendingQueue;
queue.pending = null;
}
if (null !== _dispatch) {
_dispatch = _dispatch.next;
newState = newState.baseState;
var newBaseQueueLast = (baseFirst = firstRenderPhaseUpdate = null),
_update = _dispatch;
if (null !== baseQueue) {
baseQueue = baseQueue.next;
current = current.baseState;
var newBaseQueueLast = (baseFirst = pendingQueue = null),
update = baseQueue;
do {
var updateExpirationTime = _update.expirationTime;
var updateExpirationTime = update.expirationTime;
if (updateExpirationTime < renderExpirationTime$1) {
var clone = {
expirationTime: _update.expirationTime,
suspenseConfig: _update.suspenseConfig,
action: _update.action,
eagerReducer: _update.eagerReducer,
eagerState: _update.eagerState,
expirationTime: update.expirationTime,
suspenseConfig: update.suspenseConfig,
action: update.action,
eagerReducer: update.eagerReducer,
eagerState: update.eagerState,
next: null
};
null === newBaseQueueLast
? ((baseFirst = newBaseQueueLast = clone),
(firstRenderPhaseUpdate = newState))
? ((baseFirst = newBaseQueueLast = clone), (pendingQueue = current))
: (newBaseQueueLast = newBaseQueueLast.next = clone);
updateExpirationTime > currentlyRenderingFiber$1.expirationTime &&
((currentlyRenderingFiber$1.expirationTime = updateExpirationTime),
@ -3305,33 +3278,56 @@ function updateReducer(reducer) {
null !== newBaseQueueLast &&
(newBaseQueueLast = newBaseQueueLast.next = {
expirationTime: 1073741823,
suspenseConfig: _update.suspenseConfig,
action: _update.action,
eagerReducer: _update.eagerReducer,
eagerState: _update.eagerState,
suspenseConfig: update.suspenseConfig,
action: update.action,
eagerReducer: update.eagerReducer,
eagerState: update.eagerState,
next: null
}),
markRenderEventTimeAndConfig(
updateExpirationTime,
_update.suspenseConfig
update.suspenseConfig
),
(newState =
_update.eagerReducer === reducer
? _update.eagerState
: reducer(newState, _update.action));
_update = _update.next;
} while (null !== _update && _update !== _dispatch);
(current =
update.eagerReducer === reducer
? update.eagerState
: reducer(current, update.action));
update = update.next;
} while (null !== update && update !== baseQueue);
null === newBaseQueueLast
? (firstRenderPhaseUpdate = newState)
? (pendingQueue = current)
: (newBaseQueueLast.next = baseFirst);
is$1(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
hook.baseState = firstRenderPhaseUpdate;
objectIs(current, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = current;
hook.baseState = pendingQueue;
hook.baseQueue = newBaseQueueLast;
queue.lastRenderedState = newState;
queue.lastRenderedState = current;
}
return [hook.memoizedState, queue.dispatch];
}
function rerenderReducer(reducer) {
var hook = updateWorkInProgressHook(),
queue = hook.queue;
if (null === queue)
throw Error(
"Should have a queue. This is likely a bug in React. Please file an issue."
);
queue.lastRenderedReducer = reducer;
var dispatch = queue.dispatch,
lastRenderPhaseUpdate = queue.pending,
newState = hook.memoizedState;
if (null !== lastRenderPhaseUpdate) {
queue.pending = null;
var update = (lastRenderPhaseUpdate = lastRenderPhaseUpdate.next);
do (newState = reducer(newState, update.action)), (update = update.next);
while (update !== lastRenderPhaseUpdate);
objectIs(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
null === hook.baseQueue && (hook.baseState = newState);
queue.lastRenderedState = newState;
}
return [newState, dispatch];
}
function mountState(initialState) {
var hook = mountWorkInProgressHook();
"function" === typeof initialState && (initialState = initialState());
@ -3352,6 +3348,9 @@ function mountState(initialState) {
function updateState(initialState) {
return updateReducer(basicStateReducer, initialState);
}
function rerenderState(initialState) {
return rerenderReducer(basicStateReducer, initialState);
}
function pushEffect(tag, create, destroy, deps) {
tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null };
create = currentlyRenderingFiber$1.updateQueue;
@ -3368,6 +3367,9 @@ function pushEffect(tag, create, destroy, deps) {
(create.lastEffect = tag)));
return tag;
}
function updateRef() {
return updateWorkInProgressHook().memoizedState;
}
function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
var hook = mountWorkInProgressHook();
currentlyRenderingFiber$1.effectTag |= fiberEffectTag;
@ -3399,6 +3401,9 @@ function mountEffect(create, deps) {
function updateEffect(create, deps) {
return updateEffectImpl(516, 192, create, deps);
}
function updateLayoutEffect(create, deps) {
return updateEffectImpl(4, 36, create, deps);
}
function imperativeHandleEffect(create, ref) {
if ("function" === typeof ref)
return (
@ -3417,6 +3422,15 @@ function imperativeHandleEffect(create, ref) {
}
);
}
function updateImperativeHandle(ref, create, deps) {
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
return updateEffectImpl(
4,
36,
imperativeHandleEffect.bind(null, create, ref),
deps
);
}
function mountDebugValue() {}
function mountCallback(callback, deps) {
mountWorkInProgressHook().memoizedState = [
@ -3438,6 +3452,20 @@ function updateCallback(callback, deps) {
hook.memoizedState = [callback, deps];
return callback;
}
function updateMemo(nextCreate, deps) {
var hook = updateWorkInProgressHook();
deps = void 0 === deps ? null : deps;
var prevState = hook.memoizedState;
if (
null !== prevState &&
null !== deps &&
areHookInputsEqual(deps, prevState[1])
)
return prevState[0];
nextCreate = nextCreate();
hook.memoizedState = [nextCreate, deps];
return nextCreate;
}
function startTransition(setPending, config, callback) {
var priorityLevel = getCurrentPriorityLevel();
runWithPriority(98 > priorityLevel ? 98 : priorityLevel, function() {
@ -3454,62 +3482,42 @@ function startTransition(setPending, config, callback) {
});
}
function dispatchAction(fiber, queue, action) {
if (!(25 > numberOfReRenders))
throw Error(
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
);
var alternate = fiber.alternate;
var currentTime = requestCurrentTimeForUpdate(),
suspenseConfig = ReactCurrentBatchConfig.suspense;
currentTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
suspenseConfig = {
expirationTime: currentTime,
suspenseConfig: suspenseConfig,
action: action,
eagerReducer: null,
eagerState: null,
next: null
};
var pending = queue.pending;
null === pending
? (suspenseConfig.next = suspenseConfig)
: ((suspenseConfig.next = pending.next), (pending.next = suspenseConfig));
queue.pending = suspenseConfig;
pending = fiber.alternate;
if (
fiber === currentlyRenderingFiber$1 ||
(null !== alternate && alternate === currentlyRenderingFiber$1)
(null !== pending && pending === currentlyRenderingFiber$1)
)
if (
((didScheduleRenderPhaseUpdate = !0),
(fiber = {
expirationTime: renderExpirationTime$1,
suspenseConfig: null,
action: action,
eagerReducer: null,
eagerState: null,
next: null
}),
null === renderPhaseUpdates && (renderPhaseUpdates = new Map()),
(action = renderPhaseUpdates.get(queue)),
void 0 === action)
)
renderPhaseUpdates.set(queue, fiber);
else {
for (queue = action; null !== queue.next; ) queue = queue.next;
queue.next = fiber;
}
(didScheduleRenderPhaseUpdate = !0),
(suspenseConfig.expirationTime = renderExpirationTime$1),
(currentlyRenderingFiber$1.expirationTime = renderExpirationTime$1);
else {
var currentTime = requestCurrentTimeForUpdate(),
suspenseConfig = ReactCurrentBatchConfig.suspense;
currentTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
suspenseConfig = {
expirationTime: currentTime,
suspenseConfig: suspenseConfig,
action: action,
eagerReducer: null,
eagerState: null,
next: null
};
var pending = queue.pending;
null === pending
? (suspenseConfig.next = suspenseConfig)
: ((suspenseConfig.next = pending.next), (pending.next = suspenseConfig));
queue.pending = suspenseConfig;
if (
0 === fiber.expirationTime &&
(null === alternate || 0 === alternate.expirationTime) &&
((alternate = queue.lastRenderedReducer), null !== alternate)
(null === pending || 0 === pending.expirationTime) &&
((pending = queue.lastRenderedReducer), null !== pending)
)
try {
var currentState = queue.lastRenderedState,
eagerState = alternate(currentState, action);
suspenseConfig.eagerReducer = alternate;
eagerState = pending(currentState, action);
suspenseConfig.eagerReducer = pending;
suspenseConfig.eagerState = eagerState;
if (is$1(eagerState, currentState)) return;
if (objectIs(eagerState, currentState)) return;
} catch (error) {
} finally {
}
@ -3618,36 +3626,11 @@ var ContextOnlyDispatcher = {
useCallback: updateCallback,
useContext: readContext,
useEffect: updateEffect,
useImperativeHandle: function(ref, create, deps) {
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
return updateEffectImpl(
4,
36,
imperativeHandleEffect.bind(null, create, ref),
deps
);
},
useLayoutEffect: function(create, deps) {
return updateEffectImpl(4, 36, create, deps);
},
useMemo: function(nextCreate, deps) {
var hook = updateWorkInProgressHook();
deps = void 0 === deps ? null : deps;
var prevState = hook.memoizedState;
if (
null !== prevState &&
null !== deps &&
areHookInputsEqual(deps, prevState[1])
)
return prevState[0];
nextCreate = nextCreate();
hook.memoizedState = [nextCreate, deps];
return nextCreate;
},
useImperativeHandle: updateImperativeHandle,
useLayoutEffect: updateLayoutEffect,
useMemo: updateMemo,
useReducer: updateReducer,
useRef: function() {
return updateWorkInProgressHook().memoizedState;
},
useRef: updateRef,
useState: updateState,
useDebugValue: mountDebugValue,
useResponder: createDeprecatedResponderListener,
@ -3683,6 +3666,51 @@ var ContextOnlyDispatcher = {
];
}
},
HooksDispatcherOnRerender = {
readContext: readContext,
useCallback: updateCallback,
useContext: readContext,
useEffect: updateEffect,
useImperativeHandle: updateImperativeHandle,
useLayoutEffect: updateLayoutEffect,
useMemo: updateMemo,
useReducer: rerenderReducer,
useRef: updateRef,
useState: rerenderState,
useDebugValue: mountDebugValue,
useResponder: createDeprecatedResponderListener,
useDeferredValue: function(value, config) {
var _rerenderState = rerenderState(value),
prevValue = _rerenderState[0],
setValue = _rerenderState[1];
updateEffect(
function() {
var previousConfig = ReactCurrentBatchConfig$1.suspense;
ReactCurrentBatchConfig$1.suspense =
void 0 === config ? null : config;
try {
setValue(value);
} finally {
ReactCurrentBatchConfig$1.suspense = previousConfig;
}
},
[value, config]
);
return prevValue;
},
useTransition: function(config) {
var _rerenderState2 = rerenderState(!1),
isPending = _rerenderState2[0];
_rerenderState2 = _rerenderState2[1];
return [
updateCallback(startTransition.bind(null, _rerenderState2, config), [
_rerenderState2,
config
]),
isPending
];
}
},
now$1 = Scheduler.unstable_now,
commitTime = 0,
profilerStartTime = -1;
@ -4738,8 +4766,8 @@ updateHostComponent$1 = function(current, workInProgress, type, newProps) {
? cloneNodeWithNewProps(recyclableInstance, newProps)
: cloneNode(recyclableInstance)
: null !== newProps
? cloneNodeWithNewChildrenAndProps(recyclableInstance, newProps)
: cloneNodeWithNewChildren(recyclableInstance),
? cloneNodeWithNewChildrenAndProps(recyclableInstance, newProps)
: cloneNodeWithNewChildren(recyclableInstance),
canonical: type.canonical
}),
(workInProgress.stateNode = type),
@ -5559,8 +5587,8 @@ function requestCurrentTimeForUpdate() {
return (executionContext & (RenderContext | CommitContext)) !== NoContext
? 1073741821 - ((now() / 10) | 0)
: 0 !== currentEventTime
? currentEventTime
: (currentEventTime = 1073741821 - ((now() / 10) | 0));
? currentEventTime
: (currentEventTime = 1073741821 - ((now() / 10) | 0));
}
function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
fiber = fiber.mode;
@ -5670,9 +5698,10 @@ function getNextRootExpirationTimeToWorkOn(root) {
if (0 !== lastExpiredTime) return lastExpiredTime;
lastExpiredTime = root.firstPendingTime;
if (!isRootSuspendedAtTime(root, lastExpiredTime)) return lastExpiredTime;
lastExpiredTime = root.lastPingedTime;
var lastPingedTime = root.lastPingedTime;
root = root.nextKnownPendingLevel;
return lastExpiredTime > root ? lastExpiredTime : root;
root = lastPingedTime > root ? lastPingedTime : root;
return 2 >= root && lastExpiredTime !== root ? 0 : root;
}
function ensureRootIsScheduled(root) {
if (0 !== root.lastExpiredTime)
@ -5848,35 +5877,34 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
10 * (1073741821 - workInProgressRootLatestSuspenseTimeout) -
now())
: 1073741823 === workInProgressRootLatestProcessedExpirationTime
? (prevExecutionContext = 0)
: ((prevExecutionContext =
10 *
(1073741821 -
workInProgressRootLatestProcessedExpirationTime) -
5e3),
(prevDispatcher = now()),
(expirationTime =
10 * (1073741821 - expirationTime) - prevDispatcher),
(prevExecutionContext =
prevDispatcher - prevExecutionContext),
0 > prevExecutionContext && (prevExecutionContext = 0),
(prevExecutionContext =
(120 > prevExecutionContext
? 120
: 480 > prevExecutionContext
? 480
: 1080 > prevExecutionContext
? 1080
: 1920 > prevExecutionContext
? 1920
: 3e3 > prevExecutionContext
? 3e3
: 4320 > prevExecutionContext
? 4320
: 1960 * ceil(prevExecutionContext / 1960)) -
prevExecutionContext),
expirationTime < prevExecutionContext &&
(prevExecutionContext = expirationTime));
? (prevExecutionContext = 0)
: ((prevExecutionContext =
10 *
(1073741821 -
workInProgressRootLatestProcessedExpirationTime) -
5e3),
(prevDispatcher = now()),
(expirationTime =
10 * (1073741821 - expirationTime) - prevDispatcher),
(prevExecutionContext = prevDispatcher - prevExecutionContext),
0 > prevExecutionContext && (prevExecutionContext = 0),
(prevExecutionContext =
(120 > prevExecutionContext
? 120
: 480 > prevExecutionContext
? 480
: 1080 > prevExecutionContext
? 1080
: 1920 > prevExecutionContext
? 1920
: 3e3 > prevExecutionContext
? 3e3
: 4320 > prevExecutionContext
? 4320
: 1960 * ceil(prevExecutionContext / 1960)) -
prevExecutionContext),
expirationTime < prevExecutionContext &&
(prevExecutionContext = expirationTime));
if (10 < prevExecutionContext) {
root.timeoutHandle = scheduleTimeout(
commitRoot.bind(null, root),
@ -6035,7 +6063,20 @@ function handleError(root$jscomp$0, thrownValue) {
do {
try {
resetContextDependencies();
resetHooks();
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
if (didScheduleRenderPhaseUpdate)
for (
var hook = currentlyRenderingFiber$1.memoizedState;
null !== hook;
) {
var queue = hook.queue;
null !== queue && (queue.pending = null);
hook = hook.next;
}
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
if (null === workInProgress || null === workInProgress.return)
return (
(workInProgressRootExitStatus = RootFatalErrored),
@ -6080,10 +6121,10 @@ function handleError(root$jscomp$0, thrownValue) {
void 0 === props.fallback
? !1
: !0 !== props.unstable_avoidThisFallback
? !0
: hasInvisibleParentBoundary
? !1
: !0;
? !0
: hasInvisibleParentBoundary
? !1
: !0;
}
}
if (JSCompiler_temp) {
@ -6694,8 +6735,6 @@ function pingSuspendedRoot(root, thenable, suspendedTime) {
((thenable = root.lastPingedTime),
(0 !== thenable && thenable < suspendedTime) ||
((root.lastPingedTime = suspendedTime),
root.finishedExpirationTime === suspendedTime &&
((root.finishedExpirationTime = 0), (root.finishedWork = null)),
ensureRootIsScheduled(root),
schedulePendingInteractions(root, suspendedTime)));
}
@ -6838,7 +6877,8 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) {
void 0 === renderState.$$typeof
) {
workInProgress.tag = 1;
resetHooks();
workInProgress.memoizedState = null;
workInProgress.updateQueue = null;
if (isContextProvider(updateExpirationTime)) {
var hasContext = !0;
pushContextProvider(workInProgress);
@ -7112,7 +7152,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) {
pushProvider(workInProgress, hasContext);
if (null !== getDerivedStateFromProps) {
var oldValue = getDerivedStateFromProps.value;
hasContext = is$1(oldValue, hasContext)
hasContext = objectIs(oldValue, hasContext)
? 0
: ("function" === typeof updateExpirationTime._calculateChangedBits
? updateExpirationTime._calculateChangedBits(
@ -7764,8 +7804,8 @@ function findNodeHandle(componentOrHandle) {
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical._nativeTag
: componentOrHandle._nativeTag;
? componentOrHandle.canonical._nativeTag
: componentOrHandle._nativeTag;
}
batchedUpdatesImpl = function(fn, a) {
var prevExecutionContext = executionContext;
@ -7888,8 +7928,8 @@ var roots = new Map(),
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical
: componentOrHandle;
? componentOrHandle.canonical
: componentOrHandle;
},
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
@ -7931,6 +7971,9 @@ var roots = new Map(),
return element;
},
unmountComponentAtNode: function(containerTag) {
this.stopSurface(containerTag);
},
stopSurface: function(containerTag) {
var root = roots.get(containerTag);
root &&
updateContainer(null, root, null, function() {
@ -8065,7 +8108,7 @@ var roots = new Map(),
throw Error("getInspectorDataForViewTag() is not available in production");
},
bundleType: 0,
version: "16.12.0-19f6fe170",
version: "16.12.0-241c4467e",
rendererPackageName: "react-native-renderer"
});
var ReactFabric$2 = { default: ReactFabric },

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -348,8 +348,8 @@ function SyntheticEvent(
((targetInst = dispatchConfig[propName])
? (this[propName] = targetInst(nativeEvent))
: "target" === propName
? (this.target = nativeEventTarget)
: (this[propName] = nativeEvent[propName]));
? (this.target = nativeEventTarget)
: (this[propName] = nativeEvent[propName]));
this.isDefaultPrevented = (null != nativeEvent.defaultPrevented
? nativeEvent.defaultPrevented
: !1 === nativeEvent.returnValue)
@ -562,10 +562,10 @@ function accumulate(current, next) {
return null == current
? next
: Array.isArray(current)
? current.concat(next)
: Array.isArray(next)
? [current].concat(next)
: [current, next];
? current.concat(next)
: Array.isArray(next)
? [current].concat(next)
: [current, next];
}
var responderInst = null,
trackedTouchCount = 0;
@ -667,10 +667,10 @@ var eventTypes = {
var shouldSetEventType = isStartish(topLevelType)
? eventTypes.startShouldSetResponder
: isMoveish(topLevelType)
? eventTypes.moveShouldSetResponder
: "topSelectionChange" === topLevelType
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
? eventTypes.moveShouldSetResponder
: "topSelectionChange" === topLevelType
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
if (responderInst)
b: {
var JSCompiler_temp = responderInst;
@ -824,10 +824,10 @@ var eventTypes = {
(shouldSetEventType = shouldSetEventType
? eventTypes.responderStart
: JSCompiler_temp
? eventTypes.responderMove
: targetInst
? eventTypes.responderEnd
: null)
? eventTypes.responderMove
: targetInst
? eventTypes.responderEnd
: null)
)
(shouldSetEventType = ResponderSyntheticEvent.getPooled(
shouldSetEventType,
@ -890,8 +890,8 @@ var eventTypes = {
(topLevelType = shouldSetEventType
? eventTypes.responderTerminate
: topLevelType
? eventTypes.responderRelease
: null)
? eventTypes.responderRelease
: null)
)
(nativeEvent = ResponderSyntheticEvent.getPooled(
topLevelType,
@ -1375,8 +1375,8 @@ function diffNestedProperty(
return nextProp
? addNestedProperty(updatePayload, nextProp, validAttributes)
: prevProp
? clearNestedProperty(updatePayload, prevProp, validAttributes)
: updatePayload;
? clearNestedProperty(updatePayload, prevProp, validAttributes)
: updatePayload;
if (!Array.isArray(prevProp) && !Array.isArray(nextProp))
return diffProperties(updatePayload, prevProp, nextProp, validAttributes);
if (Array.isArray(prevProp) && Array.isArray(nextProp)) {
@ -1887,10 +1887,10 @@ function flushSyncCallbackQueueImpl() {
function is(x, y) {
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
}
var is$1 = "function" === typeof Object.is ? Object.is : is,
var objectIs = "function" === typeof Object.is ? Object.is : is,
hasOwnProperty = Object.prototype.hasOwnProperty;
function shallowEqual(objA, objB) {
if (is$1(objA, objB)) return !0;
if (objectIs(objA, objB)) return !0;
if (
"object" !== typeof objA ||
null === objA ||
@ -1904,7 +1904,7 @@ function shallowEqual(objA, objB) {
for (keysB = 0; keysB < keysA.length; keysB++)
if (
!hasOwnProperty.call(objB, keysA[keysB]) ||
!is$1(objA[keysA[keysB]], objB[keysA[keysB]])
!objectIs(objA[keysA[keysB]], objB[keysA[keysB]])
)
return !1;
return !0;
@ -2256,8 +2256,8 @@ function checkShouldComponentUpdate(
return "function" === typeof workInProgress.shouldComponentUpdate
? workInProgress.shouldComponentUpdate(newProps, newState, nextContext)
: ctor.prototype && ctor.prototype.isPureReactComponent
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
: !0;
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
: !0;
}
function constructClassInstance(workInProgress, ctor, props) {
var isLegacyContextConsumer = !1,
@ -3152,9 +3152,7 @@ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher,
currentlyRenderingFiber$1 = null,
currentHook = null,
workInProgressHook = null,
didScheduleRenderPhaseUpdate = !1,
renderPhaseUpdates = null,
numberOfReRenders = 0;
didScheduleRenderPhaseUpdate = !1;
function throwInvalidHookError() {
throw Error(
"Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem."
@ -3163,7 +3161,7 @@ function throwInvalidHookError() {
function areHookInputsEqual(nextDeps, prevDeps) {
if (null === prevDeps) return !1;
for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++)
if (!is$1(nextDeps[i], prevDeps[i])) return !1;
if (!objectIs(nextDeps[i], prevDeps[i])) return !1;
return !0;
}
function renderWithHooks(
@ -3184,36 +3182,32 @@ function renderWithHooks(
? HooksDispatcherOnMount
: HooksDispatcherOnUpdate;
current = Component(props, secondArg);
if (didScheduleRenderPhaseUpdate) {
do
(didScheduleRenderPhaseUpdate = !1),
(numberOfReRenders += 1),
(workInProgressHook = currentHook = null),
(workInProgress.updateQueue = null),
(ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdate),
(current = Component(props, secondArg));
while (didScheduleRenderPhaseUpdate);
renderPhaseUpdates = null;
numberOfReRenders = 0;
if (workInProgress.expirationTime === renderExpirationTime$1) {
nextRenderExpirationTime = 0;
do {
workInProgress.expirationTime = 0;
if (!(25 > nextRenderExpirationTime))
throw Error(
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
);
nextRenderExpirationTime += 1;
workInProgressHook = currentHook = null;
workInProgress.updateQueue = null;
ReactCurrentDispatcher$1.current = HooksDispatcherOnRerender;
current = Component(props, secondArg);
} while (workInProgress.expirationTime === renderExpirationTime$1);
}
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
workInProgress = null !== currentHook && null !== currentHook.next;
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
if (workInProgress)
throw Error(
"Rendered fewer hooks than expected. This may be caused by an accidental early return statement."
);
return current;
}
function resetHooks() {
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
renderPhaseUpdates = null;
numberOfReRenders = 0;
}
function mountWorkInProgressHook() {
var hook = {
memoizedState: null,
@ -3268,57 +3262,36 @@ function updateReducer(reducer) {
"Should have a queue. This is likely a bug in React. Please file an issue."
);
queue.lastRenderedReducer = reducer;
if (0 < numberOfReRenders) {
var _dispatch = queue.dispatch;
if (null !== renderPhaseUpdates) {
var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
if (void 0 !== firstRenderPhaseUpdate) {
renderPhaseUpdates.delete(queue);
var newState = hook.memoizedState;
do
(newState = reducer(newState, firstRenderPhaseUpdate.action)),
(firstRenderPhaseUpdate = firstRenderPhaseUpdate.next);
while (null !== firstRenderPhaseUpdate);
is$1(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
null === hook.baseQueue && (hook.baseState = newState);
queue.lastRenderedState = newState;
return [newState, _dispatch];
}
var current = currentHook,
baseQueue = current.baseQueue,
pendingQueue = queue.pending;
if (null !== pendingQueue) {
if (null !== baseQueue) {
var baseFirst = baseQueue.next;
baseQueue.next = pendingQueue.next;
pendingQueue.next = baseFirst;
}
return [hook.memoizedState, _dispatch];
}
newState = currentHook;
_dispatch = newState.baseQueue;
firstRenderPhaseUpdate = queue.pending;
if (null !== firstRenderPhaseUpdate) {
if (null !== _dispatch) {
var baseFirst = _dispatch.next;
_dispatch.next = firstRenderPhaseUpdate.next;
firstRenderPhaseUpdate.next = baseFirst;
}
newState.baseQueue = _dispatch = firstRenderPhaseUpdate;
current.baseQueue = baseQueue = pendingQueue;
queue.pending = null;
}
if (null !== _dispatch) {
_dispatch = _dispatch.next;
newState = newState.baseState;
var newBaseQueueLast = (baseFirst = firstRenderPhaseUpdate = null),
_update = _dispatch;
if (null !== baseQueue) {
baseQueue = baseQueue.next;
current = current.baseState;
var newBaseQueueLast = (baseFirst = pendingQueue = null),
update = baseQueue;
do {
var updateExpirationTime = _update.expirationTime;
var updateExpirationTime = update.expirationTime;
if (updateExpirationTime < renderExpirationTime$1) {
var clone = {
expirationTime: _update.expirationTime,
suspenseConfig: _update.suspenseConfig,
action: _update.action,
eagerReducer: _update.eagerReducer,
eagerState: _update.eagerState,
expirationTime: update.expirationTime,
suspenseConfig: update.suspenseConfig,
action: update.action,
eagerReducer: update.eagerReducer,
eagerState: update.eagerState,
next: null
};
null === newBaseQueueLast
? ((baseFirst = newBaseQueueLast = clone),
(firstRenderPhaseUpdate = newState))
? ((baseFirst = newBaseQueueLast = clone), (pendingQueue = current))
: (newBaseQueueLast = newBaseQueueLast.next = clone);
updateExpirationTime > currentlyRenderingFiber$1.expirationTime &&
((currentlyRenderingFiber$1.expirationTime = updateExpirationTime),
@ -3327,33 +3300,56 @@ function updateReducer(reducer) {
null !== newBaseQueueLast &&
(newBaseQueueLast = newBaseQueueLast.next = {
expirationTime: 1073741823,
suspenseConfig: _update.suspenseConfig,
action: _update.action,
eagerReducer: _update.eagerReducer,
eagerState: _update.eagerState,
suspenseConfig: update.suspenseConfig,
action: update.action,
eagerReducer: update.eagerReducer,
eagerState: update.eagerState,
next: null
}),
markRenderEventTimeAndConfig(
updateExpirationTime,
_update.suspenseConfig
update.suspenseConfig
),
(newState =
_update.eagerReducer === reducer
? _update.eagerState
: reducer(newState, _update.action));
_update = _update.next;
} while (null !== _update && _update !== _dispatch);
(current =
update.eagerReducer === reducer
? update.eagerState
: reducer(current, update.action));
update = update.next;
} while (null !== update && update !== baseQueue);
null === newBaseQueueLast
? (firstRenderPhaseUpdate = newState)
? (pendingQueue = current)
: (newBaseQueueLast.next = baseFirst);
is$1(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
hook.baseState = firstRenderPhaseUpdate;
objectIs(current, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = current;
hook.baseState = pendingQueue;
hook.baseQueue = newBaseQueueLast;
queue.lastRenderedState = newState;
queue.lastRenderedState = current;
}
return [hook.memoizedState, queue.dispatch];
}
function rerenderReducer(reducer) {
var hook = updateWorkInProgressHook(),
queue = hook.queue;
if (null === queue)
throw Error(
"Should have a queue. This is likely a bug in React. Please file an issue."
);
queue.lastRenderedReducer = reducer;
var dispatch = queue.dispatch,
lastRenderPhaseUpdate = queue.pending,
newState = hook.memoizedState;
if (null !== lastRenderPhaseUpdate) {
queue.pending = null;
var update = (lastRenderPhaseUpdate = lastRenderPhaseUpdate.next);
do (newState = reducer(newState, update.action)), (update = update.next);
while (update !== lastRenderPhaseUpdate);
objectIs(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
null === hook.baseQueue && (hook.baseState = newState);
queue.lastRenderedState = newState;
}
return [newState, dispatch];
}
function mountState(initialState) {
var hook = mountWorkInProgressHook();
"function" === typeof initialState && (initialState = initialState());
@ -3374,6 +3370,9 @@ function mountState(initialState) {
function updateState(initialState) {
return updateReducer(basicStateReducer, initialState);
}
function rerenderState(initialState) {
return rerenderReducer(basicStateReducer, initialState);
}
function pushEffect(tag, create, destroy, deps) {
tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null };
create = currentlyRenderingFiber$1.updateQueue;
@ -3390,6 +3389,9 @@ function pushEffect(tag, create, destroy, deps) {
(create.lastEffect = tag)));
return tag;
}
function updateRef() {
return updateWorkInProgressHook().memoizedState;
}
function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
var hook = mountWorkInProgressHook();
currentlyRenderingFiber$1.effectTag |= fiberEffectTag;
@ -3421,6 +3423,9 @@ function mountEffect(create, deps) {
function updateEffect(create, deps) {
return updateEffectImpl(516, 192, create, deps);
}
function updateLayoutEffect(create, deps) {
return updateEffectImpl(4, 36, create, deps);
}
function imperativeHandleEffect(create, ref) {
if ("function" === typeof ref)
return (
@ -3439,6 +3444,15 @@ function imperativeHandleEffect(create, ref) {
}
);
}
function updateImperativeHandle(ref, create, deps) {
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
return updateEffectImpl(
4,
36,
imperativeHandleEffect.bind(null, create, ref),
deps
);
}
function mountDebugValue() {}
function mountCallback(callback, deps) {
mountWorkInProgressHook().memoizedState = [
@ -3460,6 +3474,20 @@ function updateCallback(callback, deps) {
hook.memoizedState = [callback, deps];
return callback;
}
function updateMemo(nextCreate, deps) {
var hook = updateWorkInProgressHook();
deps = void 0 === deps ? null : deps;
var prevState = hook.memoizedState;
if (
null !== prevState &&
null !== deps &&
areHookInputsEqual(deps, prevState[1])
)
return prevState[0];
nextCreate = nextCreate();
hook.memoizedState = [nextCreate, deps];
return nextCreate;
}
function startTransition(setPending, config, callback) {
var priorityLevel = getCurrentPriorityLevel();
runWithPriority(98 > priorityLevel ? 98 : priorityLevel, function() {
@ -3476,62 +3504,42 @@ function startTransition(setPending, config, callback) {
});
}
function dispatchAction(fiber, queue, action) {
if (!(25 > numberOfReRenders))
throw Error(
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
);
var alternate = fiber.alternate;
var currentTime = requestCurrentTimeForUpdate(),
suspenseConfig = ReactCurrentBatchConfig.suspense;
currentTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
suspenseConfig = {
expirationTime: currentTime,
suspenseConfig: suspenseConfig,
action: action,
eagerReducer: null,
eagerState: null,
next: null
};
var pending = queue.pending;
null === pending
? (suspenseConfig.next = suspenseConfig)
: ((suspenseConfig.next = pending.next), (pending.next = suspenseConfig));
queue.pending = suspenseConfig;
pending = fiber.alternate;
if (
fiber === currentlyRenderingFiber$1 ||
(null !== alternate && alternate === currentlyRenderingFiber$1)
(null !== pending && pending === currentlyRenderingFiber$1)
)
if (
((didScheduleRenderPhaseUpdate = !0),
(fiber = {
expirationTime: renderExpirationTime$1,
suspenseConfig: null,
action: action,
eagerReducer: null,
eagerState: null,
next: null
}),
null === renderPhaseUpdates && (renderPhaseUpdates = new Map()),
(action = renderPhaseUpdates.get(queue)),
void 0 === action)
)
renderPhaseUpdates.set(queue, fiber);
else {
for (queue = action; null !== queue.next; ) queue = queue.next;
queue.next = fiber;
}
(didScheduleRenderPhaseUpdate = !0),
(suspenseConfig.expirationTime = renderExpirationTime$1),
(currentlyRenderingFiber$1.expirationTime = renderExpirationTime$1);
else {
var currentTime = requestCurrentTimeForUpdate(),
suspenseConfig = ReactCurrentBatchConfig.suspense;
currentTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
suspenseConfig = {
expirationTime: currentTime,
suspenseConfig: suspenseConfig,
action: action,
eagerReducer: null,
eagerState: null,
next: null
};
var pending = queue.pending;
null === pending
? (suspenseConfig.next = suspenseConfig)
: ((suspenseConfig.next = pending.next), (pending.next = suspenseConfig));
queue.pending = suspenseConfig;
if (
0 === fiber.expirationTime &&
(null === alternate || 0 === alternate.expirationTime) &&
((alternate = queue.lastRenderedReducer), null !== alternate)
(null === pending || 0 === pending.expirationTime) &&
((pending = queue.lastRenderedReducer), null !== pending)
)
try {
var currentState = queue.lastRenderedState,
eagerState = alternate(currentState, action);
suspenseConfig.eagerReducer = alternate;
eagerState = pending(currentState, action);
suspenseConfig.eagerReducer = pending;
suspenseConfig.eagerState = eagerState;
if (is$1(eagerState, currentState)) return;
if (objectIs(eagerState, currentState)) return;
} catch (error) {
} finally {
}
@ -3640,36 +3648,11 @@ var ContextOnlyDispatcher = {
useCallback: updateCallback,
useContext: readContext,
useEffect: updateEffect,
useImperativeHandle: function(ref, create, deps) {
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
return updateEffectImpl(
4,
36,
imperativeHandleEffect.bind(null, create, ref),
deps
);
},
useLayoutEffect: function(create, deps) {
return updateEffectImpl(4, 36, create, deps);
},
useMemo: function(nextCreate, deps) {
var hook = updateWorkInProgressHook();
deps = void 0 === deps ? null : deps;
var prevState = hook.memoizedState;
if (
null !== prevState &&
null !== deps &&
areHookInputsEqual(deps, prevState[1])
)
return prevState[0];
nextCreate = nextCreate();
hook.memoizedState = [nextCreate, deps];
return nextCreate;
},
useImperativeHandle: updateImperativeHandle,
useLayoutEffect: updateLayoutEffect,
useMemo: updateMemo,
useReducer: updateReducer,
useRef: function() {
return updateWorkInProgressHook().memoizedState;
},
useRef: updateRef,
useState: updateState,
useDebugValue: mountDebugValue,
useResponder: createDeprecatedResponderListener,
@ -3705,6 +3688,51 @@ var ContextOnlyDispatcher = {
];
}
},
HooksDispatcherOnRerender = {
readContext: readContext,
useCallback: updateCallback,
useContext: readContext,
useEffect: updateEffect,
useImperativeHandle: updateImperativeHandle,
useLayoutEffect: updateLayoutEffect,
useMemo: updateMemo,
useReducer: rerenderReducer,
useRef: updateRef,
useState: rerenderState,
useDebugValue: mountDebugValue,
useResponder: createDeprecatedResponderListener,
useDeferredValue: function(value, config) {
var _rerenderState = rerenderState(value),
prevValue = _rerenderState[0],
setValue = _rerenderState[1];
updateEffect(
function() {
var previousConfig = ReactCurrentBatchConfig$1.suspense;
ReactCurrentBatchConfig$1.suspense =
void 0 === config ? null : config;
try {
setValue(value);
} finally {
ReactCurrentBatchConfig$1.suspense = previousConfig;
}
},
[value, config]
);
return prevValue;
},
useTransition: function(config) {
var _rerenderState2 = rerenderState(!1),
isPending = _rerenderState2[0];
_rerenderState2 = _rerenderState2[1];
return [
updateCallback(startTransition.bind(null, _rerenderState2, config), [
_rerenderState2,
config
]),
isPending
];
}
},
hydrationParentFiber = null,
nextHydratableInstance = null,
isHydrating = !1;
@ -5723,8 +5751,8 @@ function requestCurrentTimeForUpdate() {
return (executionContext & (RenderContext | CommitContext)) !== NoContext
? 1073741821 - ((now() / 10) | 0)
: 0 !== currentEventTime
? currentEventTime
: (currentEventTime = 1073741821 - ((now() / 10) | 0));
? currentEventTime
: (currentEventTime = 1073741821 - ((now() / 10) | 0));
}
function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
fiber = fiber.mode;
@ -5831,9 +5859,10 @@ function getNextRootExpirationTimeToWorkOn(root) {
if (0 !== lastExpiredTime) return lastExpiredTime;
lastExpiredTime = root.firstPendingTime;
if (!isRootSuspendedAtTime(root, lastExpiredTime)) return lastExpiredTime;
lastExpiredTime = root.lastPingedTime;
var lastPingedTime = root.lastPingedTime;
root = root.nextKnownPendingLevel;
return lastExpiredTime > root ? lastExpiredTime : root;
root = lastPingedTime > root ? lastPingedTime : root;
return 2 >= root && lastExpiredTime !== root ? 0 : root;
}
function ensureRootIsScheduled(root) {
if (0 !== root.lastExpiredTime)
@ -5855,18 +5884,18 @@ function ensureRootIsScheduled(root) {
1073741823 === expirationTime
? (priorityLevel = 99)
: 1 === expirationTime || 2 === expirationTime
? (priorityLevel = 95)
: ((priorityLevel =
10 * (1073741821 - expirationTime) -
10 * (1073741821 - priorityLevel)),
(priorityLevel =
0 >= priorityLevel
? 99
: 250 >= priorityLevel
? 98
: 5250 >= priorityLevel
? 97
: 95));
? (priorityLevel = 95)
: ((priorityLevel =
10 * (1073741821 - expirationTime) -
10 * (1073741821 - priorityLevel)),
(priorityLevel =
0 >= priorityLevel
? 99
: 250 >= priorityLevel
? 98
: 5250 >= priorityLevel
? 97
: 95));
if (null !== existingCallbackNode) {
var existingCallbackPriority = root.callbackPriority;
if (
@ -6016,35 +6045,34 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
10 * (1073741821 - workInProgressRootLatestSuspenseTimeout) -
now())
: 1073741823 === workInProgressRootLatestProcessedExpirationTime
? (prevExecutionContext = 0)
: ((prevExecutionContext =
10 *
(1073741821 -
workInProgressRootLatestProcessedExpirationTime) -
5e3),
(prevDispatcher = now()),
(expirationTime =
10 * (1073741821 - expirationTime) - prevDispatcher),
(prevExecutionContext =
prevDispatcher - prevExecutionContext),
0 > prevExecutionContext && (prevExecutionContext = 0),
(prevExecutionContext =
(120 > prevExecutionContext
? 120
: 480 > prevExecutionContext
? 480
: 1080 > prevExecutionContext
? 1080
: 1920 > prevExecutionContext
? 1920
: 3e3 > prevExecutionContext
? 3e3
: 4320 > prevExecutionContext
? 4320
: 1960 * ceil(prevExecutionContext / 1960)) -
prevExecutionContext),
expirationTime < prevExecutionContext &&
(prevExecutionContext = expirationTime));
? (prevExecutionContext = 0)
: ((prevExecutionContext =
10 *
(1073741821 -
workInProgressRootLatestProcessedExpirationTime) -
5e3),
(prevDispatcher = now()),
(expirationTime =
10 * (1073741821 - expirationTime) - prevDispatcher),
(prevExecutionContext = prevDispatcher - prevExecutionContext),
0 > prevExecutionContext && (prevExecutionContext = 0),
(prevExecutionContext =
(120 > prevExecutionContext
? 120
: 480 > prevExecutionContext
? 480
: 1080 > prevExecutionContext
? 1080
: 1920 > prevExecutionContext
? 1920
: 3e3 > prevExecutionContext
? 3e3
: 4320 > prevExecutionContext
? 4320
: 1960 * ceil(prevExecutionContext / 1960)) -
prevExecutionContext),
expirationTime < prevExecutionContext &&
(prevExecutionContext = expirationTime));
if (10 < prevExecutionContext) {
root.timeoutHandle = scheduleTimeout(
commitRoot.bind(null, root),
@ -6199,7 +6227,20 @@ function handleError(root$jscomp$0, thrownValue) {
do {
try {
resetContextDependencies();
resetHooks();
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
if (didScheduleRenderPhaseUpdate)
for (
var hook = currentlyRenderingFiber$1.memoizedState;
null !== hook;
) {
var queue = hook.queue;
null !== queue && (queue.pending = null);
hook = hook.next;
}
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
if (null === workInProgress || null === workInProgress.return)
return (
(workInProgressRootExitStatus = RootFatalErrored),
@ -6242,10 +6283,10 @@ function handleError(root$jscomp$0, thrownValue) {
void 0 === props.fallback
? !1
: !0 !== props.unstable_avoidThisFallback
? !0
: hasInvisibleParentBoundary
? !1
: !0;
? !0
: hasInvisibleParentBoundary
? !1
: !0;
}
}
if (JSCompiler_temp) {
@ -6752,10 +6793,7 @@ function pingSuspendedRoot(root, thenable, suspendedTime) {
: isRootSuspendedAtTime(root, suspendedTime) &&
((thenable = root.lastPingedTime),
(0 !== thenable && thenable < suspendedTime) ||
((root.lastPingedTime = suspendedTime),
root.finishedExpirationTime === suspendedTime &&
((root.finishedExpirationTime = 0), (root.finishedWork = null)),
ensureRootIsScheduled(root)));
((root.lastPingedTime = suspendedTime), ensureRootIsScheduled(root)));
}
function resolveRetryThenable(boundaryFiber, thenable) {
var retryCache = boundaryFiber.stateNode;
@ -6890,7 +6928,8 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) {
void 0 === renderState.$$typeof
) {
workInProgress.tag = 1;
resetHooks();
workInProgress.memoizedState = null;
workInProgress.updateQueue = null;
if (isContextProvider(updateExpirationTime)) {
var hasContext = !0;
pushContextProvider(workInProgress);
@ -7163,7 +7202,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) {
pushProvider(workInProgress, hasContext);
if (null !== getDerivedStateFromProps) {
var oldValue = getDerivedStateFromProps.value;
hasContext = is$1(oldValue, hasContext)
hasContext = objectIs(oldValue, hasContext)
? 0
: ("function" === typeof updateExpirationTime._calculateChangedBits
? updateExpirationTime._calculateChangedBits(
@ -7718,8 +7757,8 @@ function findNodeHandle(componentOrHandle) {
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical._nativeTag
: componentOrHandle._nativeTag;
? componentOrHandle.canonical._nativeTag
: componentOrHandle._nativeTag;
}
batchedUpdatesImpl = function(fn, a) {
var prevExecutionContext = executionContext;
@ -7842,8 +7881,8 @@ var roots = new Map(),
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical
: componentOrHandle;
? componentOrHandle.canonical
: componentOrHandle;
},
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
@ -8027,7 +8066,7 @@ var roots = new Map(),
throw Error("getInspectorDataForViewTag() is not available in production");
},
bundleType: 0,
version: "16.12.0-experimental-19f6fe170",
version: "16.12.0-experimental-241c4467e",
rendererPackageName: "react-native-renderer"
});
var ReactNativeRenderer$2 = { default: ReactNativeRenderer },

Просмотреть файл

@ -349,8 +349,8 @@ function SyntheticEvent(
((targetInst = dispatchConfig[propName])
? (this[propName] = targetInst(nativeEvent))
: "target" === propName
? (this.target = nativeEventTarget)
: (this[propName] = nativeEvent[propName]));
? (this.target = nativeEventTarget)
: (this[propName] = nativeEvent[propName]));
this.isDefaultPrevented = (null != nativeEvent.defaultPrevented
? nativeEvent.defaultPrevented
: !1 === nativeEvent.returnValue)
@ -563,10 +563,10 @@ function accumulate(current, next) {
return null == current
? next
: Array.isArray(current)
? current.concat(next)
: Array.isArray(next)
? [current].concat(next)
: [current, next];
? current.concat(next)
: Array.isArray(next)
? [current].concat(next)
: [current, next];
}
var responderInst = null,
trackedTouchCount = 0;
@ -668,10 +668,10 @@ var eventTypes = {
var shouldSetEventType = isStartish(topLevelType)
? eventTypes.startShouldSetResponder
: isMoveish(topLevelType)
? eventTypes.moveShouldSetResponder
: "topSelectionChange" === topLevelType
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
? eventTypes.moveShouldSetResponder
: "topSelectionChange" === topLevelType
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
if (responderInst)
b: {
var JSCompiler_temp = responderInst;
@ -825,10 +825,10 @@ var eventTypes = {
(shouldSetEventType = shouldSetEventType
? eventTypes.responderStart
: JSCompiler_temp
? eventTypes.responderMove
: targetInst
? eventTypes.responderEnd
: null)
? eventTypes.responderMove
: targetInst
? eventTypes.responderEnd
: null)
)
(shouldSetEventType = ResponderSyntheticEvent.getPooled(
shouldSetEventType,
@ -891,8 +891,8 @@ var eventTypes = {
(topLevelType = shouldSetEventType
? eventTypes.responderTerminate
: topLevelType
? eventTypes.responderRelease
: null)
? eventTypes.responderRelease
: null)
)
(nativeEvent = ResponderSyntheticEvent.getPooled(
topLevelType,
@ -1365,8 +1365,8 @@ function diffNestedProperty(
return nextProp
? addNestedProperty(updatePayload, nextProp, validAttributes)
: prevProp
? clearNestedProperty(updatePayload, prevProp, validAttributes)
: updatePayload;
? clearNestedProperty(updatePayload, prevProp, validAttributes)
: updatePayload;
if (!Array.isArray(prevProp) && !Array.isArray(nextProp))
return diffProperties(updatePayload, prevProp, nextProp, validAttributes);
if (Array.isArray(prevProp) && Array.isArray(nextProp)) {
@ -1877,10 +1877,10 @@ function flushSyncCallbackQueueImpl() {
function is(x, y) {
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
}
var is$1 = "function" === typeof Object.is ? Object.is : is,
var objectIs = "function" === typeof Object.is ? Object.is : is,
hasOwnProperty = Object.prototype.hasOwnProperty;
function shallowEqual(objA, objB) {
if (is$1(objA, objB)) return !0;
if (objectIs(objA, objB)) return !0;
if (
"object" !== typeof objA ||
null === objA ||
@ -1894,7 +1894,7 @@ function shallowEqual(objA, objB) {
for (keysB = 0; keysB < keysA.length; keysB++)
if (
!hasOwnProperty.call(objB, keysA[keysB]) ||
!is$1(objA[keysA[keysB]], objB[keysA[keysB]])
!objectIs(objA[keysA[keysB]], objB[keysA[keysB]])
)
return !1;
return !0;
@ -2246,8 +2246,8 @@ function checkShouldComponentUpdate(
return "function" === typeof workInProgress.shouldComponentUpdate
? workInProgress.shouldComponentUpdate(newProps, newState, nextContext)
: ctor.prototype && ctor.prototype.isPureReactComponent
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
: !0;
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
: !0;
}
function constructClassInstance(workInProgress, ctor, props) {
var isLegacyContextConsumer = !1,
@ -3142,9 +3142,7 @@ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher,
currentlyRenderingFiber$1 = null,
currentHook = null,
workInProgressHook = null,
didScheduleRenderPhaseUpdate = !1,
renderPhaseUpdates = null,
numberOfReRenders = 0;
didScheduleRenderPhaseUpdate = !1;
function throwInvalidHookError() {
throw Error(
"Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem."
@ -3153,7 +3151,7 @@ function throwInvalidHookError() {
function areHookInputsEqual(nextDeps, prevDeps) {
if (null === prevDeps) return !1;
for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++)
if (!is$1(nextDeps[i], prevDeps[i])) return !1;
if (!objectIs(nextDeps[i], prevDeps[i])) return !1;
return !0;
}
function renderWithHooks(
@ -3174,36 +3172,32 @@ function renderWithHooks(
? HooksDispatcherOnMount
: HooksDispatcherOnUpdate;
current = Component(props, secondArg);
if (didScheduleRenderPhaseUpdate) {
do
(didScheduleRenderPhaseUpdate = !1),
(numberOfReRenders += 1),
(workInProgressHook = currentHook = null),
(workInProgress.updateQueue = null),
(ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdate),
(current = Component(props, secondArg));
while (didScheduleRenderPhaseUpdate);
renderPhaseUpdates = null;
numberOfReRenders = 0;
if (workInProgress.expirationTime === renderExpirationTime$1) {
nextRenderExpirationTime = 0;
do {
workInProgress.expirationTime = 0;
if (!(25 > nextRenderExpirationTime))
throw Error(
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
);
nextRenderExpirationTime += 1;
workInProgressHook = currentHook = null;
workInProgress.updateQueue = null;
ReactCurrentDispatcher$1.current = HooksDispatcherOnRerender;
current = Component(props, secondArg);
} while (workInProgress.expirationTime === renderExpirationTime$1);
}
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
workInProgress = null !== currentHook && null !== currentHook.next;
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
if (workInProgress)
throw Error(
"Rendered fewer hooks than expected. This may be caused by an accidental early return statement."
);
return current;
}
function resetHooks() {
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
renderPhaseUpdates = null;
numberOfReRenders = 0;
}
function mountWorkInProgressHook() {
var hook = {
memoizedState: null,
@ -3258,57 +3252,36 @@ function updateReducer(reducer) {
"Should have a queue. This is likely a bug in React. Please file an issue."
);
queue.lastRenderedReducer = reducer;
if (0 < numberOfReRenders) {
var _dispatch = queue.dispatch;
if (null !== renderPhaseUpdates) {
var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
if (void 0 !== firstRenderPhaseUpdate) {
renderPhaseUpdates.delete(queue);
var newState = hook.memoizedState;
do
(newState = reducer(newState, firstRenderPhaseUpdate.action)),
(firstRenderPhaseUpdate = firstRenderPhaseUpdate.next);
while (null !== firstRenderPhaseUpdate);
is$1(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
null === hook.baseQueue && (hook.baseState = newState);
queue.lastRenderedState = newState;
return [newState, _dispatch];
}
var current = currentHook,
baseQueue = current.baseQueue,
pendingQueue = queue.pending;
if (null !== pendingQueue) {
if (null !== baseQueue) {
var baseFirst = baseQueue.next;
baseQueue.next = pendingQueue.next;
pendingQueue.next = baseFirst;
}
return [hook.memoizedState, _dispatch];
}
newState = currentHook;
_dispatch = newState.baseQueue;
firstRenderPhaseUpdate = queue.pending;
if (null !== firstRenderPhaseUpdate) {
if (null !== _dispatch) {
var baseFirst = _dispatch.next;
_dispatch.next = firstRenderPhaseUpdate.next;
firstRenderPhaseUpdate.next = baseFirst;
}
newState.baseQueue = _dispatch = firstRenderPhaseUpdate;
current.baseQueue = baseQueue = pendingQueue;
queue.pending = null;
}
if (null !== _dispatch) {
_dispatch = _dispatch.next;
newState = newState.baseState;
var newBaseQueueLast = (baseFirst = firstRenderPhaseUpdate = null),
_update = _dispatch;
if (null !== baseQueue) {
baseQueue = baseQueue.next;
current = current.baseState;
var newBaseQueueLast = (baseFirst = pendingQueue = null),
update = baseQueue;
do {
var updateExpirationTime = _update.expirationTime;
var updateExpirationTime = update.expirationTime;
if (updateExpirationTime < renderExpirationTime$1) {
var clone = {
expirationTime: _update.expirationTime,
suspenseConfig: _update.suspenseConfig,
action: _update.action,
eagerReducer: _update.eagerReducer,
eagerState: _update.eagerState,
expirationTime: update.expirationTime,
suspenseConfig: update.suspenseConfig,
action: update.action,
eagerReducer: update.eagerReducer,
eagerState: update.eagerState,
next: null
};
null === newBaseQueueLast
? ((baseFirst = newBaseQueueLast = clone),
(firstRenderPhaseUpdate = newState))
? ((baseFirst = newBaseQueueLast = clone), (pendingQueue = current))
: (newBaseQueueLast = newBaseQueueLast.next = clone);
updateExpirationTime > currentlyRenderingFiber$1.expirationTime &&
((currentlyRenderingFiber$1.expirationTime = updateExpirationTime),
@ -3317,33 +3290,56 @@ function updateReducer(reducer) {
null !== newBaseQueueLast &&
(newBaseQueueLast = newBaseQueueLast.next = {
expirationTime: 1073741823,
suspenseConfig: _update.suspenseConfig,
action: _update.action,
eagerReducer: _update.eagerReducer,
eagerState: _update.eagerState,
suspenseConfig: update.suspenseConfig,
action: update.action,
eagerReducer: update.eagerReducer,
eagerState: update.eagerState,
next: null
}),
markRenderEventTimeAndConfig(
updateExpirationTime,
_update.suspenseConfig
update.suspenseConfig
),
(newState =
_update.eagerReducer === reducer
? _update.eagerState
: reducer(newState, _update.action));
_update = _update.next;
} while (null !== _update && _update !== _dispatch);
(current =
update.eagerReducer === reducer
? update.eagerState
: reducer(current, update.action));
update = update.next;
} while (null !== update && update !== baseQueue);
null === newBaseQueueLast
? (firstRenderPhaseUpdate = newState)
? (pendingQueue = current)
: (newBaseQueueLast.next = baseFirst);
is$1(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
hook.baseState = firstRenderPhaseUpdate;
objectIs(current, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = current;
hook.baseState = pendingQueue;
hook.baseQueue = newBaseQueueLast;
queue.lastRenderedState = newState;
queue.lastRenderedState = current;
}
return [hook.memoizedState, queue.dispatch];
}
function rerenderReducer(reducer) {
var hook = updateWorkInProgressHook(),
queue = hook.queue;
if (null === queue)
throw Error(
"Should have a queue. This is likely a bug in React. Please file an issue."
);
queue.lastRenderedReducer = reducer;
var dispatch = queue.dispatch,
lastRenderPhaseUpdate = queue.pending,
newState = hook.memoizedState;
if (null !== lastRenderPhaseUpdate) {
queue.pending = null;
var update = (lastRenderPhaseUpdate = lastRenderPhaseUpdate.next);
do (newState = reducer(newState, update.action)), (update = update.next);
while (update !== lastRenderPhaseUpdate);
objectIs(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
null === hook.baseQueue && (hook.baseState = newState);
queue.lastRenderedState = newState;
}
return [newState, dispatch];
}
function mountState(initialState) {
var hook = mountWorkInProgressHook();
"function" === typeof initialState && (initialState = initialState());
@ -3364,6 +3360,9 @@ function mountState(initialState) {
function updateState(initialState) {
return updateReducer(basicStateReducer, initialState);
}
function rerenderState(initialState) {
return rerenderReducer(basicStateReducer, initialState);
}
function pushEffect(tag, create, destroy, deps) {
tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null };
create = currentlyRenderingFiber$1.updateQueue;
@ -3380,6 +3379,9 @@ function pushEffect(tag, create, destroy, deps) {
(create.lastEffect = tag)));
return tag;
}
function updateRef() {
return updateWorkInProgressHook().memoizedState;
}
function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
var hook = mountWorkInProgressHook();
currentlyRenderingFiber$1.effectTag |= fiberEffectTag;
@ -3411,6 +3413,9 @@ function mountEffect(create, deps) {
function updateEffect(create, deps) {
return updateEffectImpl(516, 192, create, deps);
}
function updateLayoutEffect(create, deps) {
return updateEffectImpl(4, 36, create, deps);
}
function imperativeHandleEffect(create, ref) {
if ("function" === typeof ref)
return (
@ -3429,6 +3434,15 @@ function imperativeHandleEffect(create, ref) {
}
);
}
function updateImperativeHandle(ref, create, deps) {
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
return updateEffectImpl(
4,
36,
imperativeHandleEffect.bind(null, create, ref),
deps
);
}
function mountDebugValue() {}
function mountCallback(callback, deps) {
mountWorkInProgressHook().memoizedState = [
@ -3450,6 +3464,20 @@ function updateCallback(callback, deps) {
hook.memoizedState = [callback, deps];
return callback;
}
function updateMemo(nextCreate, deps) {
var hook = updateWorkInProgressHook();
deps = void 0 === deps ? null : deps;
var prevState = hook.memoizedState;
if (
null !== prevState &&
null !== deps &&
areHookInputsEqual(deps, prevState[1])
)
return prevState[0];
nextCreate = nextCreate();
hook.memoizedState = [nextCreate, deps];
return nextCreate;
}
function startTransition(setPending, config, callback) {
var priorityLevel = getCurrentPriorityLevel();
runWithPriority(98 > priorityLevel ? 98 : priorityLevel, function() {
@ -3466,62 +3494,42 @@ function startTransition(setPending, config, callback) {
});
}
function dispatchAction(fiber, queue, action) {
if (!(25 > numberOfReRenders))
throw Error(
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
);
var alternate = fiber.alternate;
var currentTime = requestCurrentTimeForUpdate(),
suspenseConfig = ReactCurrentBatchConfig.suspense;
currentTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
suspenseConfig = {
expirationTime: currentTime,
suspenseConfig: suspenseConfig,
action: action,
eagerReducer: null,
eagerState: null,
next: null
};
var pending = queue.pending;
null === pending
? (suspenseConfig.next = suspenseConfig)
: ((suspenseConfig.next = pending.next), (pending.next = suspenseConfig));
queue.pending = suspenseConfig;
pending = fiber.alternate;
if (
fiber === currentlyRenderingFiber$1 ||
(null !== alternate && alternate === currentlyRenderingFiber$1)
(null !== pending && pending === currentlyRenderingFiber$1)
)
if (
((didScheduleRenderPhaseUpdate = !0),
(fiber = {
expirationTime: renderExpirationTime$1,
suspenseConfig: null,
action: action,
eagerReducer: null,
eagerState: null,
next: null
}),
null === renderPhaseUpdates && (renderPhaseUpdates = new Map()),
(action = renderPhaseUpdates.get(queue)),
void 0 === action)
)
renderPhaseUpdates.set(queue, fiber);
else {
for (queue = action; null !== queue.next; ) queue = queue.next;
queue.next = fiber;
}
(didScheduleRenderPhaseUpdate = !0),
(suspenseConfig.expirationTime = renderExpirationTime$1),
(currentlyRenderingFiber$1.expirationTime = renderExpirationTime$1);
else {
var currentTime = requestCurrentTimeForUpdate(),
suspenseConfig = ReactCurrentBatchConfig.suspense;
currentTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
suspenseConfig = {
expirationTime: currentTime,
suspenseConfig: suspenseConfig,
action: action,
eagerReducer: null,
eagerState: null,
next: null
};
var pending = queue.pending;
null === pending
? (suspenseConfig.next = suspenseConfig)
: ((suspenseConfig.next = pending.next), (pending.next = suspenseConfig));
queue.pending = suspenseConfig;
if (
0 === fiber.expirationTime &&
(null === alternate || 0 === alternate.expirationTime) &&
((alternate = queue.lastRenderedReducer), null !== alternate)
(null === pending || 0 === pending.expirationTime) &&
((pending = queue.lastRenderedReducer), null !== pending)
)
try {
var currentState = queue.lastRenderedState,
eagerState = alternate(currentState, action);
suspenseConfig.eagerReducer = alternate;
eagerState = pending(currentState, action);
suspenseConfig.eagerReducer = pending;
suspenseConfig.eagerState = eagerState;
if (is$1(eagerState, currentState)) return;
if (objectIs(eagerState, currentState)) return;
} catch (error) {
} finally {
}
@ -3630,36 +3638,11 @@ var ContextOnlyDispatcher = {
useCallback: updateCallback,
useContext: readContext,
useEffect: updateEffect,
useImperativeHandle: function(ref, create, deps) {
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
return updateEffectImpl(
4,
36,
imperativeHandleEffect.bind(null, create, ref),
deps
);
},
useLayoutEffect: function(create, deps) {
return updateEffectImpl(4, 36, create, deps);
},
useMemo: function(nextCreate, deps) {
var hook = updateWorkInProgressHook();
deps = void 0 === deps ? null : deps;
var prevState = hook.memoizedState;
if (
null !== prevState &&
null !== deps &&
areHookInputsEqual(deps, prevState[1])
)
return prevState[0];
nextCreate = nextCreate();
hook.memoizedState = [nextCreate, deps];
return nextCreate;
},
useImperativeHandle: updateImperativeHandle,
useLayoutEffect: updateLayoutEffect,
useMemo: updateMemo,
useReducer: updateReducer,
useRef: function() {
return updateWorkInProgressHook().memoizedState;
},
useRef: updateRef,
useState: updateState,
useDebugValue: mountDebugValue,
useResponder: createDeprecatedResponderListener,
@ -3695,6 +3678,51 @@ var ContextOnlyDispatcher = {
];
}
},
HooksDispatcherOnRerender = {
readContext: readContext,
useCallback: updateCallback,
useContext: readContext,
useEffect: updateEffect,
useImperativeHandle: updateImperativeHandle,
useLayoutEffect: updateLayoutEffect,
useMemo: updateMemo,
useReducer: rerenderReducer,
useRef: updateRef,
useState: rerenderState,
useDebugValue: mountDebugValue,
useResponder: createDeprecatedResponderListener,
useDeferredValue: function(value, config) {
var _rerenderState = rerenderState(value),
prevValue = _rerenderState[0],
setValue = _rerenderState[1];
updateEffect(
function() {
var previousConfig = ReactCurrentBatchConfig$1.suspense;
ReactCurrentBatchConfig$1.suspense =
void 0 === config ? null : config;
try {
setValue(value);
} finally {
ReactCurrentBatchConfig$1.suspense = previousConfig;
}
},
[value, config]
);
return prevValue;
},
useTransition: function(config) {
var _rerenderState2 = rerenderState(!1),
isPending = _rerenderState2[0];
_rerenderState2 = _rerenderState2[1];
return [
updateCallback(startTransition.bind(null, _rerenderState2, config), [
_rerenderState2,
config
]),
isPending
];
}
},
hydrationParentFiber = null,
nextHydratableInstance = null,
isHydrating = !1;
@ -5713,8 +5741,8 @@ function requestCurrentTimeForUpdate() {
return (executionContext & (RenderContext | CommitContext)) !== NoContext
? 1073741821 - ((now() / 10) | 0)
: 0 !== currentEventTime
? currentEventTime
: (currentEventTime = 1073741821 - ((now() / 10) | 0));
? currentEventTime
: (currentEventTime = 1073741821 - ((now() / 10) | 0));
}
function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
fiber = fiber.mode;
@ -5821,9 +5849,10 @@ function getNextRootExpirationTimeToWorkOn(root) {
if (0 !== lastExpiredTime) return lastExpiredTime;
lastExpiredTime = root.firstPendingTime;
if (!isRootSuspendedAtTime(root, lastExpiredTime)) return lastExpiredTime;
lastExpiredTime = root.lastPingedTime;
var lastPingedTime = root.lastPingedTime;
root = root.nextKnownPendingLevel;
return lastExpiredTime > root ? lastExpiredTime : root;
root = lastPingedTime > root ? lastPingedTime : root;
return 2 >= root && lastExpiredTime !== root ? 0 : root;
}
function ensureRootIsScheduled(root) {
if (0 !== root.lastExpiredTime)
@ -5845,18 +5874,18 @@ function ensureRootIsScheduled(root) {
1073741823 === expirationTime
? (priorityLevel = 99)
: 1 === expirationTime || 2 === expirationTime
? (priorityLevel = 95)
: ((priorityLevel =
10 * (1073741821 - expirationTime) -
10 * (1073741821 - priorityLevel)),
(priorityLevel =
0 >= priorityLevel
? 99
: 250 >= priorityLevel
? 98
: 5250 >= priorityLevel
? 97
: 95));
? (priorityLevel = 95)
: ((priorityLevel =
10 * (1073741821 - expirationTime) -
10 * (1073741821 - priorityLevel)),
(priorityLevel =
0 >= priorityLevel
? 99
: 250 >= priorityLevel
? 98
: 5250 >= priorityLevel
? 97
: 95));
if (null !== existingCallbackNode) {
var existingCallbackPriority = root.callbackPriority;
if (
@ -6006,35 +6035,34 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
10 * (1073741821 - workInProgressRootLatestSuspenseTimeout) -
now())
: 1073741823 === workInProgressRootLatestProcessedExpirationTime
? (prevExecutionContext = 0)
: ((prevExecutionContext =
10 *
(1073741821 -
workInProgressRootLatestProcessedExpirationTime) -
5e3),
(prevDispatcher = now()),
(expirationTime =
10 * (1073741821 - expirationTime) - prevDispatcher),
(prevExecutionContext =
prevDispatcher - prevExecutionContext),
0 > prevExecutionContext && (prevExecutionContext = 0),
(prevExecutionContext =
(120 > prevExecutionContext
? 120
: 480 > prevExecutionContext
? 480
: 1080 > prevExecutionContext
? 1080
: 1920 > prevExecutionContext
? 1920
: 3e3 > prevExecutionContext
? 3e3
: 4320 > prevExecutionContext
? 4320
: 1960 * ceil(prevExecutionContext / 1960)) -
prevExecutionContext),
expirationTime < prevExecutionContext &&
(prevExecutionContext = expirationTime));
? (prevExecutionContext = 0)
: ((prevExecutionContext =
10 *
(1073741821 -
workInProgressRootLatestProcessedExpirationTime) -
5e3),
(prevDispatcher = now()),
(expirationTime =
10 * (1073741821 - expirationTime) - prevDispatcher),
(prevExecutionContext = prevDispatcher - prevExecutionContext),
0 > prevExecutionContext && (prevExecutionContext = 0),
(prevExecutionContext =
(120 > prevExecutionContext
? 120
: 480 > prevExecutionContext
? 480
: 1080 > prevExecutionContext
? 1080
: 1920 > prevExecutionContext
? 1920
: 3e3 > prevExecutionContext
? 3e3
: 4320 > prevExecutionContext
? 4320
: 1960 * ceil(prevExecutionContext / 1960)) -
prevExecutionContext),
expirationTime < prevExecutionContext &&
(prevExecutionContext = expirationTime));
if (10 < prevExecutionContext) {
root.timeoutHandle = scheduleTimeout(
commitRoot.bind(null, root),
@ -6189,7 +6217,20 @@ function handleError(root$jscomp$0, thrownValue) {
do {
try {
resetContextDependencies();
resetHooks();
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
if (didScheduleRenderPhaseUpdate)
for (
var hook = currentlyRenderingFiber$1.memoizedState;
null !== hook;
) {
var queue = hook.queue;
null !== queue && (queue.pending = null);
hook = hook.next;
}
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
if (null === workInProgress || null === workInProgress.return)
return (
(workInProgressRootExitStatus = RootFatalErrored),
@ -6232,10 +6273,10 @@ function handleError(root$jscomp$0, thrownValue) {
void 0 === props.fallback
? !1
: !0 !== props.unstable_avoidThisFallback
? !0
: hasInvisibleParentBoundary
? !1
: !0;
? !0
: hasInvisibleParentBoundary
? !1
: !0;
}
}
if (JSCompiler_temp) {
@ -6742,10 +6783,7 @@ function pingSuspendedRoot(root, thenable, suspendedTime) {
: isRootSuspendedAtTime(root, suspendedTime) &&
((thenable = root.lastPingedTime),
(0 !== thenable && thenable < suspendedTime) ||
((root.lastPingedTime = suspendedTime),
root.finishedExpirationTime === suspendedTime &&
((root.finishedExpirationTime = 0), (root.finishedWork = null)),
ensureRootIsScheduled(root)));
((root.lastPingedTime = suspendedTime), ensureRootIsScheduled(root)));
}
function resolveRetryThenable(boundaryFiber, thenable) {
var retryCache = boundaryFiber.stateNode;
@ -6880,7 +6918,8 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) {
void 0 === renderState.$$typeof
) {
workInProgress.tag = 1;
resetHooks();
workInProgress.memoizedState = null;
workInProgress.updateQueue = null;
if (isContextProvider(updateExpirationTime)) {
var hasContext = !0;
pushContextProvider(workInProgress);
@ -7153,7 +7192,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) {
pushProvider(workInProgress, hasContext);
if (null !== getDerivedStateFromProps) {
var oldValue = getDerivedStateFromProps.value;
hasContext = is$1(oldValue, hasContext)
hasContext = objectIs(oldValue, hasContext)
? 0
: ("function" === typeof updateExpirationTime._calculateChangedBits
? updateExpirationTime._calculateChangedBits(
@ -7708,8 +7747,8 @@ function findNodeHandle(componentOrHandle) {
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical._nativeTag
: componentOrHandle._nativeTag;
? componentOrHandle.canonical._nativeTag
: componentOrHandle._nativeTag;
}
batchedUpdatesImpl = function(fn, a) {
var prevExecutionContext = executionContext;
@ -7832,8 +7871,8 @@ var roots = new Map(),
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical
: componentOrHandle;
? componentOrHandle.canonical
: componentOrHandle;
},
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
@ -8017,7 +8056,7 @@ var roots = new Map(),
throw Error("getInspectorDataForViewTag() is not available in production");
},
bundleType: 0,
version: "16.12.0-19f6fe170",
version: "16.12.0-241c4467e",
rendererPackageName: "react-native-renderer"
});
var ReactNativeRenderer$2 = { default: ReactNativeRenderer },

Просмотреть файл

@ -349,8 +349,8 @@ function SyntheticEvent(
((targetInst = dispatchConfig[propName])
? (this[propName] = targetInst(nativeEvent))
: "target" === propName
? (this.target = nativeEventTarget)
: (this[propName] = nativeEvent[propName]));
? (this.target = nativeEventTarget)
: (this[propName] = nativeEvent[propName]));
this.isDefaultPrevented = (null != nativeEvent.defaultPrevented
? nativeEvent.defaultPrevented
: !1 === nativeEvent.returnValue)
@ -563,10 +563,10 @@ function accumulate(current, next) {
return null == current
? next
: Array.isArray(current)
? current.concat(next)
: Array.isArray(next)
? [current].concat(next)
: [current, next];
? current.concat(next)
: Array.isArray(next)
? [current].concat(next)
: [current, next];
}
var responderInst = null,
trackedTouchCount = 0;
@ -668,10 +668,10 @@ var eventTypes = {
var shouldSetEventType = isStartish(topLevelType)
? eventTypes.startShouldSetResponder
: isMoveish(topLevelType)
? eventTypes.moveShouldSetResponder
: "topSelectionChange" === topLevelType
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
? eventTypes.moveShouldSetResponder
: "topSelectionChange" === topLevelType
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
if (responderInst)
b: {
var JSCompiler_temp = responderInst;
@ -825,10 +825,10 @@ var eventTypes = {
(shouldSetEventType = shouldSetEventType
? eventTypes.responderStart
: JSCompiler_temp
? eventTypes.responderMove
: targetInst
? eventTypes.responderEnd
: null)
? eventTypes.responderMove
: targetInst
? eventTypes.responderEnd
: null)
)
(shouldSetEventType = ResponderSyntheticEvent.getPooled(
shouldSetEventType,
@ -891,8 +891,8 @@ var eventTypes = {
(topLevelType = shouldSetEventType
? eventTypes.responderTerminate
: topLevelType
? eventTypes.responderRelease
: null)
? eventTypes.responderRelease
: null)
)
(nativeEvent = ResponderSyntheticEvent.getPooled(
topLevelType,
@ -1376,8 +1376,8 @@ function diffNestedProperty(
return nextProp
? addNestedProperty(updatePayload, nextProp, validAttributes)
: prevProp
? clearNestedProperty(updatePayload, prevProp, validAttributes)
: updatePayload;
? clearNestedProperty(updatePayload, prevProp, validAttributes)
: updatePayload;
if (!Array.isArray(prevProp) && !Array.isArray(nextProp))
return diffProperties(updatePayload, prevProp, nextProp, validAttributes);
if (Array.isArray(prevProp) && Array.isArray(nextProp)) {
@ -1900,18 +1900,18 @@ function inferPriorityFromExpirationTime(currentTime, expirationTime) {
return 0 >= currentTime
? 99
: 250 >= currentTime
? 98
: 5250 >= currentTime
? 97
: 95;
? 98
: 5250 >= currentTime
? 97
: 95;
}
function is(x, y) {
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
}
var is$1 = "function" === typeof Object.is ? Object.is : is,
var objectIs = "function" === typeof Object.is ? Object.is : is,
hasOwnProperty = Object.prototype.hasOwnProperty;
function shallowEqual(objA, objB) {
if (is$1(objA, objB)) return !0;
if (objectIs(objA, objB)) return !0;
if (
"object" !== typeof objA ||
null === objA ||
@ -1925,7 +1925,7 @@ function shallowEqual(objA, objB) {
for (keysB = 0; keysB < keysA.length; keysB++)
if (
!hasOwnProperty.call(objB, keysA[keysB]) ||
!is$1(objA[keysA[keysB]], objB[keysA[keysB]])
!objectIs(objA[keysA[keysB]], objB[keysA[keysB]])
)
return !1;
return !0;
@ -2277,8 +2277,8 @@ function checkShouldComponentUpdate(
return "function" === typeof workInProgress.shouldComponentUpdate
? workInProgress.shouldComponentUpdate(newProps, newState, nextContext)
: ctor.prototype && ctor.prototype.isPureReactComponent
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
: !0;
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
: !0;
}
function constructClassInstance(workInProgress, ctor, props) {
var isLegacyContextConsumer = !1,
@ -3173,9 +3173,7 @@ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher,
currentlyRenderingFiber$1 = null,
currentHook = null,
workInProgressHook = null,
didScheduleRenderPhaseUpdate = !1,
renderPhaseUpdates = null,
numberOfReRenders = 0;
didScheduleRenderPhaseUpdate = !1;
function throwInvalidHookError() {
throw Error(
"Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem."
@ -3184,7 +3182,7 @@ function throwInvalidHookError() {
function areHookInputsEqual(nextDeps, prevDeps) {
if (null === prevDeps) return !1;
for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++)
if (!is$1(nextDeps[i], prevDeps[i])) return !1;
if (!objectIs(nextDeps[i], prevDeps[i])) return !1;
return !0;
}
function renderWithHooks(
@ -3205,36 +3203,32 @@ function renderWithHooks(
? HooksDispatcherOnMount
: HooksDispatcherOnUpdate;
current = Component(props, secondArg);
if (didScheduleRenderPhaseUpdate) {
do
(didScheduleRenderPhaseUpdate = !1),
(numberOfReRenders += 1),
(workInProgressHook = currentHook = null),
(workInProgress.updateQueue = null),
(ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdate),
(current = Component(props, secondArg));
while (didScheduleRenderPhaseUpdate);
renderPhaseUpdates = null;
numberOfReRenders = 0;
if (workInProgress.expirationTime === renderExpirationTime$1) {
nextRenderExpirationTime = 0;
do {
workInProgress.expirationTime = 0;
if (!(25 > nextRenderExpirationTime))
throw Error(
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
);
nextRenderExpirationTime += 1;
workInProgressHook = currentHook = null;
workInProgress.updateQueue = null;
ReactCurrentDispatcher$1.current = HooksDispatcherOnRerender;
current = Component(props, secondArg);
} while (workInProgress.expirationTime === renderExpirationTime$1);
}
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
workInProgress = null !== currentHook && null !== currentHook.next;
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
if (workInProgress)
throw Error(
"Rendered fewer hooks than expected. This may be caused by an accidental early return statement."
);
return current;
}
function resetHooks() {
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
renderPhaseUpdates = null;
numberOfReRenders = 0;
}
function mountWorkInProgressHook() {
var hook = {
memoizedState: null,
@ -3289,57 +3283,36 @@ function updateReducer(reducer) {
"Should have a queue. This is likely a bug in React. Please file an issue."
);
queue.lastRenderedReducer = reducer;
if (0 < numberOfReRenders) {
var _dispatch = queue.dispatch;
if (null !== renderPhaseUpdates) {
var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
if (void 0 !== firstRenderPhaseUpdate) {
renderPhaseUpdates.delete(queue);
var newState = hook.memoizedState;
do
(newState = reducer(newState, firstRenderPhaseUpdate.action)),
(firstRenderPhaseUpdate = firstRenderPhaseUpdate.next);
while (null !== firstRenderPhaseUpdate);
is$1(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
null === hook.baseQueue && (hook.baseState = newState);
queue.lastRenderedState = newState;
return [newState, _dispatch];
}
var current = currentHook,
baseQueue = current.baseQueue,
pendingQueue = queue.pending;
if (null !== pendingQueue) {
if (null !== baseQueue) {
var baseFirst = baseQueue.next;
baseQueue.next = pendingQueue.next;
pendingQueue.next = baseFirst;
}
return [hook.memoizedState, _dispatch];
}
newState = currentHook;
_dispatch = newState.baseQueue;
firstRenderPhaseUpdate = queue.pending;
if (null !== firstRenderPhaseUpdate) {
if (null !== _dispatch) {
var baseFirst = _dispatch.next;
_dispatch.next = firstRenderPhaseUpdate.next;
firstRenderPhaseUpdate.next = baseFirst;
}
newState.baseQueue = _dispatch = firstRenderPhaseUpdate;
current.baseQueue = baseQueue = pendingQueue;
queue.pending = null;
}
if (null !== _dispatch) {
_dispatch = _dispatch.next;
newState = newState.baseState;
var newBaseQueueLast = (baseFirst = firstRenderPhaseUpdate = null),
_update = _dispatch;
if (null !== baseQueue) {
baseQueue = baseQueue.next;
current = current.baseState;
var newBaseQueueLast = (baseFirst = pendingQueue = null),
update = baseQueue;
do {
var updateExpirationTime = _update.expirationTime;
var updateExpirationTime = update.expirationTime;
if (updateExpirationTime < renderExpirationTime$1) {
var clone = {
expirationTime: _update.expirationTime,
suspenseConfig: _update.suspenseConfig,
action: _update.action,
eagerReducer: _update.eagerReducer,
eagerState: _update.eagerState,
expirationTime: update.expirationTime,
suspenseConfig: update.suspenseConfig,
action: update.action,
eagerReducer: update.eagerReducer,
eagerState: update.eagerState,
next: null
};
null === newBaseQueueLast
? ((baseFirst = newBaseQueueLast = clone),
(firstRenderPhaseUpdate = newState))
? ((baseFirst = newBaseQueueLast = clone), (pendingQueue = current))
: (newBaseQueueLast = newBaseQueueLast.next = clone);
updateExpirationTime > currentlyRenderingFiber$1.expirationTime &&
((currentlyRenderingFiber$1.expirationTime = updateExpirationTime),
@ -3348,33 +3321,56 @@ function updateReducer(reducer) {
null !== newBaseQueueLast &&
(newBaseQueueLast = newBaseQueueLast.next = {
expirationTime: 1073741823,
suspenseConfig: _update.suspenseConfig,
action: _update.action,
eagerReducer: _update.eagerReducer,
eagerState: _update.eagerState,
suspenseConfig: update.suspenseConfig,
action: update.action,
eagerReducer: update.eagerReducer,
eagerState: update.eagerState,
next: null
}),
markRenderEventTimeAndConfig(
updateExpirationTime,
_update.suspenseConfig
update.suspenseConfig
),
(newState =
_update.eagerReducer === reducer
? _update.eagerState
: reducer(newState, _update.action));
_update = _update.next;
} while (null !== _update && _update !== _dispatch);
(current =
update.eagerReducer === reducer
? update.eagerState
: reducer(current, update.action));
update = update.next;
} while (null !== update && update !== baseQueue);
null === newBaseQueueLast
? (firstRenderPhaseUpdate = newState)
? (pendingQueue = current)
: (newBaseQueueLast.next = baseFirst);
is$1(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
hook.baseState = firstRenderPhaseUpdate;
objectIs(current, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = current;
hook.baseState = pendingQueue;
hook.baseQueue = newBaseQueueLast;
queue.lastRenderedState = newState;
queue.lastRenderedState = current;
}
return [hook.memoizedState, queue.dispatch];
}
function rerenderReducer(reducer) {
var hook = updateWorkInProgressHook(),
queue = hook.queue;
if (null === queue)
throw Error(
"Should have a queue. This is likely a bug in React. Please file an issue."
);
queue.lastRenderedReducer = reducer;
var dispatch = queue.dispatch,
lastRenderPhaseUpdate = queue.pending,
newState = hook.memoizedState;
if (null !== lastRenderPhaseUpdate) {
queue.pending = null;
var update = (lastRenderPhaseUpdate = lastRenderPhaseUpdate.next);
do (newState = reducer(newState, update.action)), (update = update.next);
while (update !== lastRenderPhaseUpdate);
objectIs(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
null === hook.baseQueue && (hook.baseState = newState);
queue.lastRenderedState = newState;
}
return [newState, dispatch];
}
function mountState(initialState) {
var hook = mountWorkInProgressHook();
"function" === typeof initialState && (initialState = initialState());
@ -3395,6 +3391,9 @@ function mountState(initialState) {
function updateState(initialState) {
return updateReducer(basicStateReducer, initialState);
}
function rerenderState(initialState) {
return rerenderReducer(basicStateReducer, initialState);
}
function pushEffect(tag, create, destroy, deps) {
tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null };
create = currentlyRenderingFiber$1.updateQueue;
@ -3411,6 +3410,9 @@ function pushEffect(tag, create, destroy, deps) {
(create.lastEffect = tag)));
return tag;
}
function updateRef() {
return updateWorkInProgressHook().memoizedState;
}
function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
var hook = mountWorkInProgressHook();
currentlyRenderingFiber$1.effectTag |= fiberEffectTag;
@ -3442,6 +3444,9 @@ function mountEffect(create, deps) {
function updateEffect(create, deps) {
return updateEffectImpl(516, 192, create, deps);
}
function updateLayoutEffect(create, deps) {
return updateEffectImpl(4, 36, create, deps);
}
function imperativeHandleEffect(create, ref) {
if ("function" === typeof ref)
return (
@ -3460,6 +3465,15 @@ function imperativeHandleEffect(create, ref) {
}
);
}
function updateImperativeHandle(ref, create, deps) {
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
return updateEffectImpl(
4,
36,
imperativeHandleEffect.bind(null, create, ref),
deps
);
}
function mountDebugValue() {}
function mountCallback(callback, deps) {
mountWorkInProgressHook().memoizedState = [
@ -3481,6 +3495,20 @@ function updateCallback(callback, deps) {
hook.memoizedState = [callback, deps];
return callback;
}
function updateMemo(nextCreate, deps) {
var hook = updateWorkInProgressHook();
deps = void 0 === deps ? null : deps;
var prevState = hook.memoizedState;
if (
null !== prevState &&
null !== deps &&
areHookInputsEqual(deps, prevState[1])
)
return prevState[0];
nextCreate = nextCreate();
hook.memoizedState = [nextCreate, deps];
return nextCreate;
}
function startTransition(setPending, config, callback) {
var priorityLevel = getCurrentPriorityLevel();
runWithPriority(98 > priorityLevel ? 98 : priorityLevel, function() {
@ -3497,62 +3525,42 @@ function startTransition(setPending, config, callback) {
});
}
function dispatchAction(fiber, queue, action) {
if (!(25 > numberOfReRenders))
throw Error(
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
);
var alternate = fiber.alternate;
var currentTime = requestCurrentTimeForUpdate(),
suspenseConfig = ReactCurrentBatchConfig.suspense;
currentTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
suspenseConfig = {
expirationTime: currentTime,
suspenseConfig: suspenseConfig,
action: action,
eagerReducer: null,
eagerState: null,
next: null
};
var pending = queue.pending;
null === pending
? (suspenseConfig.next = suspenseConfig)
: ((suspenseConfig.next = pending.next), (pending.next = suspenseConfig));
queue.pending = suspenseConfig;
pending = fiber.alternate;
if (
fiber === currentlyRenderingFiber$1 ||
(null !== alternate && alternate === currentlyRenderingFiber$1)
(null !== pending && pending === currentlyRenderingFiber$1)
)
if (
((didScheduleRenderPhaseUpdate = !0),
(fiber = {
expirationTime: renderExpirationTime$1,
suspenseConfig: null,
action: action,
eagerReducer: null,
eagerState: null,
next: null
}),
null === renderPhaseUpdates && (renderPhaseUpdates = new Map()),
(action = renderPhaseUpdates.get(queue)),
void 0 === action)
)
renderPhaseUpdates.set(queue, fiber);
else {
for (queue = action; null !== queue.next; ) queue = queue.next;
queue.next = fiber;
}
(didScheduleRenderPhaseUpdate = !0),
(suspenseConfig.expirationTime = renderExpirationTime$1),
(currentlyRenderingFiber$1.expirationTime = renderExpirationTime$1);
else {
var currentTime = requestCurrentTimeForUpdate(),
suspenseConfig = ReactCurrentBatchConfig.suspense;
currentTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
suspenseConfig = {
expirationTime: currentTime,
suspenseConfig: suspenseConfig,
action: action,
eagerReducer: null,
eagerState: null,
next: null
};
var pending = queue.pending;
null === pending
? (suspenseConfig.next = suspenseConfig)
: ((suspenseConfig.next = pending.next), (pending.next = suspenseConfig));
queue.pending = suspenseConfig;
if (
0 === fiber.expirationTime &&
(null === alternate || 0 === alternate.expirationTime) &&
((alternate = queue.lastRenderedReducer), null !== alternate)
(null === pending || 0 === pending.expirationTime) &&
((pending = queue.lastRenderedReducer), null !== pending)
)
try {
var currentState = queue.lastRenderedState,
eagerState = alternate(currentState, action);
suspenseConfig.eagerReducer = alternate;
eagerState = pending(currentState, action);
suspenseConfig.eagerReducer = pending;
suspenseConfig.eagerState = eagerState;
if (is$1(eagerState, currentState)) return;
if (objectIs(eagerState, currentState)) return;
} catch (error) {
} finally {
}
@ -3661,36 +3669,11 @@ var ContextOnlyDispatcher = {
useCallback: updateCallback,
useContext: readContext,
useEffect: updateEffect,
useImperativeHandle: function(ref, create, deps) {
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
return updateEffectImpl(
4,
36,
imperativeHandleEffect.bind(null, create, ref),
deps
);
},
useLayoutEffect: function(create, deps) {
return updateEffectImpl(4, 36, create, deps);
},
useMemo: function(nextCreate, deps) {
var hook = updateWorkInProgressHook();
deps = void 0 === deps ? null : deps;
var prevState = hook.memoizedState;
if (
null !== prevState &&
null !== deps &&
areHookInputsEqual(deps, prevState[1])
)
return prevState[0];
nextCreate = nextCreate();
hook.memoizedState = [nextCreate, deps];
return nextCreate;
},
useImperativeHandle: updateImperativeHandle,
useLayoutEffect: updateLayoutEffect,
useMemo: updateMemo,
useReducer: updateReducer,
useRef: function() {
return updateWorkInProgressHook().memoizedState;
},
useRef: updateRef,
useState: updateState,
useDebugValue: mountDebugValue,
useResponder: createDeprecatedResponderListener,
@ -3726,6 +3709,51 @@ var ContextOnlyDispatcher = {
];
}
},
HooksDispatcherOnRerender = {
readContext: readContext,
useCallback: updateCallback,
useContext: readContext,
useEffect: updateEffect,
useImperativeHandle: updateImperativeHandle,
useLayoutEffect: updateLayoutEffect,
useMemo: updateMemo,
useReducer: rerenderReducer,
useRef: updateRef,
useState: rerenderState,
useDebugValue: mountDebugValue,
useResponder: createDeprecatedResponderListener,
useDeferredValue: function(value, config) {
var _rerenderState = rerenderState(value),
prevValue = _rerenderState[0],
setValue = _rerenderState[1];
updateEffect(
function() {
var previousConfig = ReactCurrentBatchConfig$1.suspense;
ReactCurrentBatchConfig$1.suspense =
void 0 === config ? null : config;
try {
setValue(value);
} finally {
ReactCurrentBatchConfig$1.suspense = previousConfig;
}
},
[value, config]
);
return prevValue;
},
useTransition: function(config) {
var _rerenderState2 = rerenderState(!1),
isPending = _rerenderState2[0];
_rerenderState2 = _rerenderState2[1];
return [
updateCallback(startTransition.bind(null, _rerenderState2, config), [
_rerenderState2,
config
]),
isPending
];
}
},
now$1 = Scheduler.unstable_now,
commitTime = 0,
profilerStartTime = -1;
@ -5799,8 +5827,8 @@ function requestCurrentTimeForUpdate() {
return (executionContext & (RenderContext | CommitContext)) !== NoContext
? 1073741821 - ((now() / 10) | 0)
: 0 !== currentEventTime
? currentEventTime
: (currentEventTime = 1073741821 - ((now() / 10) | 0));
? currentEventTime
: (currentEventTime = 1073741821 - ((now() / 10) | 0));
}
function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
fiber = fiber.mode;
@ -5910,9 +5938,10 @@ function getNextRootExpirationTimeToWorkOn(root) {
if (0 !== lastExpiredTime) return lastExpiredTime;
lastExpiredTime = root.firstPendingTime;
if (!isRootSuspendedAtTime(root, lastExpiredTime)) return lastExpiredTime;
lastExpiredTime = root.lastPingedTime;
var lastPingedTime = root.lastPingedTime;
root = root.nextKnownPendingLevel;
return lastExpiredTime > root ? lastExpiredTime : root;
root = lastPingedTime > root ? lastPingedTime : root;
return 2 >= root && lastExpiredTime !== root ? 0 : root;
}
function ensureRootIsScheduled(root) {
if (0 !== root.lastExpiredTime)
@ -6088,35 +6117,34 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
10 * (1073741821 - workInProgressRootLatestSuspenseTimeout) -
now())
: 1073741823 === workInProgressRootLatestProcessedExpirationTime
? (prevExecutionContext = 0)
: ((prevExecutionContext =
10 *
(1073741821 -
workInProgressRootLatestProcessedExpirationTime) -
5e3),
(prevDispatcher = now()),
(expirationTime =
10 * (1073741821 - expirationTime) - prevDispatcher),
(prevExecutionContext =
prevDispatcher - prevExecutionContext),
0 > prevExecutionContext && (prevExecutionContext = 0),
(prevExecutionContext =
(120 > prevExecutionContext
? 120
: 480 > prevExecutionContext
? 480
: 1080 > prevExecutionContext
? 1080
: 1920 > prevExecutionContext
? 1920
: 3e3 > prevExecutionContext
? 3e3
: 4320 > prevExecutionContext
? 4320
: 1960 * ceil(prevExecutionContext / 1960)) -
prevExecutionContext),
expirationTime < prevExecutionContext &&
(prevExecutionContext = expirationTime));
? (prevExecutionContext = 0)
: ((prevExecutionContext =
10 *
(1073741821 -
workInProgressRootLatestProcessedExpirationTime) -
5e3),
(prevDispatcher = now()),
(expirationTime =
10 * (1073741821 - expirationTime) - prevDispatcher),
(prevExecutionContext = prevDispatcher - prevExecutionContext),
0 > prevExecutionContext && (prevExecutionContext = 0),
(prevExecutionContext =
(120 > prevExecutionContext
? 120
: 480 > prevExecutionContext
? 480
: 1080 > prevExecutionContext
? 1080
: 1920 > prevExecutionContext
? 1920
: 3e3 > prevExecutionContext
? 3e3
: 4320 > prevExecutionContext
? 4320
: 1960 * ceil(prevExecutionContext / 1960)) -
prevExecutionContext),
expirationTime < prevExecutionContext &&
(prevExecutionContext = expirationTime));
if (10 < prevExecutionContext) {
root.timeoutHandle = scheduleTimeout(
commitRoot.bind(null, root),
@ -6275,7 +6303,20 @@ function handleError(root$jscomp$0, thrownValue) {
do {
try {
resetContextDependencies();
resetHooks();
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
if (didScheduleRenderPhaseUpdate)
for (
var hook = currentlyRenderingFiber$1.memoizedState;
null !== hook;
) {
var queue = hook.queue;
null !== queue && (queue.pending = null);
hook = hook.next;
}
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
if (null === workInProgress || null === workInProgress.return)
return (
(workInProgressRootExitStatus = RootFatalErrored),
@ -6320,10 +6361,10 @@ function handleError(root$jscomp$0, thrownValue) {
void 0 === props.fallback
? !1
: !0 !== props.unstable_avoidThisFallback
? !0
: hasInvisibleParentBoundary
? !1
: !0;
? !0
: hasInvisibleParentBoundary
? !1
: !0;
}
}
if (JSCompiler_temp) {
@ -6914,8 +6955,6 @@ function pingSuspendedRoot(root, thenable, suspendedTime) {
((thenable = root.lastPingedTime),
(0 !== thenable && thenable < suspendedTime) ||
((root.lastPingedTime = suspendedTime),
root.finishedExpirationTime === suspendedTime &&
((root.finishedExpirationTime = 0), (root.finishedWork = null)),
ensureRootIsScheduled(root),
schedulePendingInteractions(root, suspendedTime)));
}
@ -7058,7 +7097,8 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) {
void 0 === renderState.$$typeof
) {
workInProgress.tag = 1;
resetHooks();
workInProgress.memoizedState = null;
workInProgress.updateQueue = null;
if (isContextProvider(updateExpirationTime)) {
var hasContext = !0;
pushContextProvider(workInProgress);
@ -7332,7 +7372,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) {
pushProvider(workInProgress, hasContext);
if (null !== getDerivedStateFromProps) {
var oldValue = getDerivedStateFromProps.value;
hasContext = is$1(oldValue, hasContext)
hasContext = objectIs(oldValue, hasContext)
? 0
: ("function" === typeof updateExpirationTime._calculateChangedBits
? updateExpirationTime._calculateChangedBits(
@ -7984,8 +8024,8 @@ function findNodeHandle(componentOrHandle) {
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical._nativeTag
: componentOrHandle._nativeTag;
? componentOrHandle.canonical._nativeTag
: componentOrHandle._nativeTag;
}
batchedUpdatesImpl = function(fn, a) {
var prevExecutionContext = executionContext;
@ -8108,8 +8148,8 @@ var roots = new Map(),
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical
: componentOrHandle;
? componentOrHandle.canonical
: componentOrHandle;
},
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
@ -8295,7 +8335,7 @@ var roots = new Map(),
throw Error("getInspectorDataForViewTag() is not available in production");
},
bundleType: 0,
version: "16.12.0-experimental-19f6fe170",
version: "16.12.0-experimental-241c4467e",
rendererPackageName: "react-native-renderer"
});
var ReactNativeRenderer$2 = { default: ReactNativeRenderer },

Просмотреть файл

@ -350,8 +350,8 @@ function SyntheticEvent(
((targetInst = dispatchConfig[propName])
? (this[propName] = targetInst(nativeEvent))
: "target" === propName
? (this.target = nativeEventTarget)
: (this[propName] = nativeEvent[propName]));
? (this.target = nativeEventTarget)
: (this[propName] = nativeEvent[propName]));
this.isDefaultPrevented = (null != nativeEvent.defaultPrevented
? nativeEvent.defaultPrevented
: !1 === nativeEvent.returnValue)
@ -564,10 +564,10 @@ function accumulate(current, next) {
return null == current
? next
: Array.isArray(current)
? current.concat(next)
: Array.isArray(next)
? [current].concat(next)
: [current, next];
? current.concat(next)
: Array.isArray(next)
? [current].concat(next)
: [current, next];
}
var responderInst = null,
trackedTouchCount = 0;
@ -669,10 +669,10 @@ var eventTypes = {
var shouldSetEventType = isStartish(topLevelType)
? eventTypes.startShouldSetResponder
: isMoveish(topLevelType)
? eventTypes.moveShouldSetResponder
: "topSelectionChange" === topLevelType
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
? eventTypes.moveShouldSetResponder
: "topSelectionChange" === topLevelType
? eventTypes.selectionChangeShouldSetResponder
: eventTypes.scrollShouldSetResponder;
if (responderInst)
b: {
var JSCompiler_temp = responderInst;
@ -826,10 +826,10 @@ var eventTypes = {
(shouldSetEventType = shouldSetEventType
? eventTypes.responderStart
: JSCompiler_temp
? eventTypes.responderMove
: targetInst
? eventTypes.responderEnd
: null)
? eventTypes.responderMove
: targetInst
? eventTypes.responderEnd
: null)
)
(shouldSetEventType = ResponderSyntheticEvent.getPooled(
shouldSetEventType,
@ -892,8 +892,8 @@ var eventTypes = {
(topLevelType = shouldSetEventType
? eventTypes.responderTerminate
: topLevelType
? eventTypes.responderRelease
: null)
? eventTypes.responderRelease
: null)
)
(nativeEvent = ResponderSyntheticEvent.getPooled(
topLevelType,
@ -1366,8 +1366,8 @@ function diffNestedProperty(
return nextProp
? addNestedProperty(updatePayload, nextProp, validAttributes)
: prevProp
? clearNestedProperty(updatePayload, prevProp, validAttributes)
: updatePayload;
? clearNestedProperty(updatePayload, prevProp, validAttributes)
: updatePayload;
if (!Array.isArray(prevProp) && !Array.isArray(nextProp))
return diffProperties(updatePayload, prevProp, nextProp, validAttributes);
if (Array.isArray(prevProp) && Array.isArray(nextProp)) {
@ -1890,18 +1890,18 @@ function inferPriorityFromExpirationTime(currentTime, expirationTime) {
return 0 >= currentTime
? 99
: 250 >= currentTime
? 98
: 5250 >= currentTime
? 97
: 95;
? 98
: 5250 >= currentTime
? 97
: 95;
}
function is(x, y) {
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
}
var is$1 = "function" === typeof Object.is ? Object.is : is,
var objectIs = "function" === typeof Object.is ? Object.is : is,
hasOwnProperty = Object.prototype.hasOwnProperty;
function shallowEqual(objA, objB) {
if (is$1(objA, objB)) return !0;
if (objectIs(objA, objB)) return !0;
if (
"object" !== typeof objA ||
null === objA ||
@ -1915,7 +1915,7 @@ function shallowEqual(objA, objB) {
for (keysB = 0; keysB < keysA.length; keysB++)
if (
!hasOwnProperty.call(objB, keysA[keysB]) ||
!is$1(objA[keysA[keysB]], objB[keysA[keysB]])
!objectIs(objA[keysA[keysB]], objB[keysA[keysB]])
)
return !1;
return !0;
@ -2267,8 +2267,8 @@ function checkShouldComponentUpdate(
return "function" === typeof workInProgress.shouldComponentUpdate
? workInProgress.shouldComponentUpdate(newProps, newState, nextContext)
: ctor.prototype && ctor.prototype.isPureReactComponent
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
: !0;
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
: !0;
}
function constructClassInstance(workInProgress, ctor, props) {
var isLegacyContextConsumer = !1,
@ -3163,9 +3163,7 @@ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher,
currentlyRenderingFiber$1 = null,
currentHook = null,
workInProgressHook = null,
didScheduleRenderPhaseUpdate = !1,
renderPhaseUpdates = null,
numberOfReRenders = 0;
didScheduleRenderPhaseUpdate = !1;
function throwInvalidHookError() {
throw Error(
"Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem."
@ -3174,7 +3172,7 @@ function throwInvalidHookError() {
function areHookInputsEqual(nextDeps, prevDeps) {
if (null === prevDeps) return !1;
for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++)
if (!is$1(nextDeps[i], prevDeps[i])) return !1;
if (!objectIs(nextDeps[i], prevDeps[i])) return !1;
return !0;
}
function renderWithHooks(
@ -3195,36 +3193,32 @@ function renderWithHooks(
? HooksDispatcherOnMount
: HooksDispatcherOnUpdate;
current = Component(props, secondArg);
if (didScheduleRenderPhaseUpdate) {
do
(didScheduleRenderPhaseUpdate = !1),
(numberOfReRenders += 1),
(workInProgressHook = currentHook = null),
(workInProgress.updateQueue = null),
(ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdate),
(current = Component(props, secondArg));
while (didScheduleRenderPhaseUpdate);
renderPhaseUpdates = null;
numberOfReRenders = 0;
if (workInProgress.expirationTime === renderExpirationTime$1) {
nextRenderExpirationTime = 0;
do {
workInProgress.expirationTime = 0;
if (!(25 > nextRenderExpirationTime))
throw Error(
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
);
nextRenderExpirationTime += 1;
workInProgressHook = currentHook = null;
workInProgress.updateQueue = null;
ReactCurrentDispatcher$1.current = HooksDispatcherOnRerender;
current = Component(props, secondArg);
} while (workInProgress.expirationTime === renderExpirationTime$1);
}
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
workInProgress = null !== currentHook && null !== currentHook.next;
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
if (workInProgress)
throw Error(
"Rendered fewer hooks than expected. This may be caused by an accidental early return statement."
);
return current;
}
function resetHooks() {
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
renderPhaseUpdates = null;
numberOfReRenders = 0;
}
function mountWorkInProgressHook() {
var hook = {
memoizedState: null,
@ -3279,57 +3273,36 @@ function updateReducer(reducer) {
"Should have a queue. This is likely a bug in React. Please file an issue."
);
queue.lastRenderedReducer = reducer;
if (0 < numberOfReRenders) {
var _dispatch = queue.dispatch;
if (null !== renderPhaseUpdates) {
var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
if (void 0 !== firstRenderPhaseUpdate) {
renderPhaseUpdates.delete(queue);
var newState = hook.memoizedState;
do
(newState = reducer(newState, firstRenderPhaseUpdate.action)),
(firstRenderPhaseUpdate = firstRenderPhaseUpdate.next);
while (null !== firstRenderPhaseUpdate);
is$1(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
null === hook.baseQueue && (hook.baseState = newState);
queue.lastRenderedState = newState;
return [newState, _dispatch];
}
var current = currentHook,
baseQueue = current.baseQueue,
pendingQueue = queue.pending;
if (null !== pendingQueue) {
if (null !== baseQueue) {
var baseFirst = baseQueue.next;
baseQueue.next = pendingQueue.next;
pendingQueue.next = baseFirst;
}
return [hook.memoizedState, _dispatch];
}
newState = currentHook;
_dispatch = newState.baseQueue;
firstRenderPhaseUpdate = queue.pending;
if (null !== firstRenderPhaseUpdate) {
if (null !== _dispatch) {
var baseFirst = _dispatch.next;
_dispatch.next = firstRenderPhaseUpdate.next;
firstRenderPhaseUpdate.next = baseFirst;
}
newState.baseQueue = _dispatch = firstRenderPhaseUpdate;
current.baseQueue = baseQueue = pendingQueue;
queue.pending = null;
}
if (null !== _dispatch) {
_dispatch = _dispatch.next;
newState = newState.baseState;
var newBaseQueueLast = (baseFirst = firstRenderPhaseUpdate = null),
_update = _dispatch;
if (null !== baseQueue) {
baseQueue = baseQueue.next;
current = current.baseState;
var newBaseQueueLast = (baseFirst = pendingQueue = null),
update = baseQueue;
do {
var updateExpirationTime = _update.expirationTime;
var updateExpirationTime = update.expirationTime;
if (updateExpirationTime < renderExpirationTime$1) {
var clone = {
expirationTime: _update.expirationTime,
suspenseConfig: _update.suspenseConfig,
action: _update.action,
eagerReducer: _update.eagerReducer,
eagerState: _update.eagerState,
expirationTime: update.expirationTime,
suspenseConfig: update.suspenseConfig,
action: update.action,
eagerReducer: update.eagerReducer,
eagerState: update.eagerState,
next: null
};
null === newBaseQueueLast
? ((baseFirst = newBaseQueueLast = clone),
(firstRenderPhaseUpdate = newState))
? ((baseFirst = newBaseQueueLast = clone), (pendingQueue = current))
: (newBaseQueueLast = newBaseQueueLast.next = clone);
updateExpirationTime > currentlyRenderingFiber$1.expirationTime &&
((currentlyRenderingFiber$1.expirationTime = updateExpirationTime),
@ -3338,33 +3311,56 @@ function updateReducer(reducer) {
null !== newBaseQueueLast &&
(newBaseQueueLast = newBaseQueueLast.next = {
expirationTime: 1073741823,
suspenseConfig: _update.suspenseConfig,
action: _update.action,
eagerReducer: _update.eagerReducer,
eagerState: _update.eagerState,
suspenseConfig: update.suspenseConfig,
action: update.action,
eagerReducer: update.eagerReducer,
eagerState: update.eagerState,
next: null
}),
markRenderEventTimeAndConfig(
updateExpirationTime,
_update.suspenseConfig
update.suspenseConfig
),
(newState =
_update.eagerReducer === reducer
? _update.eagerState
: reducer(newState, _update.action));
_update = _update.next;
} while (null !== _update && _update !== _dispatch);
(current =
update.eagerReducer === reducer
? update.eagerState
: reducer(current, update.action));
update = update.next;
} while (null !== update && update !== baseQueue);
null === newBaseQueueLast
? (firstRenderPhaseUpdate = newState)
? (pendingQueue = current)
: (newBaseQueueLast.next = baseFirst);
is$1(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
hook.baseState = firstRenderPhaseUpdate;
objectIs(current, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = current;
hook.baseState = pendingQueue;
hook.baseQueue = newBaseQueueLast;
queue.lastRenderedState = newState;
queue.lastRenderedState = current;
}
return [hook.memoizedState, queue.dispatch];
}
function rerenderReducer(reducer) {
var hook = updateWorkInProgressHook(),
queue = hook.queue;
if (null === queue)
throw Error(
"Should have a queue. This is likely a bug in React. Please file an issue."
);
queue.lastRenderedReducer = reducer;
var dispatch = queue.dispatch,
lastRenderPhaseUpdate = queue.pending,
newState = hook.memoizedState;
if (null !== lastRenderPhaseUpdate) {
queue.pending = null;
var update = (lastRenderPhaseUpdate = lastRenderPhaseUpdate.next);
do (newState = reducer(newState, update.action)), (update = update.next);
while (update !== lastRenderPhaseUpdate);
objectIs(newState, hook.memoizedState) || (didReceiveUpdate = !0);
hook.memoizedState = newState;
null === hook.baseQueue && (hook.baseState = newState);
queue.lastRenderedState = newState;
}
return [newState, dispatch];
}
function mountState(initialState) {
var hook = mountWorkInProgressHook();
"function" === typeof initialState && (initialState = initialState());
@ -3385,6 +3381,9 @@ function mountState(initialState) {
function updateState(initialState) {
return updateReducer(basicStateReducer, initialState);
}
function rerenderState(initialState) {
return rerenderReducer(basicStateReducer, initialState);
}
function pushEffect(tag, create, destroy, deps) {
tag = { tag: tag, create: create, destroy: destroy, deps: deps, next: null };
create = currentlyRenderingFiber$1.updateQueue;
@ -3401,6 +3400,9 @@ function pushEffect(tag, create, destroy, deps) {
(create.lastEffect = tag)));
return tag;
}
function updateRef() {
return updateWorkInProgressHook().memoizedState;
}
function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
var hook = mountWorkInProgressHook();
currentlyRenderingFiber$1.effectTag |= fiberEffectTag;
@ -3432,6 +3434,9 @@ function mountEffect(create, deps) {
function updateEffect(create, deps) {
return updateEffectImpl(516, 192, create, deps);
}
function updateLayoutEffect(create, deps) {
return updateEffectImpl(4, 36, create, deps);
}
function imperativeHandleEffect(create, ref) {
if ("function" === typeof ref)
return (
@ -3450,6 +3455,15 @@ function imperativeHandleEffect(create, ref) {
}
);
}
function updateImperativeHandle(ref, create, deps) {
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
return updateEffectImpl(
4,
36,
imperativeHandleEffect.bind(null, create, ref),
deps
);
}
function mountDebugValue() {}
function mountCallback(callback, deps) {
mountWorkInProgressHook().memoizedState = [
@ -3471,6 +3485,20 @@ function updateCallback(callback, deps) {
hook.memoizedState = [callback, deps];
return callback;
}
function updateMemo(nextCreate, deps) {
var hook = updateWorkInProgressHook();
deps = void 0 === deps ? null : deps;
var prevState = hook.memoizedState;
if (
null !== prevState &&
null !== deps &&
areHookInputsEqual(deps, prevState[1])
)
return prevState[0];
nextCreate = nextCreate();
hook.memoizedState = [nextCreate, deps];
return nextCreate;
}
function startTransition(setPending, config, callback) {
var priorityLevel = getCurrentPriorityLevel();
runWithPriority(98 > priorityLevel ? 98 : priorityLevel, function() {
@ -3487,62 +3515,42 @@ function startTransition(setPending, config, callback) {
});
}
function dispatchAction(fiber, queue, action) {
if (!(25 > numberOfReRenders))
throw Error(
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
);
var alternate = fiber.alternate;
var currentTime = requestCurrentTimeForUpdate(),
suspenseConfig = ReactCurrentBatchConfig.suspense;
currentTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
suspenseConfig = {
expirationTime: currentTime,
suspenseConfig: suspenseConfig,
action: action,
eagerReducer: null,
eagerState: null,
next: null
};
var pending = queue.pending;
null === pending
? (suspenseConfig.next = suspenseConfig)
: ((suspenseConfig.next = pending.next), (pending.next = suspenseConfig));
queue.pending = suspenseConfig;
pending = fiber.alternate;
if (
fiber === currentlyRenderingFiber$1 ||
(null !== alternate && alternate === currentlyRenderingFiber$1)
(null !== pending && pending === currentlyRenderingFiber$1)
)
if (
((didScheduleRenderPhaseUpdate = !0),
(fiber = {
expirationTime: renderExpirationTime$1,
suspenseConfig: null,
action: action,
eagerReducer: null,
eagerState: null,
next: null
}),
null === renderPhaseUpdates && (renderPhaseUpdates = new Map()),
(action = renderPhaseUpdates.get(queue)),
void 0 === action)
)
renderPhaseUpdates.set(queue, fiber);
else {
for (queue = action; null !== queue.next; ) queue = queue.next;
queue.next = fiber;
}
(didScheduleRenderPhaseUpdate = !0),
(suspenseConfig.expirationTime = renderExpirationTime$1),
(currentlyRenderingFiber$1.expirationTime = renderExpirationTime$1);
else {
var currentTime = requestCurrentTimeForUpdate(),
suspenseConfig = ReactCurrentBatchConfig.suspense;
currentTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
suspenseConfig = {
expirationTime: currentTime,
suspenseConfig: suspenseConfig,
action: action,
eagerReducer: null,
eagerState: null,
next: null
};
var pending = queue.pending;
null === pending
? (suspenseConfig.next = suspenseConfig)
: ((suspenseConfig.next = pending.next), (pending.next = suspenseConfig));
queue.pending = suspenseConfig;
if (
0 === fiber.expirationTime &&
(null === alternate || 0 === alternate.expirationTime) &&
((alternate = queue.lastRenderedReducer), null !== alternate)
(null === pending || 0 === pending.expirationTime) &&
((pending = queue.lastRenderedReducer), null !== pending)
)
try {
var currentState = queue.lastRenderedState,
eagerState = alternate(currentState, action);
suspenseConfig.eagerReducer = alternate;
eagerState = pending(currentState, action);
suspenseConfig.eagerReducer = pending;
suspenseConfig.eagerState = eagerState;
if (is$1(eagerState, currentState)) return;
if (objectIs(eagerState, currentState)) return;
} catch (error) {
} finally {
}
@ -3651,36 +3659,11 @@ var ContextOnlyDispatcher = {
useCallback: updateCallback,
useContext: readContext,
useEffect: updateEffect,
useImperativeHandle: function(ref, create, deps) {
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
return updateEffectImpl(
4,
36,
imperativeHandleEffect.bind(null, create, ref),
deps
);
},
useLayoutEffect: function(create, deps) {
return updateEffectImpl(4, 36, create, deps);
},
useMemo: function(nextCreate, deps) {
var hook = updateWorkInProgressHook();
deps = void 0 === deps ? null : deps;
var prevState = hook.memoizedState;
if (
null !== prevState &&
null !== deps &&
areHookInputsEqual(deps, prevState[1])
)
return prevState[0];
nextCreate = nextCreate();
hook.memoizedState = [nextCreate, deps];
return nextCreate;
},
useImperativeHandle: updateImperativeHandle,
useLayoutEffect: updateLayoutEffect,
useMemo: updateMemo,
useReducer: updateReducer,
useRef: function() {
return updateWorkInProgressHook().memoizedState;
},
useRef: updateRef,
useState: updateState,
useDebugValue: mountDebugValue,
useResponder: createDeprecatedResponderListener,
@ -3716,6 +3699,51 @@ var ContextOnlyDispatcher = {
];
}
},
HooksDispatcherOnRerender = {
readContext: readContext,
useCallback: updateCallback,
useContext: readContext,
useEffect: updateEffect,
useImperativeHandle: updateImperativeHandle,
useLayoutEffect: updateLayoutEffect,
useMemo: updateMemo,
useReducer: rerenderReducer,
useRef: updateRef,
useState: rerenderState,
useDebugValue: mountDebugValue,
useResponder: createDeprecatedResponderListener,
useDeferredValue: function(value, config) {
var _rerenderState = rerenderState(value),
prevValue = _rerenderState[0],
setValue = _rerenderState[1];
updateEffect(
function() {
var previousConfig = ReactCurrentBatchConfig$1.suspense;
ReactCurrentBatchConfig$1.suspense =
void 0 === config ? null : config;
try {
setValue(value);
} finally {
ReactCurrentBatchConfig$1.suspense = previousConfig;
}
},
[value, config]
);
return prevValue;
},
useTransition: function(config) {
var _rerenderState2 = rerenderState(!1),
isPending = _rerenderState2[0];
_rerenderState2 = _rerenderState2[1];
return [
updateCallback(startTransition.bind(null, _rerenderState2, config), [
_rerenderState2,
config
]),
isPending
];
}
},
now$1 = Scheduler.unstable_now,
commitTime = 0,
profilerStartTime = -1;
@ -5789,8 +5817,8 @@ function requestCurrentTimeForUpdate() {
return (executionContext & (RenderContext | CommitContext)) !== NoContext
? 1073741821 - ((now() / 10) | 0)
: 0 !== currentEventTime
? currentEventTime
: (currentEventTime = 1073741821 - ((now() / 10) | 0));
? currentEventTime
: (currentEventTime = 1073741821 - ((now() / 10) | 0));
}
function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
fiber = fiber.mode;
@ -5900,9 +5928,10 @@ function getNextRootExpirationTimeToWorkOn(root) {
if (0 !== lastExpiredTime) return lastExpiredTime;
lastExpiredTime = root.firstPendingTime;
if (!isRootSuspendedAtTime(root, lastExpiredTime)) return lastExpiredTime;
lastExpiredTime = root.lastPingedTime;
var lastPingedTime = root.lastPingedTime;
root = root.nextKnownPendingLevel;
return lastExpiredTime > root ? lastExpiredTime : root;
root = lastPingedTime > root ? lastPingedTime : root;
return 2 >= root && lastExpiredTime !== root ? 0 : root;
}
function ensureRootIsScheduled(root) {
if (0 !== root.lastExpiredTime)
@ -6078,35 +6107,34 @@ function performConcurrentWorkOnRoot(root, didTimeout) {
10 * (1073741821 - workInProgressRootLatestSuspenseTimeout) -
now())
: 1073741823 === workInProgressRootLatestProcessedExpirationTime
? (prevExecutionContext = 0)
: ((prevExecutionContext =
10 *
(1073741821 -
workInProgressRootLatestProcessedExpirationTime) -
5e3),
(prevDispatcher = now()),
(expirationTime =
10 * (1073741821 - expirationTime) - prevDispatcher),
(prevExecutionContext =
prevDispatcher - prevExecutionContext),
0 > prevExecutionContext && (prevExecutionContext = 0),
(prevExecutionContext =
(120 > prevExecutionContext
? 120
: 480 > prevExecutionContext
? 480
: 1080 > prevExecutionContext
? 1080
: 1920 > prevExecutionContext
? 1920
: 3e3 > prevExecutionContext
? 3e3
: 4320 > prevExecutionContext
? 4320
: 1960 * ceil(prevExecutionContext / 1960)) -
prevExecutionContext),
expirationTime < prevExecutionContext &&
(prevExecutionContext = expirationTime));
? (prevExecutionContext = 0)
: ((prevExecutionContext =
10 *
(1073741821 -
workInProgressRootLatestProcessedExpirationTime) -
5e3),
(prevDispatcher = now()),
(expirationTime =
10 * (1073741821 - expirationTime) - prevDispatcher),
(prevExecutionContext = prevDispatcher - prevExecutionContext),
0 > prevExecutionContext && (prevExecutionContext = 0),
(prevExecutionContext =
(120 > prevExecutionContext
? 120
: 480 > prevExecutionContext
? 480
: 1080 > prevExecutionContext
? 1080
: 1920 > prevExecutionContext
? 1920
: 3e3 > prevExecutionContext
? 3e3
: 4320 > prevExecutionContext
? 4320
: 1960 * ceil(prevExecutionContext / 1960)) -
prevExecutionContext),
expirationTime < prevExecutionContext &&
(prevExecutionContext = expirationTime));
if (10 < prevExecutionContext) {
root.timeoutHandle = scheduleTimeout(
commitRoot.bind(null, root),
@ -6265,7 +6293,20 @@ function handleError(root$jscomp$0, thrownValue) {
do {
try {
resetContextDependencies();
resetHooks();
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
if (didScheduleRenderPhaseUpdate)
for (
var hook = currentlyRenderingFiber$1.memoizedState;
null !== hook;
) {
var queue = hook.queue;
null !== queue && (queue.pending = null);
hook = hook.next;
}
renderExpirationTime$1 = 0;
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
didScheduleRenderPhaseUpdate = !1;
if (null === workInProgress || null === workInProgress.return)
return (
(workInProgressRootExitStatus = RootFatalErrored),
@ -6310,10 +6351,10 @@ function handleError(root$jscomp$0, thrownValue) {
void 0 === props.fallback
? !1
: !0 !== props.unstable_avoidThisFallback
? !0
: hasInvisibleParentBoundary
? !1
: !0;
? !0
: hasInvisibleParentBoundary
? !1
: !0;
}
}
if (JSCompiler_temp) {
@ -6904,8 +6945,6 @@ function pingSuspendedRoot(root, thenable, suspendedTime) {
((thenable = root.lastPingedTime),
(0 !== thenable && thenable < suspendedTime) ||
((root.lastPingedTime = suspendedTime),
root.finishedExpirationTime === suspendedTime &&
((root.finishedExpirationTime = 0), (root.finishedWork = null)),
ensureRootIsScheduled(root),
schedulePendingInteractions(root, suspendedTime)));
}
@ -7048,7 +7087,8 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) {
void 0 === renderState.$$typeof
) {
workInProgress.tag = 1;
resetHooks();
workInProgress.memoizedState = null;
workInProgress.updateQueue = null;
if (isContextProvider(updateExpirationTime)) {
var hasContext = !0;
pushContextProvider(workInProgress);
@ -7322,7 +7362,7 @@ beginWork$$1 = function(current$$1, workInProgress, renderExpirationTime) {
pushProvider(workInProgress, hasContext);
if (null !== getDerivedStateFromProps) {
var oldValue = getDerivedStateFromProps.value;
hasContext = is$1(oldValue, hasContext)
hasContext = objectIs(oldValue, hasContext)
? 0
: ("function" === typeof updateExpirationTime._calculateChangedBits
? updateExpirationTime._calculateChangedBits(
@ -7974,8 +8014,8 @@ function findNodeHandle(componentOrHandle) {
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical._nativeTag
: componentOrHandle._nativeTag;
? componentOrHandle.canonical._nativeTag
: componentOrHandle._nativeTag;
}
batchedUpdatesImpl = function(fn, a) {
var prevExecutionContext = executionContext;
@ -8098,8 +8138,8 @@ var roots = new Map(),
return null == componentOrHandle
? componentOrHandle
: componentOrHandle.canonical
? componentOrHandle.canonical
: componentOrHandle;
? componentOrHandle.canonical
: componentOrHandle;
},
findNodeHandle: findNodeHandle,
dispatchCommand: function(handle, command, args) {
@ -8285,7 +8325,7 @@ var roots = new Map(),
throw Error("getInspectorDataForViewTag() is not available in production");
},
bundleType: 0,
version: "16.12.0-19f6fe170",
version: "16.12.0-241c4467e",
rendererPackageName: "react-native-renderer"
});
var ReactNativeRenderer$2 = { default: ReactNativeRenderer },

Просмотреть файл

@ -23,6 +23,10 @@ if (__DEV__) {
ReactFabric = require('../implementations/ReactFabric-prod');
}
BatchedBridge.registerCallableModule('ReactFabric', ReactFabric);
if (global.RN$Bridgeless) {
global.RN$stopSurface = ReactFabric.stopSurface;
} else {
BatchedBridge.registerCallableModule('ReactFabric', ReactFabric);
}
module.exports = (ReactFabric: ReactNativeType);

Просмотреть файл

@ -8,7 +8,7 @@
* @flow strict-local
*/
/* eslint-disable react-internal/warning-and-invariant-args */
/* eslint-disable react-internal/invariant-args */
'use strict';

Просмотреть файл

@ -170,18 +170,17 @@ export type ReactScope = {|
$$typeof: Symbol | number,
|};
export type ReactScopeQuery = (
type: string,
props: {[string]: mixed, ...},
instance: mixed,
) => boolean;
export type ReactScopeMethods = {|
getChildren(): null | Array<ReactScopeMethods>,
getChildrenFromRoot(): null | Array<ReactScopeMethods>,
getParent(): null | ReactScopeMethods,
getProps(): Object,
queryAllNodes(
(type: string | Object, props: Object, instance: Object) => boolean,
): null | Array<Object>,
queryFirstNode(
(type: string | Object, props: Object, instance: Object) => boolean,
): null | Object,
DO_NOT_USE_queryAllNodes(ReactScopeQuery): null | Array<Object>,
DO_NOT_USE_queryFirstNode(ReactScopeQuery): null | Object,
containsNode(Object): boolean,
getChildContextValues: <T>(context: ReactContext<T>) => Array<T>,
|};
export type ReactScopeInstance = {|