2017-05-26 17:51:06 +00:00
/ * *
2017-10-04 17:06:57 +00:00
* Copyright ( c ) 2013 - present , Facebook , Inc .
2017-05-26 17:51:06 +00:00
*
2017-10-04 17:06:57 +00:00
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree .
2017-05-26 17:51:06 +00:00
*
* @ noflow
* @ providesModule ReactNativeFiber - prod
* /
"use strict" ;
2017-08-09 19:18:46 +00:00
var invariant = require ( "fbjs/lib/invariant" ) , ExceptionsManager = require ( "ExceptionsManager" ) , emptyObject = require ( "fbjs/lib/emptyObject" ) , react = require ( "react" ) , shallowEqual = require ( "fbjs/lib/shallowEqual" ) , deepDiffer = require ( "deepDiffer" ) , flattenStyle = require ( "flattenStyle" ) , TextInputState = require ( "TextInputState" ) , UIManager = require ( "UIManager" ) ;
2017-05-26 17:51:06 +00:00
2017-09-15 01:01:25 +00:00
require ( "deepFreezeAndThrowOnMutationInDev" ) , require ( "InitializeCore" ) ;
2017-05-26 17:51:06 +00:00
2017-09-15 01:01:27 +00:00
var RCTEventEmitter = require ( "RCTEventEmitter" ) , emptyFunction = require ( "fbjs/lib/emptyFunction" ) , defaultShowDialog = function ( capturedError ) {
2017-05-26 17:51:06 +00:00
return ! 0 ;
} , showDialog = defaultShowDialog ;
function logCapturedError ( capturedError ) {
if ( ! 1 !== showDialog ( capturedError ) ) {
2017-08-09 19:18:46 +00:00
var error = capturedError . error ;
console . error ( error ) ;
2017-05-26 17:51:06 +00:00
}
}
var injection = {
injectDialog : function ( fn ) {
2017-06-09 02:01:23 +00:00
invariant ( showDialog === defaultShowDialog , "The custom dialog was already injected." ) ,
invariant ( "function" == typeof fn , "Injected showDialog() must be a function." ) ,
2017-05-26 17:51:06 +00:00
showDialog = fn ;
}
} , logCapturedError _1 = logCapturedError , ReactFiberErrorLogger = {
injection : injection ,
logCapturedError : logCapturedError _1
} , ReactErrorUtils = {
2017-08-09 19:18:46 +00:00
_caughtError : null ,
_hasCaughtError : ! 1 ,
_rethrowError : null ,
_hasRethrowError : ! 1 ,
2017-05-26 17:51:06 +00:00
injection : {
injectErrorUtils : function ( injectedErrorUtils ) {
2017-06-09 02:01:23 +00:00
invariant ( "function" == typeof injectedErrorUtils . invokeGuardedCallback , "Injected invokeGuardedCallback() must be a function." ) ,
2017-05-26 17:51:06 +00:00
invokeGuardedCallback = injectedErrorUtils . invokeGuardedCallback ;
}
} ,
invokeGuardedCallback : function ( name , func , context , a , b , c , d , e , f ) {
2017-08-09 19:18:46 +00:00
invokeGuardedCallback . apply ( ReactErrorUtils , arguments ) ;
2017-05-26 17:51:06 +00:00
} ,
invokeGuardedCallbackAndCatchFirstError : function ( name , func , context , a , b , c , d , e , f ) {
2017-08-09 19:18:46 +00:00
if ( ReactErrorUtils . invokeGuardedCallback . apply ( this , arguments ) , ReactErrorUtils . hasCaughtError ( ) ) {
var error = ReactErrorUtils . clearCaughtError ( ) ;
ReactErrorUtils . _hasRethrowError || ( ReactErrorUtils . _hasRethrowError = ! 0 , ReactErrorUtils . _rethrowError = error ) ;
}
2017-05-26 17:51:06 +00:00
} ,
rethrowCaughtError : function ( ) {
2017-08-09 19:18:46 +00:00
return rethrowCaughtError . apply ( ReactErrorUtils , arguments ) ;
} ,
hasCaughtError : function ( ) {
return ReactErrorUtils . _hasCaughtError ;
} ,
clearCaughtError : function ( ) {
if ( ReactErrorUtils . _hasCaughtError ) {
var error = ReactErrorUtils . _caughtError ;
return ReactErrorUtils . _caughtError = null , ReactErrorUtils . _hasCaughtError = ! 1 ,
error ;
}
invariant ( ! 1 , "clearCaughtError was called but no error was captured. This error " + "is likely caused by a bug in React. Please file an issue." ) ;
}
} , invokeGuardedCallback = function ( name , func , context , a , b , c , d , e , f ) {
ReactErrorUtils . _hasCaughtError = ! 1 , ReactErrorUtils . _caughtError = null ;
var funcArgs = Array . prototype . slice . call ( arguments , 3 ) ;
try {
func . apply ( context , funcArgs ) ;
} catch ( error ) {
ReactErrorUtils . _caughtError = error , ReactErrorUtils . _hasCaughtError = ! 0 ;
}
} , rethrowCaughtError = function ( ) {
if ( ReactErrorUtils . _hasRethrowError ) {
var error = ReactErrorUtils . _rethrowError ;
throw ReactErrorUtils . _rethrowError = null , ReactErrorUtils . _hasRethrowError = ! 1 ,
error ;
2017-05-26 17:51:06 +00:00
}
} , ReactErrorUtils _1 = ReactErrorUtils , ComponentTree , injection$1 = {
injectComponentTree : function ( Injected ) {
ComponentTree = Injected ;
}
} ;
function isEndish ( topLevelType ) {
return "topMouseUp" === topLevelType || "topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType ;
}
function isMoveish ( topLevelType ) {
return "topMouseMove" === topLevelType || "topTouchMove" === topLevelType ;
}
function isStartish ( topLevelType ) {
return "topMouseDown" === topLevelType || "topTouchStart" === topLevelType ;
}
function executeDispatch ( event , simulated , listener , inst ) {
var type = event . type || "unknown-event" ;
2017-06-09 02:01:23 +00:00
event . currentTarget = EventPluginUtils . getNodeFromInstance ( inst ) , ReactErrorUtils _1 . invokeGuardedCallbackAndCatchFirstError ( type , listener , void 0 , event ) ,
2017-05-26 17:51:06 +00:00
event . currentTarget = null ;
}
function executeDispatchesInOrder ( event , simulated ) {
var dispatchListeners = event . _dispatchListeners , dispatchInstances = event . _dispatchInstances ;
if ( Array . isArray ( dispatchListeners ) ) for ( var i = 0 ; i < dispatchListeners . length && ! event . isPropagationStopped ( ) ; i ++ ) executeDispatch ( event , simulated , dispatchListeners [ i ] , dispatchInstances [ i ] ) ; else dispatchListeners && executeDispatch ( event , simulated , dispatchListeners , dispatchInstances ) ;
event . _dispatchListeners = null , event . _dispatchInstances = null ;
}
function executeDispatchesInOrderStopAtTrueImpl ( event ) {
var dispatchListeners = event . _dispatchListeners , dispatchInstances = event . _dispatchInstances ;
if ( Array . isArray ( dispatchListeners ) ) {
for ( var i = 0 ; i < dispatchListeners . length && ! event . isPropagationStopped ( ) ; i ++ ) if ( dispatchListeners [ i ] ( event , dispatchInstances [ i ] ) ) return dispatchInstances [ i ] ;
} else if ( dispatchListeners && dispatchListeners ( event , dispatchInstances ) ) return dispatchInstances ;
return null ;
}
function executeDispatchesInOrderStopAtTrue ( event ) {
var ret = executeDispatchesInOrderStopAtTrueImpl ( event ) ;
return event . _dispatchInstances = null , event . _dispatchListeners = null , ret ;
}
function executeDirectDispatch ( event ) {
var dispatchListener = event . _dispatchListeners , dispatchInstance = event . _dispatchInstances ;
2017-06-09 02:01:23 +00:00
invariant ( ! Array . isArray ( dispatchListener ) , "executeDirectDispatch(...): Invalid `event`." ) ,
2017-05-26 17:51:06 +00:00
event . currentTarget = dispatchListener ? EventPluginUtils . getNodeFromInstance ( dispatchInstance ) : null ;
var res = dispatchListener ? dispatchListener ( event ) : null ;
2017-06-09 02:01:23 +00:00
return event . currentTarget = null , event . _dispatchListeners = null , event . _dispatchInstances = null ,
2017-05-26 17:51:06 +00:00
res ;
}
function hasDispatches ( event ) {
return ! ! event . _dispatchListeners ;
}
var EventPluginUtils = {
isEndish : isEndish ,
isMoveish : isMoveish ,
isStartish : isStartish ,
executeDirectDispatch : executeDirectDispatch ,
executeDispatchesInOrder : executeDispatchesInOrder ,
executeDispatchesInOrderStopAtTrue : executeDispatchesInOrderStopAtTrue ,
hasDispatches : hasDispatches ,
getFiberCurrentPropsFromNode : function ( node ) {
return ComponentTree . getFiberCurrentPropsFromNode ( node ) ;
} ,
getInstanceFromNode : function ( node ) {
return ComponentTree . getInstanceFromNode ( node ) ;
} ,
getNodeFromInstance : function ( node ) {
return ComponentTree . getNodeFromInstance ( node ) ;
} ,
injection : injection$1
} , EventPluginUtils _1 = EventPluginUtils , fiberHostComponent = null , ReactControlledComponentInjection = {
injectFiberControlledHostComponent : function ( hostComponentImpl ) {
fiberHostComponent = hostComponentImpl ;
}
} , restoreTarget = null , restoreQueue = null ;
function restoreStateOfTarget ( target ) {
var internalInstance = EventPluginUtils _1 . getInstanceFromNode ( target ) ;
if ( internalInstance ) {
2017-10-04 17:06:57 +00:00
invariant ( fiberHostComponent && "function" == typeof fiberHostComponent . restoreControlledState , "Fiber needs to be injected to handle a fiber target for controlled " + "events. This error is likely caused by a bug in React. Please file an issue." ) ;
var props = EventPluginUtils _1 . getFiberCurrentPropsFromNode ( internalInstance . stateNode ) ;
fiberHostComponent . restoreControlledState ( internalInstance . stateNode , internalInstance . type , props ) ;
2017-05-26 17:51:06 +00:00
}
}
var ReactControlledComponent = {
injection : ReactControlledComponentInjection ,
enqueueStateRestore : function ( target ) {
restoreTarget ? restoreQueue ? restoreQueue . push ( target ) : restoreQueue = [ target ] : restoreTarget = target ;
} ,
restoreStateIfNeeded : function ( ) {
if ( restoreTarget ) {
var target = restoreTarget , queuedTargets = restoreQueue ;
if ( restoreTarget = null , restoreQueue = null , restoreStateOfTarget ( target ) , queuedTargets ) for ( var i = 0 ; i < queuedTargets . length ; i ++ ) restoreStateOfTarget ( queuedTargets [ i ] ) ;
}
}
2017-10-04 17:06:57 +00:00
} , ReactControlledComponent _1 = ReactControlledComponent , fiberBatchedUpdates = function ( fn , bookkeeping ) {
2017-05-26 17:51:06 +00:00
return fn ( bookkeeping ) ;
} ;
function batchedUpdates ( fn , bookkeeping ) {
2017-10-04 17:06:57 +00:00
return fiberBatchedUpdates ( fn , bookkeeping ) ;
2017-05-26 17:51:06 +00:00
}
var isNestingBatched = ! 1 ;
function batchedUpdatesWithControlledComponents ( fn , bookkeeping ) {
if ( isNestingBatched ) return batchedUpdates ( fn , bookkeeping ) ;
isNestingBatched = ! 0 ;
try {
return batchedUpdates ( fn , bookkeeping ) ;
} finally {
isNestingBatched = ! 1 , ReactControlledComponent _1 . restoreStateIfNeeded ( ) ;
}
}
var ReactGenericBatchingInjection = {
injectFiberBatchedUpdates : function ( _batchedUpdates ) {
fiberBatchedUpdates = _batchedUpdates ;
}
} , ReactGenericBatching = {
batchedUpdates : batchedUpdatesWithControlledComponents ,
injection : ReactGenericBatchingInjection
} , ReactGenericBatching _1 = ReactGenericBatching ;
function ReactNativeFiberErrorDialog ( capturedError ) {
2017-06-26 22:12:46 +00:00
var componentStack = capturedError . componentStack , error = capturedError . error , errorToHandle = void 0 ;
if ( error instanceof Error ) {
var message = error . message , name = error . name , summary = message ? name + ": " + message : name ;
errorToHandle = error ;
try {
errorToHandle . message = summary + "\n\nThis error is located at:" + componentStack ;
} catch ( e ) { }
} else errorToHandle = "string" == typeof error ? new Error ( error + "\n\nThis error is located at:" + componentStack ) : new Error ( "Unspecified error at:" + componentStack ) ;
return ExceptionsManager . handleException ( errorToHandle , ! 1 ) , ! 1 ;
2017-05-26 17:51:06 +00:00
}
var showDialog$1 = ReactNativeFiberErrorDialog , ReactNativeFiberErrorDialog _1 = {
showDialog : showDialog$1
2017-08-09 19:18:46 +00:00
} , REACT _PORTAL _TYPE = "function" == typeof Symbol && Symbol . for && Symbol . for ( "react.portal" ) || 60106 , createPortal = function ( children , containerInfo , implementation ) {
var key = arguments . length > 3 && void 0 !== arguments [ 3 ] ? arguments [ 3 ] : null ;
return {
$$typeof : REACT _PORTAL _TYPE ,
key : null == key ? null : "" + key ,
children : children ,
containerInfo : containerInfo ,
implementation : implementation
} ;
} , isPortal = function ( object ) {
return "object" == typeof object && null !== object && object . $$typeof === REACT _PORTAL _TYPE ;
} , REACT _PORTAL _TYPE _1 = REACT _PORTAL _TYPE , ReactPortal = {
createPortal : createPortal ,
isPortal : isPortal ,
REACT _PORTAL _TYPE : REACT _PORTAL _TYPE _1
} , instanceCache = { } , instanceProps = { } ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function precacheFiberNode ( hostInst , tag ) {
instanceCache [ tag ] = hostInst ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function uncacheFiberNode ( tag ) {
delete instanceCache [ tag ] , delete instanceProps [ tag ] ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function getInstanceFromTag ( tag ) {
return instanceCache [ tag ] || null ;
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function getTagFromInstance ( inst ) {
2017-09-15 01:01:25 +00:00
var tag = inst . stateNode . _nativeTag ;
2017-08-09 19:18:46 +00:00
return invariant ( tag , "All native instances should have a tag." ) , tag ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function getFiberCurrentPropsFromNode ( stateNode ) {
return instanceProps [ stateNode . _nativeTag ] || null ;
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function updateFiberProps ( tag , props ) {
instanceProps [ tag ] = props ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var ReactNativeComponentTree = {
getClosestInstanceFromNode : getInstanceFromTag ,
getInstanceFromNode : getInstanceFromTag ,
getNodeFromInstance : getTagFromInstance ,
precacheFiberNode : precacheFiberNode ,
uncacheFiberNode : uncacheFiberNode ,
getFiberCurrentPropsFromNode : getFiberCurrentPropsFromNode ,
updateFiberProps : updateFiberProps
} , ReactNativeComponentTree _1 = ReactNativeComponentTree , commonjsGlobal = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : { } , ReactFeatureFlags = {
2017-09-15 01:01:25 +00:00
enableAsyncSubtreeAPI : ! 0
2017-08-09 19:18:46 +00:00
} , ReactFeatureFlags _1 = ReactFeatureFlags , ReactTypeOfSideEffect = {
NoEffect : 0 ,
PerformedWork : 1 ,
Placement : 2 ,
Update : 4 ,
PlacementAndUpdate : 6 ,
Deletion : 8 ,
ContentReset : 16 ,
Callback : 32 ,
Err : 64 ,
Ref : 128
} , ReactPriorityLevel = {
NoWork : 0 ,
SynchronousPriority : 1 ,
TaskPriority : 2 ,
HighPriority : 3 ,
LowPriority : 4 ,
OffscreenPriority : 5
} , ReactTypeOfWork = {
2017-05-26 17:51:06 +00:00
IndeterminateComponent : 0 ,
FunctionalComponent : 1 ,
ClassComponent : 2 ,
HostRoot : 3 ,
HostPortal : 4 ,
HostComponent : 5 ,
HostText : 6 ,
CoroutineComponent : 7 ,
CoroutineHandlerPhase : 8 ,
YieldComponent : 9 ,
Fragment : 10
2017-09-15 01:01:25 +00:00
} , CallbackEffect = ReactTypeOfSideEffect . Callback , NoWork = ReactPriorityLevel . NoWork , SynchronousPriority = ReactPriorityLevel . SynchronousPriority , TaskPriority = ReactPriorityLevel . TaskPriority , ClassComponent = ReactTypeOfWork . ClassComponent , HostRoot = ReactTypeOfWork . HostRoot , _queue1 = void 0 , _queue2 = void 0 ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function comparePriority ( a , b ) {
return a !== TaskPriority && a !== SynchronousPriority || b !== TaskPriority && b !== SynchronousPriority ? a === NoWork && b !== NoWork ? - 255 : a !== NoWork && b === NoWork ? 255 : a - b : 0 ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function createUpdateQueue ( ) {
return {
first : null ,
last : null ,
hasForceUpdate : ! 1 ,
callbackList : null
} ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function cloneUpdate ( update ) {
return {
priorityLevel : update . priorityLevel ,
partialState : update . partialState ,
callback : update . callback ,
isReplace : update . isReplace ,
isForced : update . isForced ,
isTopLevelUnmount : update . isTopLevelUnmount ,
next : null
} ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function insertUpdateIntoQueue ( queue , update , insertAfter , insertBefore ) {
null !== insertAfter ? insertAfter . next = update : ( update . next = queue . first , queue . first = update ) ,
null !== insertBefore ? update . next = insertBefore : queue . last = update ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function findInsertionPosition ( queue , update ) {
var priorityLevel = update . priorityLevel , insertAfter = null , insertBefore = null ;
if ( null !== queue . last && comparePriority ( queue . last . priorityLevel , priorityLevel ) <= 0 ) insertAfter = queue . last ; else for ( insertBefore = queue . first ; null !== insertBefore && comparePriority ( insertBefore . priorityLevel , priorityLevel ) <= 0 ; ) insertAfter = insertBefore ,
insertBefore = insertBefore . next ;
return insertAfter ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function ensureUpdateQueues ( fiber ) {
var alternateFiber = fiber . alternate , queue1 = fiber . updateQueue ;
null === queue1 && ( queue1 = fiber . updateQueue = createUpdateQueue ( ) ) ;
var queue2 = void 0 ;
2017-09-15 01:01:25 +00:00
null !== alternateFiber ? null === ( queue2 = alternateFiber . updateQueue ) && ( queue2 = alternateFiber . updateQueue = createUpdateQueue ( ) ) : queue2 = null ,
_queue1 = queue1 , _queue2 = queue2 !== queue1 ? queue2 : null ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function insertUpdate ( fiber , update ) {
2017-09-15 01:01:25 +00:00
ensureUpdateQueues ( fiber ) ;
var queue1 = _queue1 , queue2 = _queue2 , insertAfter1 = findInsertionPosition ( queue1 , update ) , insertBefore1 = null !== insertAfter1 ? insertAfter1 . next : queue1 . first ;
2017-08-09 19:18:46 +00:00
if ( null === queue2 ) return insertUpdateIntoQueue ( queue1 , update , insertAfter1 , insertBefore1 ) ,
null ;
var insertAfter2 = findInsertionPosition ( queue2 , update ) , insertBefore2 = null !== insertAfter2 ? insertAfter2 . next : queue2 . first ;
if ( insertUpdateIntoQueue ( queue1 , update , insertAfter1 , insertBefore1 ) , insertBefore1 === insertBefore2 && null !== insertBefore1 || insertAfter1 === insertAfter2 && null !== insertAfter1 ) return null === insertAfter2 && ( queue2 . first = update ) ,
null === insertBefore2 && ( queue2 . last = null ) , null ;
var update2 = cloneUpdate ( update ) ;
return insertUpdateIntoQueue ( queue2 , update2 , insertAfter2 , insertBefore2 ) , update2 ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function addUpdate ( fiber , partialState , callback , priorityLevel ) {
insertUpdate ( fiber , {
priorityLevel : priorityLevel ,
partialState : partialState ,
callback : callback ,
isReplace : ! 1 ,
isForced : ! 1 ,
isTopLevelUnmount : ! 1 ,
next : null
} ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var addUpdate _1 = addUpdate ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function addReplaceUpdate ( fiber , state , callback , priorityLevel ) {
insertUpdate ( fiber , {
priorityLevel : priorityLevel ,
partialState : state ,
callback : callback ,
isReplace : ! 0 ,
isForced : ! 1 ,
isTopLevelUnmount : ! 1 ,
next : null
} ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var addReplaceUpdate _1 = addReplaceUpdate ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function addForceUpdate ( fiber , callback , priorityLevel ) {
insertUpdate ( fiber , {
priorityLevel : priorityLevel ,
partialState : null ,
callback : callback ,
isReplace : ! 1 ,
isForced : ! 0 ,
isTopLevelUnmount : ! 1 ,
next : null
} ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var addForceUpdate _1 = addForceUpdate ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function getUpdatePriority ( fiber ) {
var updateQueue = fiber . updateQueue ;
return null === updateQueue ? NoWork : fiber . tag !== ClassComponent && fiber . tag !== HostRoot ? NoWork : null !== updateQueue . first ? updateQueue . first . priorityLevel : NoWork ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var getUpdatePriority _1 = getUpdatePriority ;
function addTopLevelUpdate$1 ( fiber , partialState , callback , priorityLevel ) {
var isTopLevelUnmount = null === partialState . element , update = {
priorityLevel : priorityLevel ,
partialState : partialState ,
callback : callback ,
isReplace : ! 1 ,
isForced : ! 1 ,
isTopLevelUnmount : isTopLevelUnmount ,
next : null
} , update2 = insertUpdate ( fiber , update ) ;
if ( isTopLevelUnmount ) {
2017-09-15 01:01:25 +00:00
var queue1 = _queue1 , queue2 = _queue2 ;
2017-08-09 19:18:46 +00:00
null !== queue1 && null !== update . next && ( update . next = null , queue1 . last = update ) ,
null !== queue2 && null !== update2 && null !== update2 . next && ( update2 . next = null ,
queue2 . last = update ) ;
}
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var addTopLevelUpdate _1 = addTopLevelUpdate$1 ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function getStateFromUpdate ( update , instance , prevState , props ) {
var partialState = update . partialState ;
if ( "function" == typeof partialState ) {
return partialState . call ( instance , prevState , props ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return partialState ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function beginUpdateQueue ( current , workInProgress , queue , instance , prevState , props , priorityLevel ) {
if ( null !== current && current . updateQueue === queue ) {
var currentQueue = queue ;
queue = workInProgress . updateQueue = {
first : currentQueue . first ,
last : currentQueue . last ,
callbackList : null ,
hasForceUpdate : ! 1
} ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
for ( var callbackList = queue . callbackList , hasForceUpdate = queue . hasForceUpdate , state = prevState , dontMutatePrevState = ! 0 , update = queue . first ; null !== update && comparePriority ( update . priorityLevel , priorityLevel ) <= 0 ; ) {
queue . first = update . next , null === queue . first && ( queue . last = null ) ;
var _partialState = void 0 ;
update . isReplace ? ( state = getStateFromUpdate ( update , instance , state , props ) ,
dontMutatePrevState = ! 0 ) : ( _partialState = getStateFromUpdate ( update , instance , state , props ) ) && ( state = dontMutatePrevState ? Object . assign ( { } , state , _partialState ) : Object . assign ( state , _partialState ) ,
dontMutatePrevState = ! 1 ) , update . isForced && ( hasForceUpdate = ! 0 ) , null === update . callback || update . isTopLevelUnmount && null !== update . next || ( callbackList = null !== callbackList ? callbackList : [ ] ,
callbackList . push ( update . callback ) , workInProgress . effectTag |= CallbackEffect ) ,
update = update . next ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return queue . callbackList = callbackList , queue . hasForceUpdate = hasForceUpdate ,
null !== queue . first || null !== callbackList || hasForceUpdate || ( workInProgress . updateQueue = null ) ,
state ;
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
var beginUpdateQueue _1 = beginUpdateQueue ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function commitCallbacks ( finishedWork , queue , context ) {
var callbackList = queue . callbackList ;
if ( null !== callbackList ) {
queue . callbackList = null ;
for ( var i = 0 ; i < callbackList . length ; i ++ ) {
var _callback = callbackList [ i ] ;
invariant ( "function" == typeof _callback , "Invalid argument passed as callback. Expected a function. Instead " + "received: %s" , _callback ) ,
_callback . call ( context ) ;
2017-05-26 17:51:06 +00:00
}
}
}
2017-08-09 19:18:46 +00:00
var commitCallbacks _1 = commitCallbacks , ReactFiberUpdateQueue = {
addUpdate : addUpdate _1 ,
addReplaceUpdate : addReplaceUpdate _1 ,
addForceUpdate : addForceUpdate _1 ,
getUpdatePriority : getUpdatePriority _1 ,
addTopLevelUpdate : addTopLevelUpdate _1 ,
beginUpdateQueue : beginUpdateQueue _1 ,
commitCallbacks : commitCallbacks _1
} ;
2017-05-26 17:51:06 +00:00
2017-10-04 17:06:57 +00:00
function getComponentName$1 ( fiber ) {
var type = fiber . type ;
return "string" == typeof type ? type : "function" == typeof type ? type . displayName || type . name : null ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var getComponentName _1 = getComponentName$1 , ReactInstanceMap = {
remove : function ( key ) {
2017-09-15 01:01:25 +00:00
key . _reactInternalFiber = void 0 ;
2017-08-09 19:18:46 +00:00
} ,
get : function ( key ) {
2017-09-15 01:01:25 +00:00
return key . _reactInternalFiber ;
2017-08-09 19:18:46 +00:00
} ,
has : function ( key ) {
2017-09-15 01:01:25 +00:00
return void 0 !== key . _reactInternalFiber ;
2017-08-09 19:18:46 +00:00
} ,
set : function ( key , value ) {
2017-09-15 01:01:25 +00:00
key . _reactInternalFiber = value ;
2017-08-09 19:18:46 +00:00
}
} , ReactInstanceMap _1 = ReactInstanceMap , ReactInternals = react . _ _SECRET _INTERNALS _DO _NOT _USE _OR _YOU _WILL _BE _FIRED , ReactGlobalSharedState = {
ReactCurrentOwner : ReactInternals . ReactCurrentOwner
} , ReactGlobalSharedState _1 = ReactGlobalSharedState , HostComponent$1 = ReactTypeOfWork . HostComponent , HostRoot$2 = ReactTypeOfWork . HostRoot , HostPortal = ReactTypeOfWork . HostPortal , HostText = ReactTypeOfWork . HostText , NoEffect = ReactTypeOfSideEffect . NoEffect , Placement = ReactTypeOfSideEffect . Placement , MOUNTING = 1 , MOUNTED = 2 , UNMOUNTED = 3 ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function isFiberMountedImpl ( fiber ) {
var node = fiber ;
if ( fiber . alternate ) for ( ; node . return ; ) node = node . return ; else {
if ( ( node . effectTag & Placement ) !== NoEffect ) return MOUNTING ;
for ( ; node . return ; ) if ( node = node . return , ( node . effectTag & Placement ) !== NoEffect ) return MOUNTING ;
}
return node . tag === HostRoot$2 ? MOUNTED : UNMOUNTED ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var isFiberMounted$1 = function ( fiber ) {
return isFiberMountedImpl ( fiber ) === MOUNTED ;
} , isMounted = function ( component ) {
var fiber = ReactInstanceMap _1 . get ( component ) ;
return ! ! fiber && isFiberMountedImpl ( fiber ) === MOUNTED ;
} ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function assertIsMounted ( fiber ) {
invariant ( isFiberMountedImpl ( fiber ) === MOUNTED , "Unable to find node on an unmounted component." ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function findCurrentFiberUsingSlowPath ( fiber ) {
var alternate = fiber . alternate ;
if ( ! alternate ) {
var state = isFiberMountedImpl ( fiber ) ;
return invariant ( state !== UNMOUNTED , "Unable to find node on an unmounted component." ) ,
state === MOUNTING ? null : fiber ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
for ( var a = fiber , b = alternate ; ! 0 ; ) {
var parentA = a . return , parentB = parentA ? parentA . alternate : null ;
if ( ! parentA || ! parentB ) break ;
if ( parentA . child === parentB . child ) {
for ( var child = parentA . child ; child ; ) {
if ( child === a ) return assertIsMounted ( parentA ) , fiber ;
if ( child === b ) return assertIsMounted ( parentA ) , alternate ;
child = child . sibling ;
}
invariant ( ! 1 , "Unable to find node on an unmounted component." ) ;
}
if ( a . return !== b . return ) a = parentA , b = parentB ; else {
for ( var didFindChild = ! 1 , _child = parentA . child ; _child ; ) {
if ( _child === a ) {
didFindChild = ! 0 , a = parentA , b = parentB ;
break ;
}
if ( _child === b ) {
didFindChild = ! 0 , b = parentA , a = parentB ;
break ;
}
_child = _child . sibling ;
}
if ( ! didFindChild ) {
for ( _child = parentB . child ; _child ; ) {
if ( _child === a ) {
didFindChild = ! 0 , a = parentB , b = parentA ;
break ;
}
if ( _child === b ) {
didFindChild = ! 0 , b = parentB , a = parentA ;
break ;
}
_child = _child . sibling ;
}
invariant ( didFindChild , "Child was not found in either parent set. This indicates a bug " + "in React related to the return pointer. Please file an issue." ) ;
}
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
invariant ( a . alternate === b , "Return fibers should always be each others' alternates. " + "This error is likely caused by a bug in React. Please file an issue." ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return invariant ( a . tag === HostRoot$2 , "Unable to find node on an unmounted component." ) ,
a . stateNode . current === a ? fiber : alternate ;
}
var findCurrentFiberUsingSlowPath _1 = findCurrentFiberUsingSlowPath , findCurrentHostFiber$1 = function ( parent ) {
var currentParent = findCurrentFiberUsingSlowPath ( parent ) ;
if ( ! currentParent ) return null ;
for ( var node = currentParent ; ! 0 ; ) {
if ( node . tag === HostComponent$1 || node . tag === HostText ) return node ;
if ( node . child ) node . child . return = node , node = node . child ; else {
if ( node === currentParent ) return null ;
for ( ; ! node . sibling ; ) {
if ( ! node . return || node . return === currentParent ) return null ;
node = node . return ;
}
node . sibling . return = node . return , node = node . sibling ;
}
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return null ;
} , findCurrentHostFiberWithNoPortals$1 = function ( parent ) {
var currentParent = findCurrentFiberUsingSlowPath ( parent ) ;
if ( ! currentParent ) return null ;
for ( var node = currentParent ; ! 0 ; ) {
if ( node . tag === HostComponent$1 || node . tag === HostText ) return node ;
if ( node . child && node . tag !== HostPortal ) node . child . return = node , node = node . child ; else {
if ( node === currentParent ) return null ;
for ( ; ! node . sibling ; ) {
if ( ! node . return || node . return === currentParent ) return null ;
node = node . return ;
}
node . sibling . return = node . return , node = node . sibling ;
}
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return null ;
} , ReactFiberTreeReflection = {
isFiberMounted : isFiberMounted$1 ,
isMounted : isMounted ,
findCurrentFiberUsingSlowPath : findCurrentFiberUsingSlowPath _1 ,
findCurrentHostFiber : findCurrentHostFiber$1 ,
findCurrentHostFiberWithNoPortals : findCurrentHostFiberWithNoPortals$1
} , valueStack = [ ] , index = - 1 , createCursor$1 = function ( defaultValue ) {
return {
current : defaultValue
} ;
} , isEmpty = function ( ) {
return - 1 === index ;
} , pop$1 = function ( cursor , fiber ) {
index < 0 || ( cursor . current = valueStack [ index ] , valueStack [ index ] = null , index -- ) ;
} , push$1 = function ( cursor , value , fiber ) {
index ++ , valueStack [ index ] = cursor . current , cursor . current = value ;
} , reset = function ( ) {
for ( ; index > - 1 ; ) valueStack [ index ] = null , index -- ;
} , ReactFiberStack = {
createCursor : createCursor$1 ,
isEmpty : isEmpty ,
pop : pop$1 ,
push : push$1 ,
reset : reset
} , isFiberMounted = ReactFiberTreeReflection . isFiberMounted , ClassComponent$1 = ReactTypeOfWork . ClassComponent , HostRoot$1 = ReactTypeOfWork . HostRoot , createCursor = ReactFiberStack . createCursor , pop = ReactFiberStack . pop , push = ReactFiberStack . push , contextStackCursor = createCursor ( emptyObject ) , didPerformWorkStackCursor = createCursor ( ! 1 ) , previousContext = emptyObject ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function getUnmaskedContext ( workInProgress ) {
return isContextProvider$1 ( workInProgress ) ? previousContext : contextStackCursor . current ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var getUnmaskedContext _1 = getUnmaskedContext ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function cacheContext ( workInProgress , unmaskedContext , maskedContext ) {
var instance = workInProgress . stateNode ;
instance . _ _reactInternalMemoizedUnmaskedChildContext = unmaskedContext , instance . _ _reactInternalMemoizedMaskedChildContext = maskedContext ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var cacheContext _1 = cacheContext , getMaskedContext = function ( workInProgress , unmaskedContext ) {
var type = workInProgress . type , contextTypes = type . contextTypes ;
if ( ! contextTypes ) return emptyObject ;
var instance = workInProgress . stateNode ;
if ( instance && instance . _ _reactInternalMemoizedUnmaskedChildContext === unmaskedContext ) return instance . _ _reactInternalMemoizedMaskedChildContext ;
var context = { } ;
for ( var key in contextTypes ) context [ key ] = unmaskedContext [ key ] ;
return instance && cacheContext ( workInProgress , unmaskedContext , context ) , context ;
} , hasContextChanged = function ( ) {
return didPerformWorkStackCursor . current ;
} ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function isContextConsumer ( fiber ) {
return fiber . tag === ClassComponent$1 && null != fiber . type . contextTypes ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var isContextConsumer _1 = isContextConsumer ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function isContextProvider$1 ( fiber ) {
return fiber . tag === ClassComponent$1 && null != fiber . type . childContextTypes ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var isContextProvider _1 = isContextProvider$1 ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function popContextProvider ( fiber ) {
isContextProvider$1 ( fiber ) && ( pop ( didPerformWorkStackCursor , fiber ) , pop ( contextStackCursor , fiber ) ) ;
2017-05-26 17:51:06 +00:00
}
2017-09-18 23:32:37 +00:00
var popContextProvider _1 = popContextProvider , popTopLevelContextObject = function ( fiber ) {
pop ( didPerformWorkStackCursor , fiber ) , pop ( contextStackCursor , fiber ) ;
} , pushTopLevelContextObject = function ( fiber , context , didChange ) {
2017-08-09 19:18:46 +00:00
invariant ( null == contextStackCursor . cursor , "Unexpected context found on stack. " + "This error is likely caused by a bug in React. Please file an issue." ) ,
push ( contextStackCursor , context , fiber ) , push ( didPerformWorkStackCursor , didChange , fiber ) ;
} ;
2017-05-26 17:51:06 +00:00
2017-10-04 17:06:57 +00:00
function processChildContext$1 ( fiber , parentContext ) {
2017-08-09 19:18:46 +00:00
var instance = fiber . stateNode , childContextTypes = fiber . type . childContextTypes ;
if ( "function" != typeof instance . getChildContext ) return parentContext ;
var childContext = void 0 ;
childContext = instance . getChildContext ( ) ;
for ( var contextKey in childContext ) invariant ( contextKey in childContextTypes , '%s.getChildContext(): key "%s" is not defined in childContextTypes.' , getComponentName _1 ( fiber ) || "Unknown" , contextKey ) ;
return Object . assign ( { } , parentContext , childContext ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var processChildContext _1 = processChildContext$1 , pushContextProvider = function ( workInProgress ) {
if ( ! isContextProvider$1 ( workInProgress ) ) return ! 1 ;
var instance = workInProgress . stateNode , memoizedMergedChildContext = instance && instance . _ _reactInternalMemoizedMergedChildContext || emptyObject ;
return previousContext = contextStackCursor . current , push ( contextStackCursor , memoizedMergedChildContext , workInProgress ) ,
push ( didPerformWorkStackCursor , didPerformWorkStackCursor . current , workInProgress ) ,
! 0 ;
} , invalidateContextProvider = function ( workInProgress , didChange ) {
var instance = workInProgress . stateNode ;
if ( invariant ( instance , "Expected to have an instance by this point. " + "This error is likely caused by a bug in React. Please file an issue." ) ,
didChange ) {
2017-10-04 17:06:57 +00:00
var mergedContext = processChildContext$1 ( workInProgress , previousContext ) ;
2017-08-09 19:18:46 +00:00
instance . _ _reactInternalMemoizedMergedChildContext = mergedContext , pop ( didPerformWorkStackCursor , workInProgress ) ,
pop ( contextStackCursor , workInProgress ) , push ( contextStackCursor , mergedContext , workInProgress ) ,
push ( didPerformWorkStackCursor , didChange , workInProgress ) ;
} else pop ( didPerformWorkStackCursor , workInProgress ) , push ( didPerformWorkStackCursor , didChange , workInProgress ) ;
} , resetContext = function ( ) {
previousContext = emptyObject , contextStackCursor . current = emptyObject , didPerformWorkStackCursor . current = ! 1 ;
} , findCurrentUnmaskedContext$1 = function ( fiber ) {
invariant ( isFiberMounted ( fiber ) && fiber . tag === ClassComponent$1 , "Expected subtree parent to be a mounted class component. " + "This error is likely caused by a bug in React. Please file an issue." ) ;
for ( var node = fiber ; node . tag !== HostRoot$1 ; ) {
if ( isContextProvider$1 ( node ) ) return node . stateNode . _ _reactInternalMemoizedMergedChildContext ;
var parent = node . return ;
invariant ( parent , "Found unexpected detached subtree parent. " + "This error is likely caused by a bug in React. Please file an issue." ) ,
node = parent ;
}
return node . stateNode . context ;
} , ReactFiberContext = {
getUnmaskedContext : getUnmaskedContext _1 ,
cacheContext : cacheContext _1 ,
getMaskedContext : getMaskedContext ,
hasContextChanged : hasContextChanged ,
isContextConsumer : isContextConsumer _1 ,
isContextProvider : isContextProvider _1 ,
popContextProvider : popContextProvider _1 ,
2017-09-18 23:32:37 +00:00
popTopLevelContextObject : popTopLevelContextObject ,
2017-08-09 19:18:46 +00:00
pushTopLevelContextObject : pushTopLevelContextObject ,
processChildContext : processChildContext _1 ,
pushContextProvider : pushContextProvider ,
invalidateContextProvider : invalidateContextProvider ,
resetContext : resetContext ,
findCurrentUnmaskedContext : findCurrentUnmaskedContext$1
} , ReactTypeOfInternalContext = {
NoContext : 0 ,
AsyncUpdates : 1
2017-09-15 01:01:25 +00:00
} , IndeterminateComponent = ReactTypeOfWork . IndeterminateComponent , ClassComponent$3 = ReactTypeOfWork . ClassComponent , HostRoot$3 = ReactTypeOfWork . HostRoot , HostComponent$2 = ReactTypeOfWork . HostComponent , HostText$1 = ReactTypeOfWork . HostText , HostPortal$1 = ReactTypeOfWork . HostPortal , CoroutineComponent = ReactTypeOfWork . CoroutineComponent , YieldComponent = ReactTypeOfWork . YieldComponent , Fragment = ReactTypeOfWork . Fragment , NoWork$1 = ReactPriorityLevel . NoWork , NoContext = ReactTypeOfInternalContext . NoContext , NoEffect$1 = ReactTypeOfSideEffect . NoEffect ;
function FiberNode ( tag , key , internalContextTag ) {
this . tag = tag , this . key = key , this . type = null , this . stateNode = null , this . return = null ,
this . child = null , this . sibling = null , this . index = 0 , this . ref = null , this . pendingProps = null ,
this . memoizedProps = null , this . updateQueue = null , this . memoizedState = null , this . internalContextTag = internalContextTag ,
this . effectTag = NoEffect$1 , this . nextEffect = null , this . firstEffect = null , this . lastEffect = null ,
this . pendingWorkPriority = NoWork$1 , this . alternate = null ;
}
var createFiber = function ( tag , key , internalContextTag ) {
return new FiberNode ( tag , key , internalContextTag ) ;
2017-08-09 19:18:46 +00:00
} ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function shouldConstruct ( Component ) {
return ! ( ! Component . prototype || ! Component . prototype . isReactComponent ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var createWorkInProgress = function ( current , renderPriority ) {
var workInProgress = current . alternate ;
return null === workInProgress ? ( workInProgress = createFiber ( current . tag , current . key , current . internalContextTag ) ,
workInProgress . type = current . type , workInProgress . stateNode = current . stateNode ,
2017-09-18 23:32:37 +00:00
workInProgress . alternate = current , current . alternate = workInProgress ) : ( workInProgress . effectTag = NoEffect$1 ,
2017-08-09 19:18:46 +00:00
workInProgress . nextEffect = null , workInProgress . firstEffect = null , workInProgress . lastEffect = null ) ,
workInProgress . pendingWorkPriority = renderPriority , workInProgress . child = current . child ,
workInProgress . memoizedProps = current . memoizedProps , workInProgress . memoizedState = current . memoizedState ,
workInProgress . updateQueue = current . updateQueue , workInProgress . sibling = current . sibling ,
workInProgress . index = current . index , workInProgress . ref = current . ref , workInProgress ;
} , createHostRootFiber$1 = function ( ) {
return createFiber ( HostRoot$3 , null , NoContext ) ;
} , createFiberFromElement = function ( element , internalContextTag , priorityLevel ) {
var owner = null , fiber = createFiberFromElementType ( element . type , element . key , internalContextTag , owner ) ;
return fiber . pendingProps = element . props , fiber . pendingWorkPriority = priorityLevel ,
fiber ;
} , createFiberFromFragment = function ( elements , internalContextTag , priorityLevel ) {
var fiber = createFiber ( Fragment , null , internalContextTag ) ;
return fiber . pendingProps = elements , fiber . pendingWorkPriority = priorityLevel ,
fiber ;
} , createFiberFromText = function ( content , internalContextTag , priorityLevel ) {
var fiber = createFiber ( HostText$1 , null , internalContextTag ) ;
return fiber . pendingProps = content , fiber . pendingWorkPriority = priorityLevel ,
fiber ;
2017-05-26 17:51:06 +00:00
} ;
2017-08-09 19:18:46 +00:00
function createFiberFromElementType ( type , key , internalContextTag , debugOwner ) {
var fiber = void 0 ;
if ( "function" == typeof type ) fiber = shouldConstruct ( type ) ? createFiber ( ClassComponent$3 , key , internalContextTag ) : createFiber ( IndeterminateComponent , key , internalContextTag ) ,
fiber . type = type ; else if ( "string" == typeof type ) fiber = createFiber ( HostComponent$2 , key , internalContextTag ) ,
fiber . type = type ; else if ( "object" == typeof type && null !== type && "number" == typeof type . tag ) fiber = type ; else {
var info = "" ;
invariant ( ! 1 , "Element type is invalid: expected a string (for built-in components) " + "or a class/function (for composite components) but got: %s.%s" , null == type ? type : typeof type , info ) ;
}
return fiber ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var createFiberFromElementType _1 = createFiberFromElementType , createFiberFromHostInstanceForDeletion = function ( ) {
var fiber = createFiber ( HostComponent$2 , null , NoContext ) ;
return fiber . type = "DELETED" , fiber ;
} , createFiberFromCoroutine = function ( coroutine , internalContextTag , priorityLevel ) {
var fiber = createFiber ( CoroutineComponent , coroutine . key , internalContextTag ) ;
return fiber . type = coroutine . handler , fiber . pendingProps = coroutine , fiber . pendingWorkPriority = priorityLevel ,
fiber ;
} , createFiberFromYield = function ( yieldNode , internalContextTag , priorityLevel ) {
return createFiber ( YieldComponent , null , internalContextTag ) ;
} , createFiberFromPortal = function ( portal , internalContextTag , priorityLevel ) {
var fiber = createFiber ( HostPortal$1 , portal . key , internalContextTag ) ;
return fiber . pendingProps = portal . children || [ ] , fiber . pendingWorkPriority = priorityLevel ,
fiber . stateNode = {
containerInfo : portal . containerInfo ,
implementation : portal . implementation
} , fiber ;
} , largerPriority = function ( p1 , p2 ) {
return p1 !== NoWork$1 && ( p2 === NoWork$1 || p2 > p1 ) ? p1 : p2 ;
} , ReactFiber = {
createWorkInProgress : createWorkInProgress ,
createHostRootFiber : createHostRootFiber$1 ,
createFiberFromElement : createFiberFromElement ,
createFiberFromFragment : createFiberFromFragment ,
createFiberFromText : createFiberFromText ,
createFiberFromElementType : createFiberFromElementType _1 ,
createFiberFromHostInstanceForDeletion : createFiberFromHostInstanceForDeletion ,
createFiberFromCoroutine : createFiberFromCoroutine ,
createFiberFromYield : createFiberFromYield ,
createFiberFromPortal : createFiberFromPortal ,
largerPriority : largerPriority
} , createHostRootFiber = ReactFiber . createHostRootFiber , createFiberRoot$1 = function ( containerInfo ) {
var uninitializedFiber = createHostRootFiber ( ) , root = {
current : uninitializedFiber ,
containerInfo : containerInfo ,
isScheduled : ! 1 ,
nextScheduledRoot : null ,
context : null ,
pendingContext : null
} ;
return uninitializedFiber . stateNode = root , root ;
} , ReactFiberRoot = {
createFiberRoot : createFiberRoot$1
} , describeComponentFrame = function ( name , source , ownerName ) {
return "\n in " + ( name || "Unknown" ) + ( source ? " (at " + source . fileName . replace ( /^.*[\\\/]/ , "" ) + ":" + source . lineNumber + ")" : ownerName ? " (created by " + ownerName + ")" : "" ) ;
} , IndeterminateComponent$1 = ReactTypeOfWork . IndeterminateComponent , FunctionalComponent = ReactTypeOfWork . FunctionalComponent , ClassComponent$5 = ReactTypeOfWork . ClassComponent , HostComponent$4 = ReactTypeOfWork . HostComponent ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function describeFiber ( fiber ) {
switch ( fiber . tag ) {
case IndeterminateComponent$1 :
case FunctionalComponent :
case ClassComponent$5 :
case HostComponent$4 :
var owner = fiber . _debugOwner , source = fiber . _debugSource , name = getComponentName _1 ( fiber ) , ownerName = null ;
return owner && ( ownerName = getComponentName _1 ( owner ) ) , describeComponentFrame ( name , source , ownerName ) ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
default :
return "" ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function getStackAddendumByWorkInProgressFiber$1 ( workInProgress ) {
var info = "" , node = workInProgress ;
do {
info += describeFiber ( node ) , node = node . return ;
} while ( node ) ;
return info ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var ReactFiberComponentTreeHook = {
getStackAddendumByWorkInProgressFiber : getStackAddendumByWorkInProgressFiber$1
} , REACT _COROUTINE _TYPE$1 , REACT _YIELD _TYPE$1 ;
"function" == typeof Symbol && Symbol . for ? ( REACT _COROUTINE _TYPE$1 = Symbol . for ( "react.coroutine" ) ,
REACT _YIELD _TYPE$1 = Symbol . for ( "react.yield" ) ) : ( REACT _COROUTINE _TYPE$1 = 60104 ,
REACT _YIELD _TYPE$1 = 60105 ) ;
var createCoroutine = function ( children , handler , props ) {
2017-05-26 17:51:06 +00:00
var key = arguments . length > 3 && void 0 !== arguments [ 3 ] ? arguments [ 3 ] : null ;
return {
2017-08-09 19:18:46 +00:00
$$typeof : REACT _COROUTINE _TYPE$1 ,
2017-05-26 17:51:06 +00:00
key : null == key ? null : "" + key ,
children : children ,
2017-08-09 19:18:46 +00:00
handler : handler ,
props : props
2017-07-14 00:20:15 +00:00
} ;
2017-08-09 19:18:46 +00:00
} , createYield = function ( value ) {
2017-05-26 17:51:06 +00:00
return {
2017-08-09 19:18:46 +00:00
$$typeof : REACT _YIELD _TYPE$1 ,
value : value
2017-05-26 17:51:06 +00:00
} ;
2017-08-09 19:18:46 +00:00
} , isCoroutine = function ( object ) {
return "object" == typeof object && null !== object && object . $$typeof === REACT _COROUTINE _TYPE$1 ;
} , isYield = function ( object ) {
return "object" == typeof object && null !== object && object . $$typeof === REACT _YIELD _TYPE$1 ;
} , REACT _YIELD _TYPE _1 = REACT _YIELD _TYPE$1 , REACT _COROUTINE _TYPE _1 = REACT _COROUTINE _TYPE$1 , ReactCoroutine = {
createCoroutine : createCoroutine ,
createYield : createYield ,
isCoroutine : isCoroutine ,
isYield : isYield ,
REACT _YIELD _TYPE : REACT _YIELD _TYPE _1 ,
REACT _COROUTINE _TYPE : REACT _COROUTINE _TYPE _1
} , REACT _COROUTINE _TYPE = ReactCoroutine . REACT _COROUTINE _TYPE , REACT _YIELD _TYPE = ReactCoroutine . REACT _YIELD _TYPE , REACT _PORTAL _TYPE$1 = ReactPortal . REACT _PORTAL _TYPE , createWorkInProgress$2 = ReactFiber . createWorkInProgress , createFiberFromElement$1 = ReactFiber . createFiberFromElement , createFiberFromFragment$1 = ReactFiber . createFiberFromFragment , createFiberFromText$1 = ReactFiber . createFiberFromText , createFiberFromCoroutine$1 = ReactFiber . createFiberFromCoroutine , createFiberFromYield$1 = ReactFiber . createFiberFromYield , createFiberFromPortal$1 = ReactFiber . createFiberFromPortal , isArray = Array . isArray , FunctionalComponent$2 = ReactTypeOfWork . FunctionalComponent , ClassComponent$7 = ReactTypeOfWork . ClassComponent , HostText$3 = ReactTypeOfWork . HostText , HostPortal$4 = ReactTypeOfWork . HostPortal , CoroutineComponent$2 = ReactTypeOfWork . CoroutineComponent , YieldComponent$2 = ReactTypeOfWork . YieldComponent , Fragment$2 = ReactTypeOfWork . Fragment , NoEffect$2 = ReactTypeOfSideEffect . NoEffect , Placement$3 = ReactTypeOfSideEffect . Placement , Deletion$1 = ReactTypeOfSideEffect . Deletion , ITERATOR _SYMBOL = "function" == typeof Symbol && Symbol . iterator , FAUX _ITERATOR _SYMBOL = "@@iterator" , REACT _ELEMENT _TYPE = "function" == typeof Symbol && Symbol . for && Symbol . for ( "react.element" ) || 60103 ;
2017-07-14 00:20:15 +00:00
2017-08-09 19:18:46 +00:00
function getIteratorFn ( maybeIterable ) {
if ( null === maybeIterable || void 0 === maybeIterable ) return null ;
var iteratorFn = ITERATOR _SYMBOL && maybeIterable [ ITERATOR _SYMBOL ] || maybeIterable [ FAUX _ITERATOR _SYMBOL ] ;
return "function" == typeof iteratorFn ? iteratorFn : null ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function coerceRef ( current , element ) {
var mixedRef = element . ref ;
if ( null !== mixedRef && "function" != typeof mixedRef ) {
if ( element . _owner ) {
var owner = element . _owner , inst = void 0 ;
2017-10-04 17:06:57 +00:00
if ( owner ) {
2017-08-09 19:18:46 +00:00
var ownerFiber = owner ;
invariant ( ownerFiber . tag === ClassComponent$7 , "Stateless function components cannot have refs." ) ,
inst = ownerFiber . stateNode ;
2017-10-04 17:06:57 +00:00
}
2017-08-09 19:18:46 +00:00
invariant ( inst , "Missing owner for string ref %s. This error is likely caused by a " + "bug in React. Please file an issue." , mixedRef ) ;
var stringRef = "" + mixedRef ;
if ( null !== current && null !== current . ref && current . ref . _stringRef === stringRef ) return current . ref ;
var ref = function ( value ) {
var refs = inst . refs === emptyObject ? inst . refs = { } : inst . refs ;
null === value ? delete refs [ stringRef ] : refs [ stringRef ] = value ;
} ;
return ref . _stringRef = stringRef , ref ;
}
invariant ( "string" == typeof mixedRef , "Expected ref to be a function or a string." ) ,
invariant ( element . _owner , "Element ref was specified as a string (%s) but no owner was " + "set. You may have multiple copies of React loaded. " + "(details: https://fb.me/react-refs-must-have-owner)." , mixedRef ) ;
}
return mixedRef ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function throwOnInvalidObjectType ( returnFiber , newChild ) {
if ( "textarea" !== returnFiber . type ) {
invariant ( ! 1 , "Objects are not valid as a React child (found: %s).%s" , "[object Object]" === Object . prototype . toString . call ( newChild ) ? "object with keys {" + Object . keys ( newChild ) . join ( ", " ) + "}" : newChild , "" ) ;
}
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function ChildReconciler ( shouldClone , shouldTrackSideEffects ) {
function deleteChild ( returnFiber , childToDelete ) {
if ( shouldTrackSideEffects ) {
if ( ! shouldClone ) {
if ( null === childToDelete . alternate ) return ;
childToDelete = childToDelete . alternate ;
}
var last = returnFiber . lastEffect ;
null !== last ? ( last . nextEffect = childToDelete , returnFiber . lastEffect = childToDelete ) : returnFiber . firstEffect = returnFiber . lastEffect = childToDelete ,
childToDelete . nextEffect = null , childToDelete . effectTag = Deletion$1 ;
}
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function deleteRemainingChildren ( returnFiber , currentFirstChild ) {
if ( ! shouldTrackSideEffects ) return null ;
for ( var childToDelete = currentFirstChild ; null !== childToDelete ; ) deleteChild ( returnFiber , childToDelete ) ,
childToDelete = childToDelete . sibling ;
return null ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function mapRemainingChildren ( returnFiber , currentFirstChild ) {
for ( var existingChildren = new Map ( ) , existingChild = currentFirstChild ; null !== existingChild ; ) null !== existingChild . key ? existingChildren . set ( existingChild . key , existingChild ) : existingChildren . set ( existingChild . index , existingChild ) ,
existingChild = existingChild . sibling ;
return existingChildren ;
2017-07-14 00:20:15 +00:00
}
2017-08-09 19:18:46 +00:00
function useFiber ( fiber , priority ) {
if ( shouldClone ) {
var clone = createWorkInProgress$2 ( fiber , priority ) ;
return clone . index = 0 , clone . sibling = null , clone ;
}
return fiber . pendingWorkPriority = priority , fiber . effectTag = NoEffect$2 , fiber . index = 0 ,
fiber . sibling = null , fiber ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function placeChild ( newFiber , lastPlacedIndex , newIndex ) {
if ( newFiber . index = newIndex , ! shouldTrackSideEffects ) return lastPlacedIndex ;
var current = newFiber . alternate ;
if ( null !== current ) {
var oldIndex = current . index ;
return oldIndex < lastPlacedIndex ? ( newFiber . effectTag = Placement$3 , lastPlacedIndex ) : oldIndex ;
2017-07-14 00:20:15 +00:00
}
2017-08-09 19:18:46 +00:00
return newFiber . effectTag = Placement$3 , lastPlacedIndex ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function placeSingleChild ( newFiber ) {
return shouldTrackSideEffects && null === newFiber . alternate && ( newFiber . effectTag = Placement$3 ) ,
newFiber ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function updateTextNode ( returnFiber , current , textContent , priority ) {
if ( null === current || current . tag !== HostText$3 ) {
var created = createFiberFromText$1 ( textContent , returnFiber . internalContextTag , priority ) ;
return created . return = returnFiber , created ;
}
var existing = useFiber ( current , priority ) ;
return existing . pendingProps = textContent , existing . return = returnFiber , existing ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function updateElement ( returnFiber , current , element , priority ) {
if ( null === current || current . type !== element . type ) {
var created = createFiberFromElement$1 ( element , returnFiber . internalContextTag , priority ) ;
return created . ref = coerceRef ( current , element ) , created . return = returnFiber ,
created ;
}
var existing = useFiber ( current , priority ) ;
return existing . ref = coerceRef ( current , element ) , existing . pendingProps = element . props ,
existing . return = returnFiber , existing ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function updateCoroutine ( returnFiber , current , coroutine , priority ) {
if ( null === current || current . tag !== CoroutineComponent$2 ) {
var created = createFiberFromCoroutine$1 ( coroutine , returnFiber . internalContextTag , priority ) ;
return created . return = returnFiber , created ;
}
var existing = useFiber ( current , priority ) ;
return existing . pendingProps = coroutine , existing . return = returnFiber , existing ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function updateYield ( returnFiber , current , yieldNode , priority ) {
if ( null === current || current . tag !== YieldComponent$2 ) {
var created = createFiberFromYield$1 ( yieldNode , returnFiber . internalContextTag , priority ) ;
return created . type = yieldNode . value , created . return = returnFiber , created ;
}
var existing = useFiber ( current , priority ) ;
return existing . type = yieldNode . value , existing . return = returnFiber , existing ;
}
function updatePortal ( returnFiber , current , portal , priority ) {
if ( null === current || current . tag !== HostPortal$4 || current . stateNode . containerInfo !== portal . containerInfo || current . stateNode . implementation !== portal . implementation ) {
var created = createFiberFromPortal$1 ( portal , returnFiber . internalContextTag , priority ) ;
return created . return = returnFiber , created ;
}
var existing = useFiber ( current , priority ) ;
return existing . pendingProps = portal . children || [ ] , existing . return = returnFiber ,
existing ;
}
function updateFragment ( returnFiber , current , fragment , priority ) {
if ( null === current || current . tag !== Fragment$2 ) {
var created = createFiberFromFragment$1 ( fragment , returnFiber . internalContextTag , priority ) ;
return created . return = returnFiber , created ;
}
var existing = useFiber ( current , priority ) ;
return existing . pendingProps = fragment , existing . return = returnFiber , existing ;
}
function createChild ( returnFiber , newChild , priority ) {
if ( "string" == typeof newChild || "number" == typeof newChild ) {
var created = createFiberFromText$1 ( "" + newChild , returnFiber . internalContextTag , priority ) ;
return created . return = returnFiber , created ;
}
if ( "object" == typeof newChild && null !== newChild ) {
switch ( newChild . $$typeof ) {
case REACT _ELEMENT _TYPE :
var _created = createFiberFromElement$1 ( newChild , returnFiber . internalContextTag , priority ) ;
return _created . ref = coerceRef ( null , newChild ) , _created . return = returnFiber ,
_created ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
case REACT _COROUTINE _TYPE :
var _created2 = createFiberFromCoroutine$1 ( newChild , returnFiber . internalContextTag , priority ) ;
return _created2 . return = returnFiber , _created2 ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
case REACT _YIELD _TYPE :
var _created3 = createFiberFromYield$1 ( newChild , returnFiber . internalContextTag , priority ) ;
return _created3 . type = newChild . value , _created3 . return = returnFiber , _created3 ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
case REACT _PORTAL _TYPE$1 :
var _created4 = createFiberFromPortal$1 ( newChild , returnFiber . internalContextTag , priority ) ;
return _created4 . return = returnFiber , _created4 ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
if ( isArray ( newChild ) || getIteratorFn ( newChild ) ) {
var _created5 = createFiberFromFragment$1 ( newChild , returnFiber . internalContextTag , priority ) ;
return _created5 . return = returnFiber , _created5 ;
}
throwOnInvalidObjectType ( returnFiber , newChild ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return null ;
}
function updateSlot ( returnFiber , oldFiber , newChild , priority ) {
var key = null !== oldFiber ? oldFiber . key : null ;
if ( "string" == typeof newChild || "number" == typeof newChild ) return null !== key ? null : updateTextNode ( returnFiber , oldFiber , "" + newChild , priority ) ;
if ( "object" == typeof newChild && null !== newChild ) {
switch ( newChild . $$typeof ) {
case REACT _ELEMENT _TYPE :
return newChild . key === key ? updateElement ( returnFiber , oldFiber , newChild , priority ) : null ;
case REACT _COROUTINE _TYPE :
return newChild . key === key ? updateCoroutine ( returnFiber , oldFiber , newChild , priority ) : null ;
case REACT _YIELD _TYPE :
return null === key ? updateYield ( returnFiber , oldFiber , newChild , priority ) : null ;
case REACT _PORTAL _TYPE$1 :
return newChild . key === key ? updatePortal ( returnFiber , oldFiber , newChild , priority ) : null ;
}
if ( isArray ( newChild ) || getIteratorFn ( newChild ) ) return null !== key ? null : updateFragment ( returnFiber , oldFiber , newChild , priority ) ;
throwOnInvalidObjectType ( returnFiber , newChild ) ;
}
return null ;
}
function updateFromMap ( existingChildren , returnFiber , newIdx , newChild , priority ) {
if ( "string" == typeof newChild || "number" == typeof newChild ) {
return updateTextNode ( returnFiber , existingChildren . get ( newIdx ) || null , "" + newChild , priority ) ;
}
if ( "object" == typeof newChild && null !== newChild ) {
switch ( newChild . $$typeof ) {
case REACT _ELEMENT _TYPE :
return updateElement ( returnFiber , existingChildren . get ( null === newChild . key ? newIdx : newChild . key ) || null , newChild , priority ) ;
case REACT _COROUTINE _TYPE :
return updateCoroutine ( returnFiber , existingChildren . get ( null === newChild . key ? newIdx : newChild . key ) || null , newChild , priority ) ;
case REACT _YIELD _TYPE :
return updateYield ( returnFiber , existingChildren . get ( newIdx ) || null , newChild , priority ) ;
case REACT _PORTAL _TYPE$1 :
return updatePortal ( returnFiber , existingChildren . get ( null === newChild . key ? newIdx : newChild . key ) || null , newChild , priority ) ;
}
if ( isArray ( newChild ) || getIteratorFn ( newChild ) ) {
return updateFragment ( returnFiber , existingChildren . get ( newIdx ) || null , newChild , priority ) ;
}
throwOnInvalidObjectType ( returnFiber , newChild ) ;
}
return null ;
}
function reconcileChildrenArray ( returnFiber , currentFirstChild , newChildren , priority ) {
for ( var resultingFirstChild = null , previousNewFiber = null , oldFiber = currentFirstChild , lastPlacedIndex = 0 , newIdx = 0 , nextOldFiber = null ; null !== oldFiber && newIdx < newChildren . length ; newIdx ++ ) {
oldFiber . index > newIdx ? ( nextOldFiber = oldFiber , oldFiber = null ) : nextOldFiber = oldFiber . sibling ;
var newFiber = updateSlot ( returnFiber , oldFiber , newChildren [ newIdx ] , priority ) ;
if ( null === newFiber ) {
null === oldFiber && ( oldFiber = nextOldFiber ) ;
break ;
}
shouldTrackSideEffects && oldFiber && null === newFiber . alternate && deleteChild ( returnFiber , oldFiber ) ,
lastPlacedIndex = placeChild ( newFiber , lastPlacedIndex , newIdx ) , null === previousNewFiber ? resultingFirstChild = newFiber : previousNewFiber . sibling = newFiber ,
previousNewFiber = newFiber , oldFiber = nextOldFiber ;
}
if ( newIdx === newChildren . length ) return deleteRemainingChildren ( returnFiber , oldFiber ) ,
resultingFirstChild ;
if ( null === oldFiber ) {
for ( ; newIdx < newChildren . length ; newIdx ++ ) {
var _newFiber = createChild ( returnFiber , newChildren [ newIdx ] , priority ) ;
_newFiber && ( lastPlacedIndex = placeChild ( _newFiber , lastPlacedIndex , newIdx ) ,
null === previousNewFiber ? resultingFirstChild = _newFiber : previousNewFiber . sibling = _newFiber ,
previousNewFiber = _newFiber ) ;
}
return resultingFirstChild ;
}
for ( var existingChildren = mapRemainingChildren ( returnFiber , oldFiber ) ; newIdx < newChildren . length ; newIdx ++ ) {
var _newFiber2 = updateFromMap ( existingChildren , returnFiber , newIdx , newChildren [ newIdx ] , priority ) ;
_newFiber2 && ( shouldTrackSideEffects && null !== _newFiber2 . alternate && existingChildren . delete ( null === _newFiber2 . key ? newIdx : _newFiber2 . key ) ,
lastPlacedIndex = placeChild ( _newFiber2 , lastPlacedIndex , newIdx ) , null === previousNewFiber ? resultingFirstChild = _newFiber2 : previousNewFiber . sibling = _newFiber2 ,
previousNewFiber = _newFiber2 ) ;
}
return shouldTrackSideEffects && existingChildren . forEach ( function ( child ) {
return deleteChild ( returnFiber , child ) ;
} ) , resultingFirstChild ;
}
function reconcileChildrenIterator ( returnFiber , currentFirstChild , newChildrenIterable , priority ) {
var iteratorFn = getIteratorFn ( newChildrenIterable ) ;
invariant ( "function" == typeof iteratorFn , "An object is not an iterable. This error is likely caused by a bug in " + "React. Please file an issue." ) ;
var newChildren = iteratorFn . call ( newChildrenIterable ) ;
invariant ( null != newChildren , "An iterable object provided no iterator." ) ;
for ( var resultingFirstChild = null , previousNewFiber = null , oldFiber = currentFirstChild , lastPlacedIndex = 0 , newIdx = 0 , nextOldFiber = null , step = newChildren . next ( ) ; null !== oldFiber && ! step . done ; newIdx ++ ,
step = newChildren . next ( ) ) {
oldFiber . index > newIdx ? ( nextOldFiber = oldFiber , oldFiber = null ) : nextOldFiber = oldFiber . sibling ;
var newFiber = updateSlot ( returnFiber , oldFiber , step . value , priority ) ;
if ( null === newFiber ) {
oldFiber || ( oldFiber = nextOldFiber ) ;
break ;
}
shouldTrackSideEffects && oldFiber && null === newFiber . alternate && deleteChild ( returnFiber , oldFiber ) ,
lastPlacedIndex = placeChild ( newFiber , lastPlacedIndex , newIdx ) , null === previousNewFiber ? resultingFirstChild = newFiber : previousNewFiber . sibling = newFiber ,
previousNewFiber = newFiber , oldFiber = nextOldFiber ;
}
if ( step . done ) return deleteRemainingChildren ( returnFiber , oldFiber ) , resultingFirstChild ;
if ( null === oldFiber ) {
for ( ; ! step . done ; newIdx ++ , step = newChildren . next ( ) ) {
var _newFiber3 = createChild ( returnFiber , step . value , priority ) ;
null !== _newFiber3 && ( lastPlacedIndex = placeChild ( _newFiber3 , lastPlacedIndex , newIdx ) ,
null === previousNewFiber ? resultingFirstChild = _newFiber3 : previousNewFiber . sibling = _newFiber3 ,
previousNewFiber = _newFiber3 ) ;
}
return resultingFirstChild ;
}
for ( var existingChildren = mapRemainingChildren ( returnFiber , oldFiber ) ; ! step . done ; newIdx ++ ,
step = newChildren . next ( ) ) {
var _newFiber4 = updateFromMap ( existingChildren , returnFiber , newIdx , step . value , priority ) ;
null !== _newFiber4 && ( shouldTrackSideEffects && null !== _newFiber4 . alternate && existingChildren . delete ( null === _newFiber4 . key ? newIdx : _newFiber4 . key ) ,
lastPlacedIndex = placeChild ( _newFiber4 , lastPlacedIndex , newIdx ) , null === previousNewFiber ? resultingFirstChild = _newFiber4 : previousNewFiber . sibling = _newFiber4 ,
previousNewFiber = _newFiber4 ) ;
}
return shouldTrackSideEffects && existingChildren . forEach ( function ( child ) {
return deleteChild ( returnFiber , child ) ;
} ) , resultingFirstChild ;
}
function reconcileSingleTextNode ( returnFiber , currentFirstChild , textContent , priority ) {
if ( null !== currentFirstChild && currentFirstChild . tag === HostText$3 ) {
deleteRemainingChildren ( returnFiber , currentFirstChild . sibling ) ;
var existing = useFiber ( currentFirstChild , priority ) ;
return existing . pendingProps = textContent , existing . return = returnFiber , existing ;
}
deleteRemainingChildren ( returnFiber , currentFirstChild ) ;
var created = createFiberFromText$1 ( textContent , returnFiber . internalContextTag , priority ) ;
return created . return = returnFiber , created ;
}
function reconcileSingleElement ( returnFiber , currentFirstChild , element , priority ) {
for ( var key = element . key , child = currentFirstChild ; null !== child ; ) {
if ( child . key === key ) {
if ( child . type === element . type ) {
deleteRemainingChildren ( returnFiber , child . sibling ) ;
var existing = useFiber ( child , priority ) ;
return existing . ref = coerceRef ( child , element ) , existing . pendingProps = element . props ,
existing . return = returnFiber , existing ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
deleteRemainingChildren ( returnFiber , child ) ;
break ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
deleteChild ( returnFiber , child ) , child = child . sibling ;
}
var created = createFiberFromElement$1 ( element , returnFiber . internalContextTag , priority ) ;
return created . ref = coerceRef ( currentFirstChild , element ) , created . return = returnFiber ,
created ;
}
function reconcileSingleCoroutine ( returnFiber , currentFirstChild , coroutine , priority ) {
for ( var key = coroutine . key , child = currentFirstChild ; null !== child ; ) {
if ( child . key === key ) {
if ( child . tag === CoroutineComponent$2 ) {
deleteRemainingChildren ( returnFiber , child . sibling ) ;
var existing = useFiber ( child , priority ) ;
return existing . pendingProps = coroutine , existing . return = returnFiber , existing ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
deleteRemainingChildren ( returnFiber , child ) ;
break ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
deleteChild ( returnFiber , child ) , child = child . sibling ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var created = createFiberFromCoroutine$1 ( coroutine , returnFiber . internalContextTag , priority ) ;
return created . return = returnFiber , created ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function reconcileSingleYield ( returnFiber , currentFirstChild , yieldNode , priority ) {
var child = currentFirstChild ;
if ( null !== child ) {
if ( child . tag === YieldComponent$2 ) {
deleteRemainingChildren ( returnFiber , child . sibling ) ;
var existing = useFiber ( child , priority ) ;
return existing . type = yieldNode . value , existing . return = returnFiber , existing ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
deleteRemainingChildren ( returnFiber , child ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var created = createFiberFromYield$1 ( yieldNode , returnFiber . internalContextTag , priority ) ;
return created . type = yieldNode . value , created . return = returnFiber , created ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function reconcileSinglePortal ( returnFiber , currentFirstChild , portal , priority ) {
for ( var key = portal . key , child = currentFirstChild ; null !== child ; ) {
if ( child . key === key ) {
if ( child . tag === HostPortal$4 && child . stateNode . containerInfo === portal . containerInfo && child . stateNode . implementation === portal . implementation ) {
deleteRemainingChildren ( returnFiber , child . sibling ) ;
var existing = useFiber ( child , priority ) ;
return existing . pendingProps = portal . children || [ ] , existing . return = returnFiber ,
existing ;
}
deleteRemainingChildren ( returnFiber , child ) ;
break ;
}
deleteChild ( returnFiber , child ) , child = child . sibling ;
}
var created = createFiberFromPortal$1 ( portal , returnFiber . internalContextTag , priority ) ;
return created . return = returnFiber , created ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function reconcileChildFibers ( returnFiber , currentFirstChild , newChild , priority ) {
2017-09-15 01:01:25 +00:00
var isObject = "object" == typeof newChild && null !== newChild ;
if ( isObject ) switch ( newChild . $$typeof ) {
2017-08-09 19:18:46 +00:00
case REACT _ELEMENT _TYPE :
return placeSingleChild ( reconcileSingleElement ( returnFiber , currentFirstChild , newChild , priority ) ) ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
case REACT _COROUTINE _TYPE :
return placeSingleChild ( reconcileSingleCoroutine ( returnFiber , currentFirstChild , newChild , priority ) ) ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
case REACT _YIELD _TYPE :
return placeSingleChild ( reconcileSingleYield ( returnFiber , currentFirstChild , newChild , priority ) ) ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
case REACT _PORTAL _TYPE$1 :
return placeSingleChild ( reconcileSinglePortal ( returnFiber , currentFirstChild , newChild , priority ) ) ;
}
if ( "string" == typeof newChild || "number" == typeof newChild ) return placeSingleChild ( reconcileSingleTextNode ( returnFiber , currentFirstChild , "" + newChild , priority ) ) ;
if ( isArray ( newChild ) ) return reconcileChildrenArray ( returnFiber , currentFirstChild , newChild , priority ) ;
if ( getIteratorFn ( newChild ) ) return reconcileChildrenIterator ( returnFiber , currentFirstChild , newChild , priority ) ;
2017-09-15 01:01:25 +00:00
if ( isObject && throwOnInvalidObjectType ( returnFiber , newChild ) , void 0 === newChild ) switch ( returnFiber . tag ) {
2017-08-09 19:18:46 +00:00
case ClassComponent$7 :
case FunctionalComponent$2 :
2017-09-15 01:01:25 +00:00
var Component = returnFiber . type ;
invariant ( ! 1 , "%s(...): Nothing was returned from render. This usually means a " + "return statement is missing. Or, to render nothing, " + "return null." , Component . displayName || Component . name || "Component" ) ;
2017-08-09 19:18:46 +00:00
}
return deleteRemainingChildren ( returnFiber , currentFirstChild ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return reconcileChildFibers ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var reconcileChildFibers$1 = ChildReconciler ( ! 0 , ! 0 ) , reconcileChildFibersInPlace$1 = ChildReconciler ( ! 1 , ! 0 ) , mountChildFibersInPlace$1 = ChildReconciler ( ! 1 , ! 1 ) , cloneChildFibers$1 = function ( current , workInProgress ) {
if ( invariant ( null === current || workInProgress . child === current . child , "Resuming work not yet implemented." ) ,
null !== workInProgress . child ) {
var currentChild = workInProgress . child , newChild = createWorkInProgress$2 ( currentChild , currentChild . pendingWorkPriority ) ;
for ( newChild . pendingProps = currentChild . pendingProps , workInProgress . child = newChild ,
newChild . return = workInProgress ; null !== currentChild . sibling ; ) currentChild = currentChild . sibling ,
newChild = newChild . sibling = createWorkInProgress$2 ( currentChild , currentChild . pendingWorkPriority ) ,
newChild . pendingProps = currentChild . pendingProps , newChild . return = workInProgress ;
newChild . sibling = null ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
} , ReactChildFiber = {
reconcileChildFibers : reconcileChildFibers$1 ,
reconcileChildFibersInPlace : reconcileChildFibersInPlace$1 ,
mountChildFibersInPlace : mountChildFibersInPlace$1 ,
cloneChildFibers : cloneChildFibers$1
} , Update$1 = ReactTypeOfSideEffect . Update , AsyncUpdates$1 = ReactTypeOfInternalContext . AsyncUpdates , cacheContext$1 = ReactFiberContext . cacheContext , getMaskedContext$2 = ReactFiberContext . getMaskedContext , getUnmaskedContext$2 = ReactFiberContext . getUnmaskedContext , isContextConsumer$1 = ReactFiberContext . isContextConsumer , addUpdate$1 = ReactFiberUpdateQueue . addUpdate , addReplaceUpdate$1 = ReactFiberUpdateQueue . addReplaceUpdate , addForceUpdate$1 = ReactFiberUpdateQueue . addForceUpdate , beginUpdateQueue$2 = ReactFiberUpdateQueue . beginUpdateQueue , _require5 = ReactFiberContext , hasContextChanged$2 = _require5 . hasContextChanged , isMounted$1 = ReactFiberTreeReflection . isMounted , ReactFiberClassComponent = function ( scheduleUpdate , getPriorityContext , memoizeProps , memoizeState ) {
var updater = {
isMounted : isMounted$1 ,
enqueueSetState : function ( instance , partialState , callback ) {
var fiber = ReactInstanceMap _1 . get ( instance ) , priorityLevel = getPriorityContext ( fiber , ! 1 ) ;
callback = void 0 === callback ? null : callback , addUpdate$1 ( fiber , partialState , callback , priorityLevel ) ,
scheduleUpdate ( fiber , priorityLevel ) ;
} ,
enqueueReplaceState : function ( instance , state , callback ) {
var fiber = ReactInstanceMap _1 . get ( instance ) , priorityLevel = getPriorityContext ( fiber , ! 1 ) ;
callback = void 0 === callback ? null : callback , addReplaceUpdate$1 ( fiber , state , callback , priorityLevel ) ,
scheduleUpdate ( fiber , priorityLevel ) ;
} ,
enqueueForceUpdate : function ( instance , callback ) {
var fiber = ReactInstanceMap _1 . get ( instance ) , priorityLevel = getPriorityContext ( fiber , ! 1 ) ;
callback = void 0 === callback ? null : callback , addForceUpdate$1 ( fiber , callback , priorityLevel ) ,
scheduleUpdate ( fiber , priorityLevel ) ;
}
2017-05-26 17:51:06 +00:00
} ;
2017-08-09 19:18:46 +00:00
function checkShouldComponentUpdate ( workInProgress , oldProps , newProps , oldState , newState , newContext ) {
if ( null === oldProps || null !== workInProgress . updateQueue && workInProgress . updateQueue . hasForceUpdate ) return ! 0 ;
var instance = workInProgress . stateNode , type = workInProgress . type ;
if ( "function" == typeof instance . shouldComponentUpdate ) {
return instance . shouldComponentUpdate ( newProps , newState , newContext ) ;
}
return ! type . prototype || ! type . prototype . isPureReactComponent || ( ! shallowEqual ( oldProps , newProps ) || ! shallowEqual ( oldState , newState ) ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function resetInputPointers ( workInProgress , instance ) {
instance . props = workInProgress . memoizedProps , instance . state = workInProgress . memoizedState ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function adoptClassInstance ( workInProgress , instance ) {
instance . updater = updater , workInProgress . stateNode = instance , ReactInstanceMap _1 . set ( instance , workInProgress ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function constructClassInstance ( workInProgress , props ) {
var ctor = workInProgress . type , unmaskedContext = getUnmaskedContext$2 ( workInProgress ) , needsContext = isContextConsumer$1 ( workInProgress ) , context = needsContext ? getMaskedContext$2 ( workInProgress , unmaskedContext ) : emptyObject , instance = new ctor ( props , context ) ;
return adoptClassInstance ( workInProgress , instance ) , needsContext && cacheContext$1 ( workInProgress , unmaskedContext , context ) ,
instance ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function callComponentWillMount ( workInProgress , instance ) {
var oldState = instance . state ;
instance . componentWillMount ( ) , oldState !== instance . state && updater . enqueueReplaceState ( instance , instance . state , null ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function callComponentWillReceiveProps ( workInProgress , instance , newProps , newContext ) {
var oldState = instance . state ;
instance . componentWillReceiveProps ( newProps , newContext ) , instance . state !== oldState && updater . enqueueReplaceState ( instance , instance . state , null ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function mountClassInstance ( workInProgress , priorityLevel ) {
var current = workInProgress . alternate , instance = workInProgress . stateNode , state = instance . state || null , props = workInProgress . pendingProps ;
invariant ( props , "There must be pending props for an initial mount. This error is " + "likely caused by a bug in React. Please file an issue." ) ;
var unmaskedContext = getUnmaskedContext$2 ( workInProgress ) ;
if ( instance . props = props , instance . state = state , instance . refs = emptyObject ,
instance . context = getMaskedContext$2 ( workInProgress , unmaskedContext ) , ReactFeatureFlags _1 . enableAsyncSubtreeAPI && null != workInProgress . type && null != workInProgress . type . prototype && ! 0 === workInProgress . type . prototype . unstable _isAsyncReactComponent && ( workInProgress . internalContextTag |= AsyncUpdates$1 ) ,
"function" == typeof instance . componentWillMount ) {
callComponentWillMount ( workInProgress , instance ) ;
var updateQueue = workInProgress . updateQueue ;
null !== updateQueue && ( instance . state = beginUpdateQueue$2 ( current , workInProgress , updateQueue , instance , state , props , priorityLevel ) ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
"function" == typeof instance . componentDidMount && ( workInProgress . effectTag |= Update$1 ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function updateClassInstance ( current , workInProgress , priorityLevel ) {
var instance = workInProgress . stateNode ;
resetInputPointers ( workInProgress , instance ) ;
var oldProps = workInProgress . memoizedProps , newProps = workInProgress . pendingProps ;
newProps || ( newProps = oldProps , invariant ( null != newProps , "There should always be pending or memoized props. This error is " + "likely caused by a bug in React. Please file an issue." ) ) ;
var oldContext = instance . context , newUnmaskedContext = getUnmaskedContext$2 ( workInProgress ) , newContext = getMaskedContext$2 ( workInProgress , newUnmaskedContext ) ;
"function" != typeof instance . componentWillReceiveProps || oldProps === newProps && oldContext === newContext || callComponentWillReceiveProps ( workInProgress , instance , newProps , newContext ) ;
var oldState = workInProgress . memoizedState , newState = void 0 ;
if ( newState = null !== workInProgress . updateQueue ? beginUpdateQueue$2 ( current , workInProgress , workInProgress . updateQueue , instance , oldState , newProps , priorityLevel ) : oldState ,
! ( oldProps !== newProps || oldState !== newState || hasContextChanged$2 ( ) || null !== workInProgress . updateQueue && workInProgress . updateQueue . hasForceUpdate ) ) return "function" == typeof instance . componentDidUpdate && ( oldProps === current . memoizedProps && oldState === current . memoizedState || ( workInProgress . effectTag |= Update$1 ) ) ,
! 1 ;
var shouldUpdate = checkShouldComponentUpdate ( workInProgress , oldProps , newProps , oldState , newState , newContext ) ;
return shouldUpdate ? ( "function" == typeof instance . componentWillUpdate && instance . componentWillUpdate ( newProps , newState , newContext ) ,
"function" == typeof instance . componentDidUpdate && ( workInProgress . effectTag |= Update$1 ) ) : ( "function" == typeof instance . componentDidUpdate && ( oldProps === current . memoizedProps && oldState === current . memoizedState || ( workInProgress . effectTag |= Update$1 ) ) ,
memoizeProps ( workInProgress , newProps ) , memoizeState ( workInProgress , newState ) ) ,
instance . props = newProps , instance . state = newState , instance . context = newContext ,
shouldUpdate ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return {
adoptClassInstance : adoptClassInstance ,
constructClassInstance : constructClassInstance ,
mountClassInstance : mountClassInstance ,
updateClassInstance : updateClassInstance
} ;
} , mountChildFibersInPlace = ReactChildFiber . mountChildFibersInPlace , reconcileChildFibers = ReactChildFiber . reconcileChildFibers , reconcileChildFibersInPlace = ReactChildFiber . reconcileChildFibersInPlace , cloneChildFibers = ReactChildFiber . cloneChildFibers , beginUpdateQueue$1 = ReactFiberUpdateQueue . beginUpdateQueue , getMaskedContext$1 = ReactFiberContext . getMaskedContext , getUnmaskedContext$1 = ReactFiberContext . getUnmaskedContext , hasContextChanged$1 = ReactFiberContext . hasContextChanged , pushContextProvider$1 = ReactFiberContext . pushContextProvider , pushTopLevelContextObject$1 = ReactFiberContext . pushTopLevelContextObject , invalidateContextProvider$1 = ReactFiberContext . invalidateContextProvider , IndeterminateComponent$2 = ReactTypeOfWork . IndeterminateComponent , FunctionalComponent$1 = ReactTypeOfWork . FunctionalComponent , ClassComponent$6 = ReactTypeOfWork . ClassComponent , HostRoot$5 = ReactTypeOfWork . HostRoot , HostComponent$5 = ReactTypeOfWork . HostComponent , HostText$2 = ReactTypeOfWork . HostText , HostPortal$3 = ReactTypeOfWork . HostPortal , CoroutineComponent$1 = ReactTypeOfWork . CoroutineComponent , CoroutineHandlerPhase = ReactTypeOfWork . CoroutineHandlerPhase , YieldComponent$1 = ReactTypeOfWork . YieldComponent , Fragment$1 = ReactTypeOfWork . Fragment , NoWork$3 = ReactPriorityLevel . NoWork , OffscreenPriority$1 = ReactPriorityLevel . OffscreenPriority , PerformedWork$1 = ReactTypeOfSideEffect . PerformedWork , Placement$2 = ReactTypeOfSideEffect . Placement , ContentReset$1 = ReactTypeOfSideEffect . ContentReset , Err$1 = ReactTypeOfSideEffect . Err , Ref$1 = ReactTypeOfSideEffect . Ref , ReactCurrentOwner$2 = ReactGlobalSharedState _1 . ReactCurrentOwner , ReactFiberBeginWork = function ( config , hostContext , hydrationContext , scheduleUpdate , getPriorityContext ) {
var shouldSetTextContent = config . shouldSetTextContent , useSyncScheduling = config . useSyncScheduling , shouldDeprioritizeSubtree = config . shouldDeprioritizeSubtree , pushHostContext = hostContext . pushHostContext , pushHostContainer = hostContext . pushHostContainer , enterHydrationState = hydrationContext . enterHydrationState , resetHydrationState = hydrationContext . resetHydrationState , tryToClaimNextHydratableInstance = hydrationContext . tryToClaimNextHydratableInstance , _ReactFiberClassCompo = ReactFiberClassComponent ( scheduleUpdate , getPriorityContext , memoizeProps , memoizeState ) , adoptClassInstance = _ReactFiberClassCompo . adoptClassInstance , constructClassInstance = _ReactFiberClassCompo . constructClassInstance , mountClassInstance = _ReactFiberClassCompo . mountClassInstance , updateClassInstance = _ReactFiberClassCompo . updateClassInstance ;
function reconcileChildren ( current , workInProgress , nextChildren ) {
reconcileChildrenAtPriority ( current , workInProgress , nextChildren , workInProgress . pendingWorkPriority ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function reconcileChildrenAtPriority ( current , workInProgress , nextChildren , priorityLevel ) {
null === current ? workInProgress . child = mountChildFibersInPlace ( workInProgress , workInProgress . child , nextChildren , priorityLevel ) : current . child === workInProgress . child ? workInProgress . child = reconcileChildFibers ( workInProgress , workInProgress . child , nextChildren , priorityLevel ) : workInProgress . child = reconcileChildFibersInPlace ( workInProgress , workInProgress . child , nextChildren , priorityLevel ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function updateFragment ( current , workInProgress ) {
var nextChildren = workInProgress . pendingProps ;
if ( hasContextChanged$1 ( ) ) null === nextChildren && ( nextChildren = workInProgress . memoizedProps ) ; else if ( null === nextChildren || workInProgress . memoizedProps === nextChildren ) return bailoutOnAlreadyFinishedWork ( current , workInProgress ) ;
return reconcileChildren ( current , workInProgress , nextChildren ) , memoizeProps ( workInProgress , nextChildren ) ,
workInProgress . child ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function markRef ( current , workInProgress ) {
var ref = workInProgress . ref ;
null === ref || current && current . ref === ref || ( workInProgress . effectTag |= Ref$1 ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function updateFunctionalComponent ( current , workInProgress ) {
var fn = workInProgress . type , nextProps = workInProgress . pendingProps , memoizedProps = workInProgress . memoizedProps ;
if ( hasContextChanged$1 ( ) ) null === nextProps && ( nextProps = memoizedProps ) ; else if ( null === nextProps || memoizedProps === nextProps ) return bailoutOnAlreadyFinishedWork ( current , workInProgress ) ;
var nextChildren , unmaskedContext = getUnmaskedContext$1 ( workInProgress ) , context = getMaskedContext$1 ( workInProgress , unmaskedContext ) ;
return nextChildren = fn ( nextProps , context ) , workInProgress . effectTag |= PerformedWork$1 ,
reconcileChildren ( current , workInProgress , nextChildren ) , memoizeProps ( workInProgress , nextProps ) ,
workInProgress . child ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function updateClassComponent ( current , workInProgress , priorityLevel ) {
var hasContext = pushContextProvider$1 ( workInProgress ) , shouldUpdate = void 0 ;
return null === current ? workInProgress . stateNode ? invariant ( ! 1 , "Resuming work not yet implemented." ) : ( constructClassInstance ( workInProgress , workInProgress . pendingProps ) ,
mountClassInstance ( workInProgress , priorityLevel ) , shouldUpdate = ! 0 ) : shouldUpdate = updateClassInstance ( current , workInProgress , priorityLevel ) ,
finishClassComponent ( current , workInProgress , shouldUpdate , hasContext ) ;
}
function finishClassComponent ( current , workInProgress , shouldUpdate , hasContext ) {
if ( markRef ( current , workInProgress ) , ! shouldUpdate ) return hasContext && invalidateContextProvider$1 ( workInProgress , ! 1 ) ,
bailoutOnAlreadyFinishedWork ( current , workInProgress ) ;
var instance = workInProgress . stateNode ;
ReactCurrentOwner$2 . current = workInProgress ;
var nextChildren = void 0 ;
return nextChildren = instance . render ( ) , workInProgress . effectTag |= PerformedWork$1 ,
reconcileChildren ( current , workInProgress , nextChildren ) , memoizeState ( workInProgress , instance . state ) ,
memoizeProps ( workInProgress , instance . props ) , hasContext && invalidateContextProvider$1 ( workInProgress , ! 0 ) ,
workInProgress . child ;
}
2017-09-18 23:32:37 +00:00
function pushHostRootContext ( workInProgress ) {
2017-08-09 19:18:46 +00:00
var root = workInProgress . stateNode ;
root . pendingContext ? pushTopLevelContextObject$1 ( workInProgress , root . pendingContext , root . pendingContext !== root . context ) : root . context && pushTopLevelContextObject$1 ( workInProgress , root . context , ! 1 ) ,
pushHostContainer ( workInProgress , root . containerInfo ) ;
2017-09-18 23:32:37 +00:00
}
function updateHostRoot ( current , workInProgress , priorityLevel ) {
pushHostRootContext ( workInProgress ) ;
2017-08-09 19:18:46 +00:00
var updateQueue = workInProgress . updateQueue ;
if ( null !== updateQueue ) {
var prevState = workInProgress . memoizedState , state = beginUpdateQueue$1 ( current , workInProgress , updateQueue , null , prevState , null , priorityLevel ) ;
if ( prevState === state ) return resetHydrationState ( ) , bailoutOnAlreadyFinishedWork ( current , workInProgress ) ;
var element = state . element ;
return null !== current && null !== current . child || ! enterHydrationState ( workInProgress ) ? ( resetHydrationState ( ) ,
reconcileChildren ( current , workInProgress , element ) ) : ( workInProgress . effectTag |= Placement$2 ,
workInProgress . child = mountChildFibersInPlace ( workInProgress , workInProgress . child , element , priorityLevel ) ) ,
memoizeState ( workInProgress , state ) , workInProgress . child ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return resetHydrationState ( ) , bailoutOnAlreadyFinishedWork ( current , workInProgress ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function updateHostComponent ( current , workInProgress , renderPriority ) {
pushHostContext ( workInProgress ) , null === current && tryToClaimNextHydratableInstance ( workInProgress ) ;
var type = workInProgress . type , memoizedProps = workInProgress . memoizedProps , nextProps = workInProgress . pendingProps ;
null === nextProps && ( nextProps = memoizedProps , invariant ( null !== nextProps , "We should always have pending or current props. This error is " + "likely caused by a bug in React. Please file an issue." ) ) ;
var prevProps = null !== current ? current . memoizedProps : null ;
if ( hasContextChanged$1 ( ) ) ; else if ( null === nextProps || memoizedProps === nextProps ) return bailoutOnAlreadyFinishedWork ( current , workInProgress ) ;
var nextChildren = nextProps . children ;
return shouldSetTextContent ( type , nextProps ) ? nextChildren = null : prevProps && shouldSetTextContent ( type , prevProps ) && ( workInProgress . effectTag |= ContentReset$1 ) ,
markRef ( current , workInProgress ) , renderPriority !== OffscreenPriority$1 && ! useSyncScheduling && shouldDeprioritizeSubtree ( type , nextProps ) ? ( workInProgress . pendingWorkPriority = OffscreenPriority$1 ,
null ) : ( reconcileChildren ( current , workInProgress , nextChildren ) , memoizeProps ( workInProgress , nextProps ) ,
workInProgress . child ) ;
}
function updateHostText ( current , workInProgress ) {
null === current && tryToClaimNextHydratableInstance ( workInProgress ) ;
var nextProps = workInProgress . pendingProps ;
return null === nextProps && ( nextProps = workInProgress . memoizedProps ) , memoizeProps ( workInProgress , nextProps ) ,
null ;
}
function mountIndeterminateComponent ( current , workInProgress , priorityLevel ) {
invariant ( null === current , "An indeterminate component should never have mounted. This error is " + "likely caused by a bug in React. Please file an issue." ) ;
var value , fn = workInProgress . type , props = workInProgress . pendingProps , unmaskedContext = getUnmaskedContext$1 ( workInProgress ) , context = getMaskedContext$1 ( workInProgress , unmaskedContext ) ;
if ( value = fn ( props , context ) , workInProgress . effectTag |= PerformedWork$1 , "object" == typeof value && null !== value && "function" == typeof value . render ) {
workInProgress . tag = ClassComponent$6 ;
var hasContext = pushContextProvider$1 ( workInProgress ) ;
return adoptClassInstance ( workInProgress , value ) , mountClassInstance ( workInProgress , priorityLevel ) ,
finishClassComponent ( current , workInProgress , ! 0 , hasContext ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return workInProgress . tag = FunctionalComponent$1 , reconcileChildren ( current , workInProgress , value ) ,
memoizeProps ( workInProgress , props ) , workInProgress . child ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function updateCoroutineComponent ( current , workInProgress ) {
var nextCoroutine = workInProgress . pendingProps ;
hasContextChanged$1 ( ) ? null === nextCoroutine && ( nextCoroutine = current && current . memoizedProps ,
invariant ( null !== nextCoroutine , "We should always have pending or current props. This error is " + "likely caused by a bug in React. Please file an issue." ) ) : null !== nextCoroutine && workInProgress . memoizedProps !== nextCoroutine || ( nextCoroutine = workInProgress . memoizedProps ) ;
var nextChildren = nextCoroutine . children , priorityLevel = workInProgress . pendingWorkPriority ;
return null === current ? workInProgress . stateNode = mountChildFibersInPlace ( workInProgress , workInProgress . stateNode , nextChildren , priorityLevel ) : current . child === workInProgress . child ? workInProgress . stateNode = reconcileChildFibers ( workInProgress , workInProgress . stateNode , nextChildren , priorityLevel ) : workInProgress . stateNode = reconcileChildFibersInPlace ( workInProgress , workInProgress . stateNode , nextChildren , priorityLevel ) ,
memoizeProps ( workInProgress , nextCoroutine ) , workInProgress . stateNode ;
}
function updatePortalComponent ( current , workInProgress ) {
pushHostContainer ( workInProgress , workInProgress . stateNode . containerInfo ) ;
var priorityLevel = workInProgress . pendingWorkPriority , nextChildren = workInProgress . pendingProps ;
if ( hasContextChanged$1 ( ) ) null === nextChildren && ( nextChildren = current && current . memoizedProps ,
invariant ( null != nextChildren , "We should always have pending or current props. This error is " + "likely caused by a bug in React. Please file an issue." ) ) ; else if ( null === nextChildren || workInProgress . memoizedProps === nextChildren ) return bailoutOnAlreadyFinishedWork ( current , workInProgress ) ;
return null === current ? ( workInProgress . child = reconcileChildFibersInPlace ( workInProgress , workInProgress . child , nextChildren , priorityLevel ) ,
memoizeProps ( workInProgress , nextChildren ) ) : ( reconcileChildren ( current , workInProgress , nextChildren ) ,
memoizeProps ( workInProgress , nextChildren ) ) , workInProgress . child ;
}
function bailoutOnAlreadyFinishedWork ( current , workInProgress ) {
return cloneChildFibers ( current , workInProgress ) , workInProgress . child ;
}
function bailoutOnLowPriority ( current , workInProgress ) {
switch ( workInProgress . tag ) {
2017-09-18 23:32:37 +00:00
case HostRoot$5 :
pushHostRootContext ( workInProgress ) ;
break ;
2017-08-09 19:18:46 +00:00
case ClassComponent$6 :
pushContextProvider$1 ( workInProgress ) ;
break ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
case HostPortal$3 :
pushHostContainer ( workInProgress , workInProgress . stateNode . containerInfo ) ;
2017-05-26 17:51:06 +00:00
}
return null ;
}
2017-08-09 19:18:46 +00:00
function memoizeProps ( workInProgress , nextProps ) {
workInProgress . memoizedProps = nextProps ;
}
function memoizeState ( workInProgress , nextState ) {
workInProgress . memoizedState = nextState ;
}
function beginWork ( current , workInProgress , priorityLevel ) {
if ( workInProgress . pendingWorkPriority === NoWork$3 || workInProgress . pendingWorkPriority > priorityLevel ) return bailoutOnLowPriority ( current , workInProgress ) ;
switch ( workInProgress . tag ) {
case IndeterminateComponent$2 :
return mountIndeterminateComponent ( current , workInProgress , priorityLevel ) ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
case FunctionalComponent$1 :
return updateFunctionalComponent ( current , workInProgress ) ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
case ClassComponent$6 :
return updateClassComponent ( current , workInProgress , priorityLevel ) ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
case HostRoot$5 :
return updateHostRoot ( current , workInProgress , priorityLevel ) ;
case HostComponent$5 :
return updateHostComponent ( current , workInProgress , priorityLevel ) ;
case HostText$2 :
return updateHostText ( current , workInProgress ) ;
case CoroutineHandlerPhase :
workInProgress . tag = CoroutineComponent$1 ;
case CoroutineComponent$1 :
return updateCoroutineComponent ( current , workInProgress ) ;
case YieldComponent$1 :
return null ;
case HostPortal$3 :
return updatePortalComponent ( current , workInProgress ) ;
case Fragment$1 :
return updateFragment ( current , workInProgress ) ;
default :
invariant ( ! 1 , "Unknown unit of work tag. This error is likely caused by a bug in " + "React. Please file an issue." ) ;
2017-05-26 17:51:06 +00:00
}
}
2017-08-09 19:18:46 +00:00
function beginFailedWork ( current , workInProgress , priorityLevel ) {
switch ( workInProgress . tag ) {
case ClassComponent$6 :
pushContextProvider$1 ( workInProgress ) ;
break ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
case HostRoot$5 :
2017-09-18 23:32:37 +00:00
pushHostRootContext ( workInProgress ) ;
2017-08-09 19:18:46 +00:00
break ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
default :
invariant ( ! 1 , "Invalid type of work. This error is likely caused by a bug in React. " + "Please file an issue." ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
if ( workInProgress . effectTag |= Err$1 , null === current ? workInProgress . child = null : workInProgress . child !== current . child && ( workInProgress . child = current . child ) ,
workInProgress . pendingWorkPriority === NoWork$3 || workInProgress . pendingWorkPriority > priorityLevel ) return bailoutOnLowPriority ( current , workInProgress ) ;
if ( workInProgress . firstEffect = null , workInProgress . lastEffect = null , reconcileChildrenAtPriority ( current , workInProgress , null , priorityLevel ) ,
workInProgress . tag === ClassComponent$6 ) {
var instance = workInProgress . stateNode ;
workInProgress . memoizedProps = instance . props , workInProgress . memoizedState = instance . state ;
}
return workInProgress . child ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return {
beginWork : beginWork ,
beginFailedWork : beginFailedWork
} ;
2017-09-18 23:32:37 +00:00
} , reconcileChildFibers$2 = ReactChildFiber . reconcileChildFibers , popContextProvider$2 = ReactFiberContext . popContextProvider , popTopLevelContextObject$1 = ReactFiberContext . popTopLevelContextObject , IndeterminateComponent$3 = ReactTypeOfWork . IndeterminateComponent , FunctionalComponent$3 = ReactTypeOfWork . FunctionalComponent , ClassComponent$8 = ReactTypeOfWork . ClassComponent , HostRoot$6 = ReactTypeOfWork . HostRoot , HostComponent$6 = ReactTypeOfWork . HostComponent , HostText$4 = ReactTypeOfWork . HostText , HostPortal$5 = ReactTypeOfWork . HostPortal , CoroutineComponent$3 = ReactTypeOfWork . CoroutineComponent , CoroutineHandlerPhase$1 = ReactTypeOfWork . CoroutineHandlerPhase , YieldComponent$3 = ReactTypeOfWork . YieldComponent , Fragment$3 = ReactTypeOfWork . Fragment , Placement$4 = ReactTypeOfSideEffect . Placement , Ref$2 = ReactTypeOfSideEffect . Ref , Update$2 = ReactTypeOfSideEffect . Update , OffscreenPriority$2 = ReactPriorityLevel . OffscreenPriority , ReactFiberCompleteWork = function ( config , hostContext , hydrationContext ) {
2017-08-09 19:18:46 +00:00
var createInstance = config . createInstance , createTextInstance = config . createTextInstance , appendInitialChild = config . appendInitialChild , finalizeInitialChildren = config . finalizeInitialChildren , prepareUpdate = config . prepareUpdate , getRootHostContainer = hostContext . getRootHostContainer , popHostContext = hostContext . popHostContext , getHostContext = hostContext . getHostContext , popHostContainer = hostContext . popHostContainer , prepareToHydrateHostInstance = hydrationContext . prepareToHydrateHostInstance , prepareToHydrateHostTextInstance = hydrationContext . prepareToHydrateHostTextInstance , popHydrationState = hydrationContext . popHydrationState ;
function markUpdate ( workInProgress ) {
workInProgress . effectTag |= Update$2 ;
}
function markRef ( workInProgress ) {
workInProgress . effectTag |= Ref$2 ;
}
function appendAllYields ( yields , workInProgress ) {
var node = workInProgress . stateNode ;
for ( node && ( node . return = workInProgress ) ; null !== node ; ) {
if ( node . tag === HostComponent$6 || node . tag === HostText$4 || node . tag === HostPortal$5 ) invariant ( ! 1 , "A coroutine cannot have host component children." ) ; else if ( node . tag === YieldComponent$3 ) yields . push ( node . type ) ; else if ( null !== node . child ) {
node . child . return = node , node = node . child ;
continue ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
for ( ; null === node . sibling ; ) {
if ( null === node . return || node . return === workInProgress ) return ;
node = node . return ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
node . sibling . return = node . return , node = node . sibling ;
2017-05-26 17:51:06 +00:00
}
}
2017-08-09 19:18:46 +00:00
function moveCoroutineToHandlerPhase ( current , workInProgress ) {
var coroutine = workInProgress . memoizedProps ;
invariant ( coroutine , "Should be resolved by now. This error is likely caused by a bug in " + "React. Please file an issue." ) ,
workInProgress . tag = CoroutineHandlerPhase$1 ;
var yields = [ ] ;
appendAllYields ( yields , workInProgress ) ;
var fn = coroutine . handler , props = coroutine . props , nextChildren = fn ( props , yields ) , currentFirstChild = null !== current ? current . child : null , priority = workInProgress . pendingWorkPriority ;
return workInProgress . child = reconcileChildFibers$2 ( workInProgress , currentFirstChild , nextChildren , priority ) ,
workInProgress . child ;
}
function appendAllChildren ( parent , workInProgress ) {
for ( var node = workInProgress . child ; null !== node ; ) {
if ( node . tag === HostComponent$6 || node . tag === HostText$4 ) appendInitialChild ( parent , node . stateNode ) ; else if ( node . tag === HostPortal$5 ) ; else if ( null !== node . child ) {
node = node . child ;
continue ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
if ( node === workInProgress ) return ;
for ( ; null === node . sibling ; ) {
if ( null === node . return || node . return === workInProgress ) return ;
node = node . return ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
node = node . sibling ;
2017-05-26 17:51:06 +00:00
}
}
2017-08-09 19:18:46 +00:00
function completeWork ( current , workInProgress , renderPriority ) {
var newProps = workInProgress . pendingProps ;
switch ( null === newProps ? newProps = workInProgress . memoizedProps : workInProgress . pendingWorkPriority === OffscreenPriority$2 && renderPriority !== OffscreenPriority$2 || ( workInProgress . pendingProps = null ) ,
workInProgress . tag ) {
case FunctionalComponent$3 :
return null ;
case ClassComponent$8 :
return popContextProvider$2 ( workInProgress ) , null ;
case HostRoot$6 :
2017-09-18 23:32:37 +00:00
popHostContainer ( workInProgress ) , popTopLevelContextObject$1 ( workInProgress ) ;
2017-08-09 19:18:46 +00:00
var fiberRoot = workInProgress . stateNode ;
return fiberRoot . pendingContext && ( fiberRoot . context = fiberRoot . pendingContext ,
fiberRoot . pendingContext = null ) , null !== current && null !== current . child || ( popHydrationState ( workInProgress ) ,
workInProgress . effectTag &= ~ Placement$4 ) , null ;
case HostComponent$6 :
popHostContext ( workInProgress ) ;
var rootContainerInstance = getRootHostContainer ( ) , type = workInProgress . type ;
if ( null !== current && null != workInProgress . stateNode ) {
var oldProps = current . memoizedProps , instance = workInProgress . stateNode , currentHostContext = getHostContext ( ) , updatePayload = prepareUpdate ( instance , type , oldProps , newProps , rootContainerInstance , currentHostContext ) ;
workInProgress . updateQueue = updatePayload , updatePayload && markUpdate ( workInProgress ) ,
current . ref !== workInProgress . ref && markRef ( workInProgress ) ;
} else {
if ( ! newProps ) return invariant ( null !== workInProgress . stateNode , "We must have new props for new mounts. This error is likely " + "caused by a bug in React. Please file an issue." ) ,
null ;
var _currentHostContext = getHostContext ( ) ;
2017-09-18 23:32:37 +00:00
if ( popHydrationState ( workInProgress ) ) prepareToHydrateHostInstance ( workInProgress , rootContainerInstance , _currentHostContext ) && markUpdate ( workInProgress ) ; else {
2017-08-09 19:18:46 +00:00
var _instance = createInstance ( type , newProps , rootContainerInstance , _currentHostContext , workInProgress ) ;
appendAllChildren ( _instance , workInProgress ) , finalizeInitialChildren ( _instance , type , newProps , rootContainerInstance ) && markUpdate ( workInProgress ) ,
workInProgress . stateNode = _instance ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
null !== workInProgress . ref && markRef ( workInProgress ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return null ;
case HostText$4 :
var newText = newProps ;
if ( current && null != workInProgress . stateNode ) {
current . memoizedProps !== newText && markUpdate ( workInProgress ) ;
} else {
if ( "string" != typeof newText ) return invariant ( null !== workInProgress . stateNode , "We must have new props for new mounts. This error is likely " + "caused by a bug in React. Please file an issue." ) ,
null ;
var _rootContainerInstance = getRootHostContainer ( ) , _currentHostContext2 = getHostContext ( ) ;
popHydrationState ( workInProgress ) ? prepareToHydrateHostTextInstance ( workInProgress ) && markUpdate ( workInProgress ) : workInProgress . stateNode = createTextInstance ( newText , _rootContainerInstance , _currentHostContext2 , workInProgress ) ;
}
return null ;
case CoroutineComponent$3 :
return moveCoroutineToHandlerPhase ( current , workInProgress ) ;
case CoroutineHandlerPhase$1 :
return workInProgress . tag = CoroutineComponent$3 , null ;
case YieldComponent$3 :
case Fragment$3 :
return null ;
case HostPortal$5 :
return markUpdate ( workInProgress ) , popHostContainer ( workInProgress ) , null ;
case IndeterminateComponent$3 :
invariant ( ! 1 , "An indeterminate component should have become determinate before " + "completing. This error is likely caused by a bug in React. Please " + "file an issue." ) ;
default :
invariant ( ! 1 , "Unknown unit of work tag. This error is likely caused by a bug in " + "React. Please file an issue." ) ;
2017-05-26 17:51:06 +00:00
}
}
2017-08-09 19:18:46 +00:00
return {
completeWork : completeWork
} ;
2017-09-15 01:01:25 +00:00
} , onCommitFiberRoot = null , onCommitFiberUnmount = null , hasLoggedError = ! 1 ;
2017-08-09 19:18:46 +00:00
function catchErrors ( fn ) {
return function ( arg ) {
try {
return fn ( arg ) ;
} catch ( err ) {
2017-09-15 01:01:25 +00:00
1 || hasLoggedError || ( hasLoggedError = ! 0 ) ;
2017-08-09 19:18:46 +00:00
}
} ;
}
function injectInternals$1 ( internals ) {
if ( "undefined" == typeof _ _REACT _DEVTOOLS _GLOBAL _HOOK _ _ ) return ! 1 ;
var hook = _ _REACT _DEVTOOLS _GLOBAL _HOOK _ _ ;
if ( ! hook . supportsFiber ) return ! 0 ;
try {
var rendererID = hook . inject ( internals ) ;
onCommitFiberRoot = catchErrors ( function ( root ) {
return hook . onCommitFiberRoot ( rendererID , root ) ;
} ) , onCommitFiberUnmount = catchErrors ( function ( fiber ) {
return hook . onCommitFiberUnmount ( rendererID , fiber ) ;
} ) ;
} catch ( err ) { }
return ! 0 ;
}
function onCommitRoot$1 ( root ) {
"function" == typeof onCommitFiberRoot && onCommitFiberRoot ( root ) ;
}
function onCommitUnmount$1 ( fiber ) {
"function" == typeof onCommitFiberUnmount && onCommitFiberUnmount ( fiber ) ;
}
var injectInternals _1 = injectInternals$1 , onCommitRoot _1 = onCommitRoot$1 , onCommitUnmount _1 = onCommitUnmount$1 , ReactFiberDevToolsHook = {
injectInternals : injectInternals _1 ,
onCommitRoot : onCommitRoot _1 ,
onCommitUnmount : onCommitUnmount _1
} , ClassComponent$9 = ReactTypeOfWork . ClassComponent , HostRoot$7 = ReactTypeOfWork . HostRoot , HostComponent$7 = ReactTypeOfWork . HostComponent , HostText$5 = ReactTypeOfWork . HostText , HostPortal$6 = ReactTypeOfWork . HostPortal , CoroutineComponent$4 = ReactTypeOfWork . CoroutineComponent , commitCallbacks$1 = ReactFiberUpdateQueue . commitCallbacks , onCommitUnmount = ReactFiberDevToolsHook . onCommitUnmount , Placement$5 = ReactTypeOfSideEffect . Placement , Update$3 = ReactTypeOfSideEffect . Update , Callback$1 = ReactTypeOfSideEffect . Callback , ContentReset$2 = ReactTypeOfSideEffect . ContentReset , ReactFiberCommitWork = function ( config , captureError ) {
var commitMount = config . commitMount , commitUpdate = config . commitUpdate , resetTextContent = config . resetTextContent , commitTextUpdate = config . commitTextUpdate , appendChild = config . appendChild , appendChildToContainer = config . appendChildToContainer , insertBefore = config . insertBefore , insertInContainerBefore = config . insertInContainerBefore , removeChild = config . removeChild , removeChildFromContainer = config . removeChildFromContainer , getPublicInstance = config . getPublicInstance ;
function safelyCallComponentWillUnmount ( current , instance ) {
try {
2017-09-15 01:01:25 +00:00
instance . props = current . memoizedProps , instance . state = current . memoizedState ,
2017-08-09 19:18:46 +00:00
instance . componentWillUnmount ( ) ;
} catch ( unmountError ) {
captureError ( current , unmountError ) ;
2017-05-26 17:51:06 +00:00
}
}
2017-08-09 19:18:46 +00:00
function safelyDetachRef ( current ) {
var ref = current . ref ;
if ( null !== ref ) {
try {
ref ( null ) ;
} catch ( refError ) {
captureError ( current , refError ) ;
2017-05-26 17:51:06 +00:00
}
}
}
2017-08-09 19:18:46 +00:00
function getHostParentFiber ( fiber ) {
for ( var parent = fiber . return ; null !== parent ; ) {
if ( isHostParent ( parent ) ) return parent ;
parent = parent . return ;
}
invariant ( ! 1 , "Expected to find a host parent. This error is likely caused by a bug " + "in React. Please file an issue." ) ;
}
function isHostParent ( fiber ) {
return fiber . tag === HostComponent$7 || fiber . tag === HostRoot$7 || fiber . tag === HostPortal$6 ;
}
function getHostSibling ( fiber ) {
var node = fiber ;
siblings : for ( ; ! 0 ; ) {
for ( ; null === node . sibling ; ) {
if ( null === node . return || isHostParent ( node . return ) ) return null ;
node = node . return ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
for ( node . sibling . return = node . return , node = node . sibling ; node . tag !== HostComponent$7 && node . tag !== HostText$5 ; ) {
if ( node . effectTag & Placement$5 ) continue siblings ;
if ( null === node . child || node . tag === HostPortal$6 ) continue siblings ;
node . child . return = node , node = node . child ;
}
if ( ! ( node . effectTag & Placement$5 ) ) return node . stateNode ;
2017-05-26 17:51:06 +00:00
}
}
2017-08-09 19:18:46 +00:00
function commitPlacement ( finishedWork ) {
var parentFiber = getHostParentFiber ( finishedWork ) , parent = void 0 , isContainer = void 0 ;
switch ( parentFiber . tag ) {
case HostComponent$7 :
parent = parentFiber . stateNode , isContainer = ! 1 ;
break ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
case HostRoot$7 :
case HostPortal$6 :
parent = parentFiber . stateNode . containerInfo , isContainer = ! 0 ;
2017-05-26 17:51:06 +00:00
break ;
2017-08-09 19:18:46 +00:00
default :
invariant ( ! 1 , "Invalid host parent fiber. This error is likely caused by a bug " + "in React. Please file an issue." ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
parentFiber . effectTag & ContentReset$2 && ( resetTextContent ( parent ) , parentFiber . effectTag &= ~ ContentReset$2 ) ;
for ( var before = getHostSibling ( finishedWork ) , node = finishedWork ; ! 0 ; ) {
if ( node . tag === HostComponent$7 || node . tag === HostText$5 ) before ? isContainer ? insertInContainerBefore ( parent , node . stateNode , before ) : insertBefore ( parent , node . stateNode , before ) : isContainer ? appendChildToContainer ( parent , node . stateNode ) : appendChild ( parent , node . stateNode ) ; else if ( node . tag === HostPortal$6 ) ; else if ( null !== node . child ) {
node . child . return = node , node = node . child ;
continue ;
}
if ( node === finishedWork ) return ;
for ( ; null === node . sibling ; ) {
if ( null === node . return || node . return === finishedWork ) return ;
node = node . return ;
}
node . sibling . return = node . return , node = node . sibling ;
2017-05-26 17:51:06 +00:00
}
}
2017-08-09 19:18:46 +00:00
function commitNestedUnmounts ( root ) {
for ( var node = root ; ! 0 ; ) if ( commitUnmount ( node ) , null === node . child || node . tag === HostPortal$6 ) {
if ( node === root ) return ;
for ( ; null === node . sibling ; ) {
if ( null === node . return || node . return === root ) return ;
node = node . return ;
}
node . sibling . return = node . return , node = node . sibling ;
} else node . child . return = node , node = node . child ;
2017-07-14 00:20:15 +00:00
}
2017-08-09 19:18:46 +00:00
function unmountHostComponents ( current ) {
for ( var node = current , currentParentIsValid = ! 1 , currentParent = void 0 , currentParentIsContainer = void 0 ; ! 0 ; ) {
if ( ! currentParentIsValid ) {
var parent = node . return ;
findParent : for ( ; ! 0 ; ) {
switch ( invariant ( null !== parent , "Expected to find a host parent. This error is likely caused by " + "a bug in React. Please file an issue." ) ,
parent . tag ) {
case HostComponent$7 :
currentParent = parent . stateNode , currentParentIsContainer = ! 1 ;
break findParent ;
case HostRoot$7 :
case HostPortal$6 :
currentParent = parent . stateNode . containerInfo , currentParentIsContainer = ! 0 ;
break findParent ;
}
parent = parent . return ;
}
currentParentIsValid = ! 0 ;
}
if ( node . tag === HostComponent$7 || node . tag === HostText$5 ) commitNestedUnmounts ( node ) ,
currentParentIsContainer ? removeChildFromContainer ( currentParent , node . stateNode ) : removeChild ( currentParent , node . stateNode ) ; else if ( node . tag === HostPortal$6 ) {
if ( currentParent = node . stateNode . containerInfo , null !== node . child ) {
node . child . return = node , node = node . child ;
continue ;
}
} else if ( commitUnmount ( node ) , null !== node . child ) {
node . child . return = node , node = node . child ;
continue ;
}
if ( node === current ) return ;
for ( ; null === node . sibling ; ) {
if ( null === node . return || node . return === current ) return ;
node = node . return , node . tag === HostPortal$6 && ( currentParentIsValid = ! 1 ) ;
}
node . sibling . return = node . return , node = node . sibling ;
2017-05-26 17:51:06 +00:00
}
}
2017-08-09 19:18:46 +00:00
function commitDeletion ( current ) {
unmountHostComponents ( current ) , current . return = null , current . child = null , current . alternate && ( current . alternate . child = null ,
current . alternate . return = null ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function commitUnmount ( current ) {
switch ( "function" == typeof onCommitUnmount && onCommitUnmount ( current ) , current . tag ) {
case ClassComponent$9 :
safelyDetachRef ( current ) ;
var instance = current . stateNode ;
return void ( "function" == typeof instance . componentWillUnmount && safelyCallComponentWillUnmount ( current , instance ) ) ;
case HostComponent$7 :
return void safelyDetachRef ( current ) ;
case CoroutineComponent$4 :
return void commitNestedUnmounts ( current . stateNode ) ;
case HostPortal$6 :
return void unmountHostComponents ( current ) ;
}
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function commitWork ( current , finishedWork ) {
switch ( finishedWork . tag ) {
case ClassComponent$9 :
return ;
case HostComponent$7 :
var instance = finishedWork . stateNode ;
if ( null != instance ) {
var newProps = finishedWork . memoizedProps , oldProps = null !== current ? current . memoizedProps : newProps , type = finishedWork . type , updatePayload = finishedWork . updateQueue ;
finishedWork . updateQueue = null , null !== updatePayload && commitUpdate ( instance , updatePayload , type , oldProps , newProps , finishedWork ) ;
}
return ;
case HostText$5 :
invariant ( null !== finishedWork . stateNode , "This should have a text node initialized. This error is likely " + "caused by a bug in React. Please file an issue." ) ;
var textInstance = finishedWork . stateNode , newText = finishedWork . memoizedProps , oldText = null !== current ? current . memoizedProps : newText ;
return void commitTextUpdate ( textInstance , oldText , newText ) ;
case HostRoot$7 :
case HostPortal$6 :
return ;
default :
invariant ( ! 1 , "This unit of work tag should not have side-effects. This error is " + "likely caused by a bug in React. Please file an issue." ) ;
}
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function commitLifeCycles ( current , finishedWork ) {
switch ( finishedWork . tag ) {
case ClassComponent$9 :
var instance = finishedWork . stateNode ;
2017-09-15 01:01:25 +00:00
if ( finishedWork . effectTag & Update$3 ) if ( null === current ) instance . props = finishedWork . memoizedProps ,
instance . state = finishedWork . memoizedState , instance . componentDidMount ( ) ; else {
2017-08-09 19:18:46 +00:00
var prevProps = current . memoizedProps , prevState = current . memoizedState ;
2017-09-15 01:01:25 +00:00
instance . props = finishedWork . memoizedProps , instance . state = finishedWork . memoizedState ,
2017-08-09 19:18:46 +00:00
instance . componentDidUpdate ( prevProps , prevState ) ;
}
return void ( finishedWork . effectTag & Callback$1 && null !== finishedWork . updateQueue && commitCallbacks$1 ( finishedWork , finishedWork . updateQueue , instance ) ) ;
case HostRoot$7 :
var updateQueue = finishedWork . updateQueue ;
if ( null !== updateQueue ) {
var _instance = finishedWork . child && finishedWork . child . stateNode ;
commitCallbacks$1 ( finishedWork , updateQueue , _instance ) ;
}
return ;
case HostComponent$7 :
var _instance2 = finishedWork . stateNode ;
if ( null === current && finishedWork . effectTag & Update$3 ) {
var type = finishedWork . type , props = finishedWork . memoizedProps ;
commitMount ( _instance2 , type , props , finishedWork ) ;
}
return ;
case HostText$5 :
case HostPortal$6 :
return ;
default :
invariant ( ! 1 , "This unit of work tag should not have side-effects. This error is " + "likely caused by a bug in React. Please file an issue." ) ;
}
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function commitAttachRef ( finishedWork ) {
var ref = finishedWork . ref ;
if ( null !== ref ) {
var instance = finishedWork . stateNode ;
switch ( finishedWork . tag ) {
case HostComponent$7 :
ref ( getPublicInstance ( instance ) ) ;
break ;
default :
ref ( instance ) ;
}
2017-05-26 17:51:06 +00:00
}
}
2017-08-09 19:18:46 +00:00
function commitDetachRef ( current ) {
var currentRef = current . ref ;
null !== currentRef && currentRef ( null ) ;
2017-05-26 17:51:06 +00:00
}
return {
2017-08-09 19:18:46 +00:00
commitPlacement : commitPlacement ,
commitDeletion : commitDeletion ,
commitWork : commitWork ,
commitLifeCycles : commitLifeCycles ,
commitAttachRef : commitAttachRef ,
commitDetachRef : commitDetachRef
2017-05-26 17:51:06 +00:00
} ;
2017-08-09 19:18:46 +00:00
} , createCursor$2 = ReactFiberStack . createCursor , pop$2 = ReactFiberStack . pop , push$2 = ReactFiberStack . push , NO _CONTEXT = { } , ReactFiberHostContext = function ( config ) {
var getChildHostContext = config . getChildHostContext , getRootHostContext = config . getRootHostContext , contextStackCursor = createCursor$2 ( NO _CONTEXT ) , contextFiberStackCursor = createCursor$2 ( NO _CONTEXT ) , rootInstanceStackCursor = createCursor$2 ( NO _CONTEXT ) ;
function requiredContext ( c ) {
return invariant ( c !== NO _CONTEXT , "Expected host context to exist. This error is likely caused by a bug " + "in React. Please file an issue." ) ,
c ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function getRootHostContainer ( ) {
return requiredContext ( rootInstanceStackCursor . current ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function pushHostContainer ( fiber , nextRootInstance ) {
push$2 ( rootInstanceStackCursor , nextRootInstance , fiber ) ;
var nextRootContext = getRootHostContext ( nextRootInstance ) ;
push$2 ( contextFiberStackCursor , fiber , fiber ) , push$2 ( contextStackCursor , nextRootContext , fiber ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function popHostContainer ( fiber ) {
pop$2 ( contextStackCursor , fiber ) , pop$2 ( contextFiberStackCursor , fiber ) , pop$2 ( rootInstanceStackCursor , fiber ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function getHostContext ( ) {
return requiredContext ( contextStackCursor . current ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function pushHostContext ( fiber ) {
var rootInstance = requiredContext ( rootInstanceStackCursor . current ) , context = requiredContext ( contextStackCursor . current ) , nextContext = getChildHostContext ( context , fiber . type , rootInstance ) ;
context !== nextContext && ( push$2 ( contextFiberStackCursor , fiber , fiber ) , push$2 ( contextStackCursor , nextContext , fiber ) ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function popHostContext ( fiber ) {
contextFiberStackCursor . current === fiber && ( pop$2 ( contextStackCursor , fiber ) ,
pop$2 ( contextFiberStackCursor , fiber ) ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function resetHostContainer ( ) {
contextStackCursor . current = NO _CONTEXT , rootInstanceStackCursor . current = NO _CONTEXT ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return {
getHostContext : getHostContext ,
getRootHostContainer : getRootHostContainer ,
popHostContainer : popHostContainer ,
popHostContext : popHostContext ,
pushHostContainer : pushHostContainer ,
pushHostContext : pushHostContext ,
resetHostContainer : resetHostContainer
} ;
} , HostComponent$8 = ReactTypeOfWork . HostComponent , HostText$6 = ReactTypeOfWork . HostText , HostRoot$8 = ReactTypeOfWork . HostRoot , Deletion$2 = ReactTypeOfSideEffect . Deletion , Placement$6 = ReactTypeOfSideEffect . Placement , createFiberFromHostInstanceForDeletion$1 = ReactFiber . createFiberFromHostInstanceForDeletion , ReactFiberHydrationContext = function ( config ) {
var shouldSetTextContent = config . shouldSetTextContent , canHydrateInstance = config . canHydrateInstance , canHydrateTextInstance = config . canHydrateTextInstance , getNextHydratableSibling = config . getNextHydratableSibling , getFirstHydratableChild = config . getFirstHydratableChild , hydrateInstance = config . hydrateInstance , hydrateTextInstance = config . hydrateTextInstance , didNotHydrateInstance = config . didNotHydrateInstance , didNotFindHydratableInstance = config . didNotFindHydratableInstance , didNotFindHydratableTextInstance = config . didNotFindHydratableTextInstance ;
if ( ! ( canHydrateInstance && canHydrateTextInstance && getNextHydratableSibling && getFirstHydratableChild && hydrateInstance && hydrateTextInstance && didNotHydrateInstance && didNotFindHydratableInstance && didNotFindHydratableTextInstance ) ) return {
enterHydrationState : function ( ) {
return ! 1 ;
} ,
resetHydrationState : function ( ) { } ,
tryToClaimNextHydratableInstance : function ( ) { } ,
prepareToHydrateHostInstance : function ( ) {
invariant ( ! 1 , "Expected prepareToHydrateHostInstance() to never be called. " + "This error is likely caused by a bug in React. Please file an issue." ) ;
} ,
prepareToHydrateHostTextInstance : function ( ) {
invariant ( ! 1 , "Expected prepareToHydrateHostTextInstance() to never be called. " + "This error is likely caused by a bug in React. Please file an issue." ) ;
} ,
popHydrationState : function ( fiber ) {
return ! 1 ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
} ;
var hydrationParentFiber = null , nextHydratableInstance = null , isHydrating = ! 1 ;
function enterHydrationState ( fiber ) {
var parentInstance = fiber . stateNode . containerInfo ;
return nextHydratableInstance = getFirstHydratableChild ( parentInstance ) , hydrationParentFiber = fiber ,
isHydrating = ! 0 , ! 0 ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function deleteHydratableInstance ( returnFiber , instance ) {
var childToDelete = createFiberFromHostInstanceForDeletion$1 ( ) ;
childToDelete . stateNode = instance , childToDelete . return = returnFiber , childToDelete . effectTag = Deletion$2 ,
null !== returnFiber . lastEffect ? ( returnFiber . lastEffect . nextEffect = childToDelete ,
returnFiber . lastEffect = childToDelete ) : returnFiber . firstEffect = returnFiber . lastEffect = childToDelete ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function insertNonHydratedInstance ( returnFiber , fiber ) {
fiber . effectTag |= Placement$6 ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function canHydrate ( fiber , nextInstance ) {
switch ( fiber . tag ) {
case HostComponent$8 :
var type = fiber . type , props = fiber . pendingProps ;
return canHydrateInstance ( nextInstance , type , props ) ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
case HostText$6 :
var text = fiber . pendingProps ;
return canHydrateTextInstance ( nextInstance , text ) ;
2017-05-26 17:51:06 +00:00
default :
2017-08-09 19:18:46 +00:00
return ! 1 ;
2017-05-26 17:51:06 +00:00
}
}
2017-08-09 19:18:46 +00:00
function tryToClaimNextHydratableInstance ( fiber ) {
if ( isHydrating ) {
var nextInstance = nextHydratableInstance ;
if ( ! nextInstance ) return insertNonHydratedInstance ( hydrationParentFiber , fiber ) ,
isHydrating = ! 1 , void ( hydrationParentFiber = fiber ) ;
if ( ! canHydrate ( fiber , nextInstance ) ) {
if ( ! ( nextInstance = getNextHydratableSibling ( nextInstance ) ) || ! canHydrate ( fiber , nextInstance ) ) return insertNonHydratedInstance ( hydrationParentFiber , fiber ) ,
isHydrating = ! 1 , void ( hydrationParentFiber = fiber ) ;
deleteHydratableInstance ( hydrationParentFiber , nextHydratableInstance ) ;
}
fiber . stateNode = nextInstance , hydrationParentFiber = fiber , nextHydratableInstance = getFirstHydratableChild ( nextInstance ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
}
2017-09-18 23:32:37 +00:00
function prepareToHydrateHostInstance ( fiber , rootContainerInstance , hostContext ) {
var instance = fiber . stateNode , updatePayload = hydrateInstance ( instance , fiber . type , fiber . memoizedProps , rootContainerInstance , hostContext , fiber ) ;
2017-08-09 19:18:46 +00:00
return fiber . updateQueue = updatePayload , null !== updatePayload ;
}
function prepareToHydrateHostTextInstance ( fiber ) {
var textInstance = fiber . stateNode ;
return hydrateTextInstance ( textInstance , fiber . memoizedProps , fiber ) ;
}
function popToNextHostParent ( fiber ) {
for ( var parent = fiber . return ; null !== parent && parent . tag !== HostComponent$8 && parent . tag !== HostRoot$8 ; ) parent = parent . return ;
hydrationParentFiber = parent ;
}
function popHydrationState ( fiber ) {
if ( fiber !== hydrationParentFiber ) return ! 1 ;
if ( ! isHydrating ) return popToNextHostParent ( fiber ) , isHydrating = ! 0 , ! 1 ;
var type = fiber . type ;
if ( fiber . tag !== HostComponent$8 || "head" !== type && "body" !== type && ! shouldSetTextContent ( type , fiber . memoizedProps ) ) for ( var nextInstance = nextHydratableInstance ; nextInstance ; ) deleteHydratableInstance ( fiber , nextInstance ) ,
nextInstance = getNextHydratableSibling ( nextInstance ) ;
return popToNextHostParent ( fiber ) , nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling ( fiber . stateNode ) : null ,
! 0 ;
}
function resetHydrationState ( ) {
hydrationParentFiber = null , nextHydratableInstance = null , isHydrating = ! 1 ;
2017-05-26 17:51:06 +00:00
}
return {
2017-08-09 19:18:46 +00:00
enterHydrationState : enterHydrationState ,
resetHydrationState : resetHydrationState ,
tryToClaimNextHydratableInstance : tryToClaimNextHydratableInstance ,
prepareToHydrateHostInstance : prepareToHydrateHostInstance ,
prepareToHydrateHostTextInstance : prepareToHydrateHostTextInstance ,
popHydrationState : popHydrationState
2017-05-26 17:51:06 +00:00
} ;
2017-08-09 19:18:46 +00:00
} , popContextProvider$1 = ReactFiberContext . popContextProvider , reset$1 = ReactFiberStack . reset , getStackAddendumByWorkInProgressFiber = ReactFiberComponentTreeHook . getStackAddendumByWorkInProgressFiber , logCapturedError$1 = ReactFiberErrorLogger . logCapturedError , ReactCurrentOwner$1 = ReactGlobalSharedState _1 . ReactCurrentOwner , createWorkInProgress$1 = ReactFiber . createWorkInProgress , largerPriority$1 = ReactFiber . largerPriority , onCommitRoot = ReactFiberDevToolsHook . onCommitRoot , NoWork$2 = ReactPriorityLevel . NoWork , SynchronousPriority$1 = ReactPriorityLevel . SynchronousPriority , TaskPriority$1 = ReactPriorityLevel . TaskPriority , HighPriority = ReactPriorityLevel . HighPriority , LowPriority = ReactPriorityLevel . LowPriority , OffscreenPriority = ReactPriorityLevel . OffscreenPriority , AsyncUpdates = ReactTypeOfInternalContext . AsyncUpdates , PerformedWork = ReactTypeOfSideEffect . PerformedWork , Placement$1 = ReactTypeOfSideEffect . Placement , Update = ReactTypeOfSideEffect . Update , PlacementAndUpdate = ReactTypeOfSideEffect . PlacementAndUpdate , Deletion = ReactTypeOfSideEffect . Deletion , ContentReset = ReactTypeOfSideEffect . ContentReset , Callback = ReactTypeOfSideEffect . Callback , Err = ReactTypeOfSideEffect . Err , Ref = ReactTypeOfSideEffect . Ref , HostRoot$4 = ReactTypeOfWork . HostRoot , HostComponent$3 = ReactTypeOfWork . HostComponent , HostPortal$2 = ReactTypeOfWork . HostPortal , ClassComponent$4 = ReactTypeOfWork . ClassComponent , getUpdatePriority$1 = ReactFiberUpdateQueue . getUpdatePriority , _require14 = ReactFiberContext , resetContext$1 = _require14 . resetContext , ReactFiberInstrumentation$1 , timeHeuristicForUnitOfWork = 1 , ReactFiberScheduler = function ( config ) {
2017-09-15 01:01:25 +00:00
var hostContext = ReactFiberHostContext ( config ) , hydrationContext = ReactFiberHydrationContext ( config ) , popHostContainer = hostContext . popHostContainer , popHostContext = hostContext . popHostContext , resetHostContainer = hostContext . resetHostContainer , _ReactFiberBeginWork = ReactFiberBeginWork ( config , hostContext , hydrationContext , scheduleUpdate , getPriorityContext ) , beginWork = _ReactFiberBeginWork . beginWork , beginFailedWork = _ReactFiberBeginWork . beginFailedWork , _ReactFiberCompleteWo = ReactFiberCompleteWork ( config , hostContext , hydrationContext ) , completeWork = _ReactFiberCompleteWo . completeWork , _ReactFiberCommitWork = ReactFiberCommitWork ( config , captureError ) , commitPlacement = _ReactFiberCommitWork . commitPlacement , commitDeletion = _ReactFiberCommitWork . commitDeletion , commitWork = _ReactFiberCommitWork . commitWork , commitLifeCycles = _ReactFiberCommitWork . commitLifeCycles , commitAttachRef = _ReactFiberCommitWork . commitAttachRef , commitDetachRef = _ReactFiberCommitWork . commitDetachRef , scheduleDeferredCallback = config . scheduleDeferredCallback , useSyncScheduling = config . useSyncScheduling , prepareForCommit = config . prepareForCommit , resetAfterCommit = config . resetAfterCommit , priorityContext = NoWork$2 , isPerformingWork = ! 1 , deadlineHasExpired = ! 1 , isBatchingUpdates = ! 1 , isUnbatchingUpdates = ! 1 , nextUnitOfWork = null , nextPriorityLevel = NoWork$2 , nextEffect = null , pendingCommit = null , nextScheduledRoot = null , lastScheduledRoot = null , isCallbackScheduled = ! 1 , capturedErrors = null , failedBoundaries = null , commitPhaseBoundaries = null , firstUncaughtError = null , didFatal = ! 1 , isCommitting = ! 1 , isUnmounting = ! 1 , NESTED _UPDATE _LIMIT = 1e3 , nestedUpdateCount = 0 , nextRenderedTree = null ;
2017-08-09 19:18:46 +00:00
function resetContextStack ( ) {
reset$1 ( ) , resetContext$1 ( ) , resetHostContainer ( ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function resetNextUnitOfWork ( ) {
for ( ; null !== nextScheduledRoot && nextScheduledRoot . current . pendingWorkPriority === NoWork$2 ; ) {
nextScheduledRoot . isScheduled = ! 1 ;
var next = nextScheduledRoot . nextScheduledRoot ;
if ( nextScheduledRoot . nextScheduledRoot = null , nextScheduledRoot === lastScheduledRoot ) return nextScheduledRoot = null ,
lastScheduledRoot = null , nextPriorityLevel = NoWork$2 , null ;
nextScheduledRoot = next ;
}
for ( var root = nextScheduledRoot , highestPriorityRoot = null , highestPriorityLevel = NoWork$2 ; null !== root ; ) root . current . pendingWorkPriority !== NoWork$2 && ( highestPriorityLevel === NoWork$2 || highestPriorityLevel > root . current . pendingWorkPriority ) && ( highestPriorityLevel = root . current . pendingWorkPriority ,
highestPriorityRoot = root ) , root = root . nextScheduledRoot ;
if ( null !== highestPriorityRoot ) return nextPriorityLevel = highestPriorityLevel ,
2017-09-15 01:01:25 +00:00
resetContextStack ( ) , nextUnitOfWork = createWorkInProgress$1 ( highestPriorityRoot . current , highestPriorityLevel ) ,
void ( highestPriorityRoot !== nextRenderedTree && ( nestedUpdateCount = 0 , nextRenderedTree = highestPriorityRoot ) ) ;
nextPriorityLevel = NoWork$2 , nextUnitOfWork = null , nextRenderedTree = null ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function commitAllHostEffects ( ) {
for ( ; null !== nextEffect ; ) {
var effectTag = nextEffect . effectTag ;
if ( effectTag & ContentReset && config . resetTextContent ( nextEffect . stateNode ) , effectTag & Ref ) {
var current = nextEffect . alternate ;
null !== current && commitDetachRef ( current ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
switch ( effectTag & ~ ( Callback | Err | ContentReset | Ref | PerformedWork ) ) {
case Placement$1 :
commitPlacement ( nextEffect ) , nextEffect . effectTag &= ~ Placement$1 ;
break ;
case PlacementAndUpdate :
commitPlacement ( nextEffect ) , nextEffect . effectTag &= ~ Placement$1 ;
var _current = nextEffect . alternate ;
commitWork ( _current , nextEffect ) ;
break ;
case Update :
var _current2 = nextEffect . alternate ;
commitWork ( _current2 , nextEffect ) ;
break ;
case Deletion :
isUnmounting = ! 0 , commitDeletion ( nextEffect ) , isUnmounting = ! 1 ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
nextEffect = nextEffect . nextEffect ;
2017-05-26 17:51:06 +00:00
}
}
2017-08-09 19:18:46 +00:00
function commitAllLifeCycles ( ) {
for ( ; null !== nextEffect ; ) {
var effectTag = nextEffect . effectTag ;
if ( effectTag & ( Update | Callback ) ) {
var current = nextEffect . alternate ;
commitLifeCycles ( current , nextEffect ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
effectTag & Ref && commitAttachRef ( nextEffect ) , effectTag & Err && commitErrorHandling ( nextEffect ) ;
var next = nextEffect . nextEffect ;
nextEffect . nextEffect = null , nextEffect = next ;
2017-05-26 17:51:06 +00:00
}
}
2017-08-09 19:18:46 +00:00
function commitAllWork ( finishedWork ) {
isCommitting = ! 0 , pendingCommit = null ;
var root = finishedWork . stateNode ;
invariant ( root . current !== finishedWork , "Cannot commit the same tree as before. This is probably a bug " + "related to the return field. This error is likely caused by a bug " + "in React. Please file an issue." ) ,
nextPriorityLevel !== SynchronousPriority$1 && nextPriorityLevel !== TaskPriority$1 || nestedUpdateCount ++ ,
ReactCurrentOwner$1 . current = null ;
var firstEffect = void 0 ;
for ( finishedWork . effectTag > PerformedWork ? null !== finishedWork . lastEffect ? ( finishedWork . lastEffect . nextEffect = finishedWork ,
firstEffect = finishedWork . firstEffect ) : firstEffect = finishedWork : firstEffect = finishedWork . firstEffect ,
prepareForCommit ( ) , nextEffect = firstEffect ; null !== nextEffect ; ) {
var didError = ! 1 , _error = void 0 ;
try {
commitAllHostEffects ( ) ;
} catch ( e ) {
didError = ! 0 , _error = e ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
didError && ( invariant ( null !== nextEffect , "Should have next effect. This error is likely caused by a bug " + "in React. Please file an issue." ) ,
captureError ( nextEffect , _error ) , null !== nextEffect && ( nextEffect = nextEffect . nextEffect ) ) ;
}
for ( resetAfterCommit ( ) , root . current = finishedWork , nextEffect = firstEffect ; null !== nextEffect ; ) {
var _didError = ! 1 , _error2 = void 0 ;
try {
commitAllLifeCycles ( ) ;
} catch ( e ) {
_didError = ! 0 , _error2 = e ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
_didError && ( invariant ( null !== nextEffect , "Should have next effect. This error is likely caused by a bug " + "in React. Please file an issue." ) ,
captureError ( nextEffect , _error2 ) , null !== nextEffect && ( nextEffect = nextEffect . nextEffect ) ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
isCommitting = ! 1 , "function" == typeof onCommitRoot && onCommitRoot ( finishedWork . stateNode ) ,
! 1 && ReactFiberInstrumentation$1 . debugTool && ReactFiberInstrumentation$1 . debugTool . onCommitWork ( finishedWork ) ,
commitPhaseBoundaries && ( commitPhaseBoundaries . forEach ( scheduleErrorRecovery ) ,
commitPhaseBoundaries = null ) , resetNextUnitOfWork ( ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function resetWorkPriority ( workInProgress , renderPriority ) {
if ( ! ( workInProgress . pendingWorkPriority !== NoWork$2 && workInProgress . pendingWorkPriority > renderPriority ) ) {
for ( var newPriority = getUpdatePriority$1 ( workInProgress ) , child = workInProgress . child ; null !== child ; ) newPriority = largerPriority$1 ( newPriority , child . pendingWorkPriority ) ,
child = child . sibling ;
workInProgress . pendingWorkPriority = newPriority ;
2017-05-26 17:51:06 +00:00
}
}
2017-08-09 19:18:46 +00:00
function completeUnitOfWork ( workInProgress ) {
for ( ; ! 0 ; ) {
var current = workInProgress . alternate , next = completeWork ( current , workInProgress , nextPriorityLevel ) , returnFiber = workInProgress . return , siblingFiber = workInProgress . sibling ;
if ( resetWorkPriority ( workInProgress , nextPriorityLevel ) , null !== next ) return ! 1 && ReactFiberInstrumentation$1 . debugTool && ReactFiberInstrumentation$1 . debugTool . onCompleteWork ( workInProgress ) ,
next ;
if ( null !== returnFiber ) {
null === returnFiber . firstEffect && ( returnFiber . firstEffect = workInProgress . firstEffect ) ,
null !== workInProgress . lastEffect && ( null !== returnFiber . lastEffect && ( returnFiber . lastEffect . nextEffect = workInProgress . firstEffect ) ,
returnFiber . lastEffect = workInProgress . lastEffect ) ;
workInProgress . effectTag > PerformedWork && ( null !== returnFiber . lastEffect ? returnFiber . lastEffect . nextEffect = workInProgress : returnFiber . firstEffect = workInProgress ,
returnFiber . lastEffect = workInProgress ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
if ( ! 1 && ReactFiberInstrumentation$1 . debugTool && ReactFiberInstrumentation$1 . debugTool . onCompleteWork ( workInProgress ) ,
null !== siblingFiber ) return siblingFiber ;
if ( null === returnFiber ) return pendingCommit = workInProgress , null ;
workInProgress = returnFiber ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return null ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function performUnitOfWork ( workInProgress ) {
var current = workInProgress . alternate , next = beginWork ( current , workInProgress , nextPriorityLevel ) ;
return ! 1 && ReactFiberInstrumentation$1 . debugTool && ReactFiberInstrumentation$1 . debugTool . onBeginWork ( workInProgress ) ,
null === next && ( next = completeUnitOfWork ( workInProgress ) ) , ReactCurrentOwner$1 . current = null ,
next ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function performFailedUnitOfWork ( workInProgress ) {
var current = workInProgress . alternate , next = beginFailedWork ( current , workInProgress , nextPriorityLevel ) ;
return ! 1 && ReactFiberInstrumentation$1 . debugTool && ReactFiberInstrumentation$1 . debugTool . onBeginWork ( workInProgress ) ,
null === next && ( next = completeUnitOfWork ( workInProgress ) ) , ReactCurrentOwner$1 . current = null ,
next ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function performDeferredWork ( deadline ) {
performWork ( OffscreenPriority , deadline ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function handleCommitPhaseErrors ( ) {
if ( null !== capturedErrors && capturedErrors . size > 0 && nextPriorityLevel === TaskPriority$1 ) for ( ; null !== nextUnitOfWork && ( null !== ( nextUnitOfWork = hasCapturedError ( nextUnitOfWork ) ? performFailedUnitOfWork ( nextUnitOfWork ) : performUnitOfWork ( nextUnitOfWork ) ) || ( invariant ( null !== pendingCommit , "Should have a pending commit. This error is likely caused by " + "a bug in React. Please file an issue." ) ,
priorityContext = TaskPriority$1 , commitAllWork ( pendingCommit ) , priorityContext = nextPriorityLevel ,
null !== capturedErrors && 0 !== capturedErrors . size && nextPriorityLevel === TaskPriority$1 ) ) ; ) ;
}
function workLoop ( minPriorityLevel , deadline ) {
if ( null !== pendingCommit ? ( priorityContext = TaskPriority$1 , commitAllWork ( pendingCommit ) ,
handleCommitPhaseErrors ( ) ) : null === nextUnitOfWork && resetNextUnitOfWork ( ) , ! ( nextPriorityLevel === NoWork$2 || nextPriorityLevel > minPriorityLevel ) ) {
priorityContext = nextPriorityLevel ;
loop : do {
if ( nextPriorityLevel <= TaskPriority$1 ) for ( ; null !== nextUnitOfWork && ! ( null === ( nextUnitOfWork = performUnitOfWork ( nextUnitOfWork ) ) && ( invariant ( null !== pendingCommit , "Should have a pending commit. This error is likely caused by " + "a bug in React. Please file an issue." ) ,
priorityContext = TaskPriority$1 , commitAllWork ( pendingCommit ) , priorityContext = nextPriorityLevel ,
handleCommitPhaseErrors ( ) , nextPriorityLevel === NoWork$2 || nextPriorityLevel > minPriorityLevel || nextPriorityLevel > TaskPriority$1 ) ) ; ) ; else if ( null !== deadline ) for ( ; null !== nextUnitOfWork && ! deadlineHasExpired ; ) if ( deadline . timeRemaining ( ) > timeHeuristicForUnitOfWork ) {
if ( null === ( nextUnitOfWork = performUnitOfWork ( nextUnitOfWork ) ) ) if ( invariant ( null !== pendingCommit , "Should have a pending commit. This error is likely caused by " + "a bug in React. Please file an issue." ) ,
deadline . timeRemaining ( ) > timeHeuristicForUnitOfWork ) {
if ( priorityContext = TaskPriority$1 , commitAllWork ( pendingCommit ) , priorityContext = nextPriorityLevel ,
handleCommitPhaseErrors ( ) , nextPriorityLevel === NoWork$2 || nextPriorityLevel > minPriorityLevel || nextPriorityLevel < HighPriority ) break ;
} else deadlineHasExpired = ! 0 ;
} else deadlineHasExpired = ! 0 ;
switch ( nextPriorityLevel ) {
case SynchronousPriority$1 :
case TaskPriority$1 :
if ( nextPriorityLevel <= minPriorityLevel ) continue loop ;
break loop ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
case HighPriority :
case LowPriority :
case OffscreenPriority :
if ( null === deadline ) break loop ;
if ( ! deadlineHasExpired && nextPriorityLevel <= minPriorityLevel ) continue loop ;
break loop ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
case NoWork$2 :
break loop ;
2017-06-26 22:12:46 +00:00
2017-08-09 19:18:46 +00:00
default :
invariant ( ! 1 , "Switch statement should be exhuastive. " + "This error is likely caused by a bug in React. Please file an issue." ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
} while ( ! 0 ) ;
2017-05-26 17:51:06 +00:00
}
}
2017-08-09 19:18:46 +00:00
function performWorkCatchBlock ( failedWork , boundary , minPriorityLevel , deadline ) {
unwindContexts ( failedWork , boundary ) , nextUnitOfWork = performFailedUnitOfWork ( boundary ) ,
workLoop ( minPriorityLevel , deadline ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function performWork ( minPriorityLevel , deadline ) {
invariant ( ! isPerformingWork , "performWork was called recursively. This error is likely caused " + "by a bug in React. Please file an issue." ) ,
2017-09-15 01:01:25 +00:00
isPerformingWork = ! 0 ;
2017-08-09 19:18:46 +00:00
var previousPriorityContext = priorityContext , didError = ! 1 , error = null ;
try {
workLoop ( minPriorityLevel , deadline ) ;
} catch ( e ) {
didError = ! 0 , error = e ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
for ( ; didError ; ) {
if ( didFatal ) {
firstUncaughtError = error ;
break ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var failedWork = nextUnitOfWork ;
if ( null !== failedWork ) {
var boundary = captureError ( failedWork , error ) ;
if ( invariant ( null !== boundary , "Should have found an error boundary. This error is likely " + "caused by a bug in React. Please file an issue." ) ,
! didFatal ) {
didError = ! 1 , error = null ;
try {
performWorkCatchBlock ( failedWork , boundary , minPriorityLevel , deadline ) , error = null ;
} catch ( e ) {
didError = ! 0 , error = e ;
continue ;
}
break ;
}
} else didFatal = ! 0 ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
priorityContext = previousPriorityContext , null !== deadline && ( isCallbackScheduled = ! 1 ) ,
nextPriorityLevel > TaskPriority$1 && ! isCallbackScheduled && ( scheduleDeferredCallback ( performDeferredWork ) ,
isCallbackScheduled = ! 0 ) ;
var errorToThrow = firstUncaughtError ;
if ( isPerformingWork = ! 1 , deadlineHasExpired = ! 1 , didFatal = ! 1 , firstUncaughtError = null ,
2017-09-15 01:01:25 +00:00
capturedErrors = null , failedBoundaries = null , nextRenderedTree = null , nestedUpdateCount = 0 ,
null !== errorToThrow ) throw errorToThrow ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function captureError ( failedWork , error ) {
ReactCurrentOwner$1 . current = null ;
var boundary = null , errorBoundaryFound = ! 1 , willRetry = ! 1 , errorBoundaryName = null ;
if ( failedWork . tag === HostRoot$4 ) boundary = failedWork , isFailedBoundary ( failedWork ) && ( didFatal = ! 0 ) ; else for ( var node = failedWork . return ; null !== node && null === boundary ; ) {
if ( node . tag === ClassComponent$4 ) {
var instance = node . stateNode ;
"function" == typeof instance . componentDidCatch && ( errorBoundaryFound = ! 0 , errorBoundaryName = getComponentName _1 ( node ) ,
boundary = node , willRetry = ! 0 ) ;
} else node . tag === HostRoot$4 && ( boundary = node ) ;
if ( isFailedBoundary ( node ) ) {
if ( isUnmounting ) return null ;
if ( null !== commitPhaseBoundaries && ( commitPhaseBoundaries . has ( node ) || null !== node . alternate && commitPhaseBoundaries . has ( node . alternate ) ) ) return null ;
boundary = null , willRetry = ! 1 ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
node = node . return ;
}
if ( null !== boundary ) {
null === failedBoundaries && ( failedBoundaries = new Set ( ) ) , failedBoundaries . add ( boundary ) ;
var _componentStack = getStackAddendumByWorkInProgressFiber ( failedWork ) , _componentName = getComponentName _1 ( failedWork ) ;
null === capturedErrors && ( capturedErrors = new Map ( ) ) ;
var capturedError = {
componentName : _componentName ,
componentStack : _componentStack ,
error : error ,
errorBoundary : errorBoundaryFound ? boundary . stateNode : null ,
errorBoundaryFound : errorBoundaryFound ,
errorBoundaryName : errorBoundaryName ,
willRetry : willRetry
} ;
capturedErrors . set ( boundary , capturedError ) ;
try {
logCapturedError$1 ( capturedError ) ;
} catch ( e ) {
console . error ( e ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return isCommitting ? ( null === commitPhaseBoundaries && ( commitPhaseBoundaries = new Set ( ) ) ,
commitPhaseBoundaries . add ( boundary ) ) : scheduleErrorRecovery ( boundary ) , boundary ;
}
return null === firstUncaughtError && ( firstUncaughtError = error ) , null ;
}
function hasCapturedError ( fiber ) {
return null !== capturedErrors && ( capturedErrors . has ( fiber ) || null !== fiber . alternate && capturedErrors . has ( fiber . alternate ) ) ;
}
function isFailedBoundary ( fiber ) {
return null !== failedBoundaries && ( failedBoundaries . has ( fiber ) || null !== fiber . alternate && failedBoundaries . has ( fiber . alternate ) ) ;
}
function commitErrorHandling ( effectfulFiber ) {
var capturedError = void 0 ;
switch ( null !== capturedErrors && ( capturedError = capturedErrors . get ( effectfulFiber ) ,
capturedErrors . delete ( effectfulFiber ) , null == capturedError && null !== effectfulFiber . alternate && ( effectfulFiber = effectfulFiber . alternate ,
capturedError = capturedErrors . get ( effectfulFiber ) , capturedErrors . delete ( effectfulFiber ) ) ) ,
invariant ( null != capturedError , "No error for given unit of work. This error is likely caused by a " + "bug in React. Please file an issue." ) ,
effectfulFiber . tag ) {
case ClassComponent$4 :
var instance = effectfulFiber . stateNode , info = {
componentStack : capturedError . componentStack
} ;
return void instance . componentDidCatch ( capturedError . error , info ) ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
case HostRoot$4 :
return void ( null === firstUncaughtError && ( firstUncaughtError = capturedError . error ) ) ;
2017-05-26 17:51:06 +00:00
default :
2017-08-09 19:18:46 +00:00
invariant ( ! 1 , "Invalid type of work. This error is likely caused by a bug in " + "React. Please file an issue." ) ;
2017-05-26 17:51:06 +00:00
}
}
2017-08-09 19:18:46 +00:00
function unwindContexts ( from , to ) {
for ( var node = from ; null !== node ; ) {
switch ( node . tag ) {
case ClassComponent$4 :
popContextProvider$1 ( node ) ;
2017-06-09 02:01:23 +00:00
break ;
2017-08-09 19:18:46 +00:00
case HostComponent$3 :
popHostContext ( node ) ;
break ;
case HostRoot$4 :
case HostPortal$2 :
popHostContainer ( node ) ;
2017-06-09 02:01:23 +00:00
}
2017-08-09 19:18:46 +00:00
if ( node === to || node . alternate === to ) break ;
node = node . return ;
2017-05-26 17:51:06 +00:00
}
}
2017-08-09 19:18:46 +00:00
function scheduleRoot ( root , priorityLevel ) {
priorityLevel !== NoWork$2 && ( root . isScheduled || ( root . isScheduled = ! 0 , lastScheduledRoot ? ( lastScheduledRoot . nextScheduledRoot = root ,
lastScheduledRoot = root ) : ( nextScheduledRoot = root , lastScheduledRoot = root ) ) ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function scheduleUpdate ( fiber , priorityLevel ) {
return scheduleUpdateImpl ( fiber , priorityLevel , ! 1 ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function scheduleUpdateImpl ( fiber , priorityLevel , isErrorRecovery ) {
nestedUpdateCount > NESTED _UPDATE _LIMIT && ( didFatal = ! 0 , invariant ( ! 1 , "Maximum update depth exceeded. This can happen when a " + "component repeatedly calls setState inside componentWillUpdate or " + "componentDidUpdate. React limits the number of nested updates to " + "prevent infinite loops." ) ) ,
! isPerformingWork && priorityLevel <= nextPriorityLevel && ( nextUnitOfWork = null ) ;
for ( var node = fiber , shouldContinue = ! 0 ; null !== node && shouldContinue ; ) {
if ( shouldContinue = ! 1 , ( node . pendingWorkPriority === NoWork$2 || node . pendingWorkPriority > priorityLevel ) && ( shouldContinue = ! 0 ,
node . pendingWorkPriority = priorityLevel ) , null !== node . alternate && ( node . alternate . pendingWorkPriority === NoWork$2 || node . alternate . pendingWorkPriority > priorityLevel ) && ( shouldContinue = ! 0 ,
node . alternate . pendingWorkPriority = priorityLevel ) , null === node . return ) {
if ( node . tag !== HostRoot$4 ) return ;
if ( scheduleRoot ( node . stateNode , priorityLevel ) , ! isPerformingWork ) switch ( priorityLevel ) {
case SynchronousPriority$1 :
isUnbatchingUpdates ? performWork ( SynchronousPriority$1 , null ) : performWork ( TaskPriority$1 , null ) ;
break ;
case TaskPriority$1 :
invariant ( isBatchingUpdates , "Task updates can only be scheduled as a nested update or " + "inside batchedUpdates." ) ;
break ;
default :
isCallbackScheduled || ( scheduleDeferredCallback ( performDeferredWork ) , isCallbackScheduled = ! 0 ) ;
}
}
node = node . return ;
}
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function getPriorityContext ( fiber , forceAsync ) {
var priorityLevel = priorityContext ;
return priorityLevel === NoWork$2 && ( priorityLevel = ! useSyncScheduling || fiber . internalContextTag & AsyncUpdates || forceAsync ? LowPriority : SynchronousPriority$1 ) ,
priorityLevel === SynchronousPriority$1 && ( isPerformingWork || isBatchingUpdates ) ? TaskPriority$1 : priorityLevel ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function scheduleErrorRecovery ( fiber ) {
scheduleUpdateImpl ( fiber , TaskPriority$1 , ! 0 ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function batchedUpdates ( fn , a ) {
var previousIsBatchingUpdates = isBatchingUpdates ;
isBatchingUpdates = ! 0 ;
try {
return fn ( a ) ;
} finally {
isBatchingUpdates = previousIsBatchingUpdates , isPerformingWork || isBatchingUpdates || performWork ( TaskPriority$1 , null ) ;
}
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function unbatchedUpdates ( fn ) {
var previousIsUnbatchingUpdates = isUnbatchingUpdates , previousIsBatchingUpdates = isBatchingUpdates ;
isUnbatchingUpdates = isBatchingUpdates , isBatchingUpdates = ! 1 ;
try {
return fn ( ) ;
} finally {
isBatchingUpdates = previousIsBatchingUpdates , isUnbatchingUpdates = previousIsUnbatchingUpdates ;
}
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function flushSync ( batch ) {
var previousIsBatchingUpdates = isBatchingUpdates , previousPriorityContext = priorityContext ;
isBatchingUpdates = ! 0 , priorityContext = SynchronousPriority$1 ;
try {
return batch ( ) ;
} finally {
isBatchingUpdates = previousIsBatchingUpdates , priorityContext = previousPriorityContext ,
invariant ( ! isPerformingWork , "flushSync was called from inside a lifecycle method. It cannot be " + "called when React is already rendering." ) ,
performWork ( TaskPriority$1 , null ) ;
}
}
function deferredUpdates ( fn ) {
var previousPriorityContext = priorityContext ;
priorityContext = LowPriority ;
try {
return fn ( ) ;
} finally {
priorityContext = previousPriorityContext ;
}
2017-05-26 17:51:06 +00:00
}
return {
2017-08-09 19:18:46 +00:00
scheduleUpdate : scheduleUpdate ,
getPriorityContext : getPriorityContext ,
batchedUpdates : batchedUpdates ,
unbatchedUpdates : unbatchedUpdates ,
flushSync : flushSync ,
deferredUpdates : deferredUpdates
2017-05-26 17:51:06 +00:00
} ;
2017-10-04 17:06:57 +00:00
} , addTopLevelUpdate = ReactFiberUpdateQueue . addTopLevelUpdate , findCurrentUnmaskedContext = ReactFiberContext . findCurrentUnmaskedContext , isContextProvider = ReactFiberContext . isContextProvider , processChildContext = ReactFiberContext . processChildContext , createFiberRoot = ReactFiberRoot . createFiberRoot , HostComponent = ReactTypeOfWork . HostComponent , findCurrentHostFiber = ReactFiberTreeReflection . findCurrentHostFiber , findCurrentHostFiberWithNoPortals = ReactFiberTreeReflection . findCurrentHostFiberWithNoPortals ;
2017-08-09 19:18:46 +00:00
function getContextForSubtree ( parentComponent ) {
if ( ! parentComponent ) return emptyObject ;
2017-10-04 17:06:57 +00:00
var fiber = ReactInstanceMap _1 . get ( parentComponent ) , parentContext = findCurrentUnmaskedContext ( fiber ) ;
return isContextProvider ( fiber ) ? processChildContext ( fiber , parentContext ) : parentContext ;
2017-08-09 19:18:46 +00:00
}
var ReactFiberReconciler = function ( config ) {
2017-09-15 01:01:27 +00:00
var getPublicInstance = config . getPublicInstance , _ReactFiberScheduler = ReactFiberScheduler ( config ) , scheduleUpdate = _ReactFiberScheduler . scheduleUpdate , getPriorityContext = _ReactFiberScheduler . getPriorityContext , batchedUpdates = _ReactFiberScheduler . batchedUpdates , unbatchedUpdates = _ReactFiberScheduler . unbatchedUpdates , flushSync = _ReactFiberScheduler . flushSync , deferredUpdates = _ReactFiberScheduler . deferredUpdates ;
2017-08-09 19:18:46 +00:00
function scheduleTopLevelUpdate ( current , element , callback ) {
var forceAsync = ReactFeatureFlags _1 . enableAsyncSubtreeAPI && null != element && null != element . type && null != element . type . prototype && ! 0 === element . type . prototype . unstable _isAsyncReactComponent , priorityLevel = getPriorityContext ( current , forceAsync ) , nextState = {
element : element
} ;
callback = void 0 === callback ? null : callback , addTopLevelUpdate ( current , nextState , callback , priorityLevel ) ,
scheduleUpdate ( current , priorityLevel ) ;
}
return {
createContainer : function ( containerInfo ) {
return createFiberRoot ( containerInfo ) ;
2017-05-26 17:51:06 +00:00
} ,
2017-08-09 19:18:46 +00:00
updateContainer : function ( element , container , parentComponent , callback ) {
2017-10-04 17:06:57 +00:00
var current = container . current , context = getContextForSubtree ( parentComponent ) ;
2017-08-09 19:18:46 +00:00
null === container . context ? container . context = context : container . pendingContext = context ,
scheduleTopLevelUpdate ( current , element , callback ) ;
2017-05-26 17:51:06 +00:00
} ,
2017-08-09 19:18:46 +00:00
batchedUpdates : batchedUpdates ,
unbatchedUpdates : unbatchedUpdates ,
deferredUpdates : deferredUpdates ,
flushSync : flushSync ,
getPublicRootInstance : function ( container ) {
var containerFiber = container . current ;
if ( ! containerFiber . child ) return null ;
switch ( containerFiber . child . tag ) {
case HostComponent :
return getPublicInstance ( containerFiber . child . stateNode ) ;
default :
return containerFiber . child . stateNode ;
}
} ,
findHostInstance : function ( fiber ) {
var hostFiber = findCurrentHostFiber ( fiber ) ;
return null === hostFiber ? null : hostFiber . stateNode ;
} ,
findHostInstanceWithNoPortals : function ( fiber ) {
var hostFiber = findCurrentHostFiberWithNoPortals ( fiber ) ;
return null === hostFiber ? null : hostFiber . stateNode ;
2017-05-26 17:51:06 +00:00
}
} ;
2017-08-09 19:18:46 +00:00
} ;
2017-06-09 02:01:23 +00:00
2017-08-09 19:18:46 +00:00
function _classCallCheck ( instance , Constructor ) {
if ( ! ( instance instanceof Constructor ) ) throw new TypeError ( "Cannot call a class as a function" ) ;
}
2017-06-09 02:01:23 +00:00
2017-08-09 19:18:46 +00:00
var objects = { } , uniqueID = 1 , emptyObject$3 = { } , ReactNativePropRegistry = function ( ) {
function ReactNativePropRegistry ( ) {
_classCallCheck ( this , ReactNativePropRegistry ) ;
2017-06-09 02:01:23 +00:00
}
2017-08-09 19:18:46 +00:00
return ReactNativePropRegistry . register = function ( object ) {
var id = ++ uniqueID ;
return objects [ id ] = object , id ;
} , ReactNativePropRegistry . getByID = function ( id ) {
if ( ! id ) return emptyObject$3 ;
var object = objects [ id ] ;
return object || ( console . warn ( "Invalid style with id `" + id + "`. Skipping ..." ) ,
emptyObject$3 ) ;
} , ReactNativePropRegistry ;
} ( ) , ReactNativePropRegistry _1 = ReactNativePropRegistry , emptyObject$2 = { } , removedKeys = null , removedKeyCount = 0 ;
function defaultDiffer ( prevProp , nextProp ) {
return "object" != typeof nextProp || null === nextProp || deepDiffer ( prevProp , nextProp ) ;
}
function resolveObject ( idOrObject ) {
return "number" == typeof idOrObject ? ReactNativePropRegistry _1 . getByID ( idOrObject ) : idOrObject ;
}
function restoreDeletedValuesInNestedArray ( updatePayload , node , validAttributes ) {
if ( Array . isArray ( node ) ) for ( var i = node . length ; i -- && removedKeyCount > 0 ; ) restoreDeletedValuesInNestedArray ( updatePayload , node [ i ] , validAttributes ) ; else if ( node && removedKeyCount > 0 ) {
var obj = resolveObject ( node ) ;
for ( var propKey in removedKeys ) if ( removedKeys [ propKey ] ) {
var nextProp = obj [ propKey ] ;
if ( void 0 !== nextProp ) {
var attributeConfig = validAttributes [ propKey ] ;
if ( attributeConfig ) {
if ( "function" == typeof nextProp && ( nextProp = ! 0 ) , void 0 === nextProp && ( nextProp = null ) ,
"object" != typeof attributeConfig ) updatePayload [ propKey ] = nextProp ; else if ( "function" == typeof attributeConfig . diff || "function" == typeof attributeConfig . process ) {
var nextValue = "function" == typeof attributeConfig . process ? attributeConfig . process ( nextProp ) : nextProp ;
updatePayload [ propKey ] = nextValue ;
}
removedKeys [ propKey ] = ! 1 , removedKeyCount -- ;
}
2017-05-26 17:51:06 +00:00
}
}
}
2017-08-09 19:18:46 +00:00
}
function diffNestedArrayProperty ( updatePayload , prevArray , nextArray , validAttributes ) {
var i , minLength = prevArray . length < nextArray . length ? prevArray . length : nextArray . length ;
for ( i = 0 ; i < minLength ; i ++ ) updatePayload = diffNestedProperty ( updatePayload , prevArray [ i ] , nextArray [ i ] , validAttributes ) ;
for ( ; i < prevArray . length ; i ++ ) updatePayload = clearNestedProperty ( updatePayload , prevArray [ i ] , validAttributes ) ;
for ( ; i < nextArray . length ; i ++ ) updatePayload = addNestedProperty ( updatePayload , nextArray [ i ] , validAttributes ) ;
return updatePayload ;
}
function diffNestedProperty ( updatePayload , prevProp , nextProp , validAttributes ) {
return updatePayload || prevProp !== nextProp ? prevProp && nextProp ? Array . isArray ( prevProp ) || Array . isArray ( nextProp ) ? Array . isArray ( prevProp ) && Array . isArray ( nextProp ) ? diffNestedArrayProperty ( updatePayload , prevProp , nextProp , validAttributes ) : Array . isArray ( prevProp ) ? diffProperties ( updatePayload , flattenStyle ( prevProp ) , resolveObject ( nextProp ) , validAttributes ) : diffProperties ( updatePayload , resolveObject ( prevProp ) , flattenStyle ( nextProp ) , validAttributes ) : diffProperties ( updatePayload , resolveObject ( prevProp ) , resolveObject ( nextProp ) , validAttributes ) : nextProp ? addNestedProperty ( updatePayload , nextProp , validAttributes ) : prevProp ? clearNestedProperty ( updatePayload , prevProp , validAttributes ) : updatePayload : updatePayload ;
}
function addNestedProperty ( updatePayload , nextProp , validAttributes ) {
if ( ! nextProp ) return updatePayload ;
if ( ! Array . isArray ( nextProp ) ) return addProperties ( updatePayload , resolveObject ( nextProp ) , validAttributes ) ;
for ( var i = 0 ; i < nextProp . length ; i ++ ) updatePayload = addNestedProperty ( updatePayload , nextProp [ i ] , validAttributes ) ;
return updatePayload ;
}
function clearNestedProperty ( updatePayload , prevProp , validAttributes ) {
if ( ! prevProp ) return updatePayload ;
if ( ! Array . isArray ( prevProp ) ) return clearProperties ( updatePayload , resolveObject ( prevProp ) , validAttributes ) ;
for ( var i = 0 ; i < prevProp . length ; i ++ ) updatePayload = clearNestedProperty ( updatePayload , prevProp [ i ] , validAttributes ) ;
return updatePayload ;
}
function diffProperties ( updatePayload , prevProps , nextProps , validAttributes ) {
var attributeConfig , nextProp , prevProp ;
for ( var propKey in nextProps ) if ( attributeConfig = validAttributes [ propKey ] ) if ( prevProp = prevProps [ propKey ] ,
nextProp = nextProps [ propKey ] , "function" == typeof nextProp && ( nextProp = ! 0 ,
"function" == typeof prevProp && ( prevProp = ! 0 ) ) , void 0 === nextProp && ( nextProp = null ,
void 0 === prevProp && ( prevProp = null ) ) , removedKeys && ( removedKeys [ propKey ] = ! 1 ) ,
updatePayload && void 0 !== updatePayload [ propKey ] ) {
if ( "object" != typeof attributeConfig ) updatePayload [ propKey ] = nextProp ; else if ( "function" == typeof attributeConfig . diff || "function" == typeof attributeConfig . process ) {
var nextValue = "function" == typeof attributeConfig . process ? attributeConfig . process ( nextProp ) : nextProp ;
updatePayload [ propKey ] = nextValue ;
}
} else if ( prevProp !== nextProp ) if ( "object" != typeof attributeConfig ) defaultDiffer ( prevProp , nextProp ) && ( ( updatePayload || ( updatePayload = { } ) ) [ propKey ] = nextProp ) ; else if ( "function" == typeof attributeConfig . diff || "function" == typeof attributeConfig . process ) {
var shouldUpdate = void 0 === prevProp || ( "function" == typeof attributeConfig . diff ? attributeConfig . diff ( prevProp , nextProp ) : defaultDiffer ( prevProp , nextProp ) ) ;
shouldUpdate && ( nextValue = "function" == typeof attributeConfig . process ? attributeConfig . process ( nextProp ) : nextProp ,
( updatePayload || ( updatePayload = { } ) ) [ propKey ] = nextValue ) ;
} else removedKeys = null , removedKeyCount = 0 , updatePayload = diffNestedProperty ( updatePayload , prevProp , nextProp , attributeConfig ) ,
removedKeyCount > 0 && updatePayload && ( restoreDeletedValuesInNestedArray ( updatePayload , nextProp , attributeConfig ) ,
removedKeys = null ) ;
for ( propKey in prevProps ) void 0 === nextProps [ propKey ] && ( attributeConfig = validAttributes [ propKey ] ) && ( updatePayload && void 0 !== updatePayload [ propKey ] || void 0 !== ( prevProp = prevProps [ propKey ] ) && ( "object" != typeof attributeConfig || "function" == typeof attributeConfig . diff || "function" == typeof attributeConfig . process ? ( ( updatePayload || ( updatePayload = { } ) ) [ propKey ] = null ,
removedKeys || ( removedKeys = { } ) , removedKeys [ propKey ] || ( removedKeys [ propKey ] = ! 0 ,
removedKeyCount ++ ) ) : updatePayload = clearNestedProperty ( updatePayload , prevProp , attributeConfig ) ) ) ;
return updatePayload ;
}
function addProperties ( updatePayload , props , validAttributes ) {
return diffProperties ( updatePayload , emptyObject$2 , props , validAttributes ) ;
}
function clearProperties ( updatePayload , prevProps , validAttributes ) {
return diffProperties ( updatePayload , prevProps , emptyObject$2 , validAttributes ) ;
}
var ReactNativeAttributePayload = {
create : function ( props , validAttributes ) {
return addProperties ( null , props , validAttributes ) ;
} ,
diff : function ( prevProps , nextProps , validAttributes ) {
return diffProperties ( null , prevProps , nextProps , validAttributes ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
} , ReactNativeAttributePayload _1 = ReactNativeAttributePayload ;
function mountSafeCallback$1 ( context , callback ) {
return function ( ) {
if ( callback ) {
if ( "boolean" == typeof context . _ _isMounted ) {
if ( ! context . _ _isMounted ) return ;
} else if ( "function" == typeof context . isMounted && ! context . isMounted ( ) ) return ;
return callback . apply ( context , arguments ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
} ;
}
function throwOnStylesProp ( component , props ) {
if ( void 0 !== props . styles ) {
var owner = component . _owner || null , name = component . constructor . displayName , msg = "`styles` is not a supported property of `" + name + "`, did " + "you mean `style` (singular)?" ;
throw owner && owner . constructor && owner . constructor . displayName && ( msg += "\n\nCheck the `" + owner . constructor . displayName + "` parent " + " component." ) ,
new Error ( msg ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function warnForStyleProps$1 ( props , validAttributes ) {
for ( var key in validAttributes . style ) validAttributes [ key ] || void 0 === props [ key ] || console . error ( "You are setting the style `{ " + key + ": ... }` as a prop. You " + "should nest it in a style object. " + "E.g. `{ style: { " + key + ": ... } }`" ) ;
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
var NativeMethodsMixinUtils = {
mountSafeCallback : mountSafeCallback$1 ,
throwOnStylesProp : throwOnStylesProp ,
warnForStyleProps : warnForStyleProps$1
} ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function _classCallCheck$1 ( instance , Constructor ) {
if ( ! ( instance instanceof Constructor ) ) throw new TypeError ( "Cannot call a class as a function" ) ;
}
var mountSafeCallback = NativeMethodsMixinUtils . mountSafeCallback , ReactNativeFiberHostComponent = function ( ) {
function ReactNativeFiberHostComponent ( tag , viewConfig ) {
_classCallCheck$1 ( this , ReactNativeFiberHostComponent ) , this . _nativeTag = tag , this . _children = [ ] ,
this . viewConfig = viewConfig ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return ReactNativeFiberHostComponent . prototype . blur = function ( ) {
TextInputState . blurTextInput ( this . _nativeTag ) ;
} , ReactNativeFiberHostComponent . prototype . focus = function ( ) {
TextInputState . focusTextInput ( this . _nativeTag ) ;
} , ReactNativeFiberHostComponent . prototype . measure = function ( callback ) {
UIManager . measure ( this . _nativeTag , mountSafeCallback ( this , callback ) ) ;
} , ReactNativeFiberHostComponent . prototype . measureInWindow = function ( callback ) {
UIManager . measureInWindow ( this . _nativeTag , mountSafeCallback ( this , callback ) ) ;
} , ReactNativeFiberHostComponent . prototype . measureLayout = function ( relativeToNativeNode , onSuccess , onFail ) {
UIManager . measureLayout ( this . _nativeTag , relativeToNativeNode , mountSafeCallback ( this , onFail ) , mountSafeCallback ( this , onSuccess ) ) ;
} , ReactNativeFiberHostComponent . prototype . setNativeProps = function ( nativeProps ) {
var updatePayload = ReactNativeAttributePayload _1 . create ( nativeProps , this . viewConfig . validAttributes ) ;
2017-09-15 01:01:25 +00:00
null != updatePayload && UIManager . updateView ( this . _nativeTag , this . viewConfig . uiViewClassName , updatePayload ) ;
2017-08-09 19:18:46 +00:00
} , ReactNativeFiberHostComponent ;
} ( ) , ReactNativeFiberHostComponent _1 = ReactNativeFiberHostComponent , INITIAL _TAG _COUNT = 1 , ReactNativeTagHandles = {
tagsStartAt : INITIAL _TAG _COUNT ,
tagCount : INITIAL _TAG _COUNT ,
allocateTag : function ( ) {
for ( ; this . reactTagIsNativeTopRootID ( ReactNativeTagHandles . tagCount ) ; ) ReactNativeTagHandles . tagCount ++ ;
var tag = ReactNativeTagHandles . tagCount ;
return ReactNativeTagHandles . tagCount ++ , tag ;
} ,
assertRootTag : function ( tag ) {
invariant ( this . reactTagIsNativeTopRootID ( tag ) , "Expect a native root tag, instead got %s" , tag ) ;
} ,
reactTagIsNativeTopRootID : function ( reactTag ) {
return reactTag % 10 == 1 ;
2017-05-26 17:51:06 +00:00
}
2017-09-15 01:01:25 +00:00
} , ReactNativeTagHandles _1 = ReactNativeTagHandles , viewConfigCallbacks = new Map ( ) , viewConfigs = new Map ( ) , ReactNativeViewConfigRegistry = {
register : function ( name , callback ) {
return invariant ( ! viewConfigCallbacks . has ( name ) , "Tried to register two views with the same name %s" , name ) ,
viewConfigCallbacks . set ( name , callback ) , name ;
2017-08-09 19:18:46 +00:00
} ,
get : function ( name ) {
2017-09-15 01:01:25 +00:00
var viewConfig = void 0 ;
if ( viewConfigs . has ( name ) ) viewConfig = viewConfigs . get ( name ) ; else {
var callback = viewConfigCallbacks . get ( name ) ;
invariant ( "function" == typeof callback , "View config not found for name %s" , name ) ,
viewConfigCallbacks . set ( name , null ) , viewConfig = callback ( ) , viewConfigs . set ( name , viewConfig ) ;
}
return invariant ( viewConfig , "View config not found for name %s" , name ) , viewConfig ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
} , ReactNativeViewConfigRegistry _1 = ReactNativeViewConfigRegistry , precacheFiberNode$1 = ReactNativeComponentTree _1 . precacheFiberNode , uncacheFiberNode$1 = ReactNativeComponentTree _1 . uncacheFiberNode , updateFiberProps$1 = ReactNativeComponentTree _1 . updateFiberProps ;
function recursivelyUncacheFiberNode ( node ) {
"number" == typeof node ? uncacheFiberNode$1 ( node ) : ( uncacheFiberNode$1 ( node . _nativeTag ) ,
node . _children . forEach ( recursivelyUncacheFiberNode ) ) ;
}
var NativeRenderer = ReactFiberReconciler ( {
appendChild : function ( parentInstance , child ) {
var childTag = "number" == typeof child ? child : child . _nativeTag , children = parentInstance . _children , index = children . indexOf ( child ) ;
index >= 0 ? ( children . splice ( index , 1 ) , children . push ( child ) , UIManager . manageChildren ( parentInstance . _nativeTag , [ index ] , [ children . length - 1 ] , [ ] , [ ] , [ ] ) ) : ( children . push ( child ) ,
UIManager . manageChildren ( parentInstance . _nativeTag , [ ] , [ ] , [ childTag ] , [ children . length - 1 ] , [ ] ) ) ;
} ,
appendChildToContainer : function ( parentInstance , child ) {
var childTag = "number" == typeof child ? child : child . _nativeTag ;
UIManager . setChildren ( parentInstance , [ childTag ] ) ;
} ,
appendInitialChild : function ( parentInstance , child ) {
parentInstance . _children . push ( child ) ;
} ,
commitTextUpdate : function ( textInstance , oldText , newText ) {
UIManager . updateView ( textInstance , "RCTRawText" , {
text : newText
} ) ;
} ,
commitMount : function ( instance , type , newProps , internalInstanceHandle ) { } ,
commitUpdate : function ( instance , updatePayloadTODO , type , oldProps , newProps , internalInstanceHandle ) {
var viewConfig = instance . viewConfig ;
updateFiberProps$1 ( instance . _nativeTag , newProps ) ;
var updatePayload = ReactNativeAttributePayload _1 . diff ( oldProps , newProps , viewConfig . validAttributes ) ;
2017-09-15 01:01:25 +00:00
null != updatePayload && UIManager . updateView ( instance . _nativeTag , viewConfig . uiViewClassName , updatePayload ) ;
2017-08-09 19:18:46 +00:00
} ,
createInstance : function ( type , props , rootContainerInstance , hostContext , internalInstanceHandle ) {
var tag = ReactNativeTagHandles _1 . allocateTag ( ) , viewConfig = ReactNativeViewConfigRegistry _1 . get ( type ) , updatePayload = ReactNativeAttributePayload _1 . create ( props , viewConfig . validAttributes ) ;
UIManager . createView ( tag , viewConfig . uiViewClassName , rootContainerInstance , updatePayload ) ;
var component = new ReactNativeFiberHostComponent _1 ( tag , viewConfig ) ;
return precacheFiberNode$1 ( internalInstanceHandle , tag ) , updateFiberProps$1 ( tag , props ) ,
component ;
} ,
createTextInstance : function ( text , rootContainerInstance , hostContext , internalInstanceHandle ) {
var tag = ReactNativeTagHandles _1 . allocateTag ( ) ;
return UIManager . createView ( tag , "RCTRawText" , rootContainerInstance , {
text : text
} ) , precacheFiberNode$1 ( internalInstanceHandle , tag ) , tag ;
} ,
finalizeInitialChildren : function ( parentInstance , type , props , rootContainerInstance ) {
if ( 0 === parentInstance . _children . length ) return ! 1 ;
var nativeTags = parentInstance . _children . map ( function ( child ) {
return "number" == typeof child ? child : child . _nativeTag ;
} ) ;
return UIManager . setChildren ( parentInstance . _nativeTag , nativeTags ) , ! 1 ;
} ,
getRootHostContext : function ( ) {
return emptyObject ;
} ,
getChildHostContext : function ( ) {
return emptyObject ;
} ,
getPublicInstance : function ( instance ) {
return instance ;
} ,
insertBefore : function ( parentInstance , child , beforeChild ) {
var children = parentInstance . _children , index = children . indexOf ( child ) ;
if ( index >= 0 ) {
children . splice ( index , 1 ) ;
var beforeChildIndex = children . indexOf ( beforeChild ) ;
children . splice ( beforeChildIndex , 0 , child ) , UIManager . manageChildren ( parentInstance . _nativeTag , [ index ] , [ beforeChildIndex ] , [ ] , [ ] , [ ] ) ;
} else {
var _beforeChildIndex = children . indexOf ( beforeChild ) ;
children . splice ( _beforeChildIndex , 0 , child ) ;
var childTag = "number" == typeof child ? child : child . _nativeTag ;
UIManager . manageChildren ( parentInstance . _nativeTag , [ ] , [ ] , [ childTag ] , [ _beforeChildIndex ] , [ ] ) ;
2017-07-14 00:20:15 +00:00
}
2017-08-09 19:18:46 +00:00
} ,
insertInContainerBefore : function ( parentInstance , child , beforeChild ) {
invariant ( "number" != typeof parentInstance , "Container does not support insertBefore operation" ) ;
} ,
prepareForCommit : function ( ) { } ,
prepareUpdate : function ( instance , type , oldProps , newProps , rootContainerInstance , hostContext ) {
return emptyObject ;
} ,
removeChild : function ( parentInstance , child ) {
recursivelyUncacheFiberNode ( child ) ;
var children = parentInstance . _children , index = children . indexOf ( child ) ;
children . splice ( index , 1 ) , UIManager . manageChildren ( parentInstance . _nativeTag , [ ] , [ ] , [ ] , [ ] , [ index ] ) ;
} ,
removeChildFromContainer : function ( parentInstance , child ) {
recursivelyUncacheFiberNode ( child ) , UIManager . manageChildren ( parentInstance , [ ] , [ ] , [ ] , [ ] , [ 0 ] ) ;
} ,
resetAfterCommit : function ( ) { } ,
resetTextContent : function ( instance ) { } ,
shouldDeprioritizeSubtree : function ( type , props ) {
return ! 1 ;
} ,
scheduleDeferredCallback : commonjsGlobal . requestIdleCallback ,
shouldSetTextContent : function ( type , props ) {
return ! 1 ;
} ,
useSyncScheduling : ! 0
} ) , ReactNativeFiberRenderer = NativeRenderer , getInspectorDataForViewTag = void 0 ;
getInspectorDataForViewTag = function ( ) {
invariant ( ! 1 , "getInspectorDataForViewTag() is not available in production" ) ;
} ;
var ReactNativeFiberInspector = {
getInspectorDataForViewTag : getInspectorDataForViewTag
2017-10-04 17:06:57 +00:00
} , ReactVersion = "16.0.0" ;
2017-08-09 19:18:46 +00:00
function findNodeHandle ( componentOrHandle ) {
if ( null == componentOrHandle ) return null ;
if ( "number" == typeof componentOrHandle ) return componentOrHandle ;
var component = componentOrHandle , internalInstance = ReactInstanceMap _1 . get ( component ) ;
2017-09-15 01:01:25 +00:00
return internalInstance ? ReactNativeFiberRenderer . findHostInstance ( internalInstance ) : component || ( invariant ( "object" == typeof component && "_nativeTag" in component || null != component . render && "function" == typeof component . render , "findNodeHandle(...): Argument is not a component " + "(type: %s, keys: %s)" , typeof component , Object . keys ( component ) ) ,
2017-08-09 19:18:46 +00:00
void invariant ( ! 1 , "findNodeHandle(...): Unable to find node handle for unmounted " + "component." ) ) ;
}
2017-09-15 01:01:25 +00:00
var findNodeHandle _1 = findNodeHandle , findNumericNodeHandle = function ( componentOrHandle ) {
2017-08-09 19:18:46 +00:00
var instance = findNodeHandle _1 ( componentOrHandle ) ;
return null == instance || "number" == typeof instance ? instance : instance . _nativeTag ;
} , eventPluginOrder = null , namesToPlugins = { } ;
function recomputePluginOrdering ( ) {
if ( eventPluginOrder ) for ( var pluginName in namesToPlugins ) {
var pluginModule = namesToPlugins [ pluginName ] , pluginIndex = eventPluginOrder . indexOf ( pluginName ) ;
if ( invariant ( pluginIndex > - 1 , "EventPluginRegistry: Cannot inject event plugins that do not exist in " + "the plugin ordering, `%s`." , pluginName ) ,
! EventPluginRegistry . plugins [ pluginIndex ] ) {
invariant ( pluginModule . extractEvents , "EventPluginRegistry: Event plugins must implement an `extractEvents` " + "method, but `%s` does not." , pluginName ) ,
EventPluginRegistry . plugins [ pluginIndex ] = pluginModule ;
var publishedEvents = pluginModule . eventTypes ;
for ( var eventName in publishedEvents ) invariant ( publishEventForPlugin ( publishedEvents [ eventName ] , pluginModule , eventName ) , "EventPluginRegistry: Failed to publish event `%s` for plugin `%s`." , eventName , pluginName ) ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
}
2017-08-09 19:18:46 +00:00
}
function publishEventForPlugin ( dispatchConfig , pluginModule , eventName ) {
invariant ( ! EventPluginRegistry . eventNameDispatchConfigs . hasOwnProperty ( eventName ) , "EventPluginHub: More than one plugin attempted to publish the same " + "event name, `%s`." , eventName ) ,
EventPluginRegistry . eventNameDispatchConfigs [ eventName ] = dispatchConfig ;
var phasedRegistrationNames = dispatchConfig . phasedRegistrationNames ;
if ( phasedRegistrationNames ) {
for ( var phaseName in phasedRegistrationNames ) if ( phasedRegistrationNames . hasOwnProperty ( phaseName ) ) {
var phasedRegistrationName = phasedRegistrationNames [ phaseName ] ;
publishRegistrationName ( phasedRegistrationName , pluginModule , eventName ) ;
}
return ! 0 ;
2017-06-26 22:12:46 +00:00
}
2017-08-09 19:18:46 +00:00
return ! ! dispatchConfig . registrationName && ( publishRegistrationName ( dispatchConfig . registrationName , pluginModule , eventName ) ,
! 0 ) ;
}
function publishRegistrationName ( registrationName , pluginModule , eventName ) {
invariant ( ! EventPluginRegistry . registrationNameModules [ registrationName ] , "EventPluginHub: More than one plugin attempted to publish the same " + "registration name, `%s`." , registrationName ) ,
EventPluginRegistry . registrationNameModules [ registrationName ] = pluginModule , EventPluginRegistry . registrationNameDependencies [ registrationName ] = pluginModule . eventTypes [ eventName ] . dependencies ;
}
var EventPluginRegistry = {
plugins : [ ] ,
eventNameDispatchConfigs : { } ,
registrationNameModules : { } ,
registrationNameDependencies : { } ,
possibleRegistrationNames : null ,
injectEventPluginOrder : function ( injectedEventPluginOrder ) {
invariant ( ! eventPluginOrder , "EventPluginRegistry: Cannot inject event plugin ordering more than " + "once. You are likely trying to load more than one copy of React." ) ,
eventPluginOrder = Array . prototype . slice . call ( injectedEventPluginOrder ) , recomputePluginOrdering ( ) ;
} ,
injectEventPluginsByName : function ( injectedNamesToPlugins ) {
var isOrderingDirty = ! 1 ;
for ( var pluginName in injectedNamesToPlugins ) if ( injectedNamesToPlugins . hasOwnProperty ( pluginName ) ) {
var pluginModule = injectedNamesToPlugins [ pluginName ] ;
namesToPlugins . hasOwnProperty ( pluginName ) && namesToPlugins [ pluginName ] === pluginModule || ( invariant ( ! namesToPlugins [ pluginName ] , "EventPluginRegistry: Cannot inject two different event plugins " + "using the same name, `%s`." , pluginName ) ,
namesToPlugins [ pluginName ] = pluginModule , isOrderingDirty = ! 0 ) ;
}
isOrderingDirty && recomputePluginOrdering ( ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
} , EventPluginRegistry _1 = EventPluginRegistry ;
2017-06-26 22:12:46 +00:00
2017-08-09 19:18:46 +00:00
function accumulateInto ( current , next ) {
return invariant ( null != next , "accumulateInto(...): Accumulated items must not be null or undefined." ) ,
null == current ? next : Array . isArray ( current ) ? Array . isArray ( next ) ? ( current . push . apply ( current , next ) ,
current ) : ( current . push ( next ) , current ) : Array . isArray ( next ) ? [ current ] . concat ( next ) : [ current , next ] ;
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
var accumulateInto _1 = accumulateInto ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function forEachAccumulated ( arr , cb , scope ) {
Array . isArray ( arr ) ? arr . forEach ( cb , scope ) : arr && cb . call ( scope , arr ) ;
}
var forEachAccumulated _1 = forEachAccumulated , eventQueue = null , executeDispatchesAndRelease = function ( event , simulated ) {
event && ( EventPluginUtils _1 . executeDispatchesInOrder ( event , simulated ) , event . isPersistent ( ) || event . constructor . release ( event ) ) ;
} , executeDispatchesAndReleaseSimulated = function ( e ) {
return executeDispatchesAndRelease ( e , ! 0 ) ;
} , executeDispatchesAndReleaseTopLevel = function ( e ) {
return executeDispatchesAndRelease ( e , ! 1 ) ;
} ;
function isInteractive ( tag ) {
return "button" === tag || "input" === tag || "select" === tag || "textarea" === tag ;
}
function shouldPreventMouseEvent ( name , type , props ) {
switch ( name ) {
case "onClick" :
case "onClickCapture" :
case "onDoubleClick" :
case "onDoubleClickCapture" :
case "onMouseDown" :
case "onMouseDownCapture" :
case "onMouseMove" :
case "onMouseMoveCapture" :
case "onMouseUp" :
case "onMouseUpCapture" :
return ! ( ! props . disabled || ! isInteractive ( type ) ) ;
default :
return ! 1 ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
}
var EventPluginHub = {
injection : {
injectEventPluginOrder : EventPluginRegistry _1 . injectEventPluginOrder ,
injectEventPluginsByName : EventPluginRegistry _1 . injectEventPluginsByName
} ,
getListener : function ( inst , registrationName ) {
2017-10-04 17:06:57 +00:00
var listener , stateNode = inst . stateNode ;
if ( ! stateNode ) return null ;
var props = EventPluginUtils _1 . getFiberCurrentPropsFromNode ( stateNode ) ;
return props ? ( listener = props [ registrationName ] , shouldPreventMouseEvent ( registrationName , inst . type , props ) ? null : ( invariant ( ! listener || "function" == typeof listener , "Expected `%s` listener to be a function, instead got a value of `%s` type." , registrationName , typeof listener ) ,
listener ) ) : null ;
2017-08-09 19:18:46 +00:00
} ,
extractEvents : function ( topLevelType , targetInst , nativeEvent , nativeEventTarget ) {
for ( var events , plugins = EventPluginRegistry _1 . plugins , i = 0 ; i < plugins . length ; i ++ ) {
var possiblePlugin = plugins [ i ] ;
if ( possiblePlugin ) {
var extractedEvents = possiblePlugin . extractEvents ( topLevelType , targetInst , nativeEvent , nativeEventTarget ) ;
extractedEvents && ( events = accumulateInto _1 ( events , extractedEvents ) ) ;
}
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return events ;
} ,
enqueueEvents : function ( events ) {
events && ( eventQueue = accumulateInto _1 ( eventQueue , events ) ) ;
} ,
processEventQueue : function ( simulated ) {
var processingEventQueue = eventQueue ;
eventQueue = null , simulated ? forEachAccumulated _1 ( processingEventQueue , executeDispatchesAndReleaseSimulated ) : forEachAccumulated _1 ( processingEventQueue , executeDispatchesAndReleaseTopLevel ) ,
invariant ( ! eventQueue , "processEventQueue(): Additional events were enqueued while processing " + "an event queue. Support for this has not yet been implemented." ) ,
ReactErrorUtils _1 . rethrowCaughtError ( ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
} , EventPluginHub _1 = EventPluginHub , HostComponent$10 = ReactTypeOfWork . HostComponent ;
function getParent ( inst ) {
2017-10-04 17:06:57 +00:00
do {
inst = inst . return ;
} while ( inst && inst . tag !== HostComponent$10 ) ;
return inst || null ;
2017-08-09 19:18:46 +00:00
}
function getLowestCommonAncestor ( instA , instB ) {
for ( var depthA = 0 , tempA = instA ; tempA ; tempA = getParent ( tempA ) ) depthA ++ ;
for ( var depthB = 0 , tempB = instB ; tempB ; tempB = getParent ( tempB ) ) depthB ++ ;
for ( ; depthA - depthB > 0 ; ) instA = getParent ( instA ) , depthA -- ;
for ( ; depthB - depthA > 0 ; ) instB = getParent ( instB ) , depthB -- ;
for ( var depth = depthA ; depth -- ; ) {
if ( instA === instB || instA === instB . alternate ) return instA ;
instA = getParent ( instA ) , instB = getParent ( instB ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return null ;
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function isAncestor ( instA , instB ) {
for ( ; instB ; ) {
if ( instA === instB || instA === instB . alternate ) return ! 0 ;
instB = getParent ( instB ) ;
}
return ! 1 ;
}
function getParentInstance ( inst ) {
return getParent ( inst ) ;
}
function traverseTwoPhase ( inst , fn , arg ) {
for ( var path = [ ] ; inst ; ) path . push ( inst ) , inst = getParent ( inst ) ;
var i ;
for ( i = path . length ; i -- > 0 ; ) fn ( path [ i ] , "captured" , arg ) ;
for ( i = 0 ; i < path . length ; i ++ ) fn ( path [ i ] , "bubbled" , arg ) ;
}
function traverseEnterLeave ( from , to , fn , argFrom , argTo ) {
for ( var common = from && to ? getLowestCommonAncestor ( from , to ) : null , pathFrom = [ ] ; from && from !== common ; ) pathFrom . push ( from ) ,
from = getParent ( from ) ;
for ( var pathTo = [ ] ; to && to !== common ; ) pathTo . push ( to ) , to = getParent ( to ) ;
var i ;
for ( i = 0 ; i < pathFrom . length ; i ++ ) fn ( pathFrom [ i ] , "bubbled" , argFrom ) ;
for ( i = pathTo . length ; i -- > 0 ; ) fn ( pathTo [ i ] , "captured" , argTo ) ;
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
var ReactTreeTraversal = {
isAncestor : isAncestor ,
getLowestCommonAncestor : getLowestCommonAncestor ,
getParentInstance : getParentInstance ,
traverseTwoPhase : traverseTwoPhase ,
traverseEnterLeave : traverseEnterLeave
} , getListener = EventPluginHub _1 . getListener ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function listenerAtPhase ( inst , event , propagationPhase ) {
var registrationName = event . dispatchConfig . phasedRegistrationNames [ propagationPhase ] ;
return getListener ( inst , registrationName ) ;
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function accumulateDirectionalDispatches ( inst , phase , event ) {
var listener = listenerAtPhase ( inst , event , phase ) ;
listener && ( event . _dispatchListeners = accumulateInto _1 ( event . _dispatchListeners , listener ) ,
event . _dispatchInstances = accumulateInto _1 ( event . _dispatchInstances , inst ) ) ;
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function accumulateTwoPhaseDispatchesSingle ( event ) {
event && event . dispatchConfig . phasedRegistrationNames && ReactTreeTraversal . traverseTwoPhase ( event . _targetInst , accumulateDirectionalDispatches , event ) ;
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function accumulateTwoPhaseDispatchesSingleSkipTarget ( event ) {
if ( event && event . dispatchConfig . phasedRegistrationNames ) {
var targetInst = event . _targetInst , parentInst = targetInst ? ReactTreeTraversal . getParentInstance ( targetInst ) : null ;
ReactTreeTraversal . traverseTwoPhase ( parentInst , accumulateDirectionalDispatches , event ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
}
function accumulateDispatches ( inst , ignoredDirection , event ) {
if ( inst && event && event . dispatchConfig . registrationName ) {
var registrationName = event . dispatchConfig . registrationName , listener = getListener ( inst , registrationName ) ;
listener && ( event . _dispatchListeners = accumulateInto _1 ( event . _dispatchListeners , listener ) ,
event . _dispatchInstances = accumulateInto _1 ( event . _dispatchInstances , inst ) ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function accumulateDirectDispatchesSingle ( event ) {
event && event . dispatchConfig . registrationName && accumulateDispatches ( event . _targetInst , null , event ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function accumulateTwoPhaseDispatches ( events ) {
forEachAccumulated _1 ( events , accumulateTwoPhaseDispatchesSingle ) ;
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function accumulateTwoPhaseDispatchesSkipTarget ( events ) {
forEachAccumulated _1 ( events , accumulateTwoPhaseDispatchesSingleSkipTarget ) ;
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function accumulateEnterLeaveDispatches ( leave , enter , from , to ) {
ReactTreeTraversal . traverseEnterLeave ( from , to , accumulateDispatches , leave , enter ) ;
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function accumulateDirectDispatches ( events ) {
forEachAccumulated _1 ( events , accumulateDirectDispatchesSingle ) ;
}
2017-06-09 02:01:23 +00:00
2017-08-09 19:18:46 +00:00
var EventPropagators = {
accumulateTwoPhaseDispatches : accumulateTwoPhaseDispatches ,
accumulateTwoPhaseDispatchesSkipTarget : accumulateTwoPhaseDispatchesSkipTarget ,
accumulateDirectDispatches : accumulateDirectDispatches ,
accumulateEnterLeaveDispatches : accumulateEnterLeaveDispatches
} , EventPropagators _1 = EventPropagators , EVENT _POOL _SIZE = 10 , shouldBeReleasedProperties = [ "dispatchConfig" , "_targetInst" , "nativeEvent" , "isDefaultPrevented" , "isPropagationStopped" , "_dispatchListeners" , "_dispatchInstances" ] , EventInterface = {
type : null ,
target : null ,
currentTarget : emptyFunction . thatReturnsNull ,
eventPhase : null ,
bubbles : null ,
cancelable : null ,
timeStamp : function ( event ) {
return event . timeStamp || Date . now ( ) ;
} ,
defaultPrevented : null ,
isTrusted : null
2017-05-26 17:51:06 +00:00
} ;
2017-08-09 19:18:46 +00:00
function SyntheticEvent ( dispatchConfig , targetInst , nativeEvent , nativeEventTarget ) {
this . dispatchConfig = dispatchConfig , this . _targetInst = targetInst , this . nativeEvent = nativeEvent ;
var Interface = this . constructor . Interface ;
for ( var propName in Interface ) if ( Interface . hasOwnProperty ( propName ) ) {
var normalize = Interface [ propName ] ;
normalize ? this [ propName ] = normalize ( nativeEvent ) : "target" === propName ? this . target = nativeEventTarget : this [ propName ] = nativeEvent [ propName ] ;
}
var defaultPrevented = null != nativeEvent . defaultPrevented ? nativeEvent . defaultPrevented : ! 1 === nativeEvent . returnValue ;
return this . isDefaultPrevented = defaultPrevented ? emptyFunction . thatReturnsTrue : emptyFunction . thatReturnsFalse ,
this . isPropagationStopped = emptyFunction . thatReturnsFalse , this ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
Object . assign ( SyntheticEvent . prototype , {
preventDefault : function ( ) {
this . defaultPrevented = ! 0 ;
var event = this . nativeEvent ;
event && ( event . preventDefault ? event . preventDefault ( ) : "unknown" != typeof event . returnValue && ( event . returnValue = ! 1 ) ,
this . isDefaultPrevented = emptyFunction . thatReturnsTrue ) ;
} ,
stopPropagation : function ( ) {
var event = this . nativeEvent ;
event && ( event . stopPropagation ? event . stopPropagation ( ) : "unknown" != typeof event . cancelBubble && ( event . cancelBubble = ! 0 ) ,
this . isPropagationStopped = emptyFunction . thatReturnsTrue ) ;
} ,
persist : function ( ) {
this . isPersistent = emptyFunction . thatReturnsTrue ;
} ,
isPersistent : emptyFunction . thatReturnsFalse ,
destructor : function ( ) {
var Interface = this . constructor . Interface ;
for ( var propName in Interface ) this [ propName ] = null ;
for ( var i = 0 ; i < shouldBeReleasedProperties . length ; i ++ ) this [ shouldBeReleasedProperties [ i ] ] = null ;
}
} ) , SyntheticEvent . Interface = EventInterface , SyntheticEvent . augmentClass = function ( Class , Interface ) {
var Super = this , E = function ( ) { } ;
E . prototype = Super . prototype ;
var prototype = new E ( ) ;
Object . assign ( prototype , Class . prototype ) , Class . prototype = prototype , Class . prototype . constructor = Class ,
Class . Interface = Object . assign ( { } , Super . Interface , Interface ) , Class . augmentClass = Super . augmentClass ,
addEventPoolingTo ( Class ) ;
} , addEventPoolingTo ( SyntheticEvent ) ;
var SyntheticEvent _1 = SyntheticEvent ;
function getPooledEvent ( dispatchConfig , targetInst , nativeEvent , nativeInst ) {
var EventConstructor = this ;
if ( EventConstructor . eventPool . length ) {
var instance = EventConstructor . eventPool . pop ( ) ;
return EventConstructor . call ( instance , dispatchConfig , targetInst , nativeEvent , nativeInst ) ,
instance ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return new EventConstructor ( dispatchConfig , targetInst , nativeEvent , nativeInst ) ;
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function releasePooledEvent ( event ) {
var EventConstructor = this ;
invariant ( event instanceof EventConstructor , "Trying to release an event instance into a pool of a different type." ) ,
event . destructor ( ) , EventConstructor . eventPool . length < EVENT _POOL _SIZE && EventConstructor . eventPool . push ( event ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function addEventPoolingTo ( EventConstructor ) {
EventConstructor . eventPool = [ ] , EventConstructor . getPooled = getPooledEvent , EventConstructor . release = releasePooledEvent ;
2017-05-26 17:51:06 +00:00
}
2017-09-15 01:01:27 +00:00
var customBubblingEventTypes = { } , customDirectEventTypes = { } , ReactNativeBridgeEventPlugin = {
eventTypes : { } ,
2017-08-09 19:18:46 +00:00
extractEvents : function ( topLevelType , targetInst , nativeEvent , nativeEventTarget ) {
2017-09-15 01:01:25 +00:00
var bubbleDispatchConfig = customBubblingEventTypes [ topLevelType ] , directDispatchConfig = customDirectEventTypes [ topLevelType ] ;
invariant ( bubbleDispatchConfig || directDispatchConfig , 'Unsupported top level event type "%s" dispatched' , topLevelType ) ;
var event = SyntheticEvent _1 . getPooled ( bubbleDispatchConfig || directDispatchConfig , targetInst , nativeEvent , nativeEventTarget ) ;
2017-08-09 19:18:46 +00:00
if ( bubbleDispatchConfig ) EventPropagators _1 . accumulateTwoPhaseDispatches ( event ) ; else {
if ( ! directDispatchConfig ) return null ;
EventPropagators _1 . accumulateDirectDispatches ( event ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
return event ;
2017-09-15 01:01:27 +00:00
} ,
processEventTypes : function ( viewConfig ) {
var bubblingEventTypes = viewConfig . bubblingEventTypes , directEventTypes = viewConfig . directEventTypes ;
if ( null != bubblingEventTypes ) for ( var _topLevelType in bubblingEventTypes ) null == customBubblingEventTypes [ _topLevelType ] && ( ReactNativeBridgeEventPlugin . eventTypes [ _topLevelType ] = customBubblingEventTypes [ _topLevelType ] = bubblingEventTypes [ _topLevelType ] ) ;
if ( null != directEventTypes ) for ( var _topLevelType2 in directEventTypes ) null == customDirectEventTypes [ _topLevelType2 ] && ( ReactNativeBridgeEventPlugin . eventTypes [ _topLevelType2 ] = customDirectEventTypes [ _topLevelType2 ] = directEventTypes [ _topLevelType2 ] ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
} , ReactNativeBridgeEventPlugin _1 = ReactNativeBridgeEventPlugin ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function runEventQueueInBatch ( events ) {
EventPluginHub _1 . enqueueEvents ( events ) , EventPluginHub _1 . processEventQueue ( ! 1 ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var ReactEventEmitterMixin = {
handleTopLevel : function ( topLevelType , targetInst , nativeEvent , nativeEventTarget ) {
runEventQueueInBatch ( EventPluginHub _1 . extractEvents ( topLevelType , targetInst , nativeEvent , nativeEventTarget ) ) ;
}
} , ReactEventEmitterMixin _1 = ReactEventEmitterMixin , EMPTY _NATIVE _EVENT = { } , touchSubsequence = function ( touches , indices ) {
for ( var ret = [ ] , i = 0 ; i < indices . length ; i ++ ) ret . push ( touches [ indices [ i ] ] ) ;
return ret ;
} , removeTouchesAtIndices = function ( touches , indices ) {
for ( var rippedOut = [ ] , temp = touches , i = 0 ; i < indices . length ; i ++ ) {
var index = indices [ i ] ;
rippedOut . push ( touches [ index ] ) , temp [ index ] = null ;
}
for ( var fillAt = 0 , j = 0 ; j < temp . length ; j ++ ) {
var cur = temp [ j ] ;
null !== cur && ( temp [ fillAt ++ ] = cur ) ;
}
return temp . length = fillAt , rippedOut ;
} , ReactNativeEventEmitter = Object . assign ( { } , ReactEventEmitterMixin _1 , {
registrationNames : EventPluginRegistry _1 . registrationNameModules ,
getListener : EventPluginHub _1 . getListener ,
_receiveRootNodeIDEvent : function ( rootNodeID , topLevelType , nativeEventParam ) {
var nativeEvent = nativeEventParam || EMPTY _NATIVE _EVENT , inst = ReactNativeComponentTree _1 . getInstanceFromNode ( rootNodeID ) ;
ReactGenericBatching _1 . batchedUpdates ( function ( ) {
ReactNativeEventEmitter . handleTopLevel ( topLevelType , inst , nativeEvent , nativeEvent . target ) ;
} ) ;
} ,
2017-09-15 01:01:25 +00:00
receiveEvent : function ( rootNodeID , topLevelType , nativeEventParam ) {
2017-08-09 19:18:46 +00:00
ReactNativeEventEmitter . _receiveRootNodeIDEvent ( rootNodeID , topLevelType , nativeEventParam ) ;
} ,
receiveTouches : function ( eventTopLevelType , touches , changedIndices ) {
for ( var changedTouches = "topTouchEnd" === eventTopLevelType || "topTouchCancel" === eventTopLevelType ? removeTouchesAtIndices ( touches , changedIndices ) : touchSubsequence ( touches , changedIndices ) , jj = 0 ; jj < changedTouches . length ; jj ++ ) {
var touch = changedTouches [ jj ] ;
touch . changedTouches = changedTouches , touch . touches = touches ;
var nativeEvent = touch , rootNodeID = null , target = nativeEvent . target ;
null !== target && void 0 !== target && ( target < ReactNativeTagHandles _1 . tagsStartAt || ( rootNodeID = target ) ) ,
ReactNativeEventEmitter . _receiveRootNodeIDEvent ( rootNodeID , eventTopLevelType , nativeEvent ) ;
}
}
} ) , ReactNativeEventEmitter _1 = ReactNativeEventEmitter , ReactNativeEventPluginOrder = [ "ResponderEventPlugin" , "ReactNativeBridgeEventPlugin" ] , ReactNativeEventPluginOrder _1 = ReactNativeEventPluginOrder , ReactNativeGlobalResponderHandler = {
onChange : function ( from , to , blockNativeResponder ) {
if ( null !== to ) {
2017-09-15 01:01:25 +00:00
var tag = to . stateNode . _nativeTag ;
2017-08-09 19:18:46 +00:00
UIManager . setJSResponder ( tag , blockNativeResponder ) ;
} else UIManager . clearJSResponder ( ) ;
}
} , ReactNativeGlobalResponderHandler _1 = ReactNativeGlobalResponderHandler , ResponderEventInterface = {
touchHistory : function ( nativeEvent ) {
return null ;
}
} ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function ResponderSyntheticEvent ( dispatchConfig , dispatchMarker , nativeEvent , nativeEventTarget ) {
return SyntheticEvent _1 . call ( this , dispatchConfig , dispatchMarker , nativeEvent , nativeEventTarget ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
SyntheticEvent _1 . augmentClass ( ResponderSyntheticEvent , ResponderEventInterface ) ;
2017-05-26 17:51:06 +00:00
2017-09-15 01:01:25 +00:00
var ResponderSyntheticEvent _1 = ResponderSyntheticEvent , isEndish$2 = EventPluginUtils _1 . isEndish , isMoveish$2 = EventPluginUtils _1 . isMoveish , isStartish$2 = EventPluginUtils _1 . isStartish , MAX _TOUCH _BANK = 20 , touchBank = [ ] , touchHistory = {
2017-08-09 19:18:46 +00:00
touchBank : touchBank ,
numberActiveTouches : 0 ,
indexOfSingleActiveTouch : - 1 ,
mostRecentTimeStamp : 0
} ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function timestampForTouch ( touch ) {
return touch . timeStamp || touch . timestamp ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function createTouchRecord ( touch ) {
return {
touchActive : ! 0 ,
startPageX : touch . pageX ,
startPageY : touch . pageY ,
startTimeStamp : timestampForTouch ( touch ) ,
currentPageX : touch . pageX ,
currentPageY : touch . pageY ,
currentTimeStamp : timestampForTouch ( touch ) ,
previousPageX : touch . pageX ,
previousPageY : touch . pageY ,
previousTimeStamp : timestampForTouch ( touch )
} ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function resetTouchRecord ( touchRecord , touch ) {
touchRecord . touchActive = ! 0 , touchRecord . startPageX = touch . pageX , touchRecord . startPageY = touch . pageY ,
touchRecord . startTimeStamp = timestampForTouch ( touch ) , touchRecord . currentPageX = touch . pageX ,
touchRecord . currentPageY = touch . pageY , touchRecord . currentTimeStamp = timestampForTouch ( touch ) ,
touchRecord . previousPageX = touch . pageX , touchRecord . previousPageY = touch . pageY ,
touchRecord . previousTimeStamp = timestampForTouch ( touch ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function getTouchIdentifier ( _ref ) {
var identifier = _ref . identifier ;
2017-09-15 01:01:25 +00:00
return invariant ( null != identifier , "Touch object is missing identifier." ) , identifier ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function recordTouchStart ( touch ) {
var identifier = getTouchIdentifier ( touch ) , touchRecord = touchBank [ identifier ] ;
touchRecord ? resetTouchRecord ( touchRecord , touch ) : touchBank [ identifier ] = createTouchRecord ( touch ) ,
touchHistory . mostRecentTimeStamp = timestampForTouch ( touch ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function recordTouchMove ( touch ) {
var touchRecord = touchBank [ getTouchIdentifier ( touch ) ] ;
touchRecord ? ( touchRecord . touchActive = ! 0 , touchRecord . previousPageX = touchRecord . currentPageX ,
touchRecord . previousPageY = touchRecord . currentPageY , touchRecord . previousTimeStamp = touchRecord . currentTimeStamp ,
touchRecord . currentPageX = touch . pageX , touchRecord . currentPageY = touch . pageY ,
touchRecord . currentTimeStamp = timestampForTouch ( touch ) , touchHistory . mostRecentTimeStamp = timestampForTouch ( touch ) ) : console . error ( "Cannot record touch move without a touch start.\n" + "Touch Move: %s\n" , "Touch Bank: %s" , printTouch ( touch ) , printTouchBank ( ) ) ;
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function recordTouchEnd ( touch ) {
var touchRecord = touchBank [ getTouchIdentifier ( touch ) ] ;
touchRecord ? ( touchRecord . touchActive = ! 1 , touchRecord . previousPageX = touchRecord . currentPageX ,
touchRecord . previousPageY = touchRecord . currentPageY , touchRecord . previousTimeStamp = touchRecord . currentTimeStamp ,
touchRecord . currentPageX = touch . pageX , touchRecord . currentPageY = touch . pageY ,
touchRecord . currentTimeStamp = timestampForTouch ( touch ) , touchHistory . mostRecentTimeStamp = timestampForTouch ( touch ) ) : console . error ( "Cannot record touch end without a touch start.\n" + "Touch End: %s\n" , "Touch Bank: %s" , printTouch ( touch ) , printTouchBank ( ) ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
function printTouch ( touch ) {
return JSON . stringify ( {
identifier : touch . identifier ,
pageX : touch . pageX ,
pageY : touch . pageY ,
timestamp : timestampForTouch ( touch )
} ) ;
}
function printTouchBank ( ) {
var printed = JSON . stringify ( touchBank . slice ( 0 , MAX _TOUCH _BANK ) ) ;
return touchBank . length > MAX _TOUCH _BANK && ( printed += " (original size: " + touchBank . length + ")" ) ,
printed ;
}
var ResponderTouchHistoryStore = {
recordTouchTrack : function ( topLevelType , nativeEvent ) {
if ( isMoveish$2 ( topLevelType ) ) nativeEvent . changedTouches . forEach ( recordTouchMove ) ; else if ( isStartish$2 ( topLevelType ) ) nativeEvent . changedTouches . forEach ( recordTouchStart ) ,
touchHistory . numberActiveTouches = nativeEvent . touches . length , 1 === touchHistory . numberActiveTouches && ( touchHistory . indexOfSingleActiveTouch = nativeEvent . touches [ 0 ] . identifier ) ; else if ( isEndish$2 ( topLevelType ) && ( nativeEvent . changedTouches . forEach ( recordTouchEnd ) ,
touchHistory . numberActiveTouches = nativeEvent . touches . length , 1 === touchHistory . numberActiveTouches ) ) for ( var i = 0 ; i < touchBank . length ; i ++ ) {
var touchTrackToCheck = touchBank [ i ] ;
if ( null != touchTrackToCheck && touchTrackToCheck . touchActive ) {
touchHistory . indexOfSingleActiveTouch = i ;
break ;
}
}
2017-05-26 17:51:06 +00:00
} ,
2017-08-09 19:18:46 +00:00
touchHistory : touchHistory
} , ResponderTouchHistoryStore _1 = ResponderTouchHistoryStore ;
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function accumulate ( current , next ) {
return invariant ( null != next , "accumulate(...): Accumulated items must be not be null or undefined." ) ,
null == current ? next : Array . isArray ( current ) ? current . concat ( next ) : Array . isArray ( next ) ? [ current ] . concat ( next ) : [ current , next ] ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var accumulate _1 = accumulate , isStartish$1 = EventPluginUtils _1 . isStartish , isMoveish$1 = EventPluginUtils _1 . isMoveish , isEndish$1 = EventPluginUtils _1 . isEndish , executeDirectDispatch$1 = EventPluginUtils _1 . executeDirectDispatch , hasDispatches$1 = EventPluginUtils _1 . hasDispatches , executeDispatchesInOrderStopAtTrue$1 = EventPluginUtils _1 . executeDispatchesInOrderStopAtTrue , responderInst = null , trackedTouchCount = 0 , previousActiveTouches = 0 , changeResponder = function ( nextResponderInst , blockHostResponder ) {
var oldResponderInst = responderInst ;
responderInst = nextResponderInst , null !== ResponderEventPlugin . GlobalResponderHandler && ResponderEventPlugin . GlobalResponderHandler . onChange ( oldResponderInst , nextResponderInst , blockHostResponder ) ;
} , eventTypes = {
startShouldSetResponder : {
phasedRegistrationNames : {
bubbled : "onStartShouldSetResponder" ,
captured : "onStartShouldSetResponderCapture"
}
2017-06-26 22:12:46 +00:00
} ,
2017-08-09 19:18:46 +00:00
scrollShouldSetResponder : {
phasedRegistrationNames : {
bubbled : "onScrollShouldSetResponder" ,
captured : "onScrollShouldSetResponderCapture"
}
2017-05-26 17:51:06 +00:00
} ,
2017-08-09 19:18:46 +00:00
selectionChangeShouldSetResponder : {
phasedRegistrationNames : {
bubbled : "onSelectionChangeShouldSetResponder" ,
captured : "onSelectionChangeShouldSetResponderCapture"
}
2017-05-26 17:51:06 +00:00
} ,
2017-08-09 19:18:46 +00:00
moveShouldSetResponder : {
phasedRegistrationNames : {
bubbled : "onMoveShouldSetResponder" ,
captured : "onMoveShouldSetResponderCapture"
}
2017-05-26 17:51:06 +00:00
} ,
2017-08-09 19:18:46 +00:00
responderStart : {
registrationName : "onResponderStart"
2017-05-26 17:51:06 +00:00
} ,
2017-08-09 19:18:46 +00:00
responderMove : {
registrationName : "onResponderMove"
2017-05-26 17:51:06 +00:00
} ,
2017-08-09 19:18:46 +00:00
responderEnd : {
registrationName : "onResponderEnd"
2017-05-26 17:51:06 +00:00
} ,
2017-08-09 19:18:46 +00:00
responderRelease : {
registrationName : "onResponderRelease"
2017-05-26 17:51:06 +00:00
} ,
2017-08-09 19:18:46 +00:00
responderTerminationRequest : {
registrationName : "onResponderTerminationRequest"
2017-05-26 17:51:06 +00:00
} ,
2017-08-09 19:18:46 +00:00
responderGrant : {
registrationName : "onResponderGrant"
2017-05-26 17:51:06 +00:00
} ,
2017-08-09 19:18:46 +00:00
responderReject : {
registrationName : "onResponderReject"
2017-05-26 17:51:06 +00:00
} ,
2017-08-09 19:18:46 +00:00
responderTerminate : {
registrationName : "onResponderTerminate"
}
} ;
function setResponderAndExtractTransfer ( topLevelType , targetInst , nativeEvent , nativeEventTarget ) {
var shouldSetEventType = isStartish$1 ( topLevelType ) ? eventTypes . startShouldSetResponder : isMoveish$1 ( topLevelType ) ? eventTypes . moveShouldSetResponder : "topSelectionChange" === topLevelType ? eventTypes . selectionChangeShouldSetResponder : eventTypes . scrollShouldSetResponder , bubbleShouldSetFrom = responderInst ? ReactTreeTraversal . getLowestCommonAncestor ( responderInst , targetInst ) : targetInst , skipOverBubbleShouldSetFrom = bubbleShouldSetFrom === responderInst , shouldSetEvent = ResponderSyntheticEvent _1 . getPooled ( shouldSetEventType , bubbleShouldSetFrom , nativeEvent , nativeEventTarget ) ;
shouldSetEvent . touchHistory = ResponderTouchHistoryStore _1 . touchHistory , skipOverBubbleShouldSetFrom ? EventPropagators _1 . accumulateTwoPhaseDispatchesSkipTarget ( shouldSetEvent ) : EventPropagators _1 . accumulateTwoPhaseDispatches ( shouldSetEvent ) ;
var wantsResponderInst = executeDispatchesInOrderStopAtTrue$1 ( shouldSetEvent ) ;
if ( shouldSetEvent . isPersistent ( ) || shouldSetEvent . constructor . release ( shouldSetEvent ) ,
! wantsResponderInst || wantsResponderInst === responderInst ) return null ;
var extracted , grantEvent = ResponderSyntheticEvent _1 . getPooled ( eventTypes . responderGrant , wantsResponderInst , nativeEvent , nativeEventTarget ) ;
grantEvent . touchHistory = ResponderTouchHistoryStore _1 . touchHistory , EventPropagators _1 . accumulateDirectDispatches ( grantEvent ) ;
var blockHostResponder = ! 0 === executeDirectDispatch$1 ( grantEvent ) ;
if ( responderInst ) {
var terminationRequestEvent = ResponderSyntheticEvent _1 . getPooled ( eventTypes . responderTerminationRequest , responderInst , nativeEvent , nativeEventTarget ) ;
terminationRequestEvent . touchHistory = ResponderTouchHistoryStore _1 . touchHistory ,
EventPropagators _1 . accumulateDirectDispatches ( terminationRequestEvent ) ;
var shouldSwitch = ! hasDispatches$1 ( terminationRequestEvent ) || executeDirectDispatch$1 ( terminationRequestEvent ) ;
if ( terminationRequestEvent . isPersistent ( ) || terminationRequestEvent . constructor . release ( terminationRequestEvent ) ,
shouldSwitch ) {
var terminateEvent = ResponderSyntheticEvent _1 . getPooled ( eventTypes . responderTerminate , responderInst , nativeEvent , nativeEventTarget ) ;
terminateEvent . touchHistory = ResponderTouchHistoryStore _1 . touchHistory , EventPropagators _1 . accumulateDirectDispatches ( terminateEvent ) ,
extracted = accumulate _1 ( extracted , [ grantEvent , terminateEvent ] ) , changeResponder ( wantsResponderInst , blockHostResponder ) ;
2017-05-26 17:51:06 +00:00
} else {
2017-08-09 19:18:46 +00:00
var rejectEvent = ResponderSyntheticEvent _1 . getPooled ( eventTypes . responderReject , wantsResponderInst , nativeEvent , nativeEventTarget ) ;
rejectEvent . touchHistory = ResponderTouchHistoryStore _1 . touchHistory , EventPropagators _1 . accumulateDirectDispatches ( rejectEvent ) ,
extracted = accumulate _1 ( extracted , rejectEvent ) ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
} else extracted = accumulate _1 ( extracted , grantEvent ) , changeResponder ( wantsResponderInst , blockHostResponder ) ;
return extracted ;
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function canTriggerTransfer ( topLevelType , topLevelInst , nativeEvent ) {
return topLevelInst && ( "topScroll" === topLevelType && ! nativeEvent . responderIgnoreScroll || trackedTouchCount > 0 && "topSelectionChange" === topLevelType || isStartish$1 ( topLevelType ) || isMoveish$1 ( topLevelType ) ) ;
}
2017-05-26 17:51:06 +00:00
2017-08-09 19:18:46 +00:00
function noResponderTouches ( nativeEvent ) {
var touches = nativeEvent . touches ;
if ( ! touches || 0 === touches . length ) return ! 0 ;
for ( var i = 0 ; i < touches . length ; i ++ ) {
var activeTouch = touches [ i ] , target = activeTouch . target ;
if ( null !== target && void 0 !== target && 0 !== target ) {
var targetInst = EventPluginUtils _1 . getInstanceFromNode ( target ) ;
if ( ReactTreeTraversal . isAncestor ( responderInst , targetInst ) ) return ! 1 ;
}
}
return ! 0 ;
2017-05-26 17:51:06 +00:00
}
2017-08-09 19:18:46 +00:00
var ResponderEventPlugin = {
_getResponder : function ( ) {
return responderInst ;
} ,
eventTypes : eventTypes ,
extractEvents : function ( topLevelType , targetInst , nativeEvent , nativeEventTarget ) {
if ( isStartish$1 ( topLevelType ) ) trackedTouchCount += 1 ; else if ( isEndish$1 ( topLevelType ) ) {
if ( ! ( trackedTouchCount >= 0 ) ) return console . error ( "Ended a touch event which was not counted in `trackedTouchCount`." ) ,
null ;
trackedTouchCount -= 1 ;
}
ResponderTouchHistoryStore _1 . recordTouchTrack ( topLevelType , nativeEvent ) ;
var extracted = canTriggerTransfer ( topLevelType , targetInst , nativeEvent ) ? setResponderAndExtractTransfer ( topLevelType , targetInst , nativeEvent , nativeEventTarget ) : null , isResponderTouchStart = responderInst && isStartish$1 ( topLevelType ) , isResponderTouchMove = responderInst && isMoveish$1 ( topLevelType ) , isResponderTouchEnd = responderInst && isEndish$1 ( topLevelType ) , incrementalTouch = isResponderTouchStart ? eventTypes . responderStart : isResponderTouchMove ? eventTypes . responderMove : isResponderTouchEnd ? eventTypes . responderEnd : null ;
if ( incrementalTouch ) {
var gesture = ResponderSyntheticEvent _1 . getPooled ( incrementalTouch , responderInst , nativeEvent , nativeEventTarget ) ;
gesture . touchHistory = ResponderTouchHistoryStore _1 . touchHistory , EventPropagators _1 . accumulateDirectDispatches ( gesture ) ,
extracted = accumulate _1 ( extracted , gesture ) ;
}
var isResponderTerminate = responderInst && "topTouchCancel" === topLevelType , isResponderRelease = responderInst && ! isResponderTerminate && isEndish$1 ( topLevelType ) && noResponderTouches ( nativeEvent ) , finalTouch = isResponderTerminate ? eventTypes . responderTerminate : isResponderRelease ? eventTypes . responderRelease : null ;
if ( finalTouch ) {
var finalEvent = ResponderSyntheticEvent _1 . getPooled ( finalTouch , responderInst , nativeEvent , nativeEventTarget ) ;
finalEvent . touchHistory = ResponderTouchHistoryStore _1 . touchHistory , EventPropagators _1 . accumulateDirectDispatches ( finalEvent ) ,
extracted = accumulate _1 ( extracted , finalEvent ) , changeResponder ( null ) ;
}
var numberActiveTouches = ResponderTouchHistoryStore _1 . touchHistory . numberActiveTouches ;
return ResponderEventPlugin . GlobalInteractionHandler && numberActiveTouches !== previousActiveTouches && ResponderEventPlugin . GlobalInteractionHandler . onChange ( numberActiveTouches ) ,
previousActiveTouches = numberActiveTouches , extracted ;
} ,
GlobalResponderHandler : null ,
GlobalInteractionHandler : null ,
injection : {
injectGlobalResponderHandler : function ( GlobalResponderHandler ) {
ResponderEventPlugin . GlobalResponderHandler = GlobalResponderHandler ;
} ,
injectGlobalInteractionHandler : function ( GlobalInteractionHandler ) {
ResponderEventPlugin . GlobalInteractionHandler = GlobalInteractionHandler ;
}
}
} , ResponderEventPlugin _1 = ResponderEventPlugin ;
RCTEventEmitter . register ( ReactNativeEventEmitter _1 ) , EventPluginHub _1 . injection . injectEventPluginOrder ( ReactNativeEventPluginOrder _1 ) ,
EventPluginUtils _1 . injection . injectComponentTree ( ReactNativeComponentTree _1 ) , ResponderEventPlugin _1 . injection . injectGlobalResponderHandler ( ReactNativeGlobalResponderHandler _1 ) ,
EventPluginHub _1 . injection . injectEventPluginsByName ( {
ResponderEventPlugin : ResponderEventPlugin _1 ,
ReactNativeBridgeEventPlugin : ReactNativeBridgeEventPlugin _1
} ) ;
2017-06-09 02:01:23 +00:00
function _classCallCheck$2 ( instance , Constructor ) {
if ( ! ( instance instanceof Constructor ) ) throw new TypeError ( "Cannot call a class as a function" ) ;
}
function _possibleConstructorReturn ( self , call ) {
if ( ! self ) throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ;
return ! call || "object" != typeof call && "function" != typeof call ? self : call ;
}
function _inherits ( subClass , superClass ) {
if ( "function" != typeof superClass && null !== superClass ) throw new TypeError ( "Super expression must either be null or a function, not " + typeof superClass ) ;
subClass . prototype = Object . create ( superClass && superClass . prototype , {
constructor : {
value : subClass ,
enumerable : ! 1 ,
writable : ! 0 ,
configurable : ! 0
}
} ) , superClass && ( Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . _ _proto _ _ = superClass ) ;
}
2017-09-15 01:01:25 +00:00
var mountSafeCallback$2 = NativeMethodsMixinUtils . mountSafeCallback , ReactNativeComponent = function ( _React$Component ) {
2017-06-09 02:01:23 +00:00
_inherits ( ReactNativeComponent , _React$Component ) ;
function ReactNativeComponent ( ) {
return _classCallCheck$2 ( this , ReactNativeComponent ) , _possibleConstructorReturn ( this , _React$Component . apply ( this , arguments ) ) ;
}
return ReactNativeComponent . prototype . blur = function ( ) {
TextInputState . blurTextInput ( findNumericNodeHandle ( this ) ) ;
} , ReactNativeComponent . prototype . focus = function ( ) {
TextInputState . focusTextInput ( findNumericNodeHandle ( this ) ) ;
} , ReactNativeComponent . prototype . measure = function ( callback ) {
2017-05-26 17:51:06 +00:00
UIManager . measure ( findNumericNodeHandle ( this ) , mountSafeCallback$2 ( this , callback ) ) ;
2017-06-09 02:01:23 +00:00
} , ReactNativeComponent . prototype . measureInWindow = function ( callback ) {
UIManager . measureInWindow ( findNumericNodeHandle ( this ) , mountSafeCallback$2 ( this , callback ) ) ;
} , ReactNativeComponent . prototype . measureLayout = function ( relativeToNativeNode , onSuccess , onFail ) {
UIManager . measureLayout ( findNumericNodeHandle ( this ) , relativeToNativeNode , mountSafeCallback$2 ( this , onFail ) , mountSafeCallback$2 ( this , onSuccess ) ) ;
} , ReactNativeComponent . prototype . setNativeProps = function ( nativeProps ) {
2017-09-15 01:01:25 +00:00
var maybeInstance = void 0 ;
try {
maybeInstance = findNodeHandle _1 ( this ) ;
} catch ( error ) { }
if ( null != maybeInstance ) {
var viewConfig = maybeInstance . viewConfig , updatePayload = ReactNativeAttributePayload _1 . create ( nativeProps , viewConfig . validAttributes ) ;
null != updatePayload && UIManager . updateView ( maybeInstance . _nativeTag , viewConfig . uiViewClassName , updatePayload ) ;
2017-06-09 02:01:23 +00:00
}
2017-09-15 01:01:25 +00:00
} , ReactNativeComponent ;
} ( react . Component ) , ReactNativeComponent _1 = ReactNativeComponent , mountSafeCallback$3 = NativeMethodsMixinUtils . mountSafeCallback , NativeMethodsMixin = {
2017-06-09 02:01:23 +00:00
measure : function ( callback ) {
2017-09-15 01:01:25 +00:00
UIManager . measure ( findNumericNodeHandle ( this ) , mountSafeCallback$3 ( this , callback ) ) ;
2017-05-26 17:51:06 +00:00
} ,
measureInWindow : function ( callback ) {
2017-09-15 01:01:25 +00:00
UIManager . measureInWindow ( findNumericNodeHandle ( this ) , mountSafeCallback$3 ( this , callback ) ) ;
2017-05-26 17:51:06 +00:00
} ,
measureLayout : function ( relativeToNativeNode , onSuccess , onFail ) {
2017-09-15 01:01:25 +00:00
UIManager . measureLayout ( findNumericNodeHandle ( this ) , relativeToNativeNode , mountSafeCallback$3 ( this , onFail ) , mountSafeCallback$3 ( this , onSuccess ) ) ;
2017-05-26 17:51:06 +00:00
} ,
setNativeProps : function ( nativeProps ) {
2017-09-15 01:01:25 +00:00
var maybeInstance = void 0 ;
try {
maybeInstance = findNodeHandle _1 ( this ) ;
} catch ( error ) { }
if ( null != maybeInstance ) {
var viewConfig = maybeInstance . viewConfig , updatePayload = ReactNativeAttributePayload _1 . create ( nativeProps , viewConfig . validAttributes ) ;
null != updatePayload && UIManager . updateView ( maybeInstance . _nativeTag , viewConfig . uiViewClassName , updatePayload ) ;
}
2017-05-26 17:51:06 +00:00
} ,
focus : function ( ) {
2017-09-15 01:01:25 +00:00
TextInputState . focusTextInput ( findNumericNodeHandle ( this ) ) ;
2017-05-26 17:51:06 +00:00
} ,
blur : function ( ) {
2017-09-15 01:01:25 +00:00
TextInputState . blurTextInput ( findNumericNodeHandle ( this ) ) ;
2017-05-26 17:51:06 +00:00
}
2017-09-15 01:01:25 +00:00
} , NativeMethodsMixin _1 = NativeMethodsMixin , TouchHistoryMath = {
2017-05-26 17:51:06 +00:00
centroidDimension : function ( touchHistory , touchesChangedAfter , isXAxis , ofCurrent ) {
var touchBank = touchHistory . touchBank , total = 0 , count = 0 , oneTouchData = 1 === touchHistory . numberActiveTouches ? touchHistory . touchBank [ touchHistory . indexOfSingleActiveTouch ] : null ;
2017-06-09 02:01:23 +00:00
if ( null !== oneTouchData ) oneTouchData . touchActive && oneTouchData . currentTimeStamp > touchesChangedAfter && ( total += ofCurrent && isXAxis ? oneTouchData . currentPageX : ofCurrent && ! isXAxis ? oneTouchData . currentPageY : ! ofCurrent && isXAxis ? oneTouchData . previousPageX : oneTouchData . previousPageY ,
2017-05-26 17:51:06 +00:00
count = 1 ) ; else for ( var i = 0 ; i < touchBank . length ; i ++ ) {
var touchTrack = touchBank [ i ] ;
if ( null !== touchTrack && void 0 !== touchTrack && touchTrack . touchActive && touchTrack . currentTimeStamp >= touchesChangedAfter ) {
var toAdd ;
2017-06-09 02:01:23 +00:00
toAdd = ofCurrent && isXAxis ? touchTrack . currentPageX : ofCurrent && ! isXAxis ? touchTrack . currentPageY : ! ofCurrent && isXAxis ? touchTrack . previousPageX : touchTrack . previousPageY ,
2017-05-26 17:51:06 +00:00
total += toAdd , count ++ ;
}
}
return count > 0 ? total / count : TouchHistoryMath . noCentroid ;
} ,
currentCentroidXOfTouchesChangedAfter : function ( touchHistory , touchesChangedAfter ) {
return TouchHistoryMath . centroidDimension ( touchHistory , touchesChangedAfter , ! 0 , ! 0 ) ;
} ,
currentCentroidYOfTouchesChangedAfter : function ( touchHistory , touchesChangedAfter ) {
return TouchHistoryMath . centroidDimension ( touchHistory , touchesChangedAfter , ! 1 , ! 0 ) ;
} ,
previousCentroidXOfTouchesChangedAfter : function ( touchHistory , touchesChangedAfter ) {
return TouchHistoryMath . centroidDimension ( touchHistory , touchesChangedAfter , ! 0 , ! 1 ) ;
} ,
previousCentroidYOfTouchesChangedAfter : function ( touchHistory , touchesChangedAfter ) {
return TouchHistoryMath . centroidDimension ( touchHistory , touchesChangedAfter , ! 1 , ! 1 ) ;
} ,
currentCentroidX : function ( touchHistory ) {
return TouchHistoryMath . centroidDimension ( touchHistory , 0 , ! 0 , ! 0 ) ;
} ,
currentCentroidY : function ( touchHistory ) {
return TouchHistoryMath . centroidDimension ( touchHistory , 0 , ! 1 , ! 0 ) ;
} ,
noCentroid : - 1
2017-09-15 01:01:25 +00:00
} , TouchHistoryMath _1 = TouchHistoryMath , createReactNativeComponentClass = function ( name , callback ) {
return ReactNativeViewConfigRegistry _1 . register ( name , callback ) ;
} , createReactNativeComponentClass _1 = createReactNativeComponentClass ;
2017-05-26 17:51:06 +00:00
function takeSnapshot ( view , options ) {
2017-09-15 01:01:25 +00:00
return "number" != typeof view && "window" !== view && ( view = findNumericNodeHandle ( view ) || "window" ) ,
2017-05-26 17:51:06 +00:00
UIManager . _ _takeSnapshot ( view , options ) ;
}
var takeSnapshot _1 = takeSnapshot , injectInternals = ReactFiberDevToolsHook . injectInternals ;
2017-08-09 19:18:46 +00:00
ReactGenericBatching _1 . injection . injectFiberBatchedUpdates ( ReactNativeFiberRenderer . batchedUpdates ) ;
2017-05-26 17:51:06 +00:00
var roots = new Map ( ) ;
ReactFiberErrorLogger . injection . injectDialog ( ReactNativeFiberErrorDialog _1 . showDialog ) ;
2017-06-26 22:12:46 +00:00
var ReactNativeFiber = {
2017-06-09 02:01:23 +00:00
NativeComponent : ReactNativeComponent _1 ,
2017-09-15 01:01:25 +00:00
findNodeHandle : findNumericNodeHandle ,
2017-05-26 17:51:06 +00:00
render : function ( element , containerTag , callback ) {
var root = roots . get ( containerTag ) ;
2017-06-09 02:01:23 +00:00
return root || ( root = ReactNativeFiberRenderer . createContainer ( containerTag ) , roots . set ( containerTag , root ) ) ,
2017-05-26 17:51:06 +00:00
ReactNativeFiberRenderer . updateContainer ( element , root , null , callback ) , ReactNativeFiberRenderer . getPublicRootInstance ( root ) ;
} ,
unmountComponentAtNode : function ( containerTag ) {
var root = roots . get ( containerTag ) ;
root && ReactNativeFiberRenderer . updateContainer ( null , root , null , function ( ) {
roots . delete ( containerTag ) ;
} ) ;
} ,
unmountComponentAtNodeAndRemoveContainer : function ( containerTag ) {
2017-06-26 22:12:46 +00:00
ReactNativeFiber . unmountComponentAtNode ( containerTag ) , UIManager . removeRootView ( containerTag ) ;
2017-05-26 17:51:06 +00:00
} ,
2017-09-18 23:32:37 +00:00
createPortal : function ( children , containerTag ) {
2017-05-26 17:51:06 +00:00
var key = arguments . length > 2 && void 0 !== arguments [ 2 ] ? arguments [ 2 ] : null ;
return ReactPortal . createPortal ( children , containerTag , null , key ) ;
} ,
unstable _batchedUpdates : ReactGenericBatching _1 . batchedUpdates ,
2017-08-09 19:18:46 +00:00
flushSync : ReactNativeFiberRenderer . flushSync ,
2017-05-26 17:51:06 +00:00
_ _SECRET _INTERNALS _DO _NOT _USE _OR _YOU _WILL _BE _FIRED : {
NativeMethodsMixin : NativeMethodsMixin _1 ,
2017-09-15 01:01:27 +00:00
ReactNativeBridgeEventPlugin : ReactNativeBridgeEventPlugin _1 ,
2017-05-26 17:51:06 +00:00
ReactGlobalSharedState : ReactGlobalSharedState _1 ,
ReactNativeComponentTree : ReactNativeComponentTree _1 ,
ReactNativePropRegistry : ReactNativePropRegistry _1 ,
TouchHistoryMath : TouchHistoryMath _1 ,
2017-09-15 01:01:25 +00:00
createReactNativeComponentClass : createReactNativeComponentClass _1 ,
2017-05-26 17:51:06 +00:00
takeSnapshot : takeSnapshot _1
}
} ;
2017-08-09 19:18:46 +00:00
injectInternals ( {
2017-05-26 17:51:06 +00:00
findFiberByHostInstance : ReactNativeComponentTree _1 . getClosestInstanceFromNode ,
findHostInstanceByFiber : ReactNativeFiberRenderer . findHostInstance ,
getInspectorDataForViewTag : ReactNativeFiberInspector . getInspectorDataForViewTag ,
bundleType : 0 ,
2017-09-15 01:01:25 +00:00
version : ReactVersion ,
rendererPackageName : "react-native"
2017-05-26 17:51:06 +00:00
} ) ;
2017-06-26 22:12:46 +00:00
var ReactNativeFiberEntry = ReactNativeFiber ;
2017-05-26 17:51:06 +00:00
2017-06-26 22:12:46 +00:00
module . exports = ReactNativeFiberEntry ;