2017-05-26 17:51:06 +00:00
/ * *
* Copyright 2013 - present , Facebook , Inc .
* All rights reserved .
*
* This source code is licensed under the BSD - style license found in the
* LICENSE file in the root directory of this source tree . An additional grant
* of patent rights can be found in the PATENTS file in the same directory .
*
* @ noflow
* @ providesModule ReactNativeStack - dev
* /
"use strict" ;
2017-06-26 22:12:46 +00:00
if ( _ _DEV _ _ ) {
var invariant = require ( "fbjs/lib/invariant" ) ;
require ( "InitializeCore" ) ;
var warning = require ( "fbjs/lib/warning" ) , RCTEventEmitter = require ( "RCTEventEmitter" ) , emptyFunction = require ( "fbjs/lib/emptyFunction" ) , UIManager = require ( "UIManager" ) , React = require ( "react" ) , ExecutionEnvironment = require ( "fbjs/lib/ExecutionEnvironment" ) , performanceNow = require ( "fbjs/lib/performanceNow" ) , emptyObject = require ( "fbjs/lib/emptyObject" ) , checkPropTypes = require ( "prop-types/checkPropTypes" ) , shallowEqual = require ( "fbjs/lib/shallowEqual" ) , deepDiffer = require ( "deepDiffer" ) , flattenStyle = require ( "flattenStyle" ) , TextInputState = require ( "TextInputState" ) , deepFreezeAndThrowOnMutationInDev = require ( "deepFreezeAndThrowOnMutationInDev" ) , instanceCache = { } , instanceProps = { } ;
function getRenderedHostOrTextFromComponent ( component ) {
for ( var rendered ; rendered = component . _renderedComponent ; ) component = rendered ;
return component ;
}
function precacheNode ( inst , tag ) {
var nativeInst = getRenderedHostOrTextFromComponent ( inst ) ;
instanceCache [ tag ] = nativeInst ;
}
function precacheFiberNode ( hostInst , tag ) {
instanceCache [ tag ] = hostInst ;
}
function uncacheNode ( inst ) {
var tag = inst . _rootNodeID ;
tag && delete instanceCache [ tag ] ;
}
function uncacheFiberNode ( tag ) {
delete instanceCache [ tag ] , delete instanceProps [ tag ] ;
}
function getInstanceFromTag ( tag ) {
return instanceCache [ tag ] || null ;
}
function getTagFromInstance ( inst ) {
var tag = "number" != typeof inst . tag ? inst . _rootNodeID : inst . stateNode . _nativeTag ;
return invariant ( tag , "All native instances should have a tag." ) , tag ;
}
function getFiberCurrentPropsFromNode ( stateNode ) {
return instanceProps [ stateNode . _nativeTag ] || null ;
}
function updateFiberProps ( tag , props ) {
instanceProps [ tag ] = props ;
}
var ReactNativeComponentTree = {
getClosestInstanceFromNode : getInstanceFromTag ,
getInstanceFromNode : getInstanceFromTag ,
getNodeFromInstance : getTagFromInstance ,
precacheFiberNode : precacheFiberNode ,
precacheNode : precacheNode ,
uncacheFiberNode : uncacheFiberNode ,
uncacheNode : uncacheNode ,
getFiberCurrentPropsFromNode : getFiberCurrentPropsFromNode ,
updateFiberProps : updateFiberProps
} , ReactNativeComponentTree _1 = ReactNativeComponentTree , 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
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-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
return ! ! dispatchConfig . registrationName && ( publishRegistrationName ( dispatchConfig . registrationName , pluginModule , eventName ) ,
! 0 ) ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
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 lowerCasedName = registrationName . toLowerCase ( ) ;
EventPluginRegistry . possibleRegistrationNames [ lowerCasedName ] = registrationName ,
"onDoubleClick" === registrationName && ( EventPluginRegistry . possibleRegistrationNames . ondblclick = registrationName ) ;
}
var EventPluginRegistry = {
plugins : [ ] ,
eventNameDispatchConfigs : { } ,
registrationNameModules : { } ,
registrationNameDependencies : { } ,
possibleRegistrationNames : { } ,
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 ( ) ;
}
} , EventPluginRegistry _1 = EventPluginRegistry , caughtError = null , invokeGuardedCallback = function ( name , func , context , a , b , c , d , e , f ) {
var funcArgs = Array . prototype . slice . call ( arguments , 3 ) ;
try {
2017-05-26 17:51:06 +00:00
func . apply ( context , funcArgs ) ;
2017-06-26 22:12:46 +00:00
} catch ( error ) {
return error ;
}
return null ;
2017-05-26 17:51:06 +00:00
} ;
2017-06-26 22:12:46 +00:00
if ( "undefined" != typeof window && "function" == typeof window . dispatchEvent && "undefined" != typeof document && "function" == typeof document . createEvent ) {
var fakeNode = document . createElement ( "react" ) , depth = 0 ;
invokeGuardedCallback = function ( name , func , context , a , b , c , d , e , f ) {
depth ++ ;
var thisDepth = depth , funcArgs = Array . prototype . slice . call ( arguments , 3 ) , boundFunc = function ( ) {
func . apply ( context , funcArgs ) ;
} , fakeEventError = null , onFakeEventError = function ( event ) {
depth === thisDepth && ( fakeEventError = event . error ) ;
} , evtType = "react-" + ( name || "invokeguardedcallback" ) + "-" + depth ;
window . addEventListener ( "error" , onFakeEventError ) , fakeNode . addEventListener ( evtType , boundFunc , ! 1 ) ;
var evt = document . createEvent ( "Event" ) ;
return evt . initEvent ( evtType , ! 1 , ! 1 ) , fakeNode . dispatchEvent ( evt ) , fakeNode . removeEventListener ( evtType , boundFunc , ! 1 ) ,
window . removeEventListener ( "error" , onFakeEventError ) , depth -- , fakeEventError ;
} ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
var rethrowCaughtError = function ( ) {
if ( caughtError ) {
var error = caughtError ;
throw caughtError = null , error ;
}
} , ReactErrorUtils = {
injection : {
injectErrorUtils : function ( injectedErrorUtils ) {
invariant ( "function" == typeof injectedErrorUtils . invokeGuardedCallback , "Injected invokeGuardedCallback() must be a function." ) ,
invokeGuardedCallback = injectedErrorUtils . invokeGuardedCallback ;
}
} ,
invokeGuardedCallback : function ( name , func , context , a , b , c , d , e , f ) {
return invokeGuardedCallback . apply ( this , arguments ) ;
} ,
invokeGuardedCallbackAndCatchFirstError : function ( name , func , context , a , b , c , d , e , f ) {
var error = ReactErrorUtils . invokeGuardedCallback . apply ( this , arguments ) ;
null !== error && null === caughtError && ( caughtError = error ) ;
} ,
rethrowCaughtError : function ( ) {
return rethrowCaughtError . apply ( this , arguments ) ;
}
} , ReactErrorUtils _1 = ReactErrorUtils , ComponentTree , injection = {
injectComponentTree : function ( Injected ) {
ComponentTree = Injected , warning ( Injected && Injected . getNodeFromInstance && Injected . getInstanceFromNode , "EventPluginUtils.injection.injectComponentTree(...): Injected " + "module is missing getNodeFromInstance or getInstanceFromNode." ) ;
}
} ;
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 ;
}
var validateEventDispatches ;
validateEventDispatches = function ( event ) {
var dispatchListeners = event . _dispatchListeners , dispatchInstances = event . _dispatchInstances , listenersIsArr = Array . isArray ( dispatchListeners ) , listenersLen = listenersIsArr ? dispatchListeners . length : dispatchListeners ? 1 : 0 , instancesIsArr = Array . isArray ( dispatchInstances ) , instancesLen = instancesIsArr ? dispatchInstances . length : dispatchInstances ? 1 : 0 ;
warning ( instancesIsArr === listenersIsArr && instancesLen === listenersLen , "EventPluginUtils: Invalid `event`." ) ;
} ;
function executeDispatch ( event , simulated , listener , inst ) {
var type = event . type || "unknown-event" ;
event . currentTarget = EventPluginUtils . getNodeFromInstance ( inst ) , ReactErrorUtils _1 . invokeGuardedCallbackAndCatchFirstError ( type , listener , void 0 , event ) ,
event . currentTarget = null ;
}
function executeDispatchesInOrder ( event , simulated ) {
var dispatchListeners = event . _dispatchListeners , dispatchInstances = event . _dispatchInstances ;
if ( validateEventDispatches ( event ) , 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 ( validateEventDispatches ( event ) , 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 ) {
validateEventDispatches ( event ) ;
var dispatchListener = event . _dispatchListeners , dispatchInstance = event . _dispatchInstances ;
invariant ( ! Array . isArray ( dispatchListener ) , "executeDirectDispatch(...): Invalid `event`." ) ,
event . currentTarget = dispatchListener ? EventPluginUtils . getNodeFromInstance ( dispatchInstance ) : null ;
var res = dispatchListener ? dispatchListener ( event ) : null ;
return event . currentTarget = null , event . _dispatchListeners = null , event . _dispatchInstances = null ,
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
} , EventPluginUtils _1 = EventPluginUtils ;
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 ] ;
}
var accumulateInto _1 = accumulateInto ;
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 ;
}
}
var EventPluginHub = {
injection : {
injectEventPluginOrder : EventPluginRegistry _1 . injectEventPluginOrder ,
injectEventPluginsByName : EventPluginRegistry _1 . injectEventPluginsByName
} ,
getListener : function ( inst , registrationName ) {
var listener ;
if ( "number" == typeof inst . tag ) {
var stateNode = inst . stateNode ;
if ( ! stateNode ) return null ;
var props = EventPluginUtils _1 . getFiberCurrentPropsFromNode ( stateNode ) ;
if ( ! props ) return null ;
if ( listener = props [ registrationName ] , shouldPreventMouseEvent ( registrationName , inst . type , props ) ) return null ;
} else {
var currentElement = inst . _currentElement ;
if ( "string" == typeof currentElement || "number" == typeof currentElement ) return null ;
if ( ! inst . _rootNodeID ) return null ;
var _props = currentElement . props ;
if ( listener = _props [ registrationName ] , shouldPreventMouseEvent ( registrationName , currentElement . type , _props ) ) return null ;
}
return invariant ( ! listener || "function" == typeof listener , "Expected %s listener to be a function, instead got type %s" , registrationName , typeof listener ) ,
listener ;
} ,
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 ) ) ;
}
}
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 ( ) ;
}
} , EventPluginHub _1 = EventPluginHub , ReactTypeOfWork = {
IndeterminateComponent : 0 ,
FunctionalComponent : 1 ,
ClassComponent : 2 ,
HostRoot : 3 ,
HostPortal : 4 ,
HostComponent : 5 ,
HostText : 6 ,
CoroutineComponent : 7 ,
CoroutineHandlerPhase : 8 ,
YieldComponent : 9 ,
Fragment : 10
} , HostComponent = ReactTypeOfWork . HostComponent ;
function getParent ( inst ) {
if ( void 0 !== inst . _hostParent ) return inst . _hostParent ;
2017-05-26 17:51:06 +00:00
if ( "number" == typeof inst . tag ) {
2017-06-26 22:12:46 +00:00
do {
inst = inst . return ;
} while ( inst && inst . tag !== HostComponent ) ;
if ( inst ) return inst ;
}
return null ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12: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 ) ;
}
return null ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12: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 ) ;
}
var ReactTreeTraversal = {
isAncestor : isAncestor ,
getLowestCommonAncestor : getLowestCommonAncestor ,
getParentInstance : getParentInstance ,
traverseTwoPhase : traverseTwoPhase ,
traverseEnterLeave : traverseEnterLeave
} , getListener = EventPluginHub _1 . getListener ;
function listenerAtPhase ( inst , event , propagationPhase ) {
var registrationName = event . dispatchConfig . phasedRegistrationNames [ propagationPhase ] ;
return getListener ( inst , registrationName ) ;
}
function accumulateDirectionalDispatches ( inst , phase , event ) {
warning ( inst , "Dispatching inst must not be null" ) ;
var listener = listenerAtPhase ( inst , event , phase ) ;
2017-06-09 02:01:23 +00:00
listener && ( event . _dispatchListeners = accumulateInto _1 ( event . _dispatchListeners , listener ) ,
2017-05-26 17:51:06 +00:00
event . _dispatchInstances = accumulateInto _1 ( event . _dispatchInstances , inst ) ) ;
}
2017-06-26 22:12:46 +00:00
function accumulateTwoPhaseDispatchesSingle ( event ) {
event && event . dispatchConfig . phasedRegistrationNames && ReactTreeTraversal . traverseTwoPhase ( event . _targetInst , accumulateDirectionalDispatches , event ) ;
}
function accumulateTwoPhaseDispatchesSingleSkipTarget ( event ) {
if ( event && event . dispatchConfig . phasedRegistrationNames ) {
var targetInst = event . _targetInst , parentInst = targetInst ? ReactTreeTraversal . getParentInstance ( targetInst ) : null ;
ReactTreeTraversal . traverseTwoPhase ( parentInst , accumulateDirectionalDispatches , event ) ;
}
}
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 ) ) ;
}
}
function accumulateDirectDispatchesSingle ( event ) {
event && event . dispatchConfig . registrationName && accumulateDispatches ( event . _targetInst , null , event ) ;
}
function accumulateTwoPhaseDispatches ( events ) {
forEachAccumulated _1 ( events , accumulateTwoPhaseDispatchesSingle ) ;
}
function accumulateTwoPhaseDispatchesSkipTarget ( events ) {
forEachAccumulated _1 ( events , accumulateTwoPhaseDispatchesSingleSkipTarget ) ;
}
function accumulateEnterLeaveDispatches ( leave , enter , from , to ) {
ReactTreeTraversal . traverseEnterLeave ( from , to , accumulateDispatches , leave , enter ) ;
}
function accumulateDirectDispatches ( events ) {
forEachAccumulated _1 ( events , accumulateDirectDispatchesSingle ) ;
}
var EventPropagators = {
accumulateTwoPhaseDispatches : accumulateTwoPhaseDispatches ,
accumulateTwoPhaseDispatchesSkipTarget : accumulateTwoPhaseDispatchesSkipTarget ,
accumulateDirectDispatches : accumulateDirectDispatches ,
accumulateEnterLeaveDispatches : accumulateEnterLeaveDispatches
} , EventPropagators _1 = EventPropagators , oneArgumentPooler = function ( copyFieldsFrom ) {
var Klass = this ;
if ( Klass . instancePool . length ) {
var instance = Klass . instancePool . pop ( ) ;
return Klass . call ( instance , copyFieldsFrom ) , instance ;
}
return new Klass ( copyFieldsFrom ) ;
} , twoArgumentPooler = function ( a1 , a2 ) {
var Klass = this ;
if ( Klass . instancePool . length ) {
var instance = Klass . instancePool . pop ( ) ;
return Klass . call ( instance , a1 , a2 ) , instance ;
}
return new Klass ( a1 , a2 ) ;
} , threeArgumentPooler = function ( a1 , a2 , a3 ) {
var Klass = this ;
if ( Klass . instancePool . length ) {
var instance = Klass . instancePool . pop ( ) ;
return Klass . call ( instance , a1 , a2 , a3 ) , instance ;
}
return new Klass ( a1 , a2 , a3 ) ;
} , fourArgumentPooler = function ( a1 , a2 , a3 , a4 ) {
var Klass = this ;
if ( Klass . instancePool . length ) {
var instance = Klass . instancePool . pop ( ) ;
return Klass . call ( instance , a1 , a2 , a3 , a4 ) , instance ;
}
return new Klass ( a1 , a2 , a3 , a4 ) ;
} , standardReleaser = function ( instance ) {
var Klass = this ;
invariant ( instance instanceof Klass , "Trying to release an instance into a pool of a different type." ) ,
instance . destructor ( ) , Klass . instancePool . length < Klass . poolSize && Klass . instancePool . push ( instance ) ;
} , DEFAULT _POOL _SIZE = 10 , DEFAULT _POOLER = oneArgumentPooler , addPoolingTo = function ( CopyConstructor , pooler ) {
var NewKlass = CopyConstructor ;
return NewKlass . instancePool = [ ] , NewKlass . getPooled = pooler || DEFAULT _POOLER ,
NewKlass . poolSize || ( NewKlass . poolSize = DEFAULT _POOL _SIZE ) , NewKlass . release = standardReleaser ,
NewKlass ;
} , PooledClass = {
addPoolingTo : addPoolingTo ,
oneArgumentPooler : oneArgumentPooler ,
twoArgumentPooler : twoArgumentPooler ,
threeArgumentPooler : threeArgumentPooler ,
fourArgumentPooler : fourArgumentPooler
} , PooledClass _1 = PooledClass , didWarnForAddedNewProperty = ! 1 , isProxySupported = "function" == typeof Proxy , 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
} ;
function SyntheticEvent ( dispatchConfig , targetInst , nativeEvent , nativeEventTarget ) {
delete this . nativeEvent , delete this . preventDefault , delete this . stopPropagation ,
this . dispatchConfig = dispatchConfig , this . _targetInst = targetInst , this . nativeEvent = nativeEvent ;
2017-05-26 17:51:06 +00:00
var Interface = this . constructor . Interface ;
2017-06-26 22:12:46 +00:00
for ( var propName in Interface ) if ( Interface . hasOwnProperty ( propName ) ) {
delete this [ 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 ;
}
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 ) Object . defineProperty ( this , propName , getPooledWarningPropertyDefinition ( propName , Interface [ propName ] ) ) ;
for ( var i = 0 ; i < shouldBeReleasedProperties . length ; i ++ ) this [ shouldBeReleasedProperties [ i ] ] = null ;
Object . defineProperty ( this , "nativeEvent" , getPooledWarningPropertyDefinition ( "nativeEvent" , null ) ) ,
Object . defineProperty ( this , "preventDefault" , getPooledWarningPropertyDefinition ( "preventDefault" , emptyFunction ) ) ,
Object . defineProperty ( this , "stopPropagation" , getPooledWarningPropertyDefinition ( "stopPropagation" , emptyFunction ) ) ;
}
} ) , SyntheticEvent . Interface = EventInterface , isProxySupported && ( SyntheticEvent = new Proxy ( SyntheticEvent , {
construct : function ( target , args ) {
return this . apply ( target , Object . create ( target . prototype ) , args ) ;
} ,
apply : function ( constructor , that , args ) {
return new Proxy ( constructor . apply ( that , args ) , {
set : function ( target , prop , value ) {
return "isPersistent" === prop || target . constructor . Interface . hasOwnProperty ( prop ) || - 1 !== shouldBeReleasedProperties . indexOf ( prop ) || ( warning ( didWarnForAddedNewProperty || target . isPersistent ( ) , "This synthetic event is reused for performance reasons. If you're " + "seeing this, you're adding a new property in the synthetic event object. " + "The property is never released. See " + "https://fb.me/react-event-pooling for more information." ) ,
didWarnForAddedNewProperty = ! 0 ) , target [ prop ] = value , ! 0 ;
}
} ) ;
}
} ) ) , 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 ,
PooledClass _1 . addPoolingTo ( Class , PooledClass _1 . fourArgumentPooler ) ;
} , PooledClass _1 . addPoolingTo ( SyntheticEvent , PooledClass _1 . fourArgumentPooler ) ;
var SyntheticEvent _1 = SyntheticEvent ;
function getPooledWarningPropertyDefinition ( propName , getVal ) {
var isFunction = "function" == typeof getVal ;
return {
configurable : ! 0 ,
set : set ,
get : get
} ;
function set ( val ) {
return warn ( isFunction ? "setting the method" : "setting the property" , "This is effectively a no-op" ) ,
val ;
}
function get ( ) {
return warn ( isFunction ? "accessing the method" : "accessing the property" , isFunction ? "This is a no-op function" : "This is set to null" ) ,
getVal ;
}
function warn ( action , result ) {
warning ( ! 1 , "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + "If you must keep the original synthetic event around, use event.persist(). " + "See https://fb.me/react-event-pooling for more information." , action , propName , result ) ;
}
}
var _extends = Object . assign || function ( target ) {
for ( var i = 1 ; i < arguments . length ; i ++ ) {
var source = arguments [ i ] ;
for ( var key in source ) Object . prototype . hasOwnProperty . call ( source , key ) && ( target [ key ] = source [ key ] ) ;
}
return target ;
} , customBubblingEventTypes = UIManager . customBubblingEventTypes , customDirectEventTypes = UIManager . customDirectEventTypes , allTypesByEventName = { } ;
for ( var bubblingTypeName in customBubblingEventTypes ) allTypesByEventName [ bubblingTypeName ] = customBubblingEventTypes [ bubblingTypeName ] ;
for ( var directTypeName in customDirectEventTypes ) warning ( ! customBubblingEventTypes [ directTypeName ] , "Event cannot be both direct and bubbling: %s" , directTypeName ) ,
allTypesByEventName [ directTypeName ] = customDirectEventTypes [ directTypeName ] ;
var ReactNativeBridgeEventPlugin = {
eventTypes : _extends ( { } , customBubblingEventTypes , customDirectEventTypes ) ,
extractEvents : function ( topLevelType , targetInst , nativeEvent , nativeEventTarget ) {
var bubbleDispatchConfig = customBubblingEventTypes [ topLevelType ] , directDispatchConfig = customDirectEventTypes [ topLevelType ] , event = SyntheticEvent _1 . getPooled ( bubbleDispatchConfig || directDispatchConfig , targetInst , nativeEvent , nativeEventTarget ) ;
if ( bubbleDispatchConfig ) EventPropagators _1 . accumulateTwoPhaseDispatches ( event ) ; else {
if ( ! directDispatchConfig ) return null ;
EventPropagators _1 . accumulateDirectDispatches ( event ) ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
return event ;
}
} , ReactNativeBridgeEventPlugin _1 = ReactNativeBridgeEventPlugin ;
function runEventQueueInBatch ( events ) {
EventPluginHub _1 . enqueueEvents ( events ) , EventPluginHub _1 . processEventQueue ( ! 1 ) ;
}
var ReactEventEmitterMixin = {
handleTopLevel : function ( topLevelType , targetInst , nativeEvent , nativeEventTarget ) {
runEventQueueInBatch ( EventPluginHub _1 . extractEvents ( topLevelType , targetInst , nativeEvent , nativeEventTarget ) ) ;
}
} , ReactEventEmitterMixin _1 = ReactEventEmitterMixin , 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 ;
}
} , ReactNativeTagHandles _1 = ReactNativeTagHandles , fiberHostComponent = null , ReactControlledComponentInjection = {
injectFiberControlledHostComponent : function ( hostComponentImpl ) {
fiberHostComponent = hostComponentImpl ;
}
} , restoreTarget = null , restoreQueue = null ;
function restoreStateOfTarget ( target ) {
var internalInstance = EventPluginUtils _1 . getInstanceFromNode ( target ) ;
if ( internalInstance ) {
if ( "number" == typeof internalInstance . tag ) {
invariant ( fiberHostComponent && "function" == typeof fiberHostComponent . restoreControlledState , "Fiber needs to be injected to handle a fiber target for controlled " + "events." ) ;
var props = EventPluginUtils _1 . getFiberCurrentPropsFromNode ( internalInstance . stateNode ) ;
return void fiberHostComponent . restoreControlledState ( internalInstance . stateNode , internalInstance . type , props ) ;
}
invariant ( "function" == typeof internalInstance . restoreControlledState , "The internal instance must be a React host component." ) ,
internalInstance . restoreControlledState ( ) ;
}
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +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 ] ) ;
}
}
} , ReactControlledComponent _1 = ReactControlledComponent , stackBatchedUpdates = function ( fn , a , b , c , d , e ) {
return fn ( a , b , c , d , e ) ;
} , fiberBatchedUpdates = function ( fn , bookkeeping ) {
return fn ( bookkeeping ) ;
2017-05-26 17:51:06 +00:00
} ;
2017-06-26 22:12:46 +00:00
function performFiberBatchedUpdates ( fn , bookkeeping ) {
return fiberBatchedUpdates ( fn , bookkeeping ) ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
function batchedUpdates ( fn , bookkeeping ) {
return stackBatchedUpdates ( performFiberBatchedUpdates , fn , bookkeeping ) ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +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 ( ) ;
2017-05-26 17:51:06 +00:00
}
}
2017-06-26 22:12:46 +00:00
var ReactGenericBatchingInjection = {
injectStackBatchedUpdates : function ( _batchedUpdates ) {
stackBatchedUpdates = _batchedUpdates ;
} ,
injectFiberBatchedUpdates : function ( _batchedUpdates ) {
fiberBatchedUpdates = _batchedUpdates ;
}
} , ReactGenericBatching = {
batchedUpdates : batchedUpdatesWithControlledComponents ,
injection : ReactGenericBatchingInjection
} , ReactGenericBatching _1 = ReactGenericBatching , _extends$1 = Object . assign || function ( target ) {
for ( var i = 1 ; i < arguments . length ; i ++ ) {
var source = arguments [ i ] ;
for ( var key in source ) Object . prototype . hasOwnProperty . call ( source , key ) && ( target [ key ] = source [ key ] ) ;
}
return target ;
} , 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 = _extends$1 ( { } , 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 ) ;
} ) ;
} ,
receiveEvent : function ( tag , topLevelType , nativeEventParam ) {
var rootNodeID = tag ;
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 ? warning ( ! 1 , "A view is reporting that a touch occurred on tag zero." ) : rootNodeID = target ) ,
ReactNativeEventEmitter . _receiveRootNodeIDEvent ( rootNodeID , eventTopLevelType , nativeEvent ) ;
}
}
} ) , ReactNativeEventEmitter _1 = ReactNativeEventEmitter , ReactNativeEventPluginOrder = [ "ResponderEventPlugin" , "ReactNativeBridgeEventPlugin" ] , ReactNativeEventPluginOrder _1 = ReactNativeEventPluginOrder , ReactNativeGlobalResponderHandler = {
onChange : function ( from , to , blockNativeResponder ) {
if ( null !== to ) {
var tag = "number" != typeof to . tag ? to . _rootNodeID : to . stateNode . _nativeTag ;
UIManager . setJSResponder ( tag , blockNativeResponder ) ;
} else UIManager . clearJSResponder ( ) ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
} , ReactNativeGlobalResponderHandler _1 = ReactNativeGlobalResponderHandler , ResponderEventInterface = {
touchHistory : function ( nativeEvent ) {
return null ;
}
} ;
function ResponderSyntheticEvent ( dispatchConfig , dispatchMarker , nativeEvent , nativeEventTarget ) {
return SyntheticEvent _1 . call ( this , dispatchConfig , dispatchMarker , nativeEvent , nativeEventTarget ) ;
}
SyntheticEvent _1 . augmentClass ( ResponderSyntheticEvent , ResponderEventInterface ) ;
var ResponderSyntheticEvent _1 = ResponderSyntheticEvent , isEndish$2 = EventPluginUtils _1 . isEndish , isMoveish$2 = EventPluginUtils _1 . isMoveish , isStartish$2 = EventPluginUtils _1 . isStartish , MAX _TOUCH _BANK = 20 , touchBank = [ ] , touchHistory = {
touchBank : touchBank ,
numberActiveTouches : 0 ,
indexOfSingleActiveTouch : - 1 ,
mostRecentTimeStamp : 0
} ;
function timestampForTouch ( touch ) {
return touch . timeStamp || touch . timestamp ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12: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-06-26 22:12: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 ) ;
}
function getTouchIdentifier ( _ref ) {
var identifier = _ref . identifier ;
return invariant ( null != identifier , "Touch object is missing identifier." ) , warning ( identifier <= MAX _TOUCH _BANK , "Touch identifier %s is greater than maximum supported %s which causes " + "performance issues backfilling array locations for all of the indices." , identifier , MAX _TOUCH _BANK ) ,
identifier ;
}
function recordTouchStart ( touch ) {
var identifier = getTouchIdentifier ( touch ) , touchRecord = touchBank [ identifier ] ;
touchRecord ? resetTouchRecord ( touchRecord , touch ) : touchBank [ identifier ] = createTouchRecord ( touch ) ,
touchHistory . mostRecentTimeStamp = timestampForTouch ( touch ) ;
}
function recordTouchMove ( touch ) {
var touchRecord = touchBank [ getTouchIdentifier ( touch ) ] ;
touchRecord ? ( touchRecord . touchActive = ! 0 , touchRecord . previousPageX = touchRecord . currentPageX ,
touchRecord . previousPageY = touchRecord . currentPageY , touchRecord . previousTimeStamp = touchRecord . currentTimeStamp ,
touchRecord . currentPageX = touch . pageX , touchRecord . currentPageY = touch . pageY ,
touchRecord . currentTimeStamp = timestampForTouch ( touch ) , touchHistory . mostRecentTimeStamp = timestampForTouch ( touch ) ) : console . error ( "Cannot record touch move without a touch start.\n" + "Touch Move: %s\n" , "Touch Bank: %s" , printTouch ( touch ) , printTouchBank ( ) ) ;
}
function recordTouchEnd ( touch ) {
var touchRecord = touchBank [ getTouchIdentifier ( touch ) ] ;
touchRecord ? ( touchRecord . touchActive = ! 1 , touchRecord . previousPageX = touchRecord . currentPageX ,
touchRecord . previousPageY = touchRecord . currentPageY , touchRecord . previousTimeStamp = touchRecord . currentTimeStamp ,
touchRecord . currentPageX = touch . pageX , touchRecord . currentPageY = touch . pageY ,
touchRecord . currentTimeStamp = timestampForTouch ( touch ) , touchHistory . mostRecentTimeStamp = timestampForTouch ( touch ) ) : console . error ( "Cannot record touch end without a touch start.\n" + "Touch End: %s\n" , "Touch Bank: %s" , printTouch ( touch ) , printTouchBank ( ) ) ;
}
function printTouch ( touch ) {
return JSON . stringify ( {
identifier : touch . identifier ,
pageX : touch . pageX ,
pageY : touch . pageY ,
timestamp : timestampForTouch ( touch )
2017-05-26 17:51:06 +00:00
} ) ;
}
2017-06-26 22:12:46 +00:00
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-06-26 22:12:46 +00:00
var activeRecord = touchBank [ touchHistory . indexOfSingleActiveTouch ] ;
warning ( null != activeRecord && activeRecord . touchActive , "Cannot find single active touch." ) ;
}
} ,
touchHistory : touchHistory
} , ResponderTouchHistoryStore _1 = ResponderTouchHistoryStore ;
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 ] ;
}
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"
}
} ,
scrollShouldSetResponder : {
phasedRegistrationNames : {
bubbled : "onScrollShouldSetResponder" ,
captured : "onScrollShouldSetResponderCapture"
}
} ,
selectionChangeShouldSetResponder : {
phasedRegistrationNames : {
bubbled : "onSelectionChangeShouldSetResponder" ,
captured : "onSelectionChangeShouldSetResponderCapture"
}
} ,
moveShouldSetResponder : {
phasedRegistrationNames : {
bubbled : "onMoveShouldSetResponder" ,
captured : "onMoveShouldSetResponderCapture"
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
} ,
responderStart : {
registrationName : "onResponderStart"
} ,
responderMove : {
registrationName : "onResponderMove"
} ,
responderEnd : {
registrationName : "onResponderEnd"
} ,
responderRelease : {
registrationName : "onResponderRelease"
} ,
responderTerminationRequest : {
registrationName : "onResponderTerminationRequest"
} ,
responderGrant : {
registrationName : "onResponderGrant"
} ,
responderReject : {
registrationName : "onResponderReject"
} ,
responderTerminate : {
registrationName : "onResponderTerminate"
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
} ;
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 ) ;
} else {
var rejectEvent = ResponderSyntheticEvent _1 . getPooled ( eventTypes . responderReject , wantsResponderInst , nativeEvent , nativeEventTarget ) ;
rejectEvent . touchHistory = ResponderTouchHistoryStore _1 . touchHistory , EventPropagators _1 . accumulateDirectDispatches ( rejectEvent ) ,
extracted = accumulate _1 ( extracted , rejectEvent ) ;
}
} else extracted = accumulate _1 ( extracted , grantEvent ) , changeResponder ( wantsResponderInst , blockHostResponder ) ;
return extracted ;
}
function canTriggerTransfer ( topLevelType , topLevelInst , nativeEvent ) {
return topLevelInst && ( "topScroll" === topLevelType && ! nativeEvent . responderIgnoreScroll || trackedTouchCount > 0 && "topSelectionChange" === topLevelType || isStartish$1 ( topLevelType ) || isMoveish$1 ( topLevelType ) ) ;
}
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 ;
}
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
return ! 0 ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12: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 ;
function inject ( ) {
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-05-26 17:51:06 +00:00
} ) ;
}
2017-06-26 22:12:46 +00:00
var ReactNativeInjection = {
inject : inject
} , ReactInvalidSetStateWarningHook = { } , processingChildContext = ! 1 , warnInvalidSetState = function ( ) {
warning ( ! processingChildContext , "setState(...): Cannot call setState() inside getChildContext()" ) ;
2017-05-26 17:51:06 +00:00
} ;
2017-06-26 22:12:46 +00:00
ReactInvalidSetStateWarningHook = {
onBeginProcessingChildContext : function ( ) {
processingChildContext = ! 0 ;
} ,
onEndProcessingChildContext : function ( ) {
processingChildContext = ! 1 ;
} ,
onSetState : function ( ) {
warnInvalidSetState ( ) ;
}
2017-05-26 17:51:06 +00:00
} ;
2017-06-26 22:12:46 +00:00
var ReactInvalidSetStateWarningHook _1 = ReactInvalidSetStateWarningHook , ReactHostOperationHistoryHook = null , history = [ ] ;
ReactHostOperationHistoryHook = {
onHostOperation : function ( operation ) {
history . push ( operation ) ;
} ,
clearHistory : function ( ) {
ReactHostOperationHistoryHook . _preventClearing || ( history = [ ] ) ;
} ,
getHistory : function ( ) {
return history ;
}
} ;
var ReactHostOperationHistoryHook _1 = ReactHostOperationHistoryHook , ReactInternals = React . _ _SECRET _INTERNALS _DO _NOT _USE _OR _YOU _WILL _BE _FIRED , ReactGlobalSharedState = {
ReactCurrentOwner : ReactInternals . ReactCurrentOwner
} ;
Object . assign ( ReactGlobalSharedState , {
ReactComponentTreeHook : ReactInternals . ReactComponentTreeHook ,
ReactDebugCurrentFrame : ReactInternals . ReactDebugCurrentFrame
} ) ;
var ReactGlobalSharedState _1 = ReactGlobalSharedState , ReactComponentTreeHook = ReactGlobalSharedState _1 . ReactComponentTreeHook , ReactDebugTool$1 = null , hooks = [ ] , didHookThrowForEvent = { } , callHook = function ( event , fn , context , arg1 , arg2 , arg3 , arg4 , arg5 ) {
2017-05-26 17:51:06 +00:00
try {
2017-06-26 22:12:46 +00:00
fn . call ( context , arg1 , arg2 , arg3 , arg4 , arg5 ) ;
} catch ( e ) {
warning ( didHookThrowForEvent [ event ] , "Exception thrown by hook while handling %s: %s" , event , e + "\n" + e . stack ) ,
didHookThrowForEvent [ event ] = ! 0 ;
}
} , emitEvent = function ( event , arg1 , arg2 , arg3 , arg4 , arg5 ) {
for ( var i = 0 ; i < hooks . length ; i ++ ) {
var hook = hooks [ i ] , fn = hook [ event ] ;
fn && callHook ( event , fn , hook , arg1 , arg2 , arg3 , arg4 , arg5 ) ;
}
} , isProfiling = ! 1 , flushHistory = [ ] , lifeCycleTimerStack = [ ] , currentFlushNesting = 0 , currentFlushMeasurements = [ ] , currentFlushStartTime = 0 , currentTimerDebugID = null , currentTimerStartTime = 0 , currentTimerNestedFlushDuration = 0 , currentTimerType = null , lifeCycleTimerHasWarned = ! 1 , clearHistory = function ( ) {
ReactComponentTreeHook . purgeUnmountedComponents ( ) , ReactHostOperationHistoryHook _1 . clearHistory ( ) ;
} , getTreeSnapshot = function ( registeredIDs ) {
return registeredIDs . reduce ( function ( tree , id ) {
var ownerID = ReactComponentTreeHook . getOwnerID ( id ) , parentID = ReactComponentTreeHook . getParentID ( id ) ;
return tree [ id ] = {
displayName : ReactComponentTreeHook . getDisplayName ( id ) ,
text : ReactComponentTreeHook . getText ( id ) ,
updateCount : ReactComponentTreeHook . getUpdateCount ( id ) ,
childIDs : ReactComponentTreeHook . getChildIDs ( id ) ,
ownerID : ownerID || parentID && ReactComponentTreeHook . getOwnerID ( parentID ) || 0 ,
parentID : parentID
} , tree ;
} , { } ) ;
} , resetMeasurements = function ( ) {
var previousStartTime = currentFlushStartTime , previousMeasurements = currentFlushMeasurements , previousOperations = ReactHostOperationHistoryHook _1 . getHistory ( ) ;
if ( 0 === currentFlushNesting ) return currentFlushStartTime = 0 , currentFlushMeasurements = [ ] ,
void clearHistory ( ) ;
if ( previousMeasurements . length || previousOperations . length ) {
var registeredIDs = ReactComponentTreeHook . getRegisteredIDs ( ) ;
flushHistory . push ( {
duration : performanceNow ( ) - previousStartTime ,
measurements : previousMeasurements || [ ] ,
operations : previousOperations || [ ] ,
treeSnapshot : getTreeSnapshot ( registeredIDs )
} ) ;
}
clearHistory ( ) , currentFlushStartTime = performanceNow ( ) , currentFlushMeasurements = [ ] ;
} , checkDebugID = function ( debugID ) {
arguments . length > 1 && void 0 !== arguments [ 1 ] && arguments [ 1 ] && 0 === debugID || debugID || warning ( ! 1 , "ReactDebugTool: debugID may not be empty." ) ;
} , beginLifeCycleTimer = function ( debugID , timerType ) {
0 !== currentFlushNesting && ( currentTimerType && ! lifeCycleTimerHasWarned && ( warning ( ! 1 , "There is an internal error in the React performance measurement code." + "\n\nDid not expect %s timer to start while %s timer is still in " + "progress for %s instance." , timerType , currentTimerType || "no" , debugID === currentTimerDebugID ? "the same" : "another" ) ,
lifeCycleTimerHasWarned = ! 0 ) , currentTimerStartTime = performanceNow ( ) , currentTimerNestedFlushDuration = 0 ,
currentTimerDebugID = debugID , currentTimerType = timerType ) ;
} , endLifeCycleTimer = function ( debugID , timerType ) {
0 !== currentFlushNesting && ( currentTimerType === timerType || lifeCycleTimerHasWarned || ( warning ( ! 1 , "There is an internal error in the React performance measurement code. " + "We did not expect %s timer to stop while %s timer is still in " + "progress for %s instance. Please report this as a bug in React." , timerType , currentTimerType || "no" , debugID === currentTimerDebugID ? "the same" : "another" ) ,
lifeCycleTimerHasWarned = ! 0 ) , isProfiling && currentFlushMeasurements . push ( {
timerType : timerType ,
instanceID : debugID ,
duration : performanceNow ( ) - currentTimerStartTime - currentTimerNestedFlushDuration
} ) , currentTimerStartTime = 0 , currentTimerNestedFlushDuration = 0 , currentTimerDebugID = null ,
currentTimerType = null ) ;
} , pauseCurrentLifeCycleTimer = function ( ) {
var currentTimer = {
startTime : currentTimerStartTime ,
nestedFlushStartTime : performanceNow ( ) ,
debugID : currentTimerDebugID ,
timerType : currentTimerType
} ;
lifeCycleTimerStack . push ( currentTimer ) , currentTimerStartTime = 0 , currentTimerNestedFlushDuration = 0 ,
currentTimerDebugID = null , currentTimerType = null ;
} , resumeCurrentLifeCycleTimer = function ( ) {
var _lifeCycleTimerStack$ = lifeCycleTimerStack . pop ( ) , startTime = _lifeCycleTimerStack$ . startTime , nestedFlushStartTime = _lifeCycleTimerStack$ . nestedFlushStartTime , debugID = _lifeCycleTimerStack$ . debugID , timerType = _lifeCycleTimerStack$ . timerType , nestedFlushDuration = performanceNow ( ) - nestedFlushStartTime ;
currentTimerStartTime = startTime , currentTimerNestedFlushDuration += nestedFlushDuration ,
currentTimerDebugID = debugID , currentTimerType = timerType ;
} , lastMarkTimeStamp = 0 , canUsePerformanceMeasure = "undefined" != typeof performance && "function" == typeof performance . mark && "function" == typeof performance . clearMarks && "function" == typeof performance . measure && "function" == typeof performance . clearMeasures , shouldMark = function ( debugID ) {
if ( ! isProfiling || ! canUsePerformanceMeasure ) return ! 1 ;
var element = ReactComponentTreeHook . getElement ( debugID ) ;
return null != element && "object" == typeof element && ! ( "string" == typeof element . type ) ;
} , markBegin = function ( debugID , markType ) {
if ( shouldMark ( debugID ) ) {
var markName = debugID + "::" + markType ;
lastMarkTimeStamp = performanceNow ( ) , performance . mark ( markName ) ;
}
} , markEnd = function ( debugID , markType ) {
if ( shouldMark ( debugID ) ) {
var markName = debugID + "::" + markType , displayName = ReactComponentTreeHook . getDisplayName ( debugID ) || "Unknown" ;
if ( performanceNow ( ) - lastMarkTimeStamp > . 1 ) {
var measurementName = displayName + " [" + markType + "]" ;
performance . measure ( measurementName , markName ) ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
performance . clearMarks ( markName ) , measurementName && performance . clearMeasures ( measurementName ) ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
} ;
ReactDebugTool$1 = {
addHook : function ( hook ) {
hooks . push ( hook ) ;
} ,
removeHook : function ( hook ) {
for ( var i = 0 ; i < hooks . length ; i ++ ) hooks [ i ] === hook && ( hooks . splice ( i , 1 ) ,
i -- ) ;
} ,
isProfiling : function ( ) {
return isProfiling ;
} ,
beginProfiling : function ( ) {
isProfiling || ( isProfiling = ! 0 , flushHistory . length = 0 , resetMeasurements ( ) ,
ReactDebugTool$1 . addHook ( ReactHostOperationHistoryHook _1 ) ) ;
} ,
endProfiling : function ( ) {
isProfiling && ( isProfiling = ! 1 , resetMeasurements ( ) , ReactDebugTool$1 . removeHook ( ReactHostOperationHistoryHook _1 ) ) ;
} ,
getFlushHistory : function ( ) {
return flushHistory ;
} ,
onBeginFlush : function ( ) {
currentFlushNesting ++ , resetMeasurements ( ) , pauseCurrentLifeCycleTimer ( ) , emitEvent ( "onBeginFlush" ) ;
} ,
onEndFlush : function ( ) {
resetMeasurements ( ) , currentFlushNesting -- , resumeCurrentLifeCycleTimer ( ) , emitEvent ( "onEndFlush" ) ;
} ,
onBeginLifeCycleTimer : function ( debugID , timerType ) {
checkDebugID ( debugID ) , emitEvent ( "onBeginLifeCycleTimer" , debugID , timerType ) , markBegin ( debugID , timerType ) ,
beginLifeCycleTimer ( debugID , timerType ) ;
} ,
onEndLifeCycleTimer : function ( debugID , timerType ) {
checkDebugID ( debugID ) , endLifeCycleTimer ( debugID , timerType ) , markEnd ( debugID , timerType ) ,
emitEvent ( "onEndLifeCycleTimer" , debugID , timerType ) ;
} ,
onBeginProcessingChildContext : function ( ) {
emitEvent ( "onBeginProcessingChildContext" ) ;
} ,
onEndProcessingChildContext : function ( ) {
emitEvent ( "onEndProcessingChildContext" ) ;
} ,
onHostOperation : function ( operation ) {
checkDebugID ( operation . instanceID ) , emitEvent ( "onHostOperation" , operation ) ;
} ,
onSetState : function ( ) {
emitEvent ( "onSetState" ) ;
} ,
onSetChildren : function ( debugID , childDebugIDs ) {
checkDebugID ( debugID ) , childDebugIDs . forEach ( checkDebugID ) , emitEvent ( "onSetChildren" , debugID , childDebugIDs ) ;
} ,
onBeforeMountComponent : function ( debugID , element , parentDebugID ) {
checkDebugID ( debugID ) , checkDebugID ( parentDebugID , ! 0 ) , emitEvent ( "onBeforeMountComponent" , debugID , element , parentDebugID ) ,
markBegin ( debugID , "mount" ) ;
} ,
onMountComponent : function ( debugID ) {
checkDebugID ( debugID ) , markEnd ( debugID , "mount" ) , emitEvent ( "onMountComponent" , debugID ) ;
} ,
onBeforeUpdateComponent : function ( debugID , element ) {
checkDebugID ( debugID ) , emitEvent ( "onBeforeUpdateComponent" , debugID , element ) , markBegin ( debugID , "update" ) ;
} ,
onUpdateComponent : function ( debugID ) {
checkDebugID ( debugID ) , markEnd ( debugID , "update" ) , emitEvent ( "onUpdateComponent" , debugID ) ;
} ,
onBeforeUnmountComponent : function ( debugID ) {
checkDebugID ( debugID ) , emitEvent ( "onBeforeUnmountComponent" , debugID ) , markBegin ( debugID , "unmount" ) ;
} ,
onUnmountComponent : function ( debugID ) {
checkDebugID ( debugID ) , markEnd ( debugID , "unmount" ) , emitEvent ( "onUnmountComponent" , debugID ) ;
} ,
onTestEvent : function ( ) {
emitEvent ( "onTestEvent" ) ;
}
} , ReactDebugTool$1 . addHook ( ReactInvalidSetStateWarningHook _1 ) , ReactDebugTool$1 . addHook ( ReactComponentTreeHook ) ;
var url = ExecutionEnvironment . canUseDOM && window . location . href || "" ;
/[?&]react_perf\b/ . test ( url ) && ReactDebugTool$1 . beginProfiling ( ) ;
var ReactDebugTool _1 = ReactDebugTool$1 , debugTool = null , ReactDebugTool = ReactDebugTool _1 ;
debugTool = ReactDebugTool ;
var ReactInstrumentation = {
debugTool : debugTool
} ;
function ReactNativeContainerInfo ( tag ) {
return {
_tag : tag
} ;
}
var ReactNativeContainerInfo _1 = ReactNativeContainerInfo , ClassComponent = ReactTypeOfWork . ClassComponent ;
function isValidOwner ( object ) {
return ! ( ! object || "function" != typeof object . attachRef || "function" != typeof object . detachRef ) ;
}
var ReactOwner = {
addComponentAsRefTo : function ( component , ref , owner ) {
if ( owner && owner . tag === ClassComponent ) {
var inst = owner . stateNode ;
( inst . refs === emptyObject ? inst . refs = { } : inst . refs ) [ ref ] = component . getPublicInstance ( ) ;
} else invariant ( isValidOwner ( owner ) , "addComponentAsRefTo(...): Only a ReactOwner can have refs. You might " + "be adding a ref to a component that was not created inside a component's " + "`render` method, or you have multiple copies of React loaded " + "(details: https://fb.me/react-refs-must-have-owner)." ) ,
owner . attachRef ( ref , component ) ;
} ,
removeComponentAsRefFrom : function ( component , ref , owner ) {
if ( owner && owner . tag === ClassComponent ) {
var inst = owner . stateNode ;
inst && inst . refs [ ref ] === component . getPublicInstance ( ) && delete inst . refs [ ref ] ;
} else {
invariant ( isValidOwner ( owner ) , "removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might " + "be removing a ref to a component that was not created inside a component's " + "`render` method, or you have multiple copies of React loaded " + "(details: https://fb.me/react-refs-must-have-owner)." ) ;
var ownerPublicInstance = owner . getPublicInstance ( ) ;
ownerPublicInstance && ownerPublicInstance . refs [ ref ] === component . getPublicInstance ( ) && owner . detachRef ( ref ) ;
2017-05-26 17:51:06 +00:00
}
}
2017-06-26 22:12:46 +00:00
} , ReactOwner _1 = ReactOwner , ReactCompositeComponentTypes$1 = {
ImpureClass : 0 ,
PureClass : 1 ,
StatelessFunctional : 2
} , ReactRef = { } , ReactCompositeComponentTypes = ReactCompositeComponentTypes$1 , _require$1 = ReactGlobalSharedState _1 , ReactComponentTreeHook$1 = _require$1 . ReactComponentTreeHook , warning$2 = warning , warnedAboutStatelessRefs = { } ;
function attachRef ( ref , component , owner ) {
if ( component . _compositeType === ReactCompositeComponentTypes . StatelessFunctional ) {
var info = "" , ownerName = void 0 ;
owner && ( "function" == typeof owner . getName && ( ownerName = owner . getName ( ) ) , ownerName && ( info += "\n\nCheck the render method of `" + ownerName + "`." ) ) ;
var warningKey = ownerName || component . _debugID , element = component . _currentElement ;
element && element . _source && ( warningKey = element . _source . fileName + ":" + element . _source . lineNumber ) ,
warnedAboutStatelessRefs [ warningKey ] || ( warnedAboutStatelessRefs [ warningKey ] = ! 0 ,
warning$2 ( ! 1 , "Stateless function components cannot be given refs. " + "Attempts to access this ref will fail.%s%s" , info , ReactComponentTreeHook$1 . getStackAddendumByID ( component . _debugID ) ) ) ;
}
"function" == typeof ref ? ref ( component . getPublicInstance ( ) ) : ReactOwner _1 . addComponentAsRefTo ( component , ref , owner ) ;
}
function detachRef ( ref , component , owner ) {
"function" == typeof ref ? ref ( null ) : ReactOwner _1 . removeComponentAsRefFrom ( component , ref , owner ) ;
}
ReactRef . attachRefs = function ( instance , element ) {
if ( null !== element && "object" == typeof element ) {
var ref = element . ref ;
null != ref && attachRef ( ref , instance , element . _owner ) ;
}
} , ReactRef . shouldUpdateRefs = function ( prevElement , nextElement ) {
var prevRef = null , prevOwner = null ;
null !== prevElement && "object" == typeof prevElement && ( prevRef = prevElement . ref ,
prevOwner = prevElement . _owner ) ;
var nextRef = null , nextOwner = null ;
return null !== nextElement && "object" == typeof nextElement && ( nextRef = nextElement . ref ,
nextOwner = nextElement . _owner ) , prevRef !== nextRef || "string" == typeof nextRef && nextOwner !== prevOwner ;
} , ReactRef . detachRefs = function ( instance , element ) {
if ( null !== element && "object" == typeof element ) {
var ref = element . ref ;
null != ref && detachRef ( ref , instance , element . _owner ) ;
}
} ;
var ReactRef _1 = ReactRef ;
function attachRefs ( ) {
ReactRef _1 . attachRefs ( this , this . _currentElement ) ;
}
var ReactReconciler = {
mountComponent : function ( internalInstance , transaction , hostParent , hostContainerInfo , context , parentDebugID ) {
0 !== internalInstance . _debugID && ReactInstrumentation . debugTool . onBeforeMountComponent ( internalInstance . _debugID , internalInstance . _currentElement , parentDebugID ) ;
var markup = internalInstance . mountComponent ( transaction , hostParent , hostContainerInfo , context , parentDebugID ) ;
return internalInstance . _currentElement && null != internalInstance . _currentElement . ref && transaction . getReactMountReady ( ) . enqueue ( attachRefs , internalInstance ) ,
0 !== internalInstance . _debugID && ReactInstrumentation . debugTool . onMountComponent ( internalInstance . _debugID ) ,
markup ;
} ,
getHostNode : function ( internalInstance ) {
return internalInstance . getHostNode ( ) ;
} ,
unmountComponent : function ( internalInstance , safely , skipLifecycle ) {
0 !== internalInstance . _debugID && ReactInstrumentation . debugTool . onBeforeUnmountComponent ( internalInstance . _debugID ) ,
ReactRef _1 . detachRefs ( internalInstance , internalInstance . _currentElement ) , internalInstance . unmountComponent ( safely , skipLifecycle ) ,
0 !== internalInstance . _debugID && ReactInstrumentation . debugTool . onUnmountComponent ( internalInstance . _debugID ) ;
} ,
receiveComponent : function ( internalInstance , nextElement , transaction , context ) {
var prevElement = internalInstance . _currentElement ;
if ( nextElement !== prevElement || context !== internalInstance . _context ) {
0 !== internalInstance . _debugID && ReactInstrumentation . debugTool . onBeforeUpdateComponent ( internalInstance . _debugID , nextElement ) ;
var refsChanged = ReactRef _1 . shouldUpdateRefs ( prevElement , nextElement ) ;
refsChanged && ReactRef _1 . detachRefs ( internalInstance , prevElement ) , internalInstance . receiveComponent ( nextElement , transaction , context ) ,
refsChanged && internalInstance . _currentElement && null != internalInstance . _currentElement . ref && transaction . getReactMountReady ( ) . enqueue ( attachRefs , internalInstance ) ,
0 !== internalInstance . _debugID && ReactInstrumentation . debugTool . onUpdateComponent ( internalInstance . _debugID ) ;
}
} ,
performUpdateIfNecessary : function ( internalInstance , transaction , updateBatchNumber ) {
if ( internalInstance . _updateBatchNumber !== updateBatchNumber ) return void warning ( null == internalInstance . _updateBatchNumber || internalInstance . _updateBatchNumber === updateBatchNumber + 1 , "performUpdateIfNecessary: Unexpected batch number (current %s, " + "pending %s)" , updateBatchNumber , internalInstance . _updateBatchNumber ) ;
0 !== internalInstance . _debugID && ReactInstrumentation . debugTool . onBeforeUpdateComponent ( internalInstance . _debugID , internalInstance . _currentElement ) ,
internalInstance . performUpdateIfNecessary ( transaction ) , 0 !== internalInstance . _debugID && ReactInstrumentation . debugTool . onUpdateComponent ( internalInstance . _debugID ) ;
}
} , ReactReconciler _1 = ReactReconciler , ReactInstanceMap = {
remove : function ( key ) {
key . _reactInternalInstance = void 0 ;
} ,
get : function ( key ) {
return key . _reactInternalInstance ;
} ,
has : function ( key ) {
return void 0 !== key . _reactInternalInstance ;
} ,
set : function ( key , value ) {
key . _reactInternalInstance = value ;
}
} , ReactInstanceMap _1 = ReactInstanceMap , OBSERVED _ERROR = { } , TransactionImpl = {
reinitializeTransaction : function ( ) {
this . transactionWrappers = this . getTransactionWrappers ( ) , this . wrapperInitData ? this . wrapperInitData . length = 0 : this . wrapperInitData = [ ] ,
this . _isInTransaction = ! 1 ;
} ,
_isInTransaction : ! 1 ,
getTransactionWrappers : null ,
isInTransaction : function ( ) {
return ! ! this . _isInTransaction ;
} ,
perform : function ( method , scope , a , b , c , d , e , f ) {
invariant ( ! this . isInTransaction ( ) , "Transaction.perform(...): Cannot initialize a transaction when there " + "is already an outstanding transaction." ) ;
var errorThrown , ret ;
2017-05-26 17:51:06 +00:00
try {
2017-06-26 22:12:46 +00:00
this . _isInTransaction = ! 0 , errorThrown = ! 0 , this . initializeAll ( 0 ) , ret = method . call ( scope , a , b , c , d , e , f ) ,
2017-05-26 17:51:06 +00:00
errorThrown = ! 1 ;
} finally {
2017-06-26 22:12:46 +00:00
try {
if ( errorThrown ) try {
this . closeAll ( 0 ) ;
} catch ( err ) { } else this . closeAll ( 0 ) ;
} finally {
this . _isInTransaction = ! 1 ;
}
}
return ret ;
} ,
initializeAll : function ( startIndex ) {
for ( var transactionWrappers = this . transactionWrappers , i = startIndex ; i < transactionWrappers . length ; i ++ ) {
var wrapper = transactionWrappers [ i ] ;
try {
this . wrapperInitData [ i ] = OBSERVED _ERROR , this . wrapperInitData [ i ] = wrapper . initialize ? wrapper . initialize . call ( this ) : null ;
} finally {
if ( this . wrapperInitData [ i ] === OBSERVED _ERROR ) try {
this . initializeAll ( i + 1 ) ;
} catch ( err ) { }
}
}
} ,
closeAll : function ( startIndex ) {
invariant ( this . isInTransaction ( ) , "Transaction.closeAll(): Cannot close transaction when none are open." ) ;
for ( var transactionWrappers = this . transactionWrappers , i = startIndex ; i < transactionWrappers . length ; i ++ ) {
var errorThrown , wrapper = transactionWrappers [ i ] , initData = this . wrapperInitData [ i ] ;
try {
errorThrown = ! 0 , initData !== OBSERVED _ERROR && wrapper . close && wrapper . close . call ( this , initData ) ,
errorThrown = ! 1 ;
} finally {
if ( errorThrown ) try {
this . closeAll ( i + 1 ) ;
} catch ( e ) { }
}
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
this . wrapperInitData . length = 0 ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
} , Transaction = TransactionImpl , dirtyComponents = [ ] , updateBatchNumber = 0 , batchingStrategy = null ;
function ensureInjected ( ) {
invariant ( ReactUpdates . ReactReconcileTransaction && batchingStrategy , "ReactUpdates: must inject a reconcile transaction class and batching " + "strategy" ) ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
var NESTED _UPDATES = {
initialize : function ( ) {
this . dirtyComponentsLength = dirtyComponents . length ;
} ,
close : function ( ) {
this . dirtyComponentsLength !== dirtyComponents . length ? ( dirtyComponents . splice ( 0 , this . dirtyComponentsLength ) ,
flushBatchedUpdates ( ) ) : dirtyComponents . length = 0 ;
}
} , TRANSACTION _WRAPPERS = [ NESTED _UPDATES ] ;
function ReactUpdatesFlushTransaction ( ) {
this . reinitializeTransaction ( ) , this . dirtyComponentsLength = null , this . reconcileTransaction = ReactUpdates . ReactReconcileTransaction . getPooled ( ! 0 ) ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
Object . assign ( ReactUpdatesFlushTransaction . prototype , Transaction , {
getTransactionWrappers : function ( ) {
return TRANSACTION _WRAPPERS ;
} ,
destructor : function ( ) {
this . dirtyComponentsLength = null , ReactUpdates . ReactReconcileTransaction . release ( this . reconcileTransaction ) ,
this . reconcileTransaction = null ;
} ,
perform : function ( method , scope , a ) {
return Transaction . perform . call ( this , this . reconcileTransaction . perform , this . reconcileTransaction , method , scope , a ) ;
}
} ) , PooledClass _1 . addPoolingTo ( ReactUpdatesFlushTransaction ) ;
function batchedUpdates$1 ( callback , a , b , c , d , e ) {
return ensureInjected ( ) , batchingStrategy . batchedUpdates ( callback , a , b , c , d , e ) ;
}
function mountOrderComparator ( c1 , c2 ) {
return c1 . _mountOrder - c2 . _mountOrder ;
}
function runBatchedUpdates ( transaction ) {
var len = transaction . dirtyComponentsLength ;
invariant ( len === dirtyComponents . length , "Expected flush transaction's stored dirty-components length (%s) to " + "match dirty-components array length (%s)." , len , dirtyComponents . length ) ,
dirtyComponents . sort ( mountOrderComparator ) , updateBatchNumber ++ ;
for ( var i = 0 ; i < len ; i ++ ) {
var component = dirtyComponents [ i ] ;
ReactReconciler _1 . performUpdateIfNecessary ( component , transaction . reconcileTransaction , updateBatchNumber ) ;
}
}
var flushBatchedUpdates = function ( ) {
for ( ; dirtyComponents . length ; ) {
var transaction = ReactUpdatesFlushTransaction . getPooled ( ) ;
transaction . perform ( runBatchedUpdates , null , transaction ) , ReactUpdatesFlushTransaction . release ( transaction ) ;
}
} ;
function enqueueUpdate$1 ( component ) {
if ( ensureInjected ( ) , ! batchingStrategy . isBatchingUpdates ) return void batchingStrategy . batchedUpdates ( enqueueUpdate$1 , component ) ;
dirtyComponents . push ( component ) , null == component . _updateBatchNumber && ( component . _updateBatchNumber = updateBatchNumber + 1 ) ;
}
var ReactUpdatesInjection = {
injectReconcileTransaction : function ( ReconcileTransaction ) {
invariant ( ReconcileTransaction , "ReactUpdates: must provide a reconcile transaction class" ) ,
ReactUpdates . ReactReconcileTransaction = ReconcileTransaction ;
} ,
injectBatchingStrategy : function ( _batchingStrategy ) {
invariant ( _batchingStrategy , "ReactUpdates: must provide a batching strategy" ) ,
invariant ( "function" == typeof _batchingStrategy . batchedUpdates , "ReactUpdates: must provide a batchedUpdates() function" ) ,
invariant ( "boolean" == typeof _batchingStrategy . isBatchingUpdates , "ReactUpdates: must provide an isBatchingUpdates boolean attribute" ) ,
batchingStrategy = _batchingStrategy ;
} ,
getBatchingStrategy : function ( ) {
return batchingStrategy ;
}
} , ReactUpdates = {
ReactReconcileTransaction : null ,
batchedUpdates : batchedUpdates$1 ,
enqueueUpdate : enqueueUpdate$1 ,
flushBatchedUpdates : flushBatchedUpdates ,
injection : ReactUpdatesInjection
} , ReactUpdates _1 = ReactUpdates , ReactCurrentOwner = ReactGlobalSharedState _1 . ReactCurrentOwner , warning$3 = warning , warnOnInvalidCallback = function ( callback , callerName ) {
warning$3 ( null === callback || "function" == typeof callback , "%s(...): Expected the last optional `callback` argument to be a " + "function. Instead received: %s." , callerName , "" + callback ) ;
} ;
function enqueueUpdate ( internalInstance ) {
ReactUpdates _1 . enqueueUpdate ( internalInstance ) ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
function getInternalInstanceReadyForUpdate ( publicInstance , callerName ) {
2017-05-26 17:51:06 +00:00
var internalInstance = ReactInstanceMap _1 . get ( publicInstance ) ;
2017-06-26 22:12:46 +00:00
if ( ! internalInstance ) {
var ctor = publicInstance . constructor ;
return warning$3 ( ! 1 , "Can only update a mounted or mounting component. This usually means " + "you called setState, replaceState, or forceUpdate on an unmounted " + "component. This is a no-op.\n\nPlease check the code for the " + "%s component." , ctor && ( ctor . displayName || ctor . name ) || "ReactClass" ) ,
null ;
}
return warning$3 ( null == ReactCurrentOwner . current , "Cannot update during an existing state transition (such as within " + "`render` or another component's constructor). Render methods should " + "be a pure function of props and state; constructor side-effects are " + "an anti-pattern, but can be moved to `componentWillMount`." ) ,
internalInstance ;
}
var ReactUpdateQueue = {
isMounted : function ( publicInstance ) {
var owner = ReactCurrentOwner . current ;
null !== owner && ( warning$3 ( owner . _warnedAboutRefsInRender , "%s is accessing isMounted inside its render() function. " + "render() should be a pure function of props and state. It should " + "never access something that requires stale data from the previous " + "render, such as refs. Move this logic to componentDidMount and " + "componentDidUpdate instead." , owner . getName ( ) || "A component" ) ,
owner . _warnedAboutRefsInRender = ! 0 ) ;
var internalInstance = ReactInstanceMap _1 . get ( publicInstance ) ;
return ! ! internalInstance && ! ! internalInstance . _renderedComponent ;
} ,
enqueueCallbackInternal : function ( internalInstance , callback ) {
internalInstance . _pendingCallbacks ? internalInstance . _pendingCallbacks . push ( callback ) : internalInstance . _pendingCallbacks = [ callback ] ,
enqueueUpdate ( internalInstance ) ;
} ,
enqueueForceUpdate : function ( publicInstance , callback , callerName ) {
var internalInstance = getInternalInstanceReadyForUpdate ( publicInstance ) ;
internalInstance && ( callback = void 0 === callback ? null : callback , null !== callback && ( warnOnInvalidCallback ( callback , callerName ) ,
internalInstance . _pendingCallbacks ? internalInstance . _pendingCallbacks . push ( callback ) : internalInstance . _pendingCallbacks = [ callback ] ) ,
internalInstance . _pendingForceUpdate = ! 0 , enqueueUpdate ( internalInstance ) ) ;
} ,
enqueueReplaceState : function ( publicInstance , completeState , callback , callerName ) {
var internalInstance = getInternalInstanceReadyForUpdate ( publicInstance ) ;
internalInstance && ( internalInstance . _pendingStateQueue = [ completeState ] , internalInstance . _pendingReplaceState = ! 0 ,
2017-06-09 02:01:23 +00:00
callback = void 0 === callback ? null : callback , null !== callback && ( warnOnInvalidCallback ( callback , callerName ) ,
internalInstance . _pendingCallbacks ? internalInstance . _pendingCallbacks . push ( callback ) : internalInstance . _pendingCallbacks = [ callback ] ) ,
2017-06-26 22:12:46 +00:00
enqueueUpdate ( internalInstance ) ) ;
} ,
enqueueSetState : function ( publicInstance , partialState , callback , callerName ) {
ReactInstrumentation . debugTool . onSetState ( ) , warning$3 ( null != partialState , "setState(...): You passed an undefined or null state object; " + "instead, use forceUpdate()." ) ;
var internalInstance = getInternalInstanceReadyForUpdate ( publicInstance ) ;
if ( internalInstance ) {
( internalInstance . _pendingStateQueue || ( internalInstance . _pendingStateQueue = [ ] ) ) . push ( partialState ) ,
callback = void 0 === callback ? null : callback , null !== callback && ( warnOnInvalidCallback ( callback , callerName ) ,
internalInstance . _pendingCallbacks ? internalInstance . _pendingCallbacks . push ( callback ) : internalInstance . _pendingCallbacks = [ callback ] ) ,
enqueueUpdate ( internalInstance ) ;
}
} ,
enqueueElementInternal : function ( internalInstance , nextElement , nextContext ) {
internalInstance . _pendingElement = nextElement , internalInstance . _context = nextContext ,
2017-05-26 17:51:06 +00:00
enqueueUpdate ( internalInstance ) ;
}
2017-06-26 22:12:46 +00:00
} , ReactUpdateQueue _1 = ReactUpdateQueue , injected = ! 1 , ReactComponentEnvironment = {
replaceNodeWithMarkup : null ,
processChildrenUpdates : null ,
injection : {
injectEnvironment : function ( environment ) {
invariant ( ! injected , "ReactCompositeComponent: injectEnvironment() can only be called once." ) ,
ReactComponentEnvironment . replaceNodeWithMarkup = environment . replaceNodeWithMarkup ,
ReactComponentEnvironment . processChildrenUpdates = environment . processChildrenUpdates ,
injected = ! 0 ;
}
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
} , ReactComponentEnvironment _1 = ReactComponentEnvironment , ReactNodeTypes = {
HOST : 0 ,
COMPOSITE : 1 ,
EMPTY : 2 ,
getType : function ( node ) {
return null === node || ! 1 === node ? ReactNodeTypes . EMPTY : React . isValidElement ( node ) ? "function" == typeof node . type ? ReactNodeTypes . COMPOSITE : ReactNodeTypes . HOST : void invariant ( ! 1 , "Unexpected node: %s" , node ) ;
}
} , ReactNodeTypes _1 = ReactNodeTypes ;
function shouldUpdateReactComponent ( prevElement , nextElement ) {
var prevEmpty = null === prevElement || ! 1 === prevElement , nextEmpty = null === nextElement || ! 1 === nextElement ;
if ( prevEmpty || nextEmpty ) return prevEmpty === nextEmpty ;
var prevType = typeof prevElement , nextType = typeof nextElement ;
return "string" === prevType || "number" === prevType ? "string" === nextType || "number" === nextType : "object" === nextType && prevElement . type === nextElement . type && prevElement . key === nextElement . key ;
}
var shouldUpdateReactComponent _1 = shouldUpdateReactComponent , ReactCurrentOwner$1 = ReactGlobalSharedState _1 . ReactCurrentOwner , _require2 = ReactGlobalSharedState _1 , ReactDebugCurrentFrame = _require2 . ReactDebugCurrentFrame , warningAboutMissingGetChildContext = { } ;
function StatelessComponent ( Component ) { }
StatelessComponent . prototype . render = function ( ) {
return ( 0 , ReactInstanceMap _1 . get ( this ) . _currentElement . type ) ( this . props , this . context , this . updater ) ;
} ;
function shouldConstruct ( Component ) {
return ! ( ! Component . prototype || ! Component . prototype . isReactComponent ) ;
}
function isPureComponent ( Component ) {
return ! ( ! Component . prototype || ! Component . prototype . isPureReactComponent ) ;
}
function measureLifeCyclePerf ( fn , debugID , timerType ) {
if ( 0 === debugID ) return fn ( ) ;
ReactInstrumentation . debugTool . onBeginLifeCycleTimer ( debugID , timerType ) ;
2017-05-26 17:51:06 +00:00
try {
2017-06-26 22:12:46 +00:00
return fn ( ) ;
2017-05-26 17:51:06 +00:00
} finally {
2017-06-26 22:12:46 +00:00
ReactInstrumentation . debugTool . onEndLifeCycleTimer ( debugID , timerType ) ;
}
}
var nextMountID = 1 , ReactCompositeComponent = {
construct : function ( element ) {
this . _currentElement = element , this . _rootNodeID = 0 , this . _compositeType = null ,
this . _instance = null , this . _hostParent = null , this . _hostContainerInfo = null ,
this . _updateBatchNumber = null , this . _pendingElement = null , this . _pendingStateQueue = null ,
this . _pendingReplaceState = ! 1 , this . _pendingForceUpdate = ! 1 , this . _renderedNodeType = null ,
this . _renderedComponent = null , this . _context = null , this . _mountOrder = 0 , this . _topLevelWrapper = null ,
this . _pendingCallbacks = null , this . _calledComponentWillUnmount = ! 1 , this . _warnedAboutRefsInRender = ! 1 ;
} ,
mountComponent : function ( transaction , hostParent , hostContainerInfo , context ) {
var _this = this ;
this . _context = context , this . _mountOrder = nextMountID ++ , this . _hostParent = hostParent ,
this . _hostContainerInfo = hostContainerInfo ;
var renderedElement , publicProps = this . _currentElement . props , publicContext = this . _processContext ( context ) , Component = this . _currentElement . type , updateQueue = transaction . getUpdateQueue ( ) , doConstruct = shouldConstruct ( Component ) , inst = this . _constructComponent ( doConstruct , publicProps , publicContext , updateQueue ) ;
doConstruct || null != inst && null != inst . render ? isPureComponent ( Component ) ? this . _compositeType = ReactCompositeComponentTypes$1 . PureClass : this . _compositeType = ReactCompositeComponentTypes$1 . ImpureClass : ( renderedElement = inst ,
warning ( ! Component . childContextTypes , "%s(...): childContextTypes cannot be defined on a functional component." , Component . displayName || Component . name || "Component" ) ,
invariant ( null === inst || ! 1 === inst || React . isValidElement ( inst ) , "%s(...): A valid React element (or null) must be returned. You may have " + "returned undefined, an array or some other invalid object." , Component . displayName || Component . name || "Component" ) ,
inst = new StatelessComponent ( Component ) , this . _compositeType = ReactCompositeComponentTypes$1 . StatelessFunctional ) ,
null == inst . render && warning ( ! 1 , "%s(...): No `render` method found on the returned component " + "instance: you may have forgotten to define `render`." , Component . displayName || Component . name || "Component" ) ;
var propsMutated = inst . props !== publicProps , componentName = Component . displayName || Component . name || "Component" ;
warning ( void 0 === inst . props || ! propsMutated , "%s(...): When calling super() in `%s`, make sure to pass " + "up the same props that your component's constructor was passed." , componentName , componentName ) ,
inst . props = publicProps , inst . context = publicContext , inst . refs = emptyObject ,
inst . updater = updateQueue , this . _instance = inst , ReactInstanceMap _1 . set ( inst , this ) ,
warning ( ! inst . getInitialState || inst . getInitialState . isReactClassApproved || inst . state , "getInitialState was defined on %s, a plain JavaScript class. " + "This is only supported for classes created using React.createClass. " + "Did you mean to define a state property instead?" , this . getName ( ) || "a component" ) ,
warning ( ! inst . getDefaultProps || inst . getDefaultProps . isReactClassApproved , "getDefaultProps was defined on %s, a plain JavaScript class. " + "This is only supported for classes created using React.createClass. " + "Use a static property to define defaultProps instead." , this . getName ( ) || "a component" ) ,
warning ( ! inst . propTypes , "propTypes was defined as an instance property on %s. Use a static " + "property to define propTypes instead." , this . getName ( ) || "a component" ) ,
warning ( ! inst . contextTypes , "contextTypes was defined as an instance property on %s. Use a " + "static property to define contextTypes instead." , this . getName ( ) || "a component" ) ,
warning ( "function" != typeof inst . componentShouldUpdate , "%s has a method called " + "componentShouldUpdate(). Did you mean shouldComponentUpdate()? " + "The name is phrased as a question because the function is " + "expected to return a value." , this . getName ( ) || "A component" ) ,
warning ( "function" != typeof inst . componentDidUnmount , "%s has a method called " + "componentDidUnmount(). But there is no such lifecycle method. " + "Did you mean componentWillUnmount()?" , this . getName ( ) || "A component" ) ,
warning ( "function" != typeof inst . componentWillRecieveProps , "%s has a method called " + "componentWillRecieveProps(). Did you mean componentWillReceiveProps()?" , this . getName ( ) || "A component" ) ,
isPureComponent ( Component ) && void 0 !== inst . shouldComponentUpdate && warning ( ! 1 , "%s has a method called shouldComponentUpdate(). " + "shouldComponentUpdate should not be used when extending React.PureComponent. " + "Please extend React.Component if shouldComponentUpdate is used." , this . getName ( ) || "A pure component" ) ,
warning ( ! inst . defaultProps , "Setting defaultProps as an instance property on %s is not supported and will be ignored." + " Instead, define defaultProps as a static property on %s." , this . getName ( ) || "a component" , this . getName ( ) || "a component" ) ;
var initialState = inst . state ;
void 0 === initialState && ( inst . state = initialState = null ) , invariant ( "object" == typeof initialState && ! Array . isArray ( initialState ) , "%s.state: must be set to an object or null" , this . getName ( ) || "ReactCompositeComponent" ) ,
2017-06-09 02:01:23 +00:00
this . _pendingStateQueue = null , this . _pendingReplaceState = ! 1 , this . _pendingForceUpdate = ! 1 ,
2017-06-26 22:12:46 +00:00
inst . componentWillMount && ( measureLifeCyclePerf ( function ( ) {
return inst . componentWillMount ( ) ;
} , this . _debugID , "componentWillMount" ) , this . _pendingStateQueue && ( inst . state = this . _processPendingState ( inst . props , inst . context ) ) ) ;
var markup ;
markup = inst . unstable _handleError ? this . performInitialMountWithErrorHandling ( renderedElement , hostParent , hostContainerInfo , transaction , context ) : this . performInitialMount ( renderedElement , hostParent , hostContainerInfo , transaction , context ) ,
inst . componentDidMount && transaction . getReactMountReady ( ) . enqueue ( function ( ) {
measureLifeCyclePerf ( function ( ) {
return inst . componentDidMount ( ) ;
} , _this . _debugID , "componentDidMount" ) ;
} ) ;
var callbacks = this . _pendingCallbacks ;
if ( callbacks ) {
this . _pendingCallbacks = null ;
for ( var i = 0 ; i < callbacks . length ; i ++ ) transaction . getReactMountReady ( ) . enqueue ( callbacks [ i ] , inst ) ;
}
return markup ;
} ,
_constructComponent : function ( doConstruct , publicProps , publicContext , updateQueue ) {
ReactCurrentOwner$1 . current = this ;
2017-05-26 17:51:06 +00:00
try {
2017-06-26 22:12:46 +00:00
return this . _constructComponentWithoutOwner ( doConstruct , publicProps , publicContext , updateQueue ) ;
2017-05-26 17:51:06 +00:00
} finally {
2017-06-26 22:12:46 +00:00
ReactCurrentOwner$1 . current = null ;
}
} ,
_constructComponentWithoutOwner : function ( doConstruct , publicProps , publicContext , updateQueue ) {
var Component = this . _currentElement . type ;
return doConstruct ? measureLifeCyclePerf ( function ( ) {
return new Component ( publicProps , publicContext , updateQueue ) ;
} , this . _debugID , "ctor" ) : measureLifeCyclePerf ( function ( ) {
return Component ( publicProps , publicContext , updateQueue ) ;
} , this . _debugID , "render" ) ;
} ,
performInitialMountWithErrorHandling : function ( renderedElement , hostParent , hostContainerInfo , transaction , context ) {
var markup , checkpoint = transaction . checkpoint ( ) ;
try {
markup = this . performInitialMount ( renderedElement , hostParent , hostContainerInfo , transaction , context ) ;
} catch ( e ) {
transaction . rollback ( checkpoint ) , this . _instance . unstable _handleError ( e ) , this . _pendingStateQueue && ( this . _instance . state = this . _processPendingState ( this . _instance . props , this . _instance . context ) ) ,
checkpoint = transaction . checkpoint ( ) , this . _renderedComponent . unmountComponent ( ! 0 , ! 0 ) ,
transaction . rollback ( checkpoint ) , markup = this . performInitialMount ( renderedElement , hostParent , hostContainerInfo , transaction , context ) ;
}
return markup ;
} ,
performInitialMount : function ( renderedElement , hostParent , hostContainerInfo , transaction , context ) {
void 0 === renderedElement && ( renderedElement = this . _renderValidatedComponent ( ) ) ;
var nodeType = ReactNodeTypes _1 . getType ( renderedElement ) ;
2017-05-26 17:51:06 +00:00
this . _renderedNodeType = nodeType ;
2017-06-26 22:12:46 +00:00
var child = this . _instantiateReactComponent ( renderedElement , nodeType !== ReactNodeTypes _1 . EMPTY ) ;
2017-05-26 17:51:06 +00:00
this . _renderedComponent = child ;
2017-06-26 22:12:46 +00:00
var debugID = 0 ;
debugID = this . _debugID ;
var markup = ReactReconciler _1 . mountComponent ( child , transaction , hostParent , hostContainerInfo , this . _processChildContext ( context ) , debugID ) ;
if ( 0 !== debugID ) {
2017-05-26 17:51:06 +00:00
var childDebugIDs = 0 !== child . _debugID ? [ child . _debugID ] : [ ] ;
ReactInstrumentation . debugTool . onSetChildren ( debugID , childDebugIDs ) ;
}
2017-06-26 22:12:46 +00:00
return markup ;
} ,
getHostNode : function ( ) {
return ReactReconciler _1 . getHostNode ( this . _renderedComponent ) ;
} ,
unmountComponent : function ( safely , skipLifecycle ) {
if ( this . _renderedComponent ) {
var inst = this . _instance ;
if ( inst . componentWillUnmount && ! inst . _calledComponentWillUnmount ) if ( inst . _calledComponentWillUnmount = ! 0 ,
safely ) {
if ( ! skipLifecycle ) {
var name = this . getName ( ) + ".componentWillUnmount()" ;
ReactErrorUtils _1 . invokeGuardedCallbackAndCatchFirstError ( name , inst . componentWillUnmount , inst ) ;
}
} else measureLifeCyclePerf ( function ( ) {
return inst . componentWillUnmount ( ) ;
} , this . _debugID , "componentWillUnmount" ) ;
this . _renderedComponent && ( ReactReconciler _1 . unmountComponent ( this . _renderedComponent , safely , skipLifecycle ) ,
this . _renderedNodeType = null , this . _renderedComponent = null , this . _instance = null ) ,
this . _pendingStateQueue = null , this . _pendingReplaceState = ! 1 , this . _pendingForceUpdate = ! 1 ,
this . _pendingCallbacks = null , this . _pendingElement = null , this . _context = null ,
this . _rootNodeID = 0 , this . _topLevelWrapper = null , ReactInstanceMap _1 . remove ( inst ) ;
}
} ,
_maskContext : function ( context ) {
var Component = this . _currentElement . type , contextTypes = Component . contextTypes ;
if ( ! contextTypes ) return emptyObject ;
var maskedContext = { } ;
for ( var contextName in contextTypes ) maskedContext [ contextName ] = context [ contextName ] ;
return maskedContext ;
} ,
_processContext : function ( context ) {
var maskedContext = this . _maskContext ( context ) , Component = this . _currentElement . type ;
return Component . contextTypes && this . _checkContextTypes ( Component . contextTypes , maskedContext , "context" ) ,
maskedContext ;
} ,
_processChildContext : function ( currentContext ) {
var childContext , Component = this . _currentElement . type , inst = this . _instance ;
if ( "function" == typeof inst . getChildContext ) {
ReactInstrumentation . debugTool . onBeginProcessingChildContext ( ) ;
try {
childContext = inst . getChildContext ( ) ;
} finally {
ReactInstrumentation . debugTool . onEndProcessingChildContext ( ) ;
}
invariant ( "object" == typeof Component . childContextTypes , "%s.getChildContext(): childContextTypes must be defined in order to " + "use getChildContext()." , this . getName ( ) || "ReactCompositeComponent" ) ,
this . _checkContextTypes ( Component . childContextTypes , childContext , "child context" ) ;
for ( var name in childContext ) invariant ( name in Component . childContextTypes , '%s.getChildContext(): key "%s" is not defined in childContextTypes.' , this . getName ( ) || "ReactCompositeComponent" , name ) ;
return Object . assign ( { } , currentContext , childContext ) ;
}
var componentName = this . getName ( ) ;
return warningAboutMissingGetChildContext [ componentName ] || ( warningAboutMissingGetChildContext [ componentName ] = ! 0 ,
warning ( ! Component . childContextTypes , "%s.childContextTypes is specified but there is no getChildContext() method " + "on the instance. You can either define getChildContext() on %s or remove " + "childContextTypes from it." , componentName , componentName ) ) ,
currentContext ;
} ,
_checkContextTypes : function ( typeSpecs , values , location ) {
ReactDebugCurrentFrame . current = this . _debugID , checkPropTypes ( typeSpecs , values , location , this . getName ( ) , ReactDebugCurrentFrame . getStackAddendum ) ,
ReactDebugCurrentFrame . current = null ;
} ,
receiveComponent : function ( nextElement , transaction , nextContext ) {
var prevElement = this . _currentElement , prevContext = this . _context ;
this . _pendingElement = null , this . updateComponent ( transaction , prevElement , nextElement , prevContext , nextContext ) ;
} ,
performUpdateIfNecessary : function ( transaction ) {
if ( null != this . _pendingElement ) ReactReconciler _1 . receiveComponent ( this , this . _pendingElement , transaction , this . _context ) ; else if ( null !== this . _pendingStateQueue || this . _pendingForceUpdate ) this . updateComponent ( transaction , this . _currentElement , this . _currentElement , this . _context , this . _context ) ; else {
var callbacks = this . _pendingCallbacks ;
if ( this . _pendingCallbacks = null , callbacks ) for ( var j = 0 ; j < callbacks . length ; j ++ ) transaction . getReactMountReady ( ) . enqueue ( callbacks [ j ] , this . getPublicInstance ( ) ) ;
this . _updateBatchNumber = null ;
}
} ,
updateComponent : function ( transaction , prevParentElement , nextParentElement , prevUnmaskedContext , nextUnmaskedContext ) {
var inst = this . _instance ;
invariant ( null != inst , "Attempted to update component `%s` that has already been unmounted " + "(or failed to mount)." , this . getName ( ) || "ReactCompositeComponent" ) ;
var nextContext , willReceive = ! 1 ;
this . _context === nextUnmaskedContext ? nextContext = inst . context : ( nextContext = this . _processContext ( nextUnmaskedContext ) ,
willReceive = ! 0 ) ;
var prevProps = prevParentElement . props , nextProps = nextParentElement . props ;
if ( prevParentElement !== nextParentElement && ( willReceive = ! 0 ) , willReceive && inst . componentWillReceiveProps ) {
var beforeState = inst . state ;
measureLifeCyclePerf ( function ( ) {
return inst . componentWillReceiveProps ( nextProps , nextContext ) ;
} , this . _debugID , "componentWillReceiveProps" ) ;
var afterState = inst . state ;
beforeState !== afterState && ( inst . state = beforeState , inst . updater . enqueueReplaceState ( inst , afterState ) ,
warning ( ! 1 , "%s.componentWillReceiveProps(): Assigning directly to " + "this.state is deprecated (except inside a component's " + "constructor). Use setState instead." , this . getName ( ) || "ReactCompositeComponent" ) ) ;
}
var callbacks = this . _pendingCallbacks ;
this . _pendingCallbacks = null ;
var nextState = this . _processPendingState ( nextProps , nextContext ) , shouldUpdate = ! 0 ;
if ( ! this . _pendingForceUpdate ) {
var prevState = inst . state ;
shouldUpdate = willReceive || nextState !== prevState , inst . shouldComponentUpdate ? shouldUpdate = measureLifeCyclePerf ( function ( ) {
return inst . shouldComponentUpdate ( nextProps , nextState , nextContext ) ;
} , this . _debugID , "shouldComponentUpdate" ) : this . _compositeType === ReactCompositeComponentTypes$1 . PureClass && ( shouldUpdate = ! shallowEqual ( prevProps , nextProps ) || ! shallowEqual ( inst . state , nextState ) ) ;
}
if ( warning ( void 0 !== shouldUpdate , "%s.shouldComponentUpdate(): Returned undefined instead of a " + "boolean value. Make sure to return true or false." , this . getName ( ) || "ReactCompositeComponent" ) ,
this . _updateBatchNumber = null , shouldUpdate ? ( this . _pendingForceUpdate = ! 1 , this . _performComponentUpdate ( nextParentElement , nextProps , nextState , nextContext , transaction , nextUnmaskedContext ) ) : ( this . _currentElement = nextParentElement ,
this . _context = nextUnmaskedContext , inst . props = nextProps , inst . state = nextState ,
inst . context = nextContext ) , callbacks ) for ( var j = 0 ; j < callbacks . length ; j ++ ) transaction . getReactMountReady ( ) . enqueue ( callbacks [ j ] , this . getPublicInstance ( ) ) ;
} ,
_processPendingState : function ( props , context ) {
var inst = this . _instance , queue = this . _pendingStateQueue , replace = this . _pendingReplaceState ;
if ( this . _pendingReplaceState = ! 1 , this . _pendingStateQueue = null , ! queue ) return inst . state ;
if ( replace && 1 === queue . length ) return queue [ 0 ] ;
for ( var nextState = replace ? queue [ 0 ] : inst . state , dontMutate = ! 0 , i = replace ? 1 : 0 ; i < queue . length ; i ++ ) {
var partial = queue [ i ] , partialState = "function" == typeof partial ? partial . call ( inst , nextState , props , context ) : partial ;
partialState && ( dontMutate ? ( dontMutate = ! 1 , nextState = Object . assign ( { } , nextState , partialState ) ) : Object . assign ( nextState , partialState ) ) ;
}
return nextState ;
} ,
_performComponentUpdate : function ( nextElement , nextProps , nextState , nextContext , transaction , unmaskedContext ) {
var prevProps , prevState , _this2 = this , inst = this . _instance , hasComponentDidUpdate = ! ! inst . componentDidUpdate ;
hasComponentDidUpdate && ( prevProps = inst . props , prevState = inst . state ) , inst . componentWillUpdate && measureLifeCyclePerf ( function ( ) {
return inst . componentWillUpdate ( nextProps , nextState , nextContext ) ;
} , this . _debugID , "componentWillUpdate" ) , this . _currentElement = nextElement , this . _context = unmaskedContext ,
inst . props = nextProps , inst . state = nextState , inst . context = nextContext , inst . unstable _handleError ? this . _updateRenderedComponentWithErrorHandling ( transaction , unmaskedContext ) : this . _updateRenderedComponent ( transaction , unmaskedContext ) ,
hasComponentDidUpdate && transaction . getReactMountReady ( ) . enqueue ( function ( ) {
measureLifeCyclePerf ( inst . componentDidUpdate . bind ( inst , prevProps , prevState ) , _this2 . _debugID , "componentDidUpdate" ) ;
} ) ;
} ,
_updateRenderedComponentWithErrorHandling : function ( transaction , context ) {
var checkpoint = transaction . checkpoint ( ) ;
2017-05-26 17:51:06 +00:00
try {
2017-06-26 22:12:46 +00:00
this . _updateRenderedComponent ( transaction , context ) ;
} catch ( e ) {
transaction . rollback ( checkpoint ) , this . _instance . unstable _handleError ( e ) , this . _pendingStateQueue && ( this . _instance . state = this . _processPendingState ( this . _instance . props , this . _instance . context ) ) ,
checkpoint = transaction . checkpoint ( ) , this . _updateRenderedComponentWithNextElement ( transaction , context , null , ! 0 ) ,
this . _updateRenderedComponent ( transaction , context ) ;
}
} ,
_updateRenderedComponent : function ( transaction , context ) {
var nextRenderedElement = this . _renderValidatedComponent ( ) ;
this . _updateRenderedComponentWithNextElement ( transaction , context , nextRenderedElement , ! 1 ) ;
} ,
_updateRenderedComponentWithNextElement : function ( transaction , context , nextRenderedElement , safely ) {
var prevComponentInstance = this . _renderedComponent , prevRenderedElement = prevComponentInstance . _currentElement , debugID = 0 ;
if ( debugID = this . _debugID , shouldUpdateReactComponent _1 ( prevRenderedElement , nextRenderedElement ) ) ReactReconciler _1 . receiveComponent ( prevComponentInstance , nextRenderedElement , transaction , this . _processChildContext ( context ) ) ; else {
var oldHostNode = ReactReconciler _1 . getHostNode ( prevComponentInstance ) , nodeType = ReactNodeTypes _1 . getType ( nextRenderedElement ) ;
this . _renderedNodeType = nodeType ;
var child = this . _instantiateReactComponent ( nextRenderedElement , nodeType !== ReactNodeTypes _1 . EMPTY ) ;
this . _renderedComponent = child ;
var nextMarkup = ReactReconciler _1 . mountComponent ( child , transaction , this . _hostParent , this . _hostContainerInfo , this . _processChildContext ( context ) , debugID ) ;
if ( ReactReconciler _1 . unmountComponent ( prevComponentInstance , safely , ! 1 ) , 0 !== debugID ) {
var childDebugIDs = 0 !== child . _debugID ? [ child . _debugID ] : [ ] ;
ReactInstrumentation . debugTool . onSetChildren ( debugID , childDebugIDs ) ;
}
this . _replaceNodeWithMarkup ( oldHostNode , nextMarkup , prevComponentInstance ) ;
}
} ,
_replaceNodeWithMarkup : function ( oldHostNode , nextMarkup , prevInstance ) {
ReactComponentEnvironment _1 . replaceNodeWithMarkup ( oldHostNode , nextMarkup , prevInstance ) ;
} ,
_renderValidatedComponentWithoutOwnerOrContext : function ( ) {
var renderedElement , inst = this . _instance ;
return renderedElement = measureLifeCyclePerf ( function ( ) {
return inst . render ( ) ;
} , this . _debugID , "render" ) , void 0 === renderedElement && inst . render . _isMockFunction && ( renderedElement = null ) ,
renderedElement ;
} ,
_renderValidatedComponent : function ( ) {
var renderedElement ;
if ( 0 && this . _compositeType === ReactCompositeComponentTypes$1 . StatelessFunctional ) renderedElement = this . _renderValidatedComponentWithoutOwnerOrContext ( ) ; else {
ReactCurrentOwner$1 . current = this ;
try {
renderedElement = this . _renderValidatedComponentWithoutOwnerOrContext ( ) ;
} finally {
ReactCurrentOwner$1 . current = null ;
}
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
return invariant ( null === renderedElement || ! 1 === renderedElement || React . isValidElement ( renderedElement ) , "%s.render(): A valid React element (or null) must be returned. You may have " + "returned undefined, an array or some other invalid object." , this . getName ( ) || "ReactCompositeComponent" ) ,
renderedElement ;
} ,
attachRef : function ( ref , component ) {
var inst = this . getPublicInstance ( ) ;
invariant ( null != inst , "Stateless function components cannot have refs." ) ;
var publicComponentInstance = component . getPublicInstance ( ) ;
( inst . refs === emptyObject ? inst . refs = { } : inst . refs ) [ ref ] = publicComponentInstance ;
} ,
detachRef : function ( ref ) {
delete this . getPublicInstance ( ) . refs [ ref ] ;
} ,
getName : function ( ) {
var type = this . _currentElement . type , constructor = this . _instance && this . _instance . constructor ;
return type . displayName || constructor && constructor . displayName || type . name || constructor && constructor . name || null ;
} ,
getPublicInstance : function ( ) {
var inst = this . _instance ;
return this . _compositeType === ReactCompositeComponentTypes$1 . StatelessFunctional ? null : inst ;
} ,
_instantiateReactComponent : null
} , ReactCompositeComponent _1 = ReactCompositeComponent , emptyComponentFactory , ReactEmptyComponentInjection = {
injectEmptyComponentFactory : function ( factory ) {
emptyComponentFactory = factory ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
} , ReactEmptyComponent = {
create : function ( instantiate ) {
return emptyComponentFactory ( instantiate ) ;
2017-05-26 17:51:06 +00:00
}
} ;
2017-06-26 22:12:46 +00:00
ReactEmptyComponent . injection = ReactEmptyComponentInjection ;
var ReactEmptyComponent _1 = ReactEmptyComponent , genericComponentClass = null , textComponentClass = null , ReactHostComponentInjection = {
injectGenericComponentClass : function ( componentClass ) {
genericComponentClass = componentClass ;
} ,
injectTextComponentClass : function ( componentClass ) {
textComponentClass = componentClass ;
}
} ;
function createInternalComponent ( element ) {
return invariant ( genericComponentClass , "There is no registered component for the tag %s" , element . type ) ,
new genericComponentClass ( element ) ;
}
function createInstanceForText ( text ) {
return new textComponentClass ( text ) ;
}
function isTextComponent ( component ) {
return component instanceof textComponentClass ;
}
var ReactHostComponent = {
createInternalComponent : createInternalComponent ,
createInstanceForText : createInstanceForText ,
isTextComponent : isTextComponent ,
injection : ReactHostComponentInjection
} , ReactHostComponent _1 = ReactHostComponent , nextDebugID = 1 , ReactCompositeComponentWrapper = function ( element ) {
this . construct ( element ) ;
} ;
function getDeclarationErrorAddendum ( owner ) {
if ( owner ) {
var name = owner . getName ( ) ;
if ( name ) return "\n\nCheck the render method of `" + name + "`." ;
}
return "" ;
}
function isInternalComponentType ( type ) {
return "function" == typeof type && void 0 !== type . prototype && "function" == typeof type . prototype . mountComponent && "function" == typeof type . prototype . receiveComponent ;
}
function instantiateReactComponent ( node , shouldHaveDebugID ) {
var instance ;
if ( null === node || ! 1 === node ) instance = ReactEmptyComponent _1 . create ( instantiateReactComponent ) ; else if ( "object" == typeof node ) {
var element = node , type = element . type ;
if ( "function" != typeof type && "string" != typeof type ) {
var info = "" ;
( void 0 === type || "object" == typeof type && null !== type && 0 === Object . keys ( type ) . length ) && ( info += " You likely forgot to export your component from the file " + "it's defined in." ) ,
info += getDeclarationErrorAddendum ( element . _owner ) , 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 ) ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
"string" == typeof element . type ? instance = ReactHostComponent _1 . createInternalComponent ( element ) : isInternalComponentType ( element . type ) ? ( instance = new element . type ( element ) ,
instance . getHostNode || ( instance . getHostNode = instance . getNativeNode ) ) : instance = new ReactCompositeComponentWrapper ( element ) ;
} else "string" == typeof node || "number" == typeof node ? instance = ReactHostComponent _1 . createInstanceForText ( node ) : invariant ( ! 1 , "Encountered invalid React node of type %s" , typeof node ) ;
return warning ( "function" == typeof instance . mountComponent && "function" == typeof instance . receiveComponent && "function" == typeof instance . getHostNode && "function" == typeof instance . unmountComponent , "Only React Components can be mounted." ) ,
instance . _mountIndex = 0 , instance . _mountImage = null , instance . _debugID = shouldHaveDebugID ? nextDebugID ++ : 0 ,
Object . preventExtensions && Object . preventExtensions ( instance ) , instance ;
}
Object . assign ( ReactCompositeComponentWrapper . prototype , ReactCompositeComponent _1 , {
_instantiateReactComponent : instantiateReactComponent
2017-05-26 17:51:06 +00:00
} ) ;
2017-06-26 22:12:46 +00:00
var instantiateReactComponent _1 = instantiateReactComponent , DevOnlyStubShim = null , ReactNativeFeatureFlags = require ( "ReactNativeFeatureFlags" ) , ReactCurrentOwner$2 = ReactGlobalSharedState _1 . ReactCurrentOwner , injectedFindNode = ReactNativeFeatureFlags . useFiber ? function ( fiber ) {
return DevOnlyStubShim . findHostInstance ( fiber ) ;
} : function ( instance ) {
return instance ;
2017-06-12 21:02:54 +00:00
} ;
2017-06-26 22:12:46 +00:00
function findNodeHandle ( componentOrHandle ) {
var owner = ReactCurrentOwner$2 . current ;
if ( null !== owner && ( warning ( owner . _warnedAboutRefsInRender , "%s is accessing findNodeHandle inside its render(). " + "render() should be a pure function of props and state. It should " + "never access something that requires stale data from the previous " + "render, such as refs. Move this logic to componentDidMount and " + "componentDidUpdate instead." , owner . getName ( ) || "A component" ) ,
owner . _warnedAboutRefsInRender = ! 0 ) , null == componentOrHandle ) return null ;
if ( "number" == typeof componentOrHandle ) return componentOrHandle ;
var component = componentOrHandle , internalInstance = ReactInstanceMap _1 . get ( component ) ;
return internalInstance ? injectedFindNode ( internalInstance ) : component || ( invariant ( "object" == typeof component && ( "_rootNodeID" in component || "_nativeTag" in component ) || null != component . render && "function" == typeof component . render , "findNodeHandle(...): Argument is not a component " + "(type: %s, keys: %s)" , typeof component , Object . keys ( component ) ) ,
void invariant ( ! 1 , "findNodeHandle(...): Unable to find node handle for unmounted " + "component." ) ) ;
}
var findNodeHandle _1 = findNodeHandle , TopLevelWrapper = function ( ) { } ;
TopLevelWrapper . prototype . isReactComponent = { } , TopLevelWrapper . displayName = "TopLevelWrapper" ,
TopLevelWrapper . prototype . render = function ( ) {
return this . props . child ;
} , TopLevelWrapper . isReactTopLevelWrapper = ! 0 ;
function mountComponentIntoNode ( componentInstance , containerTag , transaction ) {
var markup = ReactReconciler _1 . mountComponent ( componentInstance , transaction , null , ReactNativeContainerInfo _1 ( containerTag ) , emptyObject , 0 ) ;
componentInstance . _renderedComponent . _topLevelWrapper = componentInstance , ReactNativeMount . _mountImageIntoNode ( markup , containerTag ) ;
}
function batchedMountComponentIntoNode ( componentInstance , containerTag ) {
var transaction = ReactUpdates _1 . ReactReconcileTransaction . getPooled ( ) ;
transaction . perform ( mountComponentIntoNode , null , componentInstance , containerTag , transaction ) ,
ReactUpdates _1 . ReactReconcileTransaction . release ( transaction ) ;
}
var ReactNativeMount = {
_instancesByContainerID : { } ,
findNodeHandle : findNodeHandle _1 ,
renderComponent : function ( nextElement , containerTag , callback ) {
var nextWrappedElement = React . createElement ( TopLevelWrapper , {
child : nextElement
} ) , topRootNodeID = containerTag , prevComponent = ReactNativeMount . _instancesByContainerID [ topRootNodeID ] ;
if ( prevComponent ) {
var prevWrappedElement = prevComponent . _currentElement , prevElement = prevWrappedElement . props . child ;
if ( shouldUpdateReactComponent _1 ( prevElement , nextElement ) ) return ReactUpdateQueue _1 . enqueueElementInternal ( prevComponent , nextWrappedElement , emptyObject ) ,
callback && ReactUpdateQueue _1 . enqueueCallbackInternal ( prevComponent , callback ) ,
prevComponent ;
ReactNativeMount . unmountComponentAtNode ( containerTag ) ;
}
if ( ! ReactNativeTagHandles _1 . reactTagIsNativeTopRootID ( containerTag ) ) return console . error ( "You cannot render into anything but a top root" ) ,
null ;
ReactNativeTagHandles _1 . assertRootTag ( containerTag ) ;
var instance = instantiateReactComponent _1 ( nextWrappedElement , ! 1 ) ;
if ( ReactNativeMount . _instancesByContainerID [ containerTag ] = instance , callback ) {
var nonNullCallback = callback ;
instance . _pendingCallbacks = [ function ( ) {
nonNullCallback . call ( instance . _renderedComponent . getPublicInstance ( ) ) ;
} ] ;
}
return ReactUpdates _1 . batchedUpdates ( batchedMountComponentIntoNode , instance , containerTag ) ,
instance . _renderedComponent . getPublicInstance ( ) ;
} ,
_mountImageIntoNode : function ( mountImage , containerID ) {
var childTag = mountImage ;
UIManager . setChildren ( containerID , [ childTag ] ) ;
} ,
unmountComponentAtNodeAndRemoveContainer : function ( containerTag ) {
ReactNativeMount . unmountComponentAtNode ( containerTag ) , UIManager . removeRootView ( containerTag ) ;
} ,
unmountComponentAtNode : function ( containerTag ) {
if ( ! ReactNativeTagHandles _1 . reactTagIsNativeTopRootID ( containerTag ) ) return console . error ( "You cannot render into anything but a top root" ) ,
! 1 ;
var instance = ReactNativeMount . _instancesByContainerID [ containerTag ] ;
return ! ! instance && ( ReactInstrumentation . debugTool . onBeginFlush ( ) , ReactNativeMount . unmountComponentFromNode ( instance , containerTag ) ,
delete ReactNativeMount . _instancesByContainerID [ containerTag ] , ReactInstrumentation . debugTool . onEndFlush ( ) ,
! 0 ) ;
} ,
unmountComponentFromNode : function ( instance , containerID ) {
ReactReconciler _1 . unmountComponent ( instance ) , UIManager . removeSubviewsFromContainerWithID ( containerID ) ;
}
} , ReactNativeMount _1 = ReactNativeMount , RESET _BATCHED _UPDATES = {
initialize : emptyFunction ,
close : function ( ) {
ReactDefaultBatchingStrategy . isBatchingUpdates = ! 1 ;
}
} , FLUSH _BATCHED _UPDATES = {
initialize : emptyFunction ,
close : ReactUpdates _1 . flushBatchedUpdates . bind ( ReactUpdates _1 )
} , TRANSACTION _WRAPPERS$1 = [ FLUSH _BATCHED _UPDATES , RESET _BATCHED _UPDATES ] ;
function ReactDefaultBatchingStrategyTransaction ( ) {
this . reinitializeTransaction ( ) ;
}
Object . assign ( ReactDefaultBatchingStrategyTransaction . prototype , Transaction , {
getTransactionWrappers : function ( ) {
return TRANSACTION _WRAPPERS$1 ;
}
} ) ;
var transaction = new ReactDefaultBatchingStrategyTransaction ( ) , ReactDefaultBatchingStrategy = {
isBatchingUpdates : ! 1 ,
batchedUpdates : function ( callback , a , b , c , d , e ) {
var alreadyBatchingUpdates = ReactDefaultBatchingStrategy . isBatchingUpdates ;
return ReactDefaultBatchingStrategy . isBatchingUpdates = ! 0 , alreadyBatchingUpdates ? callback ( a , b , c , d , e ) : transaction . perform ( callback , null , a , b , c , d , e ) ;
}
} , ReactDefaultBatchingStrategy _1 = ReactDefaultBatchingStrategy , dangerouslyProcessChildrenUpdates = function ( inst , childrenUpdates ) {
if ( childrenUpdates . length ) {
for ( var moveFromIndices , moveToIndices , addChildTags , addAtIndices , removeAtIndices , containerTag = ReactNativeComponentTree _1 . getNodeFromInstance ( inst ) , i = 0 ; i < childrenUpdates . length ; i ++ ) {
var update = childrenUpdates [ i ] ;
if ( "MOVE_EXISTING" === update . type ) ( moveFromIndices || ( moveFromIndices = [ ] ) ) . push ( update . fromIndex ) ,
( moveToIndices || ( moveToIndices = [ ] ) ) . push ( update . toIndex ) ; else if ( "REMOVE_NODE" === update . type ) ( removeAtIndices || ( removeAtIndices = [ ] ) ) . push ( update . fromIndex ) ; else if ( "INSERT_MARKUP" === update . type ) {
var mountImage = update . content , tag = mountImage ;
( addAtIndices || ( addAtIndices = [ ] ) ) . push ( update . toIndex ) , ( addChildTags || ( addChildTags = [ ] ) ) . push ( tag ) ;
2017-05-26 17:51:06 +00:00
}
}
2017-06-26 22:12:46 +00:00
UIManager . manageChildren ( containerTag , moveFromIndices , moveToIndices , addChildTags , addAtIndices , removeAtIndices ) ;
}
} , ReactNativeDOMIDOperations = {
dangerouslyProcessChildrenUpdates : dangerouslyProcessChildrenUpdates ,
dangerouslyReplaceNodeWithMarkupByID : function ( id , mountImage ) {
var oldTag = id ;
UIManager . replaceExistingNonRootView ( oldTag , mountImage ) ;
}
} , ReactNativeDOMIDOperations _1 = ReactNativeDOMIDOperations ;
function validateCallback ( callback ) {
invariant ( ! callback || "function" == typeof callback , "Invalid argument passed as callback. Expected a function. Instead " + "received: %s" , callback ) ;
}
var validateCallback _1 = validateCallback ;
function _classCallCheck ( instance , Constructor ) {
if ( ! ( instance instanceof Constructor ) ) throw new TypeError ( "Cannot call a class as a function" ) ;
}
var CallbackQueue = function ( ) {
function CallbackQueue ( arg ) {
_classCallCheck ( this , CallbackQueue ) , this . _callbacks = null , this . _contexts = null ,
this . _arg = arg ;
}
return CallbackQueue . prototype . enqueue = function ( callback , context ) {
this . _callbacks = this . _callbacks || [ ] , this . _callbacks . push ( callback ) , this . _contexts = this . _contexts || [ ] ,
this . _contexts . push ( context ) ;
} , CallbackQueue . prototype . notifyAll = function ( ) {
var callbacks = this . _callbacks , contexts = this . _contexts , arg = this . _arg ;
if ( callbacks && contexts ) {
invariant ( callbacks . length === contexts . length , "Mismatched list of contexts in callback queue" ) ,
this . _callbacks = null , this . _contexts = null ;
for ( var i = 0 ; i < callbacks . length ; i ++ ) validateCallback _1 ( callbacks [ i ] ) , callbacks [ i ] . call ( contexts [ i ] , arg ) ;
callbacks . length = 0 , contexts . length = 0 ;
}
} , CallbackQueue . prototype . checkpoint = function ( ) {
return this . _callbacks ? this . _callbacks . length : 0 ;
} , CallbackQueue . prototype . rollback = function ( len ) {
this . _callbacks && this . _contexts && ( this . _callbacks . length = len , this . _contexts . length = len ) ;
} , CallbackQueue . prototype . reset = function ( ) {
this . _callbacks = null , this . _contexts = null ;
} , CallbackQueue . prototype . destructor = function ( ) {
this . reset ( ) ;
} , CallbackQueue ;
} ( ) , CallbackQueue _1 = PooledClass _1 . addPoolingTo ( CallbackQueue ) , ON _DOM _READY _QUEUEING = {
initialize : function ( ) {
this . reactMountReady . reset ( ) ;
} ,
close : function ( ) {
this . reactMountReady . notifyAll ( ) ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
} , TRANSACTION _WRAPPERS$2 = [ ON _DOM _READY _QUEUEING ] ;
TRANSACTION _WRAPPERS$2 . push ( {
initialize : ReactInstrumentation . debugTool . onBeginFlush ,
close : ReactInstrumentation . debugTool . onEndFlush
} ) ;
function ReactNativeReconcileTransaction ( ) {
this . reinitializeTransaction ( ) , this . reactMountReady = CallbackQueue _1 . getPooled ( null ) ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
var Mixin = {
getTransactionWrappers : function ( ) {
return TRANSACTION _WRAPPERS$2 ;
} ,
getReactMountReady : function ( ) {
return this . reactMountReady ;
} ,
getUpdateQueue : function ( ) {
return ReactUpdateQueue _1 ;
} ,
checkpoint : function ( ) {
return this . reactMountReady . checkpoint ( ) ;
} ,
rollback : function ( checkpoint ) {
this . reactMountReady . rollback ( checkpoint ) ;
} ,
destructor : function ( ) {
CallbackQueue _1 . release ( this . reactMountReady ) , this . reactMountReady = null ;
2017-05-26 17:51:06 +00:00
}
} ;
2017-06-26 22:12:46 +00:00
Object . assign ( ReactNativeReconcileTransaction . prototype , Transaction , ReactNativeReconcileTransaction , Mixin ) ,
PooledClass _1 . addPoolingTo ( ReactNativeReconcileTransaction ) ;
var ReactNativeReconcileTransaction _1 = ReactNativeReconcileTransaction , ReactNativeComponentEnvironment = {
processChildrenUpdates : ReactNativeDOMIDOperations _1 . dangerouslyProcessChildrenUpdates ,
replaceNodeWithMarkup : ReactNativeDOMIDOperations _1 . dangerouslyReplaceNodeWithMarkupByID ,
clearNode : function ( ) { } ,
ReactReconcileTransaction : ReactNativeReconcileTransaction _1
} , ReactNativeComponentEnvironment _1 = ReactNativeComponentEnvironment , ReactNativeTextComponent = function ( text ) {
this . _currentElement = text , this . _stringText = "" + text , this . _hostParent = null ,
this . _rootNodeID = 0 ;
} ;
Object . assign ( ReactNativeTextComponent . prototype , {
mountComponent : function ( transaction , hostParent , hostContainerInfo , context ) {
invariant ( context . isInAParentText , 'RawText "%s" must be wrapped in an explicit <Text> component.' , this . _stringText ) ,
this . _hostParent = hostParent ;
var tag = ReactNativeTagHandles _1 . allocateTag ( ) ;
this . _rootNodeID = tag ;
var nativeTopRootTag = hostContainerInfo . _tag ;
return UIManager . createView ( tag , "RCTRawText" , nativeTopRootTag , {
text : this . _stringText
} ) , ReactNativeComponentTree _1 . precacheNode ( this , tag ) , tag ;
} ,
getHostNode : function ( ) {
return this . _rootNodeID ;
} ,
receiveComponent : function ( nextText , transaction , context ) {
if ( nextText !== this . _currentElement ) {
this . _currentElement = nextText ;
var nextStringText = "" + nextText ;
nextStringText !== this . _stringText && ( this . _stringText = nextStringText , UIManager . updateView ( this . _rootNodeID , "RCTRawText" , {
text : this . _stringText
} ) ) ;
}
} ,
unmountComponent : function ( ) {
ReactNativeComponentTree _1 . uncacheNode ( this ) , this . _currentElement = null , this . _stringText = null ,
this . _rootNodeID = 0 ;
}
} ) ;
var ReactNativeTextComponent _1 = ReactNativeTextComponent , ReactSimpleEmptyComponent = function ( placeholderElement , instantiate ) {
this . _currentElement = null , this . _renderedComponent = instantiate ( placeholderElement ) ;
} ;
Object . assign ( ReactSimpleEmptyComponent . prototype , {
mountComponent : function ( transaction , hostParent , hostContainerInfo , context , parentDebugID ) {
return ReactReconciler _1 . mountComponent ( this . _renderedComponent , transaction , hostParent , hostContainerInfo , context , parentDebugID ) ;
} ,
receiveComponent : function ( ) { } ,
getHostNode : function ( ) {
return ReactReconciler _1 . getHostNode ( this . _renderedComponent ) ;
} ,
unmountComponent : function ( safely , skipLifecycle ) {
ReactReconciler _1 . unmountComponent ( this . _renderedComponent , safely , skipLifecycle ) ,
this . _renderedComponent = null ;
}
} ) ;
var ReactSimpleEmptyComponent _1 = ReactSimpleEmptyComponent ;
function inject$1 ( ) {
ReactGenericBatching _1 . injection . injectStackBatchedUpdates ( ReactUpdates _1 . batchedUpdates ) ,
ReactUpdates _1 . injection . injectReconcileTransaction ( ReactNativeComponentEnvironment _1 . ReactReconcileTransaction ) ,
ReactUpdates _1 . injection . injectBatchingStrategy ( ReactDefaultBatchingStrategy _1 ) ,
ReactComponentEnvironment _1 . injection . injectEnvironment ( ReactNativeComponentEnvironment _1 ) ;
var EmptyComponent = function ( instantiate ) {
var View = require ( "View" ) ;
return new ReactSimpleEmptyComponent _1 ( React . createElement ( View , {
collapsable : ! 0 ,
style : {
position : "absolute"
}
} ) , instantiate ) ;
} ;
ReactEmptyComponent _1 . injection . injectEmptyComponentFactory ( EmptyComponent ) , ReactHostComponent _1 . injection . injectTextComponentClass ( ReactNativeTextComponent _1 ) ,
ReactHostComponent _1 . injection . injectGenericComponentClass ( function ( tag ) {
var info = "" ;
"string" == typeof tag && /^[a-z]/ . test ( tag ) && ( info += " Each component name should start with an uppercase letter." ) ,
invariant ( ! 1 , "Expected a component class, got %s.%s" , tag , info ) ;
} ) ;
2017-06-09 02:01:23 +00:00
}
2017-06-26 22:12:46 +00:00
var ReactNativeStackInjection = {
inject : inject$1
} ;
function getComponentName ( instanceOrFiber ) {
if ( "function" == typeof instanceOrFiber . getName ) {
return instanceOrFiber . getName ( ) ;
2017-06-09 02:01:23 +00:00
}
2017-06-26 22:12:46 +00:00
if ( "number" == typeof instanceOrFiber . tag ) {
var fiber = instanceOrFiber , type = fiber . type ;
if ( "string" == typeof type ) return type ;
if ( "function" == typeof type ) return type . displayName || type . name ;
}
return null ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
var getComponentName _1 = getComponentName , getInspectorDataForViewTag = void 0 , traverseOwnerTreeUp = function ( hierarchy , instance ) {
instance && ( hierarchy . unshift ( instance ) , traverseOwnerTreeUp ( hierarchy , instance . _currentElement . _owner ) ) ;
} , getOwnerHierarchy = function ( instance ) {
var hierarchy = [ ] ;
return traverseOwnerTreeUp ( hierarchy , instance ) , hierarchy ;
} , lastNotNativeInstance = function ( hierarchy ) {
for ( var i = hierarchy . length - 1 ; i > 1 ; i -- ) {
var instance = hierarchy [ i ] ;
if ( ! instance . viewConfig ) return instance ;
}
return hierarchy [ 0 ] ;
} , getHostProps = function ( component ) {
var instance = component . _instance ;
return instance ? instance . props || emptyObject : emptyObject ;
} , createHierarchy = function ( componentHierarchy ) {
return componentHierarchy . map ( function ( component ) {
return {
name : getComponentName _1 ( component ) ,
getInspectorData : function ( ) {
return {
measure : function ( callback ) {
return UIManager . measure ( component . getHostNode ( ) , callback ) ;
} ,
props : getHostProps ( component ) ,
source : component . _currentElement && component . _currentElement . _source
} ;
}
} ;
} ) ;
2017-05-26 17:51:06 +00:00
} ;
2017-06-26 22:12:46 +00:00
getInspectorDataForViewTag = function ( viewTag ) {
var component = ReactNativeComponentTree _1 . getClosestInstanceFromNode ( viewTag ) ;
if ( ! component ) return {
hierarchy : [ ] ,
props : emptyObject ,
selection : null ,
source : null
} ;
var componentHierarchy = getOwnerHierarchy ( component ) , instance = lastNotNativeInstance ( componentHierarchy ) , hierarchy = createHierarchy ( componentHierarchy ) , props = getHostProps ( instance ) , source = instance . _currentElement && instance . _currentElement . _source ;
return {
hierarchy : hierarchy ,
props : props ,
selection : componentHierarchy . indexOf ( instance ) ,
source : source
} ;
2017-05-26 17:51:06 +00:00
} ;
2017-06-26 22:12:46 +00:00
var ReactNativeStackInspector = {
getInspectorDataForViewTag : getInspectorDataForViewTag
} , findNumericNodeHandleStack = function ( componentOrHandle ) {
var nodeHandle = findNodeHandle _1 ( componentOrHandle ) ;
return null == nodeHandle || "number" == typeof nodeHandle ? nodeHandle : nodeHandle . getHostNode ( ) ;
} ;
function _classCallCheck$2 ( instance , Constructor ) {
if ( ! ( instance instanceof Constructor ) ) throw new TypeError ( "Cannot call a class as a function" ) ;
}
var objects = { } , uniqueID = 1 , emptyObject$3 = { } , ReactNativePropRegistry = function ( ) {
function ReactNativePropRegistry ( ) {
_classCallCheck$2 ( this , ReactNativePropRegistry ) ;
}
return ReactNativePropRegistry . register = function ( object ) {
var id = ++ uniqueID ;
return Object . freeze ( object ) , 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-06-26 22:12: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 ) ;
}
} , 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 ) ;
}
} ;
}
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-06-26 22:12:46 +00:00
function warnForStyleProps ( 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-06-26 22:12:46 +00:00
var NativeMethodsMixinUtils = {
mountSafeCallback : mountSafeCallback$1 ,
throwOnStylesProp : throwOnStylesProp ,
warnForStyleProps : warnForStyleProps
2017-05-26 17:51:06 +00:00
} ;
2017-06-26 22:12:46 +00:00
function _classCallCheck$1 ( 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 ) ;
}
var ReactNativeFeatureFlags$1 = require ( "ReactNativeFeatureFlags" ) , mountSafeCallback = NativeMethodsMixinUtils . mountSafeCallback , findNumericNodeHandle = ReactNativeFeatureFlags$1 . useFiber ? DevOnlyStubShim : findNumericNodeHandleStack , ReactNativeComponent = function ( _React$Component ) {
_inherits ( ReactNativeComponent , _React$Component ) ;
function ReactNativeComponent ( ) {
return _classCallCheck$1 ( 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 ) {
UIManager . measure ( findNumericNodeHandle ( this ) , mountSafeCallback ( this , callback ) ) ;
} , ReactNativeComponent . prototype . measureInWindow = function ( callback ) {
UIManager . measureInWindow ( findNumericNodeHandle ( this ) , mountSafeCallback ( this , callback ) ) ;
} , ReactNativeComponent . prototype . measureLayout = function ( relativeToNativeNode , onSuccess , onFail ) {
UIManager . measureLayout ( findNumericNodeHandle ( this ) , relativeToNativeNode , mountSafeCallback ( this , onFail ) , mountSafeCallback ( this , onSuccess ) ) ;
} , ReactNativeComponent . prototype . setNativeProps = function ( nativeProps ) {
injectedSetNativeProps ( this , nativeProps ) ;
} , ReactNativeComponent ;
} ( React . Component ) ;
function setNativePropsFiber ( componentOrHandle , nativeProps ) {
var maybeInstance = void 0 ;
try {
maybeInstance = findNodeHandle _1 ( componentOrHandle ) ;
} catch ( error ) { }
if ( null != maybeInstance ) {
var viewConfig = maybeInstance . viewConfig , updatePayload = ReactNativeAttributePayload _1 . create ( nativeProps , viewConfig . validAttributes ) ;
UIManager . updateView ( maybeInstance . _nativeTag , viewConfig . uiViewClassName , updatePayload ) ;
}
}
function setNativePropsStack ( componentOrHandle , nativeProps ) {
var maybeInstance = findNodeHandle _1 ( componentOrHandle ) ;
if ( null != maybeInstance ) {
var viewConfig = void 0 ;
if ( void 0 !== maybeInstance . viewConfig ) viewConfig = maybeInstance . viewConfig ; else if ( void 0 !== maybeInstance . _instance && void 0 !== maybeInstance . _instance . viewConfig ) viewConfig = maybeInstance . _instance . viewConfig ; else {
for ( ; void 0 !== maybeInstance . _renderedComponent ; ) maybeInstance = maybeInstance . _renderedComponent ;
viewConfig = maybeInstance . viewConfig ;
}
var tag = "function" == typeof maybeInstance . getHostNode ? maybeInstance . getHostNode ( ) : maybeInstance . _rootNodeID , updatePayload = ReactNativeAttributePayload _1 . create ( nativeProps , viewConfig . validAttributes ) ;
UIManager . updateView ( tag , viewConfig . uiViewClassName , updatePayload ) ;
}
}
var injectedSetNativeProps = void 0 ;
injectedSetNativeProps = ReactNativeFeatureFlags$1 . useFiber ? setNativePropsFiber : setNativePropsStack ;
var ReactNativeComponent _1 = ReactNativeComponent , ReactNativeFeatureFlags$2 = require ( "ReactNativeFeatureFlags" ) , mountSafeCallback$2 = NativeMethodsMixinUtils . mountSafeCallback , throwOnStylesProp$1 = NativeMethodsMixinUtils . throwOnStylesProp , warnForStyleProps$1 = NativeMethodsMixinUtils . warnForStyleProps , findNumericNodeHandle$1 = ReactNativeFeatureFlags$2 . useFiber ? DevOnlyStubShim : findNumericNodeHandleStack , NativeMethodsMixin = {
measure : function ( callback ) {
UIManager . measure ( findNumericNodeHandle$1 ( this ) , mountSafeCallback$2 ( this , callback ) ) ;
} ,
measureInWindow : function ( callback ) {
UIManager . measureInWindow ( findNumericNodeHandle$1 ( this ) , mountSafeCallback$2 ( this , callback ) ) ;
} ,
measureLayout : function ( relativeToNativeNode , onSuccess , onFail ) {
UIManager . measureLayout ( findNumericNodeHandle$1 ( this ) , relativeToNativeNode , mountSafeCallback$2 ( this , onFail ) , mountSafeCallback$2 ( this , onSuccess ) ) ;
} ,
setNativeProps : function ( nativeProps ) {
injectedSetNativeProps$1 ( this , nativeProps ) ;
} ,
focus : function ( ) {
TextInputState . focusTextInput ( findNumericNodeHandle$1 ( this ) ) ;
} ,
blur : function ( ) {
TextInputState . blurTextInput ( findNumericNodeHandle$1 ( this ) ) ;
}
2017-05-26 17:51:06 +00:00
} ;
2017-06-26 22:12:46 +00:00
function setNativePropsFiber$1 ( componentOrHandle , nativeProps ) {
var maybeInstance = void 0 ;
try {
maybeInstance = findNodeHandle _1 ( componentOrHandle ) ;
} catch ( error ) { }
if ( null != maybeInstance ) {
var viewConfig = maybeInstance . viewConfig ;
warnForStyleProps$1 ( nativeProps , viewConfig . validAttributes ) ;
var updatePayload = ReactNativeAttributePayload _1 . create ( nativeProps , viewConfig . validAttributes ) ;
UIManager . updateView ( maybeInstance . _nativeTag , viewConfig . uiViewClassName , updatePayload ) ;
}
}
function setNativePropsStack$1 ( componentOrHandle , nativeProps ) {
var maybeInstance = findNodeHandle _1 ( componentOrHandle ) ;
if ( null != maybeInstance ) {
var viewConfig = void 0 ;
if ( void 0 !== maybeInstance . viewConfig ) viewConfig = maybeInstance . viewConfig ; else if ( void 0 !== maybeInstance . _instance && void 0 !== maybeInstance . _instance . viewConfig ) viewConfig = maybeInstance . _instance . viewConfig ; else {
for ( ; void 0 !== maybeInstance . _renderedComponent ; ) maybeInstance = maybeInstance . _renderedComponent ;
viewConfig = maybeInstance . viewConfig ;
}
var tag = "function" == typeof maybeInstance . getHostNode ? maybeInstance . getHostNode ( ) : maybeInstance . _rootNodeID ;
warnForStyleProps$1 ( nativeProps , viewConfig . validAttributes ) ;
var updatePayload = ReactNativeAttributePayload _1 . create ( nativeProps , viewConfig . validAttributes ) ;
UIManager . updateView ( tag , viewConfig . uiViewClassName , updatePayload ) ;
}
}
var injectedSetNativeProps$1 = void 0 ;
injectedSetNativeProps$1 = ReactNativeFeatureFlags$2 . useFiber ? setNativePropsFiber$1 : setNativePropsStack$1 ;
var NativeMethodsMixin _DEV = NativeMethodsMixin ;
invariant ( ! NativeMethodsMixin _DEV . componentWillMount && ! NativeMethodsMixin _DEV . componentWillReceiveProps , "Do not override existing functions." ) ,
NativeMethodsMixin _DEV . componentWillMount = function ( ) {
throwOnStylesProp$1 ( this , this . props ) ;
} , NativeMethodsMixin _DEV . componentWillReceiveProps = function ( newProps ) {
throwOnStylesProp$1 ( this , newProps ) ;
2017-05-26 17:51:06 +00:00
} ;
2017-06-26 22:12:46 +00:00
var NativeMethodsMixin _1 = NativeMethodsMixin , TouchHistoryMath = {
centroidDimension : function ( touchHistory , touchesChangedAfter , isXAxis , ofCurrent ) {
var touchBank = touchHistory . touchBank , total = 0 , count = 0 , oneTouchData = 1 === touchHistory . numberActiveTouches ? touchHistory . touchBank [ touchHistory . indexOfSingleActiveTouch ] : null ;
if ( null !== oneTouchData ) oneTouchData . touchActive && oneTouchData . currentTimeStamp > touchesChangedAfter && ( total += ofCurrent && isXAxis ? oneTouchData . currentPageX : ofCurrent && ! isXAxis ? oneTouchData . currentPageY : ! ofCurrent && isXAxis ? oneTouchData . previousPageX : oneTouchData . previousPageY ,
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 ;
toAdd = ofCurrent && isXAxis ? touchTrack . currentPageX : ofCurrent && ! isXAxis ? touchTrack . currentPageY : ! ofCurrent && isXAxis ? touchTrack . previousPageX : touchTrack . previousPageY ,
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
} , TouchHistoryMath _1 = TouchHistoryMath ;
function escape ( key ) {
var escaperLookup = {
"=" : "=0" ,
":" : "=2"
} ;
return "$" + ( "" + key ) . replace ( /[=:]/g , function ( match ) {
return escaperLookup [ match ] ;
} ) ;
}
var unescapeInDev = emptyFunction ;
unescapeInDev = function ( key ) {
var unescapeRegex = /(=0|=2)/g , unescaperLookup = {
"=0" : "=" ,
"=2" : ":"
} ;
return ( "" + ( "." === key [ 0 ] && "$" === key [ 1 ] ? key . substring ( 2 ) : key . substring ( 1 ) ) ) . replace ( unescapeRegex , function ( match ) {
return unescaperLookup [ match ] ;
} ) ;
2017-05-26 17:51:06 +00:00
} ;
2017-06-26 22:12:46 +00:00
var KeyEscapeUtils = {
escape : escape ,
unescapeInDev : unescapeInDev
} , KeyEscapeUtils _1 = KeyEscapeUtils , ITERATOR _SYMBOL = "function" == typeof Symbol && Symbol . iterator , FAUX _ITERATOR _SYMBOL = "@@iterator" , REACT _ELEMENT _TYPE = "function" == typeof Symbol && Symbol . for && Symbol . for ( "react.element" ) || 60103 , getCurrentStackAddendum = ReactGlobalSharedState _1 . ReactComponentTreeHook . getCurrentStackAddendum , SEPARATOR = "." , SUBSEPARATOR = ":" , didWarnAboutMaps = ! 1 ;
function getComponentKey ( component , index ) {
return component && "object" == typeof component && null != component . key ? KeyEscapeUtils _1 . escape ( component . key ) : index . toString ( 36 ) ;
}
function traverseStackChildrenImpl ( children , nameSoFar , callback , traverseContext ) {
var type = typeof children ;
if ( "undefined" !== type && "boolean" !== type || ( children = null ) , null === children || "string" === type || "number" === type || "object" === type && children . $$typeof === REACT _ELEMENT _TYPE ) return callback ( traverseContext , children , "" === nameSoFar ? SEPARATOR + getComponentKey ( children , 0 ) : nameSoFar ) ,
1 ;
var child , nextName , subtreeCount = 0 , nextNamePrefix = "" === nameSoFar ? SEPARATOR : nameSoFar + SUBSEPARATOR ;
if ( Array . isArray ( children ) ) for ( var i = 0 ; i < children . length ; i ++ ) child = children [ i ] ,
nextName = nextNamePrefix + getComponentKey ( child , i ) , subtreeCount += traverseStackChildrenImpl ( child , nextName , callback , traverseContext ) ; else {
var iteratorFn = ITERATOR _SYMBOL && children [ ITERATOR _SYMBOL ] || children [ FAUX _ITERATOR _SYMBOL ] ;
if ( "function" == typeof iteratorFn ) {
iteratorFn === children . entries && ( warning ( didWarnAboutMaps , "Using Maps as children is unsupported and will likely yield " + "unexpected results. Convert it to a sequence/iterable of keyed " + "ReactElements instead.%s" , getCurrentStackAddendum ( ) ) ,
didWarnAboutMaps = ! 0 ) ;
for ( var step , iterator = iteratorFn . call ( children ) , ii = 0 ; ! ( step = iterator . next ( ) ) . done ; ) child = step . value ,
nextName = nextNamePrefix + getComponentKey ( child , ii ++ ) , subtreeCount += traverseStackChildrenImpl ( child , nextName , callback , traverseContext ) ;
} else if ( "object" === type ) {
var addendum = "" ;
addendum = " If you meant to render a collection of children, use an array " + "instead." + getCurrentStackAddendum ( ) ;
var childrenString = "" + children ;
invariant ( ! 1 , "Objects are not valid as a React child (found: %s).%s" , "[object Object]" === childrenString ? "object with keys {" + Object . keys ( children ) . join ( ", " ) + "}" : childrenString , addendum ) ;
}
}
return subtreeCount ;
}
function traverseStackChildren ( children , callback , traverseContext ) {
return null == children ? 0 : traverseStackChildrenImpl ( children , "" , callback , traverseContext ) ;
}
var traverseStackChildren _1 = traverseStackChildren , ReactComponentTreeHook$2 ;
"undefined" != typeof process && process . env && "development" == "test" && ( ReactComponentTreeHook$2 = ReactGlobalSharedState _1 . ReactComponentTreeHook ) ;
function instantiateChild ( childInstances , child , name , selfDebugID ) {
var keyUnique = void 0 === childInstances [ name ] ;
ReactComponentTreeHook$2 || ( ReactComponentTreeHook$2 = ReactGlobalSharedState _1 . ReactComponentTreeHook ) ,
keyUnique || warning ( ! 1 , "flattenChildren(...): Encountered two children with the same key, " + "`%s`. Child keys must be unique; when two children share a key, only " + "the first child will be used.%s" , KeyEscapeUtils _1 . unescapeInDev ( name ) , ReactComponentTreeHook$2 . getStackAddendumByID ( selfDebugID ) ) ,
null != child && keyUnique && ( childInstances [ name ] = instantiateReactComponent _1 ( child , ! 0 ) ) ;
}
var ReactChildReconciler = {
instantiateChildren : function ( nestedChildNodes , transaction , context , selfDebugID ) {
if ( null == nestedChildNodes ) return null ;
var childInstances = { } ;
return traverseStackChildren _1 ( nestedChildNodes , function ( childInsts , child , name ) {
return instantiateChild ( childInsts , child , name , selfDebugID ) ;
} , childInstances ) , childInstances ;
} ,
updateChildren : function ( prevChildren , nextChildren , mountImages , removedNodes , transaction , hostParent , hostContainerInfo , context , selfDebugID ) {
if ( nextChildren || prevChildren ) {
var name , prevChild ;
for ( name in nextChildren ) if ( nextChildren . hasOwnProperty ( name ) ) {
prevChild = prevChildren && prevChildren [ name ] ;
var prevElement = prevChild && prevChild . _currentElement , nextElement = nextChildren [ name ] ;
if ( null != prevChild && shouldUpdateReactComponent _1 ( prevElement , nextElement ) ) ReactReconciler _1 . receiveComponent ( prevChild , nextElement , transaction , context ) ,
nextChildren [ name ] = prevChild ; else {
var nextChildInstance = instantiateReactComponent _1 ( nextElement , ! 0 ) ;
nextChildren [ name ] = nextChildInstance ;
var nextChildMountImage = ReactReconciler _1 . mountComponent ( nextChildInstance , transaction , hostParent , hostContainerInfo , context , selfDebugID ) ;
mountImages . push ( nextChildMountImage ) , prevChild && ( removedNodes [ name ] = ReactReconciler _1 . getHostNode ( prevChild ) ,
ReactReconciler _1 . unmountComponent ( prevChild , ! 1 , ! 1 ) ) ;
}
}
for ( name in prevChildren ) ! prevChildren . hasOwnProperty ( name ) || nextChildren && nextChildren . hasOwnProperty ( name ) || ( prevChild = prevChildren [ name ] ,
removedNodes [ name ] = ReactReconciler _1 . getHostNode ( prevChild ) , ReactReconciler _1 . unmountComponent ( prevChild , ! 1 , ! 1 ) ) ;
}
} ,
unmountChildren : function ( renderedChildren , safely , skipLifecycle ) {
for ( var name in renderedChildren ) if ( renderedChildren . hasOwnProperty ( name ) ) {
var renderedChild = renderedChildren [ name ] ;
ReactReconciler _1 . unmountComponent ( renderedChild , safely , skipLifecycle ) ;
}
}
} , ReactChildReconciler _1 = ReactChildReconciler , ReactComponentTreeHook$3 ;
"undefined" != typeof process && process . env && "development" == "test" && ( ReactComponentTreeHook$3 = ReactGlobalSharedState _1 . ReactComponentTreeHook ) ;
function flattenSingleChildIntoContext ( traverseContext , child , name , selfDebugID ) {
if ( traverseContext && "object" == typeof traverseContext ) {
var result = traverseContext , keyUnique = void 0 === result [ name ] ;
ReactComponentTreeHook$3 || ( ReactComponentTreeHook$3 = ReactGlobalSharedState _1 . ReactComponentTreeHook ) ,
keyUnique || warning ( ! 1 , "flattenChildren(...): Encountered two children with the same key, " + "`%s`. Child keys must be unique; when two children share a key, only " + "the first child will be used.%s" , KeyEscapeUtils _1 . unescapeInDev ( name ) , ReactComponentTreeHook$3 . getStackAddendumByID ( selfDebugID ) ) ,
keyUnique && null != child && ( result [ name ] = child ) ;
}
}
function flattenStackChildren ( children , selfDebugID ) {
if ( null == children ) return children ;
var result = { } ;
return traverseStackChildren _1 ( children , function ( traverseContext , child , name ) {
return flattenSingleChildIntoContext ( traverseContext , child , name , selfDebugID ) ;
} , result ) , result ;
}
var flattenStackChildren _1 = flattenStackChildren , ReactCurrentOwner$3 = ReactGlobalSharedState _1 . ReactCurrentOwner ;
function makeInsertMarkup ( markup , afterNode , toIndex ) {
return {
type : "INSERT_MARKUP" ,
content : markup ,
fromIndex : null ,
fromNode : null ,
toIndex : toIndex ,
afterNode : afterNode
} ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
function makeMove ( child , afterNode , toIndex ) {
return {
type : "MOVE_EXISTING" ,
content : null ,
fromIndex : child . _mountIndex ,
fromNode : ReactReconciler _1 . getHostNode ( child ) ,
toIndex : toIndex ,
afterNode : afterNode
} ;
}
function makeRemove ( child , node ) {
return {
type : "REMOVE_NODE" ,
content : null ,
fromIndex : child . _mountIndex ,
fromNode : node ,
toIndex : null ,
afterNode : null
} ;
}
function makeSetMarkup ( markup ) {
return {
type : "SET_MARKUP" ,
content : markup ,
fromIndex : null ,
fromNode : null ,
toIndex : null ,
afterNode : null
} ;
}
function makeTextContent ( textContent ) {
return {
type : "TEXT_CONTENT" ,
content : textContent ,
fromIndex : null ,
fromNode : null ,
toIndex : null ,
afterNode : null
} ;
}
function enqueue ( queue , update ) {
return update && ( queue = queue || [ ] , queue . push ( update ) ) , queue ;
}
function processQueue ( inst , updateQueue ) {
ReactComponentEnvironment _1 . processChildrenUpdates ( inst , updateQueue ) ;
}
var setChildrenForInstrumentation = emptyFunction , getDebugID = function ( inst ) {
if ( ! inst . _debugID ) {
var internal ;
( internal = ReactInstanceMap _1 . get ( inst ) ) && ( inst = internal ) ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
return inst . _debugID ;
} ;
setChildrenForInstrumentation = function ( children ) {
var debugID = getDebugID ( this ) ;
0 !== debugID && ReactInstrumentation . debugTool . onSetChildren ( debugID , children ? Object . keys ( children ) . map ( function ( key ) {
return children [ key ] . _debugID ;
} ) : [ ] ) ;
} ;
var ReactMultiChild = {
_reconcilerInstantiateChildren : function ( nestedChildren , transaction , context ) {
var selfDebugID = getDebugID ( this ) ;
if ( this . _currentElement ) try {
return ReactCurrentOwner$3 . current = this . _currentElement . _owner , ReactChildReconciler _1 . instantiateChildren ( nestedChildren , transaction , context , selfDebugID ) ;
2017-05-26 17:51:06 +00:00
} finally {
ReactCurrentOwner$3 . current = null ;
}
2017-06-26 22:12:46 +00:00
return ReactChildReconciler _1 . instantiateChildren ( nestedChildren , transaction , context ) ;
} ,
_reconcilerUpdateChildren : function ( prevChildren , nextNestedChildrenElements , mountImages , removedNodes , transaction , context ) {
var nextChildren , selfDebugID = 0 ;
if ( selfDebugID = getDebugID ( this ) , this . _currentElement ) {
try {
ReactCurrentOwner$3 . current = this . _currentElement . _owner , nextChildren = flattenStackChildren _1 ( nextNestedChildrenElements , selfDebugID ) ;
} finally {
ReactCurrentOwner$3 . current = null ;
}
return ReactChildReconciler _1 . updateChildren ( prevChildren , nextChildren , mountImages , removedNodes , transaction , this , this . _hostContainerInfo , context , selfDebugID ) ,
nextChildren ;
}
return nextChildren = flattenStackChildren _1 ( nextNestedChildrenElements , selfDebugID ) ,
ReactChildReconciler _1 . updateChildren ( prevChildren , nextChildren , mountImages , removedNodes , transaction , this , this . _hostContainerInfo , context , selfDebugID ) ,
2017-05-26 17:51:06 +00:00
nextChildren ;
2017-06-26 22:12:46 +00:00
} ,
mountChildren : function ( nestedChildren , transaction , context ) {
var children = this . _reconcilerInstantiateChildren ( nestedChildren , transaction , context ) ;
this . _renderedChildren = children ;
var mountImages = [ ] , index = 0 ;
for ( var name in children ) if ( children . hasOwnProperty ( name ) ) {
var child = children [ name ] , selfDebugID = 0 ;
selfDebugID = getDebugID ( this ) ;
var mountImage = ReactReconciler _1 . mountComponent ( child , transaction , this , this . _hostContainerInfo , context , selfDebugID ) ;
child . _mountIndex = index ++ , mountImages . push ( mountImage ) ;
}
return setChildrenForInstrumentation . call ( this , children ) , mountImages ;
} ,
updateTextContent : function ( nextContent ) {
var prevChildren = this . _renderedChildren ;
ReactChildReconciler _1 . unmountChildren ( prevChildren , ! 1 , ! 1 ) ;
for ( var name in prevChildren ) prevChildren . hasOwnProperty ( name ) && invariant ( ! 1 , "updateTextContent called on non-empty component." ) ;
processQueue ( this , [ makeTextContent ( nextContent ) ] ) ;
} ,
updateMarkup : function ( nextMarkup ) {
var prevChildren = this . _renderedChildren ;
ReactChildReconciler _1 . unmountChildren ( prevChildren , ! 1 , ! 1 ) ;
for ( var name in prevChildren ) prevChildren . hasOwnProperty ( name ) && invariant ( ! 1 , "updateTextContent called on non-empty component." ) ;
processQueue ( this , [ makeSetMarkup ( nextMarkup ) ] ) ;
} ,
updateChildren : function ( nextNestedChildrenElements , transaction , context ) {
this . _updateChildren ( nextNestedChildrenElements , transaction , context ) ;
} ,
_updateChildren : function ( nextNestedChildrenElements , transaction , context ) {
var prevChildren = this . _renderedChildren , removedNodes = { } , mountImages = [ ] , nextChildren = this . _reconcilerUpdateChildren ( prevChildren , nextNestedChildrenElements , mountImages , removedNodes , transaction , context ) ;
if ( nextChildren || prevChildren ) {
var name , updates = null , nextIndex = 0 , lastIndex = 0 , nextMountIndex = 0 , lastPlacedNode = null ;
for ( name in nextChildren ) if ( nextChildren . hasOwnProperty ( name ) ) {
var prevChild = prevChildren && prevChildren [ name ] , nextChild = nextChildren [ name ] ;
prevChild === nextChild ? ( updates = enqueue ( updates , this . moveChild ( prevChild , lastPlacedNode , nextIndex , lastIndex ) ) ,
lastIndex = Math . max ( prevChild . _mountIndex , lastIndex ) , prevChild . _mountIndex = nextIndex ) : ( prevChild && ( lastIndex = Math . max ( prevChild . _mountIndex , lastIndex ) ) ,
updates = enqueue ( updates , this . _mountChildAtIndex ( nextChild , mountImages [ nextMountIndex ] , lastPlacedNode , nextIndex , transaction , context ) ) ,
nextMountIndex ++ ) , nextIndex ++ , lastPlacedNode = ReactReconciler _1 . getHostNode ( nextChild ) ;
}
for ( name in removedNodes ) removedNodes . hasOwnProperty ( name ) && ( updates = enqueue ( updates , this . _unmountChild ( prevChildren [ name ] , removedNodes [ name ] ) ) ) ;
updates && processQueue ( this , updates ) , this . _renderedChildren = nextChildren , setChildrenForInstrumentation . call ( this , nextChildren ) ;
}
} ,
unmountChildren : function ( safely , skipLifecycle ) {
var renderedChildren = this . _renderedChildren ;
ReactChildReconciler _1 . unmountChildren ( renderedChildren , safely , skipLifecycle ) ,
this . _renderedChildren = null ;
} ,
moveChild : function ( child , afterNode , toIndex , lastIndex ) {
if ( child . _mountIndex < lastIndex ) return makeMove ( child , afterNode , toIndex ) ;
} ,
createChild : function ( child , afterNode , mountImage ) {
return makeInsertMarkup ( mountImage , afterNode , child . _mountIndex ) ;
} ,
removeChild : function ( child , node ) {
return makeRemove ( child , node ) ;
} ,
_mountChildAtIndex : function ( child , mountImage , afterNode , index , transaction , context ) {
return child . _mountIndex = index , this . createChild ( child , afterNode , mountImage ) ;
} ,
_unmountChild : function ( child , node ) {
var update = this . removeChild ( child , node ) ;
return child . _mountIndex = null , update ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
} , ReactMultiChild _1 = ReactMultiChild , ReactNativeBaseComponent = function ( viewConfig ) {
this . viewConfig = viewConfig ;
2017-05-26 17:51:06 +00:00
} ;
2017-06-26 22:12:46 +00:00
ReactNativeBaseComponent . Mixin = {
getPublicInstance : function ( ) {
return this ;
} ,
unmountComponent : function ( safely , skipLifecycle ) {
ReactNativeComponentTree _1 . uncacheNode ( this ) , this . unmountChildren ( safely , skipLifecycle ) ,
this . _rootNodeID = 0 ;
} ,
initializeChildren : function ( children , containerTag , transaction , context ) {
var mountImages = this . mountChildren ( children , transaction , context ) ;
if ( mountImages . length ) {
for ( var createdTags = [ ] , i = 0 , l = mountImages . length ; i < l ; i ++ ) {
var mountImage = mountImages [ i ] , childTag = mountImage ;
createdTags [ i ] = childTag ;
}
UIManager . setChildren ( containerTag , createdTags ) ;
}
} ,
receiveComponent : function ( nextElement , transaction , context ) {
var prevElement = this . _currentElement ;
this . _currentElement = nextElement ;
for ( var key in this . viewConfig . validAttributes ) nextElement . props . hasOwnProperty ( key ) && deepFreezeAndThrowOnMutationInDev ( nextElement . props [ key ] ) ;
var updatePayload = ReactNativeAttributePayload _1 . diff ( prevElement . props , nextElement . props , this . viewConfig . validAttributes ) ;
updatePayload && UIManager . updateView ( this . _rootNodeID , this . viewConfig . uiViewClassName , updatePayload ) ,
this . updateChildren ( nextElement . props . children , transaction , context ) ;
} ,
getName : function ( ) {
return this . constructor . displayName || this . constructor . name || "Unknown" ;
} ,
getHostNode : function ( ) {
return this . _rootNodeID ;
} ,
mountComponent : function ( transaction , hostParent , hostContainerInfo , context ) {
var tag = ReactNativeTagHandles _1 . allocateTag ( ) ;
this . _rootNodeID = tag , this . _hostParent = hostParent , this . _hostContainerInfo = hostContainerInfo ;
for ( var key in this . viewConfig . validAttributes ) this . _currentElement . props . hasOwnProperty ( key ) && deepFreezeAndThrowOnMutationInDev ( this . _currentElement . props [ key ] ) ;
var updatePayload = ReactNativeAttributePayload _1 . create ( this . _currentElement . props , this . viewConfig . validAttributes ) , nativeTopRootTag = hostContainerInfo . _tag ;
return UIManager . createView ( tag , this . viewConfig . uiViewClassName , nativeTopRootTag , updatePayload ) ,
ReactNativeComponentTree _1 . precacheNode ( this , tag ) , this . initializeChildren ( this . _currentElement . props . children , tag , transaction , context ) ,
tag ;
}
} , Object . assign ( ReactNativeBaseComponent . prototype , ReactMultiChild _1 , ReactNativeBaseComponent . Mixin , NativeMethodsMixin _1 ) ;
var ReactNativeBaseComponent _1 = ReactNativeBaseComponent , createReactNativeComponentClassStack = function ( viewConfig ) {
var Constructor = function ( element ) {
this . _currentElement = element , this . _topLevelWrapper = null , this . _hostParent = null ,
this . _hostContainerInfo = null , this . _rootNodeID = 0 , this . _renderedChildren = null ;
} ;
return Constructor . displayName = viewConfig . uiViewClassName , Constructor . viewConfig = viewConfig ,
Constructor . propTypes = viewConfig . propTypes , Constructor . prototype = new ReactNativeBaseComponent _1 ( viewConfig ) ,
Constructor . prototype . constructor = Constructor , Constructor ;
} , createReactNativeComponentClassStack _1 = createReactNativeComponentClassStack , ReactNativeFeatureFlags$3 = require ( "ReactNativeFeatureFlags" ) , createReactNativeComponentClass = ReactNativeFeatureFlags$3 . useFiber ? DevOnlyStubShim : createReactNativeComponentClassStack _1 , ReactNativeFeatureFlags$4 = require ( "ReactNativeFeatureFlags" ) , findNumericNodeHandle$2 = ReactNativeFeatureFlags$4 . useFiber ? DevOnlyStubShim : findNumericNodeHandleStack ;
function takeSnapshot ( view , options ) {
return "number" != typeof view && "window" !== view && ( view = findNumericNodeHandle$2 ( view ) || "window" ) ,
UIManager . _ _takeSnapshot ( view , options ) ;
}
var takeSnapshot _1 = takeSnapshot , lowPriorityWarning = function ( ) { } , printWarning = function ( format ) {
for ( var _len = arguments . length , args = Array ( _len > 1 ? _len - 1 : 0 ) , _key = 1 ; _key < _len ; _key ++ ) args [ _key - 1 ] = arguments [ _key ] ;
var argIndex = 0 , message = "Warning: " + format . replace ( /%s/g , function ( ) {
return args [ argIndex ++ ] ;
} ) ;
"undefined" != typeof console && console . warn ( message ) ;
try {
throw new Error ( message ) ;
} catch ( x ) { }
} ;
lowPriorityWarning = function ( condition , format ) {
if ( void 0 === format ) throw new Error ( "`warning(condition, format, ...args)` requires a warning " + "message argument" ) ;
if ( ! condition ) {
for ( var _len2 = arguments . length , args = Array ( _len2 > 2 ? _len2 - 2 : 0 ) , _key2 = 2 ; _key2 < _len2 ; _key2 ++ ) args [ _key2 - 2 ] = arguments [ _key2 ] ;
printWarning . apply ( void 0 , [ format ] . concat ( args ) ) ;
}
} ;
var lowPriorityWarning _1 = lowPriorityWarning , _extends$2 = Object . assign || function ( target ) {
for ( var i = 1 ; i < arguments . length ; i ++ ) {
var source = arguments [ i ] ;
for ( var key in source ) Object . prototype . hasOwnProperty . call ( source , key ) && ( target [ key ] = source [ key ] ) ;
}
return target ;
} ;
function roundFloat ( val ) {
var base = arguments . length > 1 && void 0 !== arguments [ 1 ] ? arguments [ 1 ] : 2 , n = Math . pow ( 10 , base ) ;
return Math . floor ( val * n ) / n ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
function consoleTable ( table ) {
console . table ( table ) ;
2017-05-26 17:51:06 +00:00
}
2017-06-26 22:12:46 +00:00
function getLastMeasurements ( ) {
return ReactDebugTool _1 . getFlushHistory ( ) ;
}
function getExclusive ( ) {
var flushHistory = arguments . length > 0 && void 0 !== arguments [ 0 ] ? arguments [ 0 ] : getLastMeasurements ( ) , aggregatedStats = { } , affectedIDs = { } ;
function updateAggregatedStats ( treeSnapshot , instanceID , timerType , applyUpdate ) {
var displayName = treeSnapshot [ instanceID ] . displayName , key = displayName , stats = aggregatedStats [ key ] ;
stats || ( affectedIDs [ key ] = { } , stats = aggregatedStats [ key ] = {
key : key ,
instanceCount : 0 ,
counts : { } ,
durations : { } ,
totalDuration : 0
} ) , stats . durations [ timerType ] || ( stats . durations [ timerType ] = 0 ) , stats . counts [ timerType ] || ( stats . counts [ timerType ] = 0 ) ,
affectedIDs [ key ] [ instanceID ] = ! 0 , applyUpdate ( stats ) ;
}
return flushHistory . forEach ( function ( flush ) {
var measurements = flush . measurements , treeSnapshot = flush . treeSnapshot ;
measurements . forEach ( function ( measurement ) {
var duration = measurement . duration , instanceID = measurement . instanceID , timerType = measurement . timerType ;
updateAggregatedStats ( treeSnapshot , instanceID , timerType , function ( stats ) {
stats . totalDuration += duration , stats . durations [ timerType ] += duration , stats . counts [ timerType ] ++ ;
2017-05-26 17:51:06 +00:00
} ) ;
2017-06-26 22:12:46 +00:00
} ) ;
} ) , Object . keys ( aggregatedStats ) . map ( function ( key ) {
return _extends$2 ( { } , aggregatedStats [ key ] , {
instanceCount : Object . keys ( affectedIDs [ key ] ) . length
} ) ;
} ) . sort ( function ( a , b ) {
return b . totalDuration - a . totalDuration ;
2017-05-26 17:51:06 +00:00
} ) ;
2017-06-26 22:12:46 +00:00
}
function getInclusive ( ) {
var flushHistory = arguments . length > 0 && void 0 !== arguments [ 0 ] ? arguments [ 0 ] : getLastMeasurements ( ) , aggregatedStats = { } , affectedIDs = { } ;
function updateAggregatedStats ( treeSnapshot , instanceID , applyUpdate ) {
var _treeSnapshot$instanc = treeSnapshot [ instanceID ] , displayName = _treeSnapshot$instanc . displayName , ownerID = _treeSnapshot$instanc . ownerID , owner = treeSnapshot [ ownerID ] , key = ( owner ? owner . displayName + " > " : "" ) + displayName , stats = aggregatedStats [ key ] ;
stats || ( affectedIDs [ key ] = { } , stats = aggregatedStats [ key ] = {
key : key ,
instanceCount : 0 ,
inclusiveRenderDuration : 0 ,
renderCount : 0
} ) , affectedIDs [ key ] [ instanceID ] = ! 0 , applyUpdate ( stats ) ;
}
var isCompositeByID = { } ;
return flushHistory . forEach ( function ( flush ) {
flush . measurements . forEach ( function ( measurement ) {
var instanceID = measurement . instanceID ;
"render" === measurement . timerType && ( isCompositeByID [ instanceID ] = ! 0 ) ;
} ) ;
} ) , flushHistory . forEach ( function ( flush ) {
var measurements = flush . measurements , treeSnapshot = flush . treeSnapshot ;
measurements . forEach ( function ( measurement ) {
var duration = measurement . duration , instanceID = measurement . instanceID ;
if ( "render" === measurement . timerType ) {
2017-05-26 17:51:06 +00:00
updateAggregatedStats ( treeSnapshot , instanceID , function ( stats ) {
stats . renderCount ++ ;
} ) ;
2017-06-26 22:12:46 +00:00
for ( var nextParentID = instanceID ; nextParentID ; ) isCompositeByID [ nextParentID ] && updateAggregatedStats ( treeSnapshot , nextParentID , function ( stats ) {
2017-05-26 17:51:06 +00:00
stats . inclusiveRenderDuration += duration ;
} ) , nextParentID = treeSnapshot [ nextParentID ] . parentID ;
}
2017-06-26 22:12:46 +00:00
} ) ;
} ) , Object . keys ( aggregatedStats ) . map ( function ( key ) {
return _extends$2 ( { } , aggregatedStats [ key ] , {
instanceCount : Object . keys ( affectedIDs [ key ] ) . length
} ) ;
} ) . sort ( function ( a , b ) {
return b . inclusiveRenderDuration - a . inclusiveRenderDuration ;
2017-05-26 17:51:06 +00:00
} ) ;
2017-06-26 22:12:46 +00:00
}
function getWasted ( ) {
var flushHistory = arguments . length > 0 && void 0 !== arguments [ 0 ] ? arguments [ 0 ] : getLastMeasurements ( ) , aggregatedStats = { } , affectedIDs = { } ;
function updateAggregatedStats ( treeSnapshot , instanceID , applyUpdate ) {
var _treeSnapshot$instanc2 = treeSnapshot [ instanceID ] , displayName = _treeSnapshot$instanc2 . displayName , ownerID = _treeSnapshot$instanc2 . ownerID , owner = treeSnapshot [ ownerID ] , key = ( owner ? owner . displayName + " > " : "" ) + displayName , stats = aggregatedStats [ key ] ;
stats || ( affectedIDs [ key ] = { } , stats = aggregatedStats [ key ] = {
2017-05-26 17:51:06 +00:00
key : key ,
2017-06-26 22:12:46 +00:00
instanceCount : 0 ,
inclusiveRenderDuration : 0 ,
renderCount : 0
} ) , affectedIDs [ key ] [ instanceID ] = ! 0 , applyUpdate ( stats ) ;
}
return flushHistory . forEach ( function ( flush ) {
var measurements = flush . measurements , treeSnapshot = flush . treeSnapshot , operations = flush . operations , isDefinitelyNotWastedByID = { } ;
operations . forEach ( function ( operation ) {
for ( var instanceID = operation . instanceID , nextParentID = instanceID ; nextParentID ; ) isDefinitelyNotWastedByID [ nextParentID ] = ! 0 ,
nextParentID = treeSnapshot [ nextParentID ] . parentID ;
} ) ;
var renderedCompositeIDs = { } ;
measurements . forEach ( function ( measurement ) {
var instanceID = measurement . instanceID ;
"render" === measurement . timerType && ( renderedCompositeIDs [ instanceID ] = ! 0 ) ;
} ) , measurements . forEach ( function ( measurement ) {
var duration = measurement . duration , instanceID = measurement . instanceID ;
if ( "render" === measurement . timerType ) {
var updateCount = treeSnapshot [ instanceID ] . updateCount ;
if ( ! isDefinitelyNotWastedByID [ instanceID ] && 0 !== updateCount ) {
updateAggregatedStats ( treeSnapshot , instanceID , function ( stats ) {
stats . renderCount ++ ;
} ) ;
for ( var nextParentID = instanceID ; nextParentID ; ) renderedCompositeIDs [ nextParentID ] && ! isDefinitelyNotWastedByID [ nextParentID ] && updateAggregatedStats ( treeSnapshot , nextParentID , function ( stats ) {
stats . inclusiveRenderDuration += duration ;
} ) , nextParentID = treeSnapshot [ nextParentID ] . parentID ;
}
}
} ) ;
} ) , Object . keys ( aggregatedStats ) . map ( function ( key ) {
return _extends$2 ( { } , aggregatedStats [ key ] , {
instanceCount : Object . keys ( affectedIDs [ key ] ) . length
2017-05-26 17:51:06 +00:00
} ) ;
2017-06-26 22:12:46 +00:00
} ) . sort ( function ( a , b ) {
return b . inclusiveRenderDuration - a . inclusiveRenderDuration ;
2017-05-26 17:51:06 +00:00
} ) ;
2017-06-26 22:12:46 +00:00
}
function getOperations ( ) {
var flushHistory = arguments . length > 0 && void 0 !== arguments [ 0 ] ? arguments [ 0 ] : getLastMeasurements ( ) , stats = [ ] ;
return flushHistory . forEach ( function ( flush , flushIndex ) {
var operations = flush . operations , treeSnapshot = flush . treeSnapshot ;
operations . forEach ( function ( operation ) {
var instanceID = operation . instanceID , type = operation . type , payload = operation . payload , _treeSnapshot$instanc3 = treeSnapshot [ instanceID ] , displayName = _treeSnapshot$instanc3 . displayName , ownerID = _treeSnapshot$instanc3 . ownerID , owner = treeSnapshot [ ownerID ] , key = ( owner ? owner . displayName + " > " : "" ) + displayName ;
stats . push ( {
flushIndex : flushIndex ,
instanceID : instanceID ,
key : key ,
type : type ,
ownerID : ownerID ,
payload : payload
} ) ;
} ) ;
} ) , stats ;
}
function printExclusive ( flushHistory ) {
consoleTable ( getExclusive ( flushHistory ) . map ( function ( item ) {
var key = item . key , instanceCount = item . instanceCount , totalDuration = item . totalDuration , renderCount = item . counts . render || 0 , renderDuration = item . durations . render || 0 ;
return {
Component : key ,
"Total time (ms)" : roundFloat ( totalDuration ) ,
"Instance count" : instanceCount ,
"Total render time (ms)" : roundFloat ( renderDuration ) ,
"Average render time (ms)" : renderCount ? roundFloat ( renderDuration / renderCount ) : void 0 ,
"Render count" : renderCount ,
"Total lifecycle time (ms)" : roundFloat ( totalDuration - renderDuration )
} ;
} ) ) ;
}
function printInclusive ( flushHistory ) {
consoleTable ( getInclusive ( flushHistory ) . map ( function ( item ) {
var key = item . key , instanceCount = item . instanceCount , inclusiveRenderDuration = item . inclusiveRenderDuration , renderCount = item . renderCount ;
return {
"Owner > Component" : key ,
"Inclusive render time (ms)" : roundFloat ( inclusiveRenderDuration ) ,
"Instance count" : instanceCount ,
"Render count" : renderCount
} ;
} ) ) ;
}
function printWasted ( flushHistory ) {
consoleTable ( getWasted ( flushHistory ) . map ( function ( item ) {
var key = item . key , instanceCount = item . instanceCount , inclusiveRenderDuration = item . inclusiveRenderDuration , renderCount = item . renderCount ;
return {
"Owner > Component" : key ,
"Inclusive wasted time (ms)" : roundFloat ( inclusiveRenderDuration ) ,
"Instance count" : instanceCount ,
"Render count" : renderCount
} ;
} ) ) ;
}
function printOperations ( flushHistory ) {
consoleTable ( getOperations ( flushHistory ) . map ( function ( stat ) {
return {
"Owner > Node" : stat . key ,
Operation : stat . type ,
Payload : "object" == typeof stat . payload ? JSON . stringify ( stat . payload ) : stat . payload ,
"Flush index" : stat . flushIndex ,
"Owner Component ID" : stat . ownerID ,
"DOM Component ID" : stat . instanceID
} ;
} ) ) ;
}
var warnedAboutPrintDOM = ! 1 ;
function printDOM ( measurements ) {
return lowPriorityWarning _1 ( warnedAboutPrintDOM , "`ReactPerf.printDOM(...)` is deprecated. Use " + "`ReactPerf.printOperations(...)` instead." ) ,
warnedAboutPrintDOM = ! 0 , printOperations ( measurements ) ;
}
var warnedAboutGetMeasurementsSummaryMap = ! 1 ;
function getMeasurementsSummaryMap ( measurements ) {
return lowPriorityWarning _1 ( warnedAboutGetMeasurementsSummaryMap , "`ReactPerf.getMeasurementsSummaryMap(...)` is deprecated. Use " + "`ReactPerf.getWasted(...)` instead." ) ,
warnedAboutGetMeasurementsSummaryMap = ! 0 , getWasted ( measurements ) ;
}
function start ( ) {
ReactDebugTool _1 . beginProfiling ( ) ;
}
function stop ( ) {
ReactDebugTool _1 . endProfiling ( ) ;
}
function isRunning ( ) {
return ReactDebugTool _1 . isProfiling ( ) ;
}
var ReactPerfAnalysis = {
getLastMeasurements : getLastMeasurements ,
getExclusive : getExclusive ,
getInclusive : getInclusive ,
getWasted : getWasted ,
getOperations : getOperations ,
printExclusive : printExclusive ,
printInclusive : printInclusive ,
printWasted : printWasted ,
printOperations : printOperations ,
start : start ,
stop : stop ,
isRunning : isRunning ,
printDOM : printDOM ,
getMeasurementsSummaryMap : getMeasurementsSummaryMap
} , ReactPerf = ReactPerfAnalysis ;
ReactNativeInjection . inject ( ) , ReactNativeStackInjection . inject ( ) ;
var render = function ( element , mountInto , callback ) {
return ReactNativeMount _1 . renderComponent ( element , mountInto , callback ) ;
} , ReactNativeStack = {
NativeComponent : ReactNativeComponent _1 ,
hasReactNativeInitialized : ! 1 ,
findNodeHandle : findNumericNodeHandleStack ,
render : render ,
unmountComponentAtNode : ReactNativeMount _1 . unmountComponentAtNode ,
unstable _batchedUpdates : ReactUpdates _1 . batchedUpdates ,
unmountComponentAtNodeAndRemoveContainer : ReactNativeMount _1 . unmountComponentAtNodeAndRemoveContainer ,
_ _SECRET _INTERNALS _DO _NOT _USE _OR _YOU _WILL _BE _FIRED : {
NativeMethodsMixin : NativeMethodsMixin _1 ,
ReactGlobalSharedState : ReactGlobalSharedState _1 ,
ReactNativeComponentTree : ReactNativeComponentTree _1 ,
ReactNativePropRegistry : ReactNativePropRegistry _1 ,
TouchHistoryMath : TouchHistoryMath _1 ,
createReactNativeComponentClass : createReactNativeComponentClass ,
takeSnapshot : takeSnapshot _1
}
} ;
Object . assign ( ReactNativeStack . _ _SECRET _INTERNALS _DO _NOT _USE _OR _YOU _WILL _BE _FIRED , {
ReactDebugTool : ReactDebugTool _1 ,
ReactPerf : ReactPerf
} ) , "undefined" != typeof _ _REACT _DEVTOOLS _GLOBAL _HOOK _ _ && "function" == typeof _ _REACT _DEVTOOLS _GLOBAL _HOOK _ _ . inject && _ _REACT _DEVTOOLS _GLOBAL _HOOK _ _ . inject ( {
ComponentTree : {
getClosestInstanceFromNode : function ( node ) {
return ReactNativeComponentTree _1 . getClosestInstanceFromNode ( node ) ;
} ,
getNodeFromInstance : function ( inst ) {
for ( ; inst . _renderedComponent ; ) inst = inst . _renderedComponent ;
return inst ? ReactNativeComponentTree _1 . getNodeFromInstance ( inst ) : null ;
}
} ,
Mount : ReactNativeMount _1 ,
Reconciler : ReactReconciler _1 ,
getInspectorDataForViewTag : ReactNativeStackInspector . getInspectorDataForViewTag
} ) ;
var ReactNativeStackEntry = ReactNativeStack ;
module . exports = ReactNativeStackEntry ;
2017-05-26 17:51:06 +00:00
}