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" ;
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" ) ;
require ( "ReactNativeFeatureFlags" ) ;
var 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 ) ;
2017-06-09 02:01:23 +00:00
if ( invariant ( pluginIndex > - 1 , "EventPluginRegistry: Cannot inject event plugins that do not exist in " + "the plugin ordering, `%s`." , pluginName ) ,
2017-05-26 17:51:06 +00:00
! EventPluginRegistry . plugins [ pluginIndex ] ) {
2017-06-09 02:01:23 +00:00
invariant ( pluginModule . extractEvents , "EventPluginRegistry: Event plugins must implement an `extractEvents` " + "method, but `%s` does not." , pluginName ) ,
2017-05-26 17:51:06 +00:00
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 ) ;
}
}
}
function publishEventForPlugin ( dispatchConfig , pluginModule , eventName ) {
2017-06-09 02:01:23 +00:00
invariant ( ! EventPluginRegistry . eventNameDispatchConfigs . hasOwnProperty ( eventName ) , "EventPluginHub: More than one plugin attempted to publish the same " + "event name, `%s`." , eventName ) ,
2017-05-26 17:51:06 +00:00
EventPluginRegistry . eventNameDispatchConfigs [ eventName ] = dispatchConfig ;
var phasedRegistrationNames = dispatchConfig . phasedRegistrationNames ;
if ( phasedRegistrationNames ) {
for ( var phaseName in phasedRegistrationNames ) if ( phasedRegistrationNames . hasOwnProperty ( phaseName ) ) {
var phasedRegistrationName = phasedRegistrationNames [ phaseName ] ;
publishRegistrationName ( phasedRegistrationName , pluginModule , eventName ) ;
}
return ! 0 ;
}
2017-06-09 02:01:23 +00:00
return ! ! dispatchConfig . registrationName && ( publishRegistrationName ( dispatchConfig . registrationName , pluginModule , eventName ) ,
2017-05-26 17:51:06 +00:00
! 0 ) ;
}
function publishRegistrationName ( registrationName , pluginModule , eventName ) {
2017-06-09 02:01:23 +00:00
invariant ( ! EventPluginRegistry . registrationNameModules [ registrationName ] , "EventPluginHub: More than one plugin attempted to publish the same " + "registration name, `%s`." , registrationName ) ,
2017-05-26 17:51:06 +00:00
EventPluginRegistry . registrationNameModules [ registrationName ] = pluginModule , EventPluginRegistry . registrationNameDependencies [ registrationName ] = pluginModule . eventTypes [ eventName ] . dependencies ;
var lowerCasedName = registrationName . toLowerCase ( ) ;
2017-06-09 02:01:23 +00:00
EventPluginRegistry . possibleRegistrationNames [ lowerCasedName ] = registrationName ,
2017-05-26 17:51:06 +00:00
"onDoubleClick" === registrationName && ( EventPluginRegistry . possibleRegistrationNames . ondblclick = registrationName ) ;
}
var EventPluginRegistry = {
plugins : [ ] ,
eventNameDispatchConfigs : { } ,
registrationNameModules : { } ,
registrationNameDependencies : { } ,
possibleRegistrationNames : { } ,
injectEventPluginOrder : function ( injectedEventPluginOrder ) {
2017-06-09 02:01:23 +00:00
invariant ( ! eventPluginOrder , "EventPluginRegistry: Cannot inject event plugin ordering more than " + "once. You are likely trying to load more than one copy of React." ) ,
2017-05-26 17:51:06 +00:00
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 ] ;
2017-06-09 02:01:23 +00:00
namesToPlugins . hasOwnProperty ( pluginName ) && namesToPlugins [ pluginName ] === pluginModule || ( invariant ( ! namesToPlugins [ pluginName ] , "EventPluginRegistry: Cannot inject two different event plugins " + "using the same name, `%s`." , pluginName ) ,
2017-05-26 17:51:06 +00:00
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 {
func . apply ( context , funcArgs ) ;
} catch ( error ) {
return error ;
}
return null ;
} ;
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" ) ;
2017-06-09 02:01:23 +00:00
return evt . initEvent ( evtType , ! 1 , ! 1 ) , fakeNode . dispatchEvent ( evt ) , fakeNode . removeEventListener ( evtType , boundFunc , ! 1 ) ,
2017-05-26 17:51:06 +00:00
window . removeEventListener ( "error" , onFakeEventError ) , depth -- , fakeEventError ;
} ;
}
var rethrowCaughtError = function ( ) {
if ( caughtError ) {
var error = caughtError ;
throw caughtError = null , error ;
}
} , ReactErrorUtils = {
injection : {
injectErrorUtils : function ( injectedErrorUtils ) {
2017-06-09 02:01:23 +00:00
invariant ( "function" == typeof injectedErrorUtils . invokeGuardedCallback , "Injected invokeGuardedCallback() must be a function." ) ,
2017-05-26 17:51:06 +00:00
invokeGuardedCallback = injectedErrorUtils . invokeGuardedCallback ;
}
} ,
invokeGuardedCallback : function ( name , func , context , a , b , c , d , e , f ) {
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" ;
2017-06-09 02:01:23 +00:00
event . currentTarget = EventPluginUtils . getNodeFromInstance ( inst ) , ReactErrorUtils _1 . invokeGuardedCallbackAndCatchFirstError ( type , listener , void 0 , event ) ,
2017-05-26 17:51:06 +00:00
event . currentTarget = null ;
}
function executeDispatchesInOrder ( event , simulated ) {
var dispatchListeners = event . _dispatchListeners , dispatchInstances = event . _dispatchInstances ;
if ( 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 ;
2017-06-09 02:01:23 +00:00
invariant ( ! Array . isArray ( dispatchListener ) , "executeDirectDispatch(...): Invalid `event`." ) ,
2017-05-26 17:51:06 +00:00
event . currentTarget = dispatchListener ? EventPluginUtils . getNodeFromInstance ( dispatchInstance ) : null ;
var res = dispatchListener ? dispatchListener ( event ) : null ;
2017-06-09 02:01:23 +00:00
return event . currentTarget = null , event . _dispatchListeners = null , event . _dispatchInstances = null ,
2017-05-26 17:51:06 +00:00
res ;
}
function hasDispatches ( event ) {
return ! ! event . _dispatchListeners ;
}
var EventPluginUtils = {
isEndish : isEndish ,
isMoveish : isMoveish ,
isStartish : isStartish ,
executeDirectDispatch : executeDirectDispatch ,
executeDispatchesInOrder : executeDispatchesInOrder ,
executeDispatchesInOrderStopAtTrue : executeDispatchesInOrderStopAtTrue ,
hasDispatches : hasDispatches ,
getFiberCurrentPropsFromNode : function ( node ) {
return ComponentTree . getFiberCurrentPropsFromNode ( node ) ;
} ,
getInstanceFromNode : function ( node ) {
return ComponentTree . getInstanceFromNode ( node ) ;
} ,
getNodeFromInstance : function ( node ) {
return ComponentTree . getNodeFromInstance ( node ) ;
} ,
injection : injection
} , EventPluginUtils _1 = EventPluginUtils ;
function accumulateInto ( current , next ) {
2017-06-09 02:01:23 +00:00
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 ) ,
2017-05-26 17:51:06 +00:00
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 ;
}
2017-06-09 02:01:23 +00:00
return invariant ( ! listener || "function" == typeof listener , "Expected %s listener to be a function, instead got type %s" , registrationName , typeof listener ) ,
2017-05-26 17:51:06 +00:00
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 ;
2017-06-09 02:01:23 +00:00
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." ) ,
2017-05-26 17:51:06 +00:00
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 ;
if ( "number" == typeof inst . tag ) {
do {
inst = inst . return ;
} while ( inst && inst . tag !== HostComponent ) ;
if ( inst ) return inst ;
}
return null ;
}
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 ;
}
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 ) {
2017-06-09 02:01:23 +00:00
for ( var common = from && to ? getLowestCommonAncestor ( from , to ) : null , pathFrom = [ ] ; from && from !== common ; ) pathFrom . push ( from ) ,
2017-05-26 17:51:06 +00:00
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 ) ) ;
}
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 ) ;
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 ) ) ;
}
}
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 ;
2017-06-09 02:01:23 +00:00
invariant ( instance instanceof Klass , "Trying to release an instance into a pool of a different type." ) ,
2017-05-26 17:51:06 +00:00
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 ;
2017-06-09 02:01:23 +00:00
return NewKlass . instancePool = [ ] , NewKlass . getPooled = pooler || DEFAULT _POOLER ,
NewKlass . poolSize || ( NewKlass . poolSize = DEFAULT _POOL _SIZE ) , NewKlass . release = standardReleaser ,
2017-05-26 17:51:06 +00:00
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 ) {
2017-06-09 02:01:23 +00:00
delete this . nativeEvent , delete this . preventDefault , delete this . stopPropagation ,
2017-05-26 17:51:06 +00:00
this . dispatchConfig = dispatchConfig , this . _targetInst = targetInst , this . nativeEvent = nativeEvent ;
var Interface = this . constructor . Interface ;
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 ;
2017-06-09 02:01:23 +00:00
return this . isDefaultPrevented = defaultPrevented ? emptyFunction . thatReturnsTrue : emptyFunction . thatReturnsFalse ,
2017-05-26 17:51:06 +00:00
this . isPropagationStopped = emptyFunction . thatReturnsFalse , this ;
}
Object . assign ( SyntheticEvent . prototype , {
preventDefault : function ( ) {
this . defaultPrevented = ! 0 ;
var event = this . nativeEvent ;
2017-06-09 02:01:23 +00:00
event && ( event . preventDefault ? event . preventDefault ( ) : "unknown" != typeof event . returnValue && ( event . returnValue = ! 1 ) ,
2017-05-26 17:51:06 +00:00
this . isDefaultPrevented = emptyFunction . thatReturnsTrue ) ;
} ,
stopPropagation : function ( ) {
var event = this . nativeEvent ;
2017-06-09 02:01:23 +00:00
event && ( event . stopPropagation ? event . stopPropagation ( ) : "unknown" != typeof event . cancelBubble && ( event . cancelBubble = ! 0 ) ,
2017-05-26 17:51:06 +00:00
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 ;
2017-06-09 02:01:23 +00:00
Object . defineProperty ( this , "nativeEvent" , getPooledWarningPropertyDefinition ( "nativeEvent" , null ) ) ,
Object . defineProperty ( this , "preventDefault" , getPooledWarningPropertyDefinition ( "preventDefault" , emptyFunction ) ) ,
2017-05-26 17:51:06 +00:00
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 ) {
2017-06-09 02:01:23 +00:00
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." ) ,
2017-05-26 17:51:06 +00:00
didWarnForAddedNewProperty = ! 0 ) , target [ prop ] = value , ! 0 ;
}
} ) ;
}
} ) ) , SyntheticEvent . augmentClass = function ( Class , Interface ) {
var Super = this , E = function ( ) { } ;
E . prototype = Super . prototype ;
var prototype = new E ( ) ;
2017-06-09 02:01:23 +00:00
Object . assign ( prototype , Class . prototype ) , Class . prototype = prototype , Class . prototype . constructor = Class ,
Class . Interface = Object . assign ( { } , Super . Interface , Interface ) , Class . augmentClass = Super . augmentClass ,
2017-05-26 17:51:06 +00:00
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 ) {
2017-06-09 02:01:23 +00:00
return warn ( isFunction ? "setting the method" : "setting the property" , "This is effectively a no-op" ) ,
2017-05-26 17:51:06 +00:00
val ;
}
function get ( ) {
2017-06-09 02:01:23 +00:00
return warn ( isFunction ? "accessing the method" : "accessing the property" , isFunction ? "This is a no-op function" : "This is set to null" ) ,
2017-05-26 17:51:06 +00:00
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 ] ;
2017-06-09 02:01:23 +00:00
for ( var directTypeName in customDirectEventTypes ) warning ( ! customBubblingEventTypes [ directTypeName ] , "Event cannot be both direct and bubbling: %s" , directTypeName ) ,
2017-05-26 17:51:06 +00:00
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 ) ;
}
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 ) ;
}
2017-06-09 02:01:23 +00:00
invariant ( "function" == typeof internalInstance . restoreControlledState , "The internal instance must be a React host component." ) ,
2017-05-26 17:51:06 +00:00
internalInstance . restoreControlledState ( ) ;
}
}
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 ) ;
} ;
function performFiberBatchedUpdates ( fn , bookkeeping ) {
return fiberBatchedUpdates ( fn , bookkeeping ) ;
}
function batchedUpdates ( fn , bookkeeping ) {
return stackBatchedUpdates ( performFiberBatchedUpdates , fn , bookkeeping ) ;
}
var isNestingBatched = ! 1 ;
function batchedUpdatesWithControlledComponents ( fn , bookkeeping ) {
if ( isNestingBatched ) return batchedUpdates ( fn , bookkeeping ) ;
isNestingBatched = ! 0 ;
try {
return batchedUpdates ( fn , bookkeeping ) ;
} finally {
isNestingBatched = ! 1 , ReactControlledComponent _1 . restoreStateIfNeeded ( ) ;
}
}
var ReactGenericBatchingInjection = {
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 ;
2017-06-09 02:01:23 +00:00
null !== target && void 0 !== target && ( target < ReactNativeTagHandles _1 . tagsStartAt ? warning ( ! 1 , "A view is reporting that a touch occurred on tag zero." ) : rootNodeID = target ) ,
2017-05-26 17:51:06 +00:00
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 ( ) ;
}
} , 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 ;
}
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 )
} ;
}
function resetTouchRecord ( touchRecord , touch ) {
2017-06-09 02:01:23 +00:00
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 ,
2017-05-26 17:51:06 +00:00
touchRecord . previousTimeStamp = timestampForTouch ( touch ) ;
}
function getTouchIdentifier ( _ref ) {
var identifier = _ref . identifier ;
2017-06-09 02:01:23 +00:00
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 ) ,
2017-05-26 17:51:06 +00:00
identifier ;
}
function recordTouchStart ( touch ) {
var identifier = getTouchIdentifier ( touch ) , touchRecord = touchBank [ identifier ] ;
2017-06-09 02:01:23 +00:00
touchRecord ? resetTouchRecord ( touchRecord , touch ) : touchBank [ identifier ] = createTouchRecord ( touch ) ,
2017-05-26 17:51:06 +00:00
touchHistory . mostRecentTimeStamp = timestampForTouch ( touch ) ;
}
function recordTouchMove ( touch ) {
var touchRecord = touchBank [ getTouchIdentifier ( touch ) ] ;
2017-06-09 02:01:23 +00:00
touchRecord ? ( touchRecord . touchActive = ! 0 , touchRecord . previousPageX = touchRecord . currentPageX ,
touchRecord . previousPageY = touchRecord . currentPageY , touchRecord . previousTimeStamp = touchRecord . currentTimeStamp ,
touchRecord . currentPageX = touch . pageX , touchRecord . currentPageY = touch . pageY ,
2017-05-26 17:51:06 +00:00
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 ) ] ;
2017-06-09 02:01:23 +00:00
touchRecord ? ( touchRecord . touchActive = ! 1 , touchRecord . previousPageX = touchRecord . currentPageX ,
touchRecord . previousPageY = touchRecord . currentPageY , touchRecord . previousTimeStamp = touchRecord . currentTimeStamp ,
touchRecord . currentPageX = touch . pageX , touchRecord . currentPageY = touch . pageY ,
2017-05-26 17:51:06 +00:00
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 )
} ) ;
}
function printTouchBank ( ) {
var printed = JSON . stringify ( touchBank . slice ( 0 , MAX _TOUCH _BANK ) ) ;
2017-06-09 02:01:23 +00:00
return touchBank . length > MAX _TOUCH _BANK && ( printed += " (original size: " + touchBank . length + ")" ) ,
2017-05-26 17:51:06 +00:00
printed ;
}
var ResponderTouchHistoryStore = {
recordTouchTrack : function ( topLevelType , nativeEvent ) {
2017-06-09 02:01:23 +00:00
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 ) ,
2017-05-26 17:51:06 +00:00
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 ;
}
}
var activeRecord = touchBank [ touchHistory . indexOfSingleActiveTouch ] ;
warning ( null != activeRecord && activeRecord . touchActive , "Cannot find single active touch." ) ;
}
} ,
touchHistory : touchHistory
} , ResponderTouchHistoryStore _1 = ResponderTouchHistoryStore ;
function accumulate ( current , next ) {
2017-06-09 02:01:23 +00:00
return invariant ( null != next , "accumulate(...): Accumulated items must be not be null or undefined." ) ,
2017-05-26 17:51:06 +00:00
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"
}
} ,
responderStart : {
registrationName : "onResponderStart"
} ,
responderMove : {
registrationName : "onResponderMove"
} ,
responderEnd : {
registrationName : "onResponderEnd"
} ,
responderRelease : {
registrationName : "onResponderRelease"
} ,
responderTerminationRequest : {
registrationName : "onResponderTerminationRequest"
} ,
responderGrant : {
registrationName : "onResponderGrant"
} ,
responderReject : {
registrationName : "onResponderReject"
} ,
responderTerminate : {
registrationName : "onResponderTerminate"
}
} ;
function setResponderAndExtractTransfer ( topLevelType , targetInst , nativeEvent , nativeEventTarget ) {
var shouldSetEventType = isStartish$1 ( topLevelType ) ? eventTypes . startShouldSetResponder : isMoveish$1 ( topLevelType ) ? eventTypes . moveShouldSetResponder : "topSelectionChange" === topLevelType ? eventTypes . selectionChangeShouldSetResponder : eventTypes . scrollShouldSetResponder , bubbleShouldSetFrom = responderInst ? ReactTreeTraversal . getLowestCommonAncestor ( responderInst , targetInst ) : targetInst , skipOverBubbleShouldSetFrom = bubbleShouldSetFrom === responderInst , shouldSetEvent = ResponderSyntheticEvent _1 . getPooled ( shouldSetEventType , bubbleShouldSetFrom , nativeEvent , nativeEventTarget ) ;
shouldSetEvent . touchHistory = ResponderTouchHistoryStore _1 . touchHistory , skipOverBubbleShouldSetFrom ? EventPropagators _1 . accumulateTwoPhaseDispatchesSkipTarget ( shouldSetEvent ) : EventPropagators _1 . accumulateTwoPhaseDispatches ( shouldSetEvent ) ;
var wantsResponderInst = executeDispatchesInOrderStopAtTrue$1 ( shouldSetEvent ) ;
2017-06-09 02:01:23 +00:00
if ( shouldSetEvent . isPersistent ( ) || shouldSetEvent . constructor . release ( shouldSetEvent ) ,
2017-05-26 17:51:06 +00:00
! 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 ) ;
2017-06-09 02:01:23 +00:00
terminationRequestEvent . touchHistory = ResponderTouchHistoryStore _1 . touchHistory ,
2017-05-26 17:51:06 +00:00
EventPropagators _1 . accumulateDirectDispatches ( terminationRequestEvent ) ;
var shouldSwitch = ! hasDispatches$1 ( terminationRequestEvent ) || executeDirectDispatch$1 ( terminationRequestEvent ) ;
2017-06-09 02:01:23 +00:00
if ( terminationRequestEvent . isPersistent ( ) || terminationRequestEvent . constructor . release ( terminationRequestEvent ) ,
2017-05-26 17:51:06 +00:00
shouldSwitch ) {
var terminateEvent = ResponderSyntheticEvent _1 . getPooled ( eventTypes . responderTerminate , responderInst , nativeEvent , nativeEventTarget ) ;
2017-06-09 02:01:23 +00:00
terminateEvent . touchHistory = ResponderTouchHistoryStore _1 . touchHistory , EventPropagators _1 . accumulateDirectDispatches ( terminateEvent ) ,
2017-05-26 17:51:06 +00:00
extracted = accumulate _1 ( extracted , [ grantEvent , terminateEvent ] ) , changeResponder ( wantsResponderInst , blockHostResponder ) ;
} else {
var rejectEvent = ResponderSyntheticEvent _1 . getPooled ( eventTypes . responderReject , wantsResponderInst , nativeEvent , nativeEventTarget ) ;
2017-06-09 02:01:23 +00:00
rejectEvent . touchHistory = ResponderTouchHistoryStore _1 . touchHistory , EventPropagators _1 . accumulateDirectDispatches ( rejectEvent ) ,
2017-05-26 17:51:06 +00:00
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 ;
}
}
return ! 0 ;
}
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 ) ) {
2017-06-09 02:01:23 +00:00
if ( ! ( trackedTouchCount >= 0 ) ) return console . error ( "Ended a touch event which was not counted in `trackedTouchCount`." ) ,
2017-05-26 17:51:06 +00:00
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 ) ;
2017-06-09 02:01:23 +00:00
gesture . touchHistory = ResponderTouchHistoryStore _1 . touchHistory , EventPropagators _1 . accumulateDirectDispatches ( gesture ) ,
2017-05-26 17:51:06 +00:00
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 ) ;
2017-06-09 02:01:23 +00:00
finalEvent . touchHistory = ResponderTouchHistoryStore _1 . touchHistory , EventPropagators _1 . accumulateDirectDispatches ( finalEvent ) ,
2017-05-26 17:51:06 +00:00
extracted = accumulate _1 ( extracted , finalEvent ) , changeResponder ( null ) ;
}
var numberActiveTouches = ResponderTouchHistoryStore _1 . touchHistory . numberActiveTouches ;
2017-06-09 02:01:23 +00:00
return ResponderEventPlugin . GlobalInteractionHandler && numberActiveTouches !== previousActiveTouches && ResponderEventPlugin . GlobalInteractionHandler . onChange ( numberActiveTouches ) ,
2017-05-26 17:51:06 +00:00
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 ( ) {
2017-06-09 02:01:23 +00:00
RCTEventEmitter . register ( ReactNativeEventEmitter _1 ) , EventPluginHub _1 . injection . injectEventPluginOrder ( ReactNativeEventPluginOrder _1 ) ,
EventPluginUtils _1 . injection . injectComponentTree ( ReactNativeComponentTree _1 ) , ResponderEventPlugin _1 . injection . injectGlobalResponderHandler ( ReactNativeGlobalResponderHandler _1 ) ,
2017-05-26 17:51:06 +00:00
EventPluginHub _1 . injection . injectEventPluginsByName ( {
ResponderEventPlugin : ResponderEventPlugin _1 ,
ReactNativeBridgeEventPlugin : ReactNativeBridgeEventPlugin _1
} ) ;
}
var ReactNativeInjection = {
inject : inject
} , ReactInvalidSetStateWarningHook = { } , processingChildContext = ! 1 , warnInvalidSetState = function ( ) {
warning ( ! processingChildContext , "setState(...): Cannot call setState() inside getChildContext()" ) ;
} ;
ReactInvalidSetStateWarningHook = {
onBeginProcessingChildContext : function ( ) {
processingChildContext = ! 0 ;
} ,
onEndProcessingChildContext : function ( ) {
processingChildContext = ! 1 ;
} ,
onSetState : function ( ) {
warnInvalidSetState ( ) ;
}
} ;
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 ) {
try {
fn . call ( context , arg1 , arg2 , arg3 , arg4 , arg5 ) ;
} catch ( e ) {
2017-06-09 02:01:23 +00:00
warning ( didHookThrowForEvent [ event ] , "Exception thrown by hook while handling %s: %s" , event , e + "\n" + e . stack ) ,
2017-05-26 17:51:06 +00:00
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 ( ) ;
2017-06-09 02:01:23 +00:00
if ( 0 === currentFlushNesting ) return currentFlushStartTime = 0 , currentFlushMeasurements = [ ] ,
2017-05-26 17:51:06 +00:00
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 ) {
2017-06-09 02:01:23 +00:00
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 ,
2017-05-26 17:51:06 +00:00
currentTimerDebugID = debugID , currentTimerType = timerType ) ;
} , endLifeCycleTimer = function ( debugID , timerType ) {
2017-06-09 02:01:23 +00:00
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" ) ,
2017-05-26 17:51:06 +00:00
lifeCycleTimerHasWarned = ! 0 ) , isProfiling && currentFlushMeasurements . push ( {
timerType : timerType ,
instanceID : debugID ,
duration : performanceNow ( ) - currentTimerStartTime - currentTimerNestedFlushDuration
2017-06-09 02:01:23 +00:00
} ) , currentTimerStartTime = 0 , currentTimerNestedFlushDuration = 0 , currentTimerDebugID = null ,
2017-05-26 17:51:06 +00:00
currentTimerType = null ) ;
} , pauseCurrentLifeCycleTimer = function ( ) {
var currentTimer = {
startTime : currentTimerStartTime ,
nestedFlushStartTime : performanceNow ( ) ,
debugID : currentTimerDebugID ,
timerType : currentTimerType
} ;
2017-06-09 02:01:23 +00:00
lifeCycleTimerStack . push ( currentTimer ) , currentTimerStartTime = 0 , currentTimerNestedFlushDuration = 0 ,
2017-05-26 17:51:06 +00:00
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 ;
2017-06-09 02:01:23 +00:00
currentTimerStartTime = startTime , currentTimerNestedFlushDuration += nestedFlushDuration ,
2017-05-26 17:51:06 +00:00
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 ) ;
}
performance . clearMarks ( markName ) , measurementName && performance . clearMeasures ( measurementName ) ;
}
} ;
ReactDebugTool$1 = {
addHook : function ( hook ) {
hooks . push ( hook ) ;
} ,
removeHook : function ( hook ) {
2017-06-09 02:01:23 +00:00
for ( var i = 0 ; i < hooks . length ; i ++ ) hooks [ i ] === hook && ( hooks . splice ( i , 1 ) ,
2017-05-26 17:51:06 +00:00
i -- ) ;
} ,
isProfiling : function ( ) {
return isProfiling ;
} ,
beginProfiling : function ( ) {
2017-06-09 02:01:23 +00:00
isProfiling || ( isProfiling = ! 0 , flushHistory . length = 0 , resetMeasurements ( ) ,
2017-05-26 17:51:06 +00:00
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 ) {
2017-06-09 02:01:23 +00:00
checkDebugID ( debugID ) , emitEvent ( "onBeginLifeCycleTimer" , debugID , timerType ) , markBegin ( debugID , timerType ) ,
2017-05-26 17:51:06 +00:00
beginLifeCycleTimer ( debugID , timerType ) ;
} ,
onEndLifeCycleTimer : function ( debugID , timerType ) {
2017-06-09 02:01:23 +00:00
checkDebugID ( debugID ) , endLifeCycleTimer ( debugID , timerType ) , markEnd ( debugID , timerType ) ,
2017-05-26 17:51:06 +00:00
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 ) {
2017-06-09 02:01:23 +00:00
checkDebugID ( debugID ) , checkDebugID ( parentDebugID , ! 0 ) , emitEvent ( "onBeforeMountComponent" , debugID , element , parentDebugID ) ,
2017-05-26 17:51:06 +00:00
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 ( ) ;
2017-06-09 02:01:23 +00:00
} 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)." ) ,
2017-05-26 17:51:06 +00:00
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 ) ;
}
}
} , 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 ;
2017-06-09 02:01:23 +00:00
element && element . _source && ( warningKey = element . _source . fileName + ":" + element . _source . lineNumber ) ,
warnedAboutStatelessRefs [ warningKey ] || ( warnedAboutStatelessRefs [ warningKey ] = ! 0 ,
2017-05-26 17:51:06 +00:00
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 ;
2017-06-09 02:01:23 +00:00
null !== prevElement && "object" == typeof prevElement && ( prevRef = prevElement . ref ,
2017-05-26 17:51:06 +00:00
prevOwner = prevElement . _owner ) ;
var nextRef = null , nextOwner = null ;
2017-06-09 02:01:23 +00:00
return null !== nextElement && "object" == typeof nextElement && ( nextRef = nextElement . ref ,
2017-05-26 17:51:06 +00:00
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 ) ;
2017-06-09 02:01:23 +00:00
return internalInstance . _currentElement && null != internalInstance . _currentElement . ref && transaction . getReactMountReady ( ) . enqueue ( attachRefs , internalInstance ) ,
0 !== internalInstance . _debugID && ReactInstrumentation . debugTool . onMountComponent ( internalInstance . _debugID ) ,
2017-05-26 17:51:06 +00:00
markup ;
} ,
getHostNode : function ( internalInstance ) {
return internalInstance . getHostNode ( ) ;
} ,
unmountComponent : function ( internalInstance , safely , skipLifecycle ) {
2017-06-09 02:01:23 +00:00
0 !== internalInstance . _debugID && ReactInstrumentation . debugTool . onBeforeUnmountComponent ( internalInstance . _debugID ) ,
ReactRef _1 . detachRefs ( internalInstance , internalInstance . _currentElement ) , internalInstance . unmountComponent ( safely , skipLifecycle ) ,
2017-05-26 17:51:06 +00:00
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 ) ;
2017-06-09 02:01:23 +00:00
refsChanged && ReactRef _1 . detachRefs ( internalInstance , prevElement ) , internalInstance . receiveComponent ( nextElement , transaction , context ) ,
refsChanged && internalInstance . _currentElement && null != internalInstance . _currentElement . ref && transaction . getReactMountReady ( ) . enqueue ( attachRefs , internalInstance ) ,
2017-05-26 17:51:06 +00:00
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 ) ;
2017-06-09 02:01:23 +00:00
0 !== internalInstance . _debugID && ReactInstrumentation . debugTool . onBeforeUpdateComponent ( internalInstance . _debugID , internalInstance . _currentElement ) ,
2017-05-26 17:51:06 +00:00
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 ;
}
2017-06-09 02:01:23 +00:00
} , ReactInstanceMap _1 = ReactInstanceMap , OBSERVED _ERROR = { } , TransactionImpl = {
2017-05-26 17:51:06 +00:00
reinitializeTransaction : function ( ) {
2017-06-09 02:01:23 +00:00
this . transactionWrappers = this . getTransactionWrappers ( ) , this . wrapperInitData ? this . wrapperInitData . length = 0 : this . wrapperInitData = [ ] ,
2017-05-26 17:51:06 +00:00
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 ;
try {
2017-06-09 02:01:23 +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 {
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 {
2017-06-09 02:01:23 +00:00
errorThrown = ! 0 , initData !== OBSERVED _ERROR && wrapper . close && wrapper . close . call ( this , initData ) ,
2017-05-26 17:51:06 +00:00
errorThrown = ! 1 ;
} finally {
if ( errorThrown ) try {
this . closeAll ( i + 1 ) ;
} catch ( e ) { }
}
}
this . wrapperInitData . length = 0 ;
}
} , Transaction = TransactionImpl , dirtyComponents = [ ] , updateBatchNumber = 0 , batchingStrategy = null ;
function ensureInjected ( ) {
invariant ( ReactUpdates . ReactReconcileTransaction && batchingStrategy , "ReactUpdates: must inject a reconcile transaction class and batching " + "strategy" ) ;
}
var NESTED _UPDATES = {
initialize : function ( ) {
this . dirtyComponentsLength = dirtyComponents . length ;
} ,
close : function ( ) {
2017-06-09 02:01:23 +00:00
this . dirtyComponentsLength !== dirtyComponents . length ? ( dirtyComponents . splice ( 0 , this . dirtyComponentsLength ) ,
2017-05-26 17:51:06 +00:00
flushBatchedUpdates ( ) ) : dirtyComponents . length = 0 ;
}
} , TRANSACTION _WRAPPERS = [ NESTED _UPDATES ] ;
function ReactUpdatesFlushTransaction ( ) {
this . reinitializeTransaction ( ) , this . dirtyComponentsLength = null , this . reconcileTransaction = ReactUpdates . ReactReconcileTransaction . getPooled ( ! 0 ) ;
}
Object . assign ( ReactUpdatesFlushTransaction . prototype , Transaction , {
getTransactionWrappers : function ( ) {
return TRANSACTION _WRAPPERS ;
} ,
destructor : function ( ) {
2017-06-09 02:01:23 +00:00
this . dirtyComponentsLength = null , ReactUpdates . ReactReconcileTransaction . release ( this . reconcileTransaction ) ,
2017-05-26 17:51:06 +00:00
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 ;
2017-06-09 02:01:23 +00:00
invariant ( len === dirtyComponents . length , "Expected flush transaction's stored dirty-components length (%s) to " + "match dirty-components array length (%s)." , len , dirtyComponents . length ) ,
2017-05-26 17:51:06 +00:00
dirtyComponents . sort ( mountOrderComparator ) , updateBatchNumber ++ ;
for ( var i = 0 ; i < len ; i ++ ) {
2017-06-09 02:01:23 +00:00
var component = dirtyComponents [ i ] ;
ReactReconciler _1 . performUpdateIfNecessary ( component , transaction . reconcileTransaction , updateBatchNumber ) ;
2017-05-26 17:51:06 +00:00
}
}
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 ) {
2017-06-09 02:01:23 +00:00
invariant ( ReconcileTransaction , "ReactUpdates: must provide a reconcile transaction class" ) ,
2017-05-26 17:51:06 +00:00
ReactUpdates . ReactReconcileTransaction = ReconcileTransaction ;
} ,
injectBatchingStrategy : function ( _batchingStrategy ) {
2017-06-09 02:01:23 +00:00
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" ) ,
2017-05-26 17:51:06 +00:00
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 ) ;
}
function getInternalInstanceReadyForUpdate ( publicInstance , callerName ) {
var internalInstance = ReactInstanceMap _1 . get ( publicInstance ) ;
if ( ! internalInstance ) {
var ctor = publicInstance . constructor ;
2017-06-09 02:01:23 +00:00
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" ) ,
2017-05-26 17:51:06 +00:00
null ;
}
2017-06-09 02:01:23 +00:00
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`." ) ,
2017-05-26 17:51:06 +00:00
internalInstance ;
}
var ReactUpdateQueue = {
isMounted : function ( publicInstance ) {
var owner = ReactCurrentOwner . current ;
2017-06-09 02:01:23 +00:00
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" ) ,
2017-05-26 17:51:06 +00:00
owner . _warnedAboutRefsInRender = ! 0 ) ;
var internalInstance = ReactInstanceMap _1 . get ( publicInstance ) ;
return ! ! internalInstance && ! ! internalInstance . _renderedComponent ;
} ,
enqueueCallbackInternal : function ( internalInstance , callback ) {
2017-06-09 02:01:23 +00:00
internalInstance . _pendingCallbacks ? internalInstance . _pendingCallbacks . push ( callback ) : internalInstance . _pendingCallbacks = [ callback ] ,
2017-05-26 17:51:06 +00:00
enqueueUpdate ( internalInstance ) ;
} ,
enqueueForceUpdate : function ( publicInstance , callback , callerName ) {
var internalInstance = getInternalInstanceReadyForUpdate ( publicInstance ) ;
2017-06-09 02:01:23 +00:00
internalInstance && ( callback = void 0 === callback ? null : callback , null !== callback && ( warnOnInvalidCallback ( callback , callerName ) ,
internalInstance . _pendingCallbacks ? internalInstance . _pendingCallbacks . push ( callback ) : internalInstance . _pendingCallbacks = [ callback ] ) ,
2017-05-26 17:51:06 +00:00
internalInstance . _pendingForceUpdate = ! 0 , enqueueUpdate ( internalInstance ) ) ;
} ,
enqueueReplaceState : function ( publicInstance , completeState , callback , callerName ) {
var internalInstance = getInternalInstanceReadyForUpdate ( publicInstance ) ;
2017-06-09 02:01:23 +00:00
internalInstance && ( internalInstance . _pendingStateQueue = [ completeState ] , internalInstance . _pendingReplaceState = ! 0 ,
callback = void 0 === callback ? null : callback , null !== callback && ( warnOnInvalidCallback ( callback , callerName ) ,
internalInstance . _pendingCallbacks ? internalInstance . _pendingCallbacks . push ( callback ) : internalInstance . _pendingCallbacks = [ callback ] ) ,
2017-05-26 17:51:06 +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 ) {
2017-06-09 02:01:23 +00:00
( 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 ] ) ,
2017-05-26 17:51:06 +00:00
enqueueUpdate ( internalInstance ) ;
}
} ,
enqueueElementInternal : function ( internalInstance , nextElement , nextContext ) {
2017-06-09 02:01:23 +00:00
internalInstance . _pendingElement = nextElement , internalInstance . _context = nextContext ,
2017-05-26 17:51:06 +00:00
enqueueUpdate ( internalInstance ) ;
}
} , ReactUpdateQueue _1 = ReactUpdateQueue , injected = ! 1 , ReactComponentEnvironment = {
replaceNodeWithMarkup : null ,
processChildrenUpdates : null ,
injection : {
injectEnvironment : function ( environment ) {
2017-06-09 02:01:23 +00:00
invariant ( ! injected , "ReactCompositeComponent: injectEnvironment() can only be called once." ) ,
ReactComponentEnvironment . replaceNodeWithMarkup = environment . replaceNodeWithMarkup ,
ReactComponentEnvironment . processChildrenUpdates = environment . processChildrenUpdates ,
2017-05-26 17:51:06 +00:00
injected = ! 0 ;
}
}
} , 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 ) ;
try {
return fn ( ) ;
} finally {
ReactInstrumentation . debugTool . onEndLifeCycleTimer ( debugID , timerType ) ;
}
}
var nextMountID = 1 , ReactCompositeComponent = {
construct : function ( element ) {
2017-06-09 02:01:23 +00:00
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 ,
2017-05-26 17:51:06 +00:00
this . _pendingCallbacks = null , this . _calledComponentWillUnmount = ! 1 , this . _warnedAboutRefsInRender = ! 1 ;
} ,
mountComponent : function ( transaction , hostParent , hostContainerInfo , context ) {
var _this = this ;
2017-06-09 02:01:23 +00:00
this . _context = context , this . _mountOrder = nextMountID ++ , this . _hostParent = hostParent ,
2017-05-26 17:51:06 +00:00
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 ) ;
2017-06-09 02:01:23 +00:00
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 ) ,
2017-05-26 17:51:06 +00:00
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" ;
2017-06-09 02:01:23 +00:00
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" ) ,
2017-05-26 17:51:06 +00:00
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 ;
2017-06-09 02:01:23 +00:00
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" ) ,
this . _pendingStateQueue = null , this . _pendingReplaceState = ! 1 , this . _pendingForceUpdate = ! 1 ,
2017-05-26 17:51:06 +00:00
inst . componentWillMount && ( measureLifeCyclePerf ( function ( ) {
return inst . componentWillMount ( ) ;
} , this . _debugID , "componentWillMount" ) , this . _pendingStateQueue && ( inst . state = this . _processPendingState ( inst . props , inst . context ) ) ) ;
var markup ;
2017-06-09 02:01:23 +00:00
markup = inst . unstable _handleError ? this . performInitialMountWithErrorHandling ( renderedElement , hostParent , hostContainerInfo , transaction , context ) : this . performInitialMount ( renderedElement , hostParent , hostContainerInfo , transaction , context ) ,
2017-05-26 17:51:06 +00:00
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 ;
try {
return this . _constructComponentWithoutOwner ( doConstruct , publicProps , publicContext , updateQueue ) ;
} finally {
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 ) {
2017-06-09 02:01:23 +00:00
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 ) ,
2017-05-26 17:51:06 +00:00
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 ) ;
this . _renderedNodeType = nodeType ;
var child = this . _instantiateReactComponent ( renderedElement , nodeType !== ReactNodeTypes _1 . EMPTY ) ;
this . _renderedComponent = child ;
var debugID = 0 ;
debugID = this . _debugID ;
var markup = ReactReconciler _1 . mountComponent ( child , transaction , hostParent , hostContainerInfo , this . _processChildContext ( context ) , debugID ) ;
if ( 0 !== debugID ) {
var childDebugIDs = 0 !== child . _debugID ? [ child . _debugID ] : [ ] ;
ReactInstrumentation . debugTool . onSetChildren ( debugID , childDebugIDs ) ;
}
return markup ;
} ,
getHostNode : function ( ) {
return ReactReconciler _1 . getHostNode ( this . _renderedComponent ) ;
} ,
unmountComponent : function ( safely , skipLifecycle ) {
if ( this . _renderedComponent ) {
var inst = this . _instance ;
2017-06-09 02:01:23 +00:00
if ( inst . componentWillUnmount && ! inst . _calledComponentWillUnmount ) if ( inst . _calledComponentWillUnmount = ! 0 ,
2017-05-26 17:51:06 +00:00
safely ) {
if ( ! skipLifecycle ) {
var name = this . getName ( ) + ".componentWillUnmount()" ;
ReactErrorUtils _1 . invokeGuardedCallbackAndCatchFirstError ( name , inst . componentWillUnmount , inst ) ;
}
} else measureLifeCyclePerf ( function ( ) {
return inst . componentWillUnmount ( ) ;
} , this . _debugID , "componentWillUnmount" ) ;
2017-06-09 02:01:23 +00:00
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 ,
2017-05-26 17:51:06 +00:00
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 ;
2017-06-09 02:01:23 +00:00
return Component . contextTypes && this . _checkContextTypes ( Component . contextTypes , maskedContext , "context" ) ,
2017-05-26 17:51:06 +00:00
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 ( ) ;
}
2017-06-09 02:01:23 +00:00
invariant ( "object" == typeof Component . childContextTypes , "%s.getChildContext(): childContextTypes must be defined in order to " + "use getChildContext()." , this . getName ( ) || "ReactCompositeComponent" ) ,
2017-05-26 17:51:06 +00:00
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 ( ) ;
2017-06-09 02:01:23 +00:00
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 ) ) ,
2017-05-26 17:51:06 +00:00
currentContext ;
} ,
_checkContextTypes : function ( typeSpecs , values , location ) {
2017-06-09 02:01:23 +00:00
ReactDebugCurrentFrame . current = this . _debugID , checkPropTypes ( typeSpecs , values , location , this . getName ( ) , ReactDebugCurrentFrame . getStackAddendum ) ,
2017-05-26 17:51:06 +00:00
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 ;
2017-06-09 02:01:23 +00:00
this . _context === nextUnmaskedContext ? nextContext = inst . context : ( nextContext = this . _processContext ( nextUnmaskedContext ) ,
2017-05-26 17:51:06 +00:00
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 ;
2017-06-09 02:01:23 +00:00
beforeState !== afterState && ( inst . state = beforeState , inst . updater . enqueueReplaceState ( inst , afterState ) ,
2017-05-26 17:51:06 +00:00
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 ) ) ;
}
2017-06-09 02:01:23 +00:00
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 ,
2017-05-26 17:51:06 +00:00
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 ) ;
2017-06-09 02:01:23 +00:00
} , 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 ) ,
2017-05-26 17:51:06 +00:00
hasComponentDidUpdate && transaction . getReactMountReady ( ) . enqueue ( function ( ) {
measureLifeCyclePerf ( inst . componentDidUpdate . bind ( inst , prevProps , prevState ) , _this2 . _debugID , "componentDidUpdate" ) ;
} ) ;
} ,
_updateRenderedComponentWithErrorHandling : function ( transaction , context ) {
var checkpoint = transaction . checkpoint ( ) ;
try {
this . _updateRenderedComponent ( transaction , context ) ;
} catch ( e ) {
2017-06-09 02:01:23 +00:00
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 ) ,
2017-05-26 17:51:06 +00:00
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 {
2017-06-09 02:01:23 +00:00
var oldHostNode = ReactReconciler _1 . getHostNode ( prevComponentInstance ) , nodeType = ReactNodeTypes _1 . getType ( nextRenderedElement ) ;
2017-05-26 17:51:06 +00:00
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 ) ;
2017-06-09 02:01:23 +00:00
if ( ReactReconciler _1 . unmountComponent ( prevComponentInstance , safely , ! 1 ) , 0 !== debugID ) {
2017-05-26 17:51:06 +00:00
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 ( ) ;
2017-06-09 02:01:23 +00:00
} , this . _debugID , "render" ) , void 0 === renderedElement && inst . render . _isMockFunction && ( renderedElement = null ) ,
2017-05-26 17:51:06 +00:00
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-06-09 02:01:23 +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" ) ,
2017-05-26 17:51:06 +00:00
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 ;
}
} , ReactEmptyComponent = {
create : function ( instantiate ) {
return emptyComponentFactory ( instantiate ) ;
}
} ;
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 ) {
2017-06-09 02:01:23 +00:00
return invariant ( genericComponentClass , "There is no registered component for the tag %s" , element . type ) ,
2017-05-26 17:51:06 +00:00
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
2017-06-12 21:02:54 +00:00
} , ReactHostComponent _1 = ReactHostComponent , nextDebugID = 1 , ReactCompositeComponentWrapper = function ( element ) {
2017-05-26 17:51:06 +00:00
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 = "" ;
2017-06-09 02:01:23 +00:00
( 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." ) ,
2017-05-26 17:51:06 +00:00
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-06-09 02:01:23 +00:00
"string" == typeof element . type ? instance = ReactHostComponent _1 . createInternalComponent ( element ) : isInternalComponentType ( element . type ) ? ( instance = new element . type ( element ) ,
2017-05-26 17:51:06 +00:00
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 ) ;
2017-06-09 02:01:23 +00:00
return warning ( "function" == typeof instance . mountComponent && "function" == typeof instance . receiveComponent && "function" == typeof instance . getHostNode && "function" == typeof instance . unmountComponent , "Only React Components can be mounted." ) ,
2017-06-12 21:02:54 +00:00
instance . _mountIndex = 0 , instance . _mountImage = null , instance . _debugID = shouldHaveDebugID ? nextDebugID ++ : 0 ,
2017-05-26 17:51:06 +00:00
Object . preventExtensions && Object . preventExtensions ( instance ) , instance ;
}
Object . assign ( ReactCompositeComponentWrapper . prototype , ReactCompositeComponent _1 , {
_instantiateReactComponent : instantiateReactComponent
} ) ;
var instantiateReactComponent _1 = instantiateReactComponent , DevOnlyStubShim = null , ReactNativeFeatureFlags$2 = {
useFiber : ! 1
} , ReactNativeFeatureFlags _1 = ReactNativeFeatureFlags$2 , ReactNativeFeatureFlags$3 = Object . freeze ( {
default : ReactNativeFeatureFlags _1 ,
_ _moduleExports : ReactNativeFeatureFlags _1
} ) , ReactNativeFeatureFlags$1 = ReactNativeFeatureFlags$3 && ReactNativeFeatureFlags _1 || ReactNativeFeatureFlags$3 , ReactCurrentOwner$2 = ReactGlobalSharedState _1 . ReactCurrentOwner , injectedFindNode = ReactNativeFeatureFlags$1 . useFiber ? function ( fiber ) {
return DevOnlyStubShim . findHostInstance ( fiber ) ;
} : function ( instance ) {
return instance ;
} ;
function findNodeHandle ( componentOrHandle ) {
var owner = ReactCurrentOwner$2 . current ;
2017-06-09 02:01:23 +00:00
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" ) ,
2017-05-26 17:51:06 +00:00
owner . _warnedAboutRefsInRender = ! 0 ) , null == componentOrHandle ) return null ;
if ( "number" == typeof componentOrHandle ) return componentOrHandle ;
var component = componentOrHandle , internalInstance = ReactInstanceMap _1 . get ( component ) ;
2017-06-09 02:01:23 +00:00
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 ) ) ,
2017-05-26 17:51:06 +00:00
void invariant ( ! 1 , "findNodeHandle(...): Unable to find node handle for unmounted " + "component." ) ) ;
}
var findNodeHandle _1 = findNodeHandle , TopLevelWrapper = function ( ) { } ;
2017-06-09 02:01:23 +00:00
TopLevelWrapper . prototype . isReactComponent = { } , TopLevelWrapper . displayName = "TopLevelWrapper" ,
2017-05-26 17:51:06 +00:00
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 ( ) ;
2017-06-09 02:01:23 +00:00
transaction . perform ( mountComponentIntoNode , null , componentInstance , containerTag , transaction ) ,
2017-05-26 17:51:06 +00:00
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 ;
2017-06-09 02:01:23 +00:00
if ( shouldUpdateReactComponent _1 ( prevElement , nextElement ) ) return ReactUpdateQueue _1 . enqueueElementInternal ( prevComponent , nextWrappedElement , emptyObject ) ,
callback && ReactUpdateQueue _1 . enqueueCallbackInternal ( prevComponent , callback ) ,
2017-05-26 17:51:06 +00:00
prevComponent ;
ReactNativeMount . unmountComponentAtNode ( containerTag ) ;
}
2017-06-09 02:01:23 +00:00
if ( ! ReactNativeTagHandles _1 . reactTagIsNativeTopRootID ( containerTag ) ) return console . error ( "You cannot render into anything but a top root" ) ,
2017-05-26 17:51:06 +00:00
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 ( ) ) ;
} ] ;
}
2017-06-09 02:01:23 +00:00
return ReactUpdates _1 . batchedUpdates ( batchedMountComponentIntoNode , instance , containerTag ) ,
2017-05-26 17:51:06 +00:00
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 ) {
2017-06-09 02:01:23 +00:00
if ( ! ReactNativeTagHandles _1 . reactTagIsNativeTopRootID ( containerTag ) ) return console . error ( "You cannot render into anything but a top root" ) ,
2017-05-26 17:51:06 +00:00
! 1 ;
var instance = ReactNativeMount . _instancesByContainerID [ containerTag ] ;
2017-06-09 02:01:23 +00:00
return ! ! instance && ( ReactInstrumentation . debugTool . onBeginFlush ( ) , ReactNativeMount . unmountComponentFromNode ( instance , containerTag ) ,
delete ReactNativeMount . _instancesByContainerID [ containerTag ] , ReactInstrumentation . debugTool . onEndFlush ( ) ,
2017-05-26 17:51:06 +00:00
! 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 ] ;
2017-06-09 02:01:23 +00:00
if ( "MOVE_EXISTING" === update . type ) ( moveFromIndices || ( moveFromIndices = [ ] ) ) . push ( update . fromIndex ) ,
2017-05-26 17:51:06 +00:00
( 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 ) ;
}
}
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 ) {
2017-06-09 02:01:23 +00:00
_classCallCheck ( this , CallbackQueue ) , this . _callbacks = null , this . _contexts = null ,
2017-05-26 17:51:06 +00:00
this . _arg = arg ;
}
return CallbackQueue . prototype . enqueue = function ( callback , context ) {
2017-06-09 02:01:23 +00:00
this . _callbacks = this . _callbacks || [ ] , this . _callbacks . push ( callback ) , this . _contexts = this . _contexts || [ ] ,
2017-05-26 17:51:06 +00:00
this . _contexts . push ( context ) ;
} , CallbackQueue . prototype . notifyAll = function ( ) {
var callbacks = this . _callbacks , contexts = this . _contexts , arg = this . _arg ;
if ( callbacks && contexts ) {
2017-06-09 02:01:23 +00:00
invariant ( callbacks . length === contexts . length , "Mismatched list of contexts in callback queue" ) ,
2017-05-26 17:51:06 +00:00
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 ( ) ;
}
} , 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 ) ;
}
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-06-09 02:01:23 +00:00
Object . assign ( ReactNativeReconcileTransaction . prototype , Transaction , ReactNativeReconcileTransaction , Mixin ) ,
2017-05-26 17:51:06 +00:00
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 ) {
2017-06-09 02:01:23 +00:00
this . _currentElement = text , this . _stringText = "" + text , this . _hostParent = null ,
2017-05-26 17:51:06 +00:00
this . _rootNodeID = 0 ;
} ;
Object . assign ( ReactNativeTextComponent . prototype , {
mountComponent : function ( transaction , hostParent , hostContainerInfo , context ) {
2017-06-09 02:01:23 +00:00
invariant ( context . isInAParentText , 'RawText "%s" must be wrapped in an explicit <Text> component.' , this . _stringText ) ,
2017-05-26 17:51:06 +00:00
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 ( ) {
2017-06-09 02:01:23 +00:00
ReactNativeComponentTree _1 . uncacheNode ( this ) , this . _currentElement = null , this . _stringText = null ,
2017-05-26 17:51:06 +00:00
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 ) {
2017-06-09 02:01:23 +00:00
ReactReconciler _1 . unmountComponent ( this . _renderedComponent , safely , skipLifecycle ) ,
2017-05-26 17:51:06 +00:00
this . _renderedComponent = null ;
}
} ) ;
var ReactSimpleEmptyComponent _1 = ReactSimpleEmptyComponent ;
function inject$1 ( ) {
2017-06-09 02:01:23 +00:00
ReactGenericBatching _1 . injection . injectStackBatchedUpdates ( ReactUpdates _1 . batchedUpdates ) ,
ReactUpdates _1 . injection . injectReconcileTransaction ( ReactNativeComponentEnvironment _1 . ReactReconcileTransaction ) ,
ReactUpdates _1 . injection . injectBatchingStrategy ( ReactDefaultBatchingStrategy _1 ) ,
2017-05-26 17:51:06 +00:00
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 ) ;
} ;
2017-06-09 02:01:23 +00:00
ReactEmptyComponent _1 . injection . injectEmptyComponentFactory ( EmptyComponent ) , ReactHostComponent _1 . injection . injectTextComponentClass ( ReactNativeTextComponent _1 ) ,
2017-05-26 17:51:06 +00:00
ReactHostComponent _1 . injection . injectGenericComponentClass ( function ( tag ) {
var info = "" ;
2017-06-09 02:01:23 +00:00
"string" == typeof tag && /^[a-z]/ . test ( tag ) && ( info += " Each component name should start with an uppercase letter." ) ,
2017-05-26 17:51:06 +00:00
invariant ( ! 1 , "Expected a component class, got %s.%s" , tag , info ) ;
} ) ;
}
var ReactNativeStackInjection = {
inject : inject$1
} ;
function getComponentName ( instanceOrFiber ) {
if ( "function" == typeof instanceOrFiber . getName ) {
return instanceOrFiber . getName ( ) ;
}
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 ;
}
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
} ;
}
} ;
} ) ;
} ;
getInspectorDataForViewTag = function ( viewTag ) {
2017-06-12 21:02:54 +00:00
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 ;
2017-05-26 17:51:06 +00:00
return {
hierarchy : hierarchy ,
props : props ,
selection : componentHierarchy . indexOf ( instance ) ,
source : source
} ;
} ;
var ReactNativeStackInspector = {
getInspectorDataForViewTag : getInspectorDataForViewTag
} , findNumericNodeHandleStack = function ( componentOrHandle ) {
var nodeHandle = findNodeHandle _1 ( componentOrHandle ) ;
return null == nodeHandle || "number" == typeof nodeHandle ? nodeHandle : nodeHandle . getHostNode ( ) ;
} ;
2017-06-09 02:01:23 +00:00
function _classCallCheck$2 ( instance , Constructor ) {
2017-05-26 17:51:06 +00:00
if ( ! ( instance instanceof Constructor ) ) throw new TypeError ( "Cannot call a class as a function" ) ;
}
var objects = { } , uniqueID = 1 , emptyObject$3 = { } , ReactNativePropRegistry = function ( ) {
function ReactNativePropRegistry ( ) {
2017-06-09 02:01:23 +00:00
_classCallCheck$2 ( this , ReactNativePropRegistry ) ;
2017-05-26 17:51:06 +00:00
}
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 ] ;
2017-06-09 02:01:23 +00:00
return object || ( console . warn ( "Invalid style with id `" + id + "`. Skipping ..." ) ,
2017-05-26 17:51:06 +00:00
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 ) {
2017-06-09 02:01:23 +00:00
if ( "function" == typeof nextProp && ( nextProp = ! 0 ) , void 0 === nextProp && ( nextProp = null ) ,
2017-05-26 17:51:06 +00:00
"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 -- ;
}
}
}
}
}
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 ;
2017-06-09 02:01:23 +00:00
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 ) ,
2017-05-26 17:51:06 +00:00
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 ) ) ;
2017-06-09 02:01:23 +00:00
shouldUpdate && ( nextValue = "function" == typeof attributeConfig . process ? attributeConfig . process ( nextProp ) : nextProp ,
2017-05-26 17:51:06 +00:00
( updatePayload || ( updatePayload = { } ) ) [ propKey ] = nextValue ) ;
2017-06-09 02:01:23 +00:00
} else removedKeys = null , removedKeyCount = 0 , updatePayload = diffNestedProperty ( updatePayload , prevProp , nextProp , attributeConfig ) ,
removedKeyCount > 0 && updatePayload && ( restoreDeletedValuesInNestedArray ( updatePayload , nextProp , attributeConfig ) ,
2017-05-26 17:51:06 +00:00
removedKeys = null ) ;
2017-06-09 02:01:23 +00:00
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 ,
2017-05-26 17:51:06 +00:00
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 ) ;
}
} ;
}
2017-06-09 02:01:23 +00:00
function throwOnStylesProp ( component , props ) {
2017-05-26 17:51:06 +00:00
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)?" ;
2017-06-09 02:01:23 +00:00
throw owner && owner . constructor && owner . constructor . displayName && ( msg += "\n\nCheck the `" + owner . constructor . displayName + "` parent " + " component." ) ,
2017-05-26 17:51:06 +00:00
new Error ( msg ) ;
}
}
2017-06-09 02:01:23 +00:00
function warnForStyleProps ( props , validAttributes ) {
2017-05-26 17:51:06 +00:00
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 + ": ... } }`" ) ;
}
var NativeMethodsMixinUtils = {
mountSafeCallback : mountSafeCallback$1 ,
2017-06-09 02:01:23 +00:00
throwOnStylesProp : throwOnStylesProp ,
warnForStyleProps : warnForStyleProps
} ;
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 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 ) {
2017-05-26 17:51:06 +00:00
UIManager . measure ( findNumericNodeHandle ( this ) , mountSafeCallback ( this , callback ) ) ;
2017-06-09 02:01:23 +00:00
} , 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 , mountSafeCallback$2 = NativeMethodsMixinUtils . mountSafeCallback , throwOnStylesProp$1 = NativeMethodsMixinUtils . throwOnStylesProp , warnForStyleProps$1 = NativeMethodsMixinUtils . warnForStyleProps , findNumericNodeHandle$1 = ReactNativeFeatureFlags$1 . useFiber ? DevOnlyStubShim : findNumericNodeHandleStack , NativeMethodsMixin = {
measure : function ( callback ) {
UIManager . measure ( findNumericNodeHandle$1 ( this ) , mountSafeCallback$2 ( this , callback ) ) ;
2017-05-26 17:51:06 +00:00
} ,
measureInWindow : function ( callback ) {
2017-06-09 02:01:23 +00:00
UIManager . measureInWindow ( findNumericNodeHandle$1 ( this ) , mountSafeCallback$2 ( this , callback ) ) ;
2017-05-26 17:51:06 +00:00
} ,
measureLayout : function ( relativeToNativeNode , onSuccess , onFail ) {
2017-06-09 02:01:23 +00:00
UIManager . measureLayout ( findNumericNodeHandle$1 ( this ) , relativeToNativeNode , mountSafeCallback$2 ( this , onFail ) , mountSafeCallback$2 ( this , onSuccess ) ) ;
2017-05-26 17:51:06 +00:00
} ,
setNativeProps : function ( nativeProps ) {
2017-06-09 02:01:23 +00:00
injectedSetNativeProps$1 ( this , nativeProps ) ;
2017-05-26 17:51:06 +00:00
} ,
focus : function ( ) {
2017-06-09 02:01:23 +00:00
TextInputState . focusTextInput ( findNumericNodeHandle$1 ( this ) ) ;
2017-05-26 17:51:06 +00:00
} ,
blur : function ( ) {
2017-06-09 02:01:23 +00:00
TextInputState . blurTextInput ( findNumericNodeHandle$1 ( this ) ) ;
2017-05-26 17:51:06 +00:00
}
} ;
2017-06-09 02:01:23 +00:00
function setNativePropsFiber$1 ( componentOrHandle , nativeProps ) {
2017-05-26 17:51:06 +00:00
var maybeInstance = void 0 ;
try {
maybeInstance = findNodeHandle _1 ( componentOrHandle ) ;
} catch ( error ) { }
if ( null != maybeInstance ) {
var viewConfig = maybeInstance . viewConfig ;
2017-06-09 02:01:23 +00:00
warnForStyleProps$1 ( nativeProps , viewConfig . validAttributes ) ;
2017-05-26 17:51:06 +00:00
var updatePayload = ReactNativeAttributePayload _1 . create ( nativeProps , viewConfig . validAttributes ) ;
UIManager . updateView ( maybeInstance . _nativeTag , viewConfig . uiViewClassName , updatePayload ) ;
}
}
2017-06-09 02:01:23 +00:00
function setNativePropsStack$1 ( componentOrHandle , nativeProps ) {
2017-05-26 17:51:06 +00:00
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 ;
2017-06-09 02:01:23 +00:00
warnForStyleProps$1 ( nativeProps , viewConfig . validAttributes ) ;
2017-05-26 17:51:06 +00:00
var updatePayload = ReactNativeAttributePayload _1 . create ( nativeProps , viewConfig . validAttributes ) ;
UIManager . updateView ( tag , viewConfig . uiViewClassName , updatePayload ) ;
}
}
2017-06-09 02:01:23 +00:00
var injectedSetNativeProps$1 = void 0 ;
2017-05-26 17:51:06 +00:00
2017-06-09 02:01:23 +00:00
injectedSetNativeProps$1 = ReactNativeFeatureFlags$1 . useFiber ? setNativePropsFiber$1 : setNativePropsStack$1 ;
2017-05-26 17:51:06 +00:00
var NativeMethodsMixin _DEV = NativeMethodsMixin ;
2017-06-09 02:01:23 +00:00
invariant ( ! NativeMethodsMixin _DEV . componentWillMount && ! NativeMethodsMixin _DEV . componentWillReceiveProps , "Do not override existing functions." ) ,
2017-05-26 17:51:06 +00:00
NativeMethodsMixin _DEV . componentWillMount = function ( ) {
2017-06-09 02:01:23 +00:00
throwOnStylesProp$1 ( this , this . props ) ;
2017-05-26 17:51:06 +00:00
} , NativeMethodsMixin _DEV . componentWillReceiveProps = function ( newProps ) {
2017-06-09 02:01:23 +00:00
throwOnStylesProp$1 ( this , newProps ) ;
2017-05-26 17:51:06 +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 ;
2017-06-09 02:01:23 +00:00
if ( null !== oneTouchData ) oneTouchData . touchActive && oneTouchData . currentTimeStamp > touchesChangedAfter && ( total += ofCurrent && isXAxis ? oneTouchData . currentPageX : ofCurrent && ! isXAxis ? oneTouchData . currentPageY : ! ofCurrent && isXAxis ? oneTouchData . previousPageX : oneTouchData . previousPageY ,
2017-05-26 17:51:06 +00:00
count = 1 ) ; else for ( var i = 0 ; i < touchBank . length ; i ++ ) {
var touchTrack = touchBank [ i ] ;
if ( null !== touchTrack && void 0 !== touchTrack && touchTrack . touchActive && touchTrack . currentTimeStamp >= touchesChangedAfter ) {
var toAdd ;
2017-06-09 02:01:23 +00:00
toAdd = ofCurrent && isXAxis ? touchTrack . currentPageX : ofCurrent && ! isXAxis ? touchTrack . currentPageY : ! ofCurrent && isXAxis ? touchTrack . previousPageX : touchTrack . previousPageY ,
2017-05-26 17:51:06 +00:00
total += toAdd , count ++ ;
}
}
return count > 0 ? total / count : TouchHistoryMath . noCentroid ;
} ,
currentCentroidXOfTouchesChangedAfter : function ( touchHistory , touchesChangedAfter ) {
return TouchHistoryMath . centroidDimension ( touchHistory , touchesChangedAfter , ! 0 , ! 0 ) ;
} ,
currentCentroidYOfTouchesChangedAfter : function ( touchHistory , touchesChangedAfter ) {
return TouchHistoryMath . centroidDimension ( touchHistory , touchesChangedAfter , ! 1 , ! 0 ) ;
} ,
previousCentroidXOfTouchesChangedAfter : function ( touchHistory , touchesChangedAfter ) {
return TouchHistoryMath . centroidDimension ( touchHistory , touchesChangedAfter , ! 0 , ! 1 ) ;
} ,
previousCentroidYOfTouchesChangedAfter : function ( touchHistory , touchesChangedAfter ) {
return TouchHistoryMath . centroidDimension ( touchHistory , touchesChangedAfter , ! 1 , ! 1 ) ;
} ,
currentCentroidX : function ( touchHistory ) {
return TouchHistoryMath . centroidDimension ( touchHistory , 0 , ! 0 , ! 0 ) ;
} ,
currentCentroidY : function ( touchHistory ) {
return TouchHistoryMath . centroidDimension ( touchHistory , 0 , ! 1 , ! 0 ) ;
} ,
noCentroid : - 1
} , TouchHistoryMath _1 = TouchHistoryMath ;
function escape ( key ) {
var escaperLookup = {
"=" : "=0" ,
":" : "=2"
} ;
return "$" + ( "" + key ) . replace ( /[=:]/g , function ( match ) {
return escaperLookup [ match ] ;
} ) ;
}
2017-06-12 21:02:54 +00:00
var unescapeInDev = emptyFunction ;
unescapeInDev = function ( key ) {
2017-05-26 17:51:06 +00:00
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-06-12 21:02:54 +00:00
} ;
2017-05-26 17:51:06 +00:00
var KeyEscapeUtils = {
escape : escape ,
2017-06-12 21:02:54 +00:00
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 ;
2017-05-26 17:51:06 +00:00
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 ;
2017-06-12 21:02:54 +00:00
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 ) ,
2017-05-26 17:51:06 +00:00
1 ;
var child , nextName , subtreeCount = 0 , nextNamePrefix = "" === nameSoFar ? SEPARATOR : nameSoFar + SUBSEPARATOR ;
2017-06-09 02:01:23 +00:00
if ( Array . isArray ( children ) ) for ( var i = 0 ; i < children . length ; i ++ ) child = children [ i ] ,
2017-05-26 17:51:06 +00:00
nextName = nextNamePrefix + getComponentKey ( child , i ) , subtreeCount += traverseStackChildrenImpl ( child , nextName , callback , traverseContext ) ; else {
2017-06-12 21:02:54 +00:00
var iteratorFn = ITERATOR _SYMBOL && children [ ITERATOR _SYMBOL ] || children [ FAUX _ITERATOR _SYMBOL ] ;
if ( "function" == typeof iteratorFn ) {
2017-06-09 02:01:23 +00:00
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 ( ) ) ,
2017-05-26 17:51:06 +00:00
didWarnAboutMaps = ! 0 ) ;
2017-06-09 02:01:23 +00:00
for ( var step , iterator = iteratorFn . call ( children ) , ii = 0 ; ! ( step = iterator . next ( ) ) . done ; ) child = step . value ,
2017-05-26 17:51:06 +00:00
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 ] ;
2017-06-09 02:01:23 +00:00
ReactComponentTreeHook$2 || ( ReactComponentTreeHook$2 = ReactGlobalSharedState _1 . ReactComponentTreeHook ) ,
2017-06-12 21:02:54 +00:00
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 ) ) ,
2017-05-26 17:51:06 +00:00
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 ] ;
2017-06-09 02:01:23 +00:00
if ( null != prevChild && shouldUpdateReactComponent _1 ( prevElement , nextElement ) ) ReactReconciler _1 . receiveComponent ( prevChild , nextElement , transaction , context ) ,
2017-05-26 17:51:06 +00:00
nextChildren [ name ] = prevChild ; else {
var nextChildInstance = instantiateReactComponent _1 ( nextElement , ! 0 ) ;
nextChildren [ name ] = nextChildInstance ;
var nextChildMountImage = ReactReconciler _1 . mountComponent ( nextChildInstance , transaction , hostParent , hostContainerInfo , context , selfDebugID ) ;
2017-06-09 02:01:23 +00:00
mountImages . push ( nextChildMountImage ) , prevChild && ( removedNodes [ name ] = ReactReconciler _1 . getHostNode ( prevChild ) ,
2017-05-26 17:51:06 +00:00
ReactReconciler _1 . unmountComponent ( prevChild , ! 1 , ! 1 ) ) ;
}
}
2017-06-09 02:01:23 +00:00
for ( name in prevChildren ) ! prevChildren . hasOwnProperty ( name ) || nextChildren && nextChildren . hasOwnProperty ( name ) || ( prevChild = prevChildren [ name ] ,
2017-05-26 17:51:06 +00:00
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 ] ;
2017-06-09 02:01:23 +00:00
ReactComponentTreeHook$3 || ( ReactComponentTreeHook$3 = ReactGlobalSharedState _1 . ReactComponentTreeHook ) ,
2017-06-12 21:02:54 +00:00
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 ) ) ,
2017-05-26 17:51:06 +00:00
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
} ;
}
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 ) ;
}
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 ) ;
} finally {
ReactCurrentOwner$3 . current = null ;
}
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 ;
}
2017-06-09 02:01:23 +00:00
return ReactChildReconciler _1 . updateChildren ( prevChildren , nextChildren , mountImages , removedNodes , transaction , this , this . _hostContainerInfo , context , selfDebugID ) ,
2017-05-26 17:51:06 +00:00
nextChildren ;
}
2017-06-09 02:01:23 +00:00
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 ;
} ,
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 ] ;
2017-06-09 02:01:23 +00:00
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 ) ) ,
2017-05-26 17:51:06 +00:00
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 ;
2017-06-09 02:01:23 +00:00
ReactChildReconciler _1 . unmountChildren ( renderedChildren , safely , skipLifecycle ) ,
2017-05-26 17:51:06 +00:00
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 ;
}
} , ReactMultiChild _1 = ReactMultiChild , ReactNativeBaseComponent = function ( viewConfig ) {
this . viewConfig = viewConfig ;
} ;
ReactNativeBaseComponent . Mixin = {
getPublicInstance : function ( ) {
return this ;
} ,
unmountComponent : function ( safely , skipLifecycle ) {
2017-06-09 02:01:23 +00:00
ReactNativeComponentTree _1 . uncacheNode ( this ) , this . unmountChildren ( safely , skipLifecycle ) ,
2017-05-26 17:51:06 +00:00
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 ) ;
2017-06-09 02:01:23 +00:00
updatePayload && UIManager . updateView ( this . _rootNodeID , this . viewConfig . uiViewClassName , updatePayload ) ,
2017-05-26 17:51:06 +00:00
this . updateChildren ( nextElement . props . children , transaction , context ) ;
} ,
2017-05-30 16:55:20 +00:00
getName : function ( ) {
return this . constructor . displayName || this . constructor . name || "Unknown" ;
} ,
2017-05-26 17:51:06 +00:00
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 ;
2017-06-09 02:01:23 +00:00
return UIManager . createView ( tag , this . viewConfig . uiViewClassName , nativeTopRootTag , updatePayload ) ,
ReactNativeComponentTree _1 . precacheNode ( this , tag ) , this . initializeChildren ( this . _currentElement . props . children , tag , transaction , context ) ,
2017-05-26 17:51:06 +00:00
tag ;
}
} , Object . assign ( ReactNativeBaseComponent . prototype , ReactMultiChild _1 , ReactNativeBaseComponent . Mixin , NativeMethodsMixin _1 ) ;
var ReactNativeBaseComponent _1 = ReactNativeBaseComponent , createReactNativeComponentClassStack = function ( viewConfig ) {
var Constructor = function ( element ) {
2017-06-09 02:01:23 +00:00
this . _currentElement = element , this . _topLevelWrapper = null , this . _hostParent = null ,
2017-05-26 17:51:06 +00:00
this . _hostContainerInfo = null , this . _rootNodeID = 0 , this . _renderedChildren = null ;
} ;
2017-06-09 02:01:23 +00:00
return Constructor . displayName = viewConfig . uiViewClassName , Constructor . viewConfig = viewConfig ,
Constructor . propTypes = viewConfig . propTypes , Constructor . prototype = new ReactNativeBaseComponent _1 ( viewConfig ) ,
2017-05-26 17:51:06 +00:00
Constructor . prototype . constructor = Constructor , Constructor ;
2017-06-09 02:01:23 +00:00
} , createReactNativeComponentClassStack _1 = createReactNativeComponentClassStack , createReactNativeComponentClass = ReactNativeFeatureFlags$1 . useFiber ? DevOnlyStubShim : createReactNativeComponentClassStack _1 , findNumericNodeHandle$2 = ReactNativeFeatureFlags$1 . useFiber ? DevOnlyStubShim : findNumericNodeHandleStack ;
2017-05-26 17:51:06 +00:00
function takeSnapshot ( view , options ) {
2017-06-09 02:01:23 +00:00
return "number" != typeof view && "window" !== view && ( view = findNumericNodeHandle$2 ( view ) || "window" ) ,
2017-05-26 17:51:06 +00:00
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 ;
}
function consoleTable ( table ) {
console . table ( table ) ;
}
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
2017-06-09 02:01:23 +00:00
} ) , stats . durations [ timerType ] || ( stats . durations [ timerType ] = 0 ) , stats . counts [ timerType ] || ( stats . counts [ timerType ] = 0 ) ,
2017-05-26 17:51:06 +00:00
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 ] ++ ;
} ) ;
} ) ;
} ) , 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 ;
} ) ;
}
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 ) {
updateAggregatedStats ( treeSnapshot , instanceID , function ( stats ) {
stats . renderCount ++ ;
} ) ;
for ( var nextParentID = instanceID ; nextParentID ; ) isCompositeByID [ 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
} ) ;
} ) . sort ( function ( a , b ) {
return b . inclusiveRenderDuration - a . inclusiveRenderDuration ;
} ) ;
}
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 ] = {
key : key ,
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 ) {
2017-06-09 02:01:23 +00:00
for ( var instanceID = operation . instanceID , nextParentID = instanceID ; nextParentID ; ) isDefinitelyNotWastedByID [ nextParentID ] = ! 0 ,
2017-05-26 17:51:06 +00:00
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
} ) ;
} ) . sort ( function ( a , b ) {
return b . inclusiveRenderDuration - a . inclusiveRenderDuration ;
} ) ;
}
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 ) {
2017-06-09 02:01:23 +00:00
return lowPriorityWarning _1 ( warnedAboutPrintDOM , "`ReactPerf.printDOM(...)` is deprecated. Use " + "`ReactPerf.printOperations(...)` instead." ) ,
2017-05-26 17:51:06 +00:00
warnedAboutPrintDOM = ! 0 , printOperations ( measurements ) ;
}
var warnedAboutGetMeasurementsSummaryMap = ! 1 ;
function getMeasurementsSummaryMap ( measurements ) {
2017-06-09 02:01:23 +00:00
return lowPriorityWarning _1 ( warnedAboutGetMeasurementsSummaryMap , "`ReactPerf.getMeasurementsSummaryMap(...)` is deprecated. Use " + "`ReactPerf.getWasted(...)` instead." ) ,
2017-05-26 17:51:06 +00:00
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 ) ;
} , ReactNative = {
2017-06-09 02:01:23 +00:00
NativeComponent : ReactNativeComponent _1 ,
2017-05-26 17:51:06 +00:00
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 ( ReactNative . _ _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 ReactNativeStack = ReactNative ;
module . exports = ReactNativeStack ;