7abc8adc4cdef721efbe97482547e620.json 35.2 KB
{"ast":null,"code":"var _interopRequireDefault=require(\"@babel/runtime/helpers/interopRequireDefault\");Object.defineProperty(exports,\"__esModule\",{value:true});exports._TESTING_ONLY_reset_container_count=_TESTING_ONLY_reset_container_count;exports.default=createNavigationContainer;var _extends2=_interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));var _slicedToArray2=_interopRequireDefault(require(\"@babel/runtime/helpers/slicedToArray\"));var _regenerator=_interopRequireDefault(require(\"@babel/runtime/regenerator\"));var _classCallCheck2=_interopRequireDefault(require(\"@babel/runtime/helpers/classCallCheck\"));var _possibleConstructorReturn2=_interopRequireDefault(require(\"@babel/runtime/helpers/possibleConstructorReturn\"));var _getPrototypeOf2=_interopRequireDefault(require(\"@babel/runtime/helpers/getPrototypeOf\"));var _createClass2=_interopRequireDefault(require(\"@babel/runtime/helpers/createClass\"));var _inherits2=_interopRequireDefault(require(\"@babel/runtime/helpers/inherits\"));var _objectWithoutProperties2=_interopRequireDefault(require(\"@babel/runtime/helpers/objectWithoutProperties\"));var _react=_interopRequireDefault(require(\"react\"));var _Linking=_interopRequireDefault(require(\"react-native-web/dist/exports/Linking\"));var _Platform=_interopRequireDefault(require(\"react-native-web/dist/exports/Platform\"));var _BackHandler=_interopRequireDefault(require(\"react-native-web/dist/exports/BackHandler\"));var _core=require(\"@react-navigation/core\");var _invariant=_interopRequireDefault(require(\"./utils/invariant\"));var _docsUrl=_interopRequireDefault(require(\"./utils/docsUrl\"));var urlToPathAndParams=_core.pathUtils.urlToPathAndParams;function isStateful(props){return!props.navigation;}function validateProps(props){if(props.persistenceKey){console.warn('You passed persistenceKey prop to a navigator. '+'The persistenceKey prop was replaced by a more flexible persistence mechanism, '+'please see the navigation state persistence docs for more information. '+'Passing the persistenceKey prop is a no-op.');}if(isStateful(props)){return;}var navigation=props.navigation,screenProps=props.screenProps,persistNavigationState=props.persistNavigationState,loadNavigationState=props.loadNavigationState,theme=props.theme,containerProps=(0,_objectWithoutProperties2.default)(props,[\"navigation\",\"screenProps\",\"persistNavigationState\",\"loadNavigationState\",\"theme\"]);var keys=Object.keys(containerProps);if(keys.length!==0){throw new Error('This navigator has both navigation and container props, so it is '+(\"unclear if it should own its own state. Remove props: \\\"\"+keys.join(', ')+\"\\\" \")+'if the navigator should get its state from the navigation prop. If the '+'navigator should maintain its own state, do not pass a navigation prop.');}(0,_invariant.default)(persistNavigationState===undefined&&loadNavigationState===undefined||typeof persistNavigationState==='function'&&typeof loadNavigationState==='function','both persistNavigationState and loadNavigationState must either be undefined, or be functions');}var _statefulContainerCount=0;function _TESTING_ONLY_reset_container_count(){_statefulContainerCount=0;}var _reactNavigationIsHydratingState=false;function createNavigationContainer(Component){var NavigationContainer=function(_React$Component){(0,_inherits2.default)(NavigationContainer,_React$Component);(0,_createClass2.default)(NavigationContainer,null,[{key:\"getDerivedStateFromProps\",value:function getDerivedStateFromProps(nextProps){validateProps(nextProps);return null;}}]);function NavigationContainer(props){var _this;(0,_classCallCheck2.default)(this,NavigationContainer);_this=(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(NavigationContainer).call(this,props));_this.subs=null;_this._actionEventSubscribers=new Set();_this._handleOpenURL=function(_ref){var url=_ref.url;var _this$props=_this.props,enableURLHandling=_this$props.enableURLHandling,uriPrefix=_this$props.uriPrefix;if(enableURLHandling===false){return;}var parsedUrl=urlToPathAndParams(url,uriPrefix);if(parsedUrl){var path=parsedUrl.path,params=parsedUrl.params;var action=Component.router.getActionForPathAndParams(path,params);if(action){_this.dispatch(action);}}};_this._persistNavigationState=function _callee(nav){var persistNavigationState;return _regenerator.default.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:persistNavigationState=_this.props.persistNavigationState;if(!persistNavigationState){_context.next=10;break;}_context.prev=2;_context.next=5;return _regenerator.default.awrap(persistNavigationState(nav));case 5:_context.next=10;break;case 7:_context.prev=7;_context.t0=_context[\"catch\"](2);console.warn('Uncaught exception while calling persistNavigationState()! You should handle exceptions thrown from persistNavigationState(), ignoring them may result in undefined behavior.');case 10:case\"end\":return _context.stop();}}},null,null,[[2,7]]);};_this.dispatch=function(action){if(_this.props.navigation){return _this.props.navigation.dispatch(action);}_this._navState=_this._navState||_this.state.nav;var lastNavState=_this._navState;(0,_invariant.default)(lastNavState,'should be set in constructor if stateful');var reducedState=Component.router.getStateForAction(action,lastNavState);var navState=reducedState===null?lastNavState:reducedState;var dispatchActionEvents=function dispatchActionEvents(){_this._actionEventSubscribers.forEach(function(subscriber){return subscriber({type:'action',action:action,state:navState,lastState:lastNavState});});};if(reducedState===null){dispatchActionEvents();return true;}if(navState!==lastNavState){_this._navState=navState;_this.setState({nav:navState},function(){_this._onNavigationStateChange(lastNavState,navState,action);dispatchActionEvents();_this._persistNavigationState(navState);});return true;}dispatchActionEvents();return false;};_this._getScreenProps=function(){return _this.props.screenProps;};_this._getTheme=function(){if(_this.props.theme==='light'||_this.props.theme==='dark'){return _this.props.theme;}else if(_this.props.theme==='no-preference'){return'light';}else{console.warn(\"Invalid theme provided: \"+_this.props.theme+\". Only 'light' and 'dark' are supported. Falling back to 'light'\");return'light';}};validateProps(props);_this._initialAction=_core.NavigationActions.init();if(_this._isStateful()&&_BackHandler.default&&typeof _BackHandler.default.addEventListener==='function'){_this.subs=_BackHandler.default.addEventListener('hardwareBackPress',function(){if(!_this._isMounted){_this.subs&&_this.subs.remove();}else{return _this.dispatch(_core.NavigationActions.back());}});}_this.state={nav:_this._isStateful()&&!props.loadNavigationState?Component.router.getStateForAction(_this._initialAction):null};return _this;}(0,_createClass2.default)(NavigationContainer,[{key:\"_renderLoading\",value:function _renderLoading(){return this.props.renderLoadingExperimental?this.props.renderLoadingExperimental():null;}},{key:\"_isStateful\",value:function _isStateful(){return isStateful(this.props);}},{key:\"_onNavigationStateChange\",value:function _onNavigationStateChange(prevNav,nav,action){if(typeof this.props.onNavigationStateChange==='undefined'&&this._isStateful()&&!!process.env.REACT_NAV_LOGGING){if(console.group){console.group('Navigation Dispatch: ');console.log('Action: ',action);console.log('New State: ',nav);console.log('Last State: ',prevNav);console.groupEnd();}else{console.log('Navigation Dispatch: ',{action:action,newState:nav,lastState:prevNav});}return;}if(typeof this.props.onNavigationStateChange==='function'){this.props.onNavigationStateChange(prevNav,nav,action);}}},{key:\"componentDidUpdate\",value:function componentDidUpdate(){if(this._navState===this.state.nav){this._navState=null;}}},{key:\"componentDidMount\",value:function componentDidMount(){var _this2=this;var parsedUrl,userProvidedStartupState,_ref2,action,startupState,_parsedUrl,path,params,urlAction,dispatchActions;return _regenerator.default.async(function componentDidMount$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:this._isMounted=true;if(this._isStateful()){_context2.next=3;break;}return _context2.abrupt(\"return\");case 3:if(__DEV__&&!this.props.detached){if(_statefulContainerCount>0){if(_Platform.default.OS==='ios'){console.warn(\"You should only render one navigator explicitly in your app, and other navigators should be rendered by including them in that navigator. Full details at: \"+(0,_docsUrl.default)('common-mistakes.html#explicitly-rendering-more-than-one-navigator'));}}}_statefulContainerCount++;_Linking.default.addEventListener('url',this._handleOpenURL);parsedUrl=null;userProvidedStartupState=null;if(!(this.props.enableURLHandling!==false)){_context2.next=14;break;}_context2.next=11;return _regenerator.default.awrap(this.getStartupParams());case 11:_ref2=_context2.sent;parsedUrl=_ref2.parsedUrl;userProvidedStartupState=_ref2.userProvidedStartupState;case 14:action=this._initialAction;startupState=this.state.nav;if(!startupState&&!userProvidedStartupState){!!process.env.REACT_NAV_LOGGING&&console.log('Init new Navigation State');startupState=Component.router.getStateForAction(action);}if(userProvidedStartupState){startupState=userProvidedStartupState;_reactNavigationIsHydratingState=true;}if(parsedUrl){_parsedUrl=parsedUrl,path=_parsedUrl.path,params=_parsedUrl.params;urlAction=Component.router.getActionForPathAndParams(path,params);if(urlAction){!!process.env.REACT_NAV_LOGGING&&console.log('Applying Navigation Action for Initial URL:',parsedUrl);action=urlAction;startupState=Component.router.getStateForAction(urlAction,startupState);}}dispatchActions=function dispatchActions(){return _this2._actionEventSubscribers.forEach(function(subscriber){return subscriber({type:'action',action:action,state:_this2.state.nav,lastState:null});});};if(!(startupState===this.state.nav)){_context2.next=23;break;}dispatchActions();return _context2.abrupt(\"return\");case 23:this.setState({nav:startupState},function(){_reactNavigationIsHydratingState=false;dispatchActions();});case 24:case\"end\":return _context2.stop();}}},null,this);}},{key:\"getStartupParams\",value:function getStartupParams(){var _this$props2,uriPrefix,loadNavigationState,url,loadedNavState,_ref3,_ref4;return _regenerator.default.async(function getStartupParams$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_this$props2=this.props,uriPrefix=_this$props2.uriPrefix,loadNavigationState=_this$props2.loadNavigationState;_context3.prev=1;_context3.next=4;return _regenerator.default.awrap(Promise.all([_Linking.default.getInitialURL(),loadNavigationState&&loadNavigationState()]));case 4:_ref3=_context3.sent;_ref4=(0,_slicedToArray2.default)(_ref3,2);url=_ref4[0];loadedNavState=_ref4[1];_context3.next=12;break;case 10:_context3.prev=10;_context3.t0=_context3[\"catch\"](1);case 12:return _context3.abrupt(\"return\",{parsedUrl:url&&urlToPathAndParams(url,uriPrefix),userProvidedStartupState:loadedNavState});case 13:case\"end\":return _context3.stop();}}},null,this,[[1,10]]);}},{key:\"componentDidCatch\",value:function componentDidCatch(e){if(_reactNavigationIsHydratingState){_reactNavigationIsHydratingState=false;console.warn('Uncaught exception while starting app from persisted navigation state! Trying to render again with a fresh navigation state...');this.dispatch(_core.NavigationActions.init());}else{throw e;}}},{key:\"componentWillUnmount\",value:function componentWillUnmount(){this._isMounted=false;_Linking.default.removeEventListener('url',this._handleOpenURL);this.subs&&this.subs.remove();if(this._isStateful()){_statefulContainerCount--;}}},{key:\"render\",value:function render(){var _this3=this;var navigation=this.props.navigation;if(this._isStateful()){var navState=this.state.nav;if(!navState){return this._renderLoading();}if(!this._navigation||this._navigation.state!==navState){this._navigation=(0,_core.getNavigation)(Component.router,navState,this.dispatch,this._actionEventSubscribers,this._getScreenProps,function(){return _this3._navigation;});}navigation=this._navigation;}(0,_invariant.default)(navigation,'failed to get navigation');return _react.default.createElement(_core.ThemeProvider,{value:this._getTheme()},_react.default.createElement(_core.NavigationProvider,{value:navigation},_react.default.createElement(Component,(0,_extends2.default)({},this.props,{navigation:navigation}))));}}]);return NavigationContainer;}(_react.default.Component);NavigationContainer.router=Component.router;NavigationContainer.navigationOptions=null;NavigationContainer.defaultProps={theme:'light'};return NavigationContainer;}","map":{"version":3,"sources":["C:/Users/bluej/Desktop/2_2/searchGuide/searchGuide/node_modules/@react-navigation/native/dist/createAppContainer.js"],"names":["urlToPathAndParams","pathUtils","isStateful","props","navigation","validateProps","persistenceKey","console","warn","screenProps","persistNavigationState","loadNavigationState","theme","containerProps","keys","Object","length","Error","join","undefined","_statefulContainerCount","_TESTING_ONLY_reset_container_count","_reactNavigationIsHydratingState","createNavigationContainer","Component","NavigationContainer","nextProps","subs","_actionEventSubscribers","Set","_handleOpenURL","url","enableURLHandling","uriPrefix","parsedUrl","path","params","action","router","getActionForPathAndParams","dispatch","_persistNavigationState","nav","_navState","state","lastNavState","reducedState","getStateForAction","navState","dispatchActionEvents","forEach","subscriber","type","lastState","setState","_onNavigationStateChange","_getScreenProps","_getTheme","_initialAction","NavigationActions","init","_isStateful","BackHandler","addEventListener","_isMounted","remove","back","renderLoadingExperimental","prevNav","onNavigationStateChange","process","env","REACT_NAV_LOGGING","group","log","groupEnd","newState","__DEV__","detached","Platform","OS","Linking","userProvidedStartupState","getStartupParams","startupState","urlAction","dispatchActions","Promise","all","getInitialURL","loadedNavState","e","removeEventListener","_renderLoading","_navigation","React","navigationOptions","defaultProps"],"mappings":"2kCAAA,oD,4QAEA,4CACA,oEACA,gE,GAEQA,CAAAA,kB,CAAuBC,e,CAAvBD,kB,CAER,QAASE,CAAAA,UAAT,CAAoBC,KAApB,CAA2B,CACzB,MAAO,CAACA,KAAK,CAACC,UAAd,CACD,CAED,QAASC,CAAAA,aAAT,CAAuBF,KAAvB,CAA8B,CAC5B,GAAIA,KAAK,CAACG,cAAV,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,CAAAA,QAAQ,CAAG,KAAKJ,KAAL,CAAWF,GAA5B,CACA,GAAI,CAACM,QAAL,CAAe,CACb,MAAO,MAAK6C,cAAL,EAAP,CACD,CACD,GAAI,CAAC,KAAKC,WAAN,EAAqB,KAAKA,WAAL,CAAiBlD,KAAjB,GAA2BI,QAApD,CAA8D,CAC5D,KAAK8C,WAAL,CAAmB,wBAActE,SAAS,CAACc,MAAxB,CAAgCU,QAAhC,CAA0C,KAAKR,QAA/C,CAAyD,KAAKZ,uBAA9D,CAAuF,KAAK4B,eAA5F,CAA6G,iBAAM,CAAA,MAAI,CAACsC,WAAX,EAA7G,CAAnB,CACD,CACD1F,UAAU,CAAG,KAAK0F,WAAlB,CACD,CACD,uBAAU1F,UAAV,CAAsB,0BAAtB,EAEA,MAAO,8BAAC,mBAAD,EAAe,KAAK,CAAE,KAAKqD,SAAL,EAAtB,EACH,6BAAC,wBAAD,EAAoB,KAAK,CAAErD,UAA3B,EACE,6BAAC,SAAD,0BAAe,KAAKD,KAApB,EAA2B,UAAU,CAAEC,UAAvC,GADF,CADG,CAAP,CAKD,CApSwD,iCACzB2F,eAAMvE,SADmB,EACrDC,mBADqD,CAIlDa,MAJkD,CAIzCd,SAAS,CAACc,MAJ+B,CACrDb,mBADqD,CAKlDuE,iBALkD,CAK9B,IAL8B,CACrDvE,mBADqD,CAOlDwE,YAPkD,CAOnC,CACpBrF,KAAK,CAAE,OADa,CAPmC,CAuS3D,MAAOa,CAAAA,mBAAP,CACD","sourcesContent":["import React from 'react';\nimport { Linking, Platform, BackHandler } from 'react-native';\nimport { NavigationActions, ThemeProvider, pathUtils, getNavigation, NavigationProvider } from '@react-navigation/core';\nimport invariant from './utils/invariant';\nimport docsUrl from './utils/docsUrl';\n\nconst { urlToPathAndParams } = pathUtils;\n\nfunction isStateful(props) {\n  return !props.navigation;\n}\n\nfunction validateProps(props) {\n  if (props.persistenceKey) {\n    console.warn('You passed persistenceKey prop to a navigator. ' + 'The persistenceKey prop was replaced by a more flexible persistence mechanism, ' + 'please see the navigation state persistence docs for more information. ' + 'Passing the persistenceKey prop is a no-op.');\n  }\n  if (isStateful(props)) {\n    return;\n  }\n  /* eslint-disable no-unused-vars */\n  const {\n    navigation,\n    screenProps,\n    persistNavigationState,\n    loadNavigationState,\n    theme,\n    ...containerProps\n  } = props;\n  /* eslint-enable no-unused-vars */\n\n  const keys = Object.keys(containerProps);\n\n  if (keys.length !== 0) {\n    throw new Error('This navigator has both navigation and container props, so it is ' + `unclear if it should own its own state. Remove props: \"${keys.join(', ')}\" ` + 'if the navigator should get its state from the navigation prop. If the ' + 'navigator should maintain its own state, do not pass a navigation prop.');\n  }\n  invariant(persistNavigationState === undefined && loadNavigationState === undefined || typeof persistNavigationState === 'function' && typeof loadNavigationState === 'function', 'both persistNavigationState and loadNavigationState must either be undefined, or be functions');\n}\n\n// Track the number of stateful container instances. Warn if >0 and not using the\n// detached prop to explicitly acknowledge the behavior. We should deprecated implicit\n// stateful navigation containers in a future release and require a provider style pattern\n// instead in order to eliminate confusion entirely.\nlet _statefulContainerCount = 0;\nexport function _TESTING_ONLY_reset_container_count() {\n  _statefulContainerCount = 0;\n}\n\n// We keep a global flag to catch errors during the state persistence hydrating scenario.\n// The innermost navigator who catches the error will dispatch a new init action.\nlet _reactNavigationIsHydratingState = false;\n// Unfortunate to use global state here, but it seems necessesary for the time\n// being. There seems to be some problems with cascading componentDidCatch\n// handlers. Ideally the inner non-stateful navigator catches the error and\n// re-throws it, to be caught by the top-level stateful navigator.\n\n/**\n * Create an HOC that injects the navigation and manages the navigation state\n * in case it's not passed from above.\n * This allows to use e.g. the StackNavigator and TabNavigator as root-level\n * components.\n */\nexport default function createNavigationContainer(Component) {\n  class NavigationContainer extends React.Component {\n    subs = null;\n\n    static router = Component.router;\n    static navigationOptions = null;\n\n    static defaultProps = {\n      theme: 'light'\n    };\n\n    static getDerivedStateFromProps(nextProps) {\n      validateProps(nextProps);\n      return null;\n    }\n\n    _actionEventSubscribers = new Set();\n\n    constructor(props) {\n      super(props);\n\n      validateProps(props);\n\n      this._initialAction = NavigationActions.init();\n\n      if (this._isStateful() && BackHandler && typeof BackHandler.addEventListener === 'function') {\n        this.subs = BackHandler.addEventListener('hardwareBackPress', () => {\n          if (!this._isMounted) {\n            this.subs && this.subs.remove();\n          } else {\n            // dispatch returns true if the action results in a state change,\n            // and false otherwise. This maps well to what BackHandler expects\n            // from a callback -- true if handled, false if not handled\n            return this.dispatch(NavigationActions.back());\n          }\n        });\n      }\n\n      this.state = {\n        nav: this._isStateful() && !props.loadNavigationState ? Component.router.getStateForAction(this._initialAction) : null\n      };\n    }\n\n    _renderLoading() {\n      return this.props.renderLoadingExperimental ? this.props.renderLoadingExperimental() : null;\n    }\n\n    _isStateful() {\n      return isStateful(this.props);\n    }\n\n    _handleOpenURL = ({ url }) => {\n      const { enableURLHandling, uriPrefix } = this.props;\n      if (enableURLHandling === false) {\n        return;\n      }\n      const parsedUrl = urlToPathAndParams(url, uriPrefix);\n      if (parsedUrl) {\n        const { path, params } = parsedUrl;\n        const action = Component.router.getActionForPathAndParams(path, params);\n        if (action) {\n          this.dispatch(action);\n        }\n      }\n    };\n\n    _onNavigationStateChange(prevNav, nav, action) {\n      if (typeof this.props.onNavigationStateChange === 'undefined' && this._isStateful() && !!process.env.REACT_NAV_LOGGING) {\n        if (console.group) {\n          console.group('Navigation Dispatch: ');\n          console.log('Action: ', action);\n          console.log('New State: ', nav);\n          console.log('Last State: ', prevNav);\n          console.groupEnd();\n        } else {\n          console.log('Navigation Dispatch: ', {\n            action,\n            newState: nav,\n            lastState: prevNav\n          });\n        }\n        return;\n      }\n\n      if (typeof this.props.onNavigationStateChange === 'function') {\n        this.props.onNavigationStateChange(prevNav, nav, action);\n      }\n    }\n\n    componentDidUpdate() {\n      // Clear cached _navState every tick\n      if (this._navState === this.state.nav) {\n        this._navState = null;\n      }\n    }\n\n    async componentDidMount() {\n      this._isMounted = true;\n      if (!this._isStateful()) {\n        return;\n      }\n\n      if (__DEV__ && !this.props.detached) {\n        if (_statefulContainerCount > 0) {\n          // Temporarily only show this on iOS due to this issue:\n          // https://github.com/react-navigation/react-navigation/issues/4196#issuecomment-390827829\n          if (Platform.OS === 'ios') {\n            console.warn(`You should only render one navigator explicitly in your app, and other navigators should be rendered by including them in that navigator. Full details at: ${docsUrl('common-mistakes.html#explicitly-rendering-more-than-one-navigator')}`);\n          }\n        }\n      }\n      _statefulContainerCount++;\n      Linking.addEventListener('url', this._handleOpenURL);\n\n      // Pull out anything that can impact state\n      let parsedUrl = null;\n      let userProvidedStartupState = null;\n      if (this.props.enableURLHandling !== false) {\n        ({\n          parsedUrl,\n          userProvidedStartupState\n        } = await this.getStartupParams());\n      }\n\n      // Initialize state. This must be done *after* any async code\n      // so we don't end up with a different value for this.state.nav\n      // due to changes while async function was resolving\n      let action = this._initialAction;\n      let startupState = this.state.nav;\n      if (!startupState && !userProvidedStartupState) {\n        !!process.env.REACT_NAV_LOGGING && console.log('Init new Navigation State');\n        startupState = Component.router.getStateForAction(action);\n      }\n\n      // Pull user-provided persisted state\n      if (userProvidedStartupState) {\n        startupState = userProvidedStartupState;\n        _reactNavigationIsHydratingState = true;\n      }\n\n      // Pull state out of URL\n      if (parsedUrl) {\n        const { path, params } = parsedUrl;\n        const urlAction = Component.router.getActionForPathAndParams(path, params);\n        if (urlAction) {\n          !!process.env.REACT_NAV_LOGGING && console.log('Applying Navigation Action for Initial URL:', parsedUrl);\n          action = urlAction;\n          startupState = Component.router.getStateForAction(urlAction, startupState);\n        }\n      }\n\n      const dispatchActions = () => this._actionEventSubscribers.forEach(subscriber => subscriber({\n        type: 'action',\n        action,\n        state: this.state.nav,\n        lastState: null\n      }));\n\n      if (startupState === this.state.nav) {\n        dispatchActions();\n        return;\n      }\n\n      // eslint-disable-next-line react/no-did-mount-set-state\n      this.setState({ nav: startupState }, () => {\n        _reactNavigationIsHydratingState = false;\n        dispatchActions();\n      });\n    }\n\n    async getStartupParams() {\n      const { uriPrefix, loadNavigationState } = this.props;\n      let url, loadedNavState;\n      try {\n        [url, loadedNavState] = await Promise.all([Linking.getInitialURL(), loadNavigationState && loadNavigationState()]);\n      } catch (err) {\n        // ignore\n      }\n      return {\n        parsedUrl: url && urlToPathAndParams(url, uriPrefix),\n        userProvidedStartupState: loadedNavState\n      };\n    }\n\n    componentDidCatch(e) {\n      if (_reactNavigationIsHydratingState) {\n        _reactNavigationIsHydratingState = false;\n        console.warn('Uncaught exception while starting app from persisted navigation state! Trying to render again with a fresh navigation state...');\n        this.dispatch(NavigationActions.init());\n      } else {\n        throw e;\n      }\n    }\n\n    _persistNavigationState = async nav => {\n      const { persistNavigationState } = this.props;\n      if (persistNavigationState) {\n        try {\n          await persistNavigationState(nav);\n        } catch (err) {\n          console.warn('Uncaught exception while calling persistNavigationState()! You should handle exceptions thrown from persistNavigationState(), ignoring them may result in undefined behavior.');\n        }\n      }\n    };\n\n    componentWillUnmount() {\n      this._isMounted = false;\n      Linking.removeEventListener('url', this._handleOpenURL);\n      this.subs && this.subs.remove();\n\n      if (this._isStateful()) {\n        _statefulContainerCount--;\n      }\n    }\n\n    // Per-tick temporary storage for state.nav\n\n    dispatch = action => {\n      if (this.props.navigation) {\n        return this.props.navigation.dispatch(action);\n      }\n\n      // navState will have the most up-to-date value, because setState sometimes behaves asyncronously\n      this._navState = this._navState || this.state.nav;\n      const lastNavState = this._navState;\n      invariant(lastNavState, 'should be set in constructor if stateful');\n      const reducedState = Component.router.getStateForAction(action, lastNavState);\n      const navState = reducedState === null ? lastNavState : reducedState;\n\n      const dispatchActionEvents = () => {\n        this._actionEventSubscribers.forEach(subscriber => subscriber({\n          type: 'action',\n          action,\n          state: navState,\n          lastState: lastNavState\n        }));\n      };\n\n      if (reducedState === null) {\n        // The router will return null when action has been handled and the state hasn't changed.\n        // dispatch returns true when something has been handled.\n        dispatchActionEvents();\n        return true;\n      }\n\n      if (navState !== lastNavState) {\n        // Cache updates to state.nav during the tick to ensure that subsequent calls will not discard this change\n        this._navState = navState;\n        this.setState({ nav: navState }, () => {\n          this._onNavigationStateChange(lastNavState, navState, action);\n          dispatchActionEvents();\n          this._persistNavigationState(navState);\n        });\n        return true;\n      }\n\n      dispatchActionEvents();\n      return false;\n    };\n\n    _getScreenProps = () => this.props.screenProps;\n\n    _getTheme = () => {\n      if (this.props.theme === 'light' || this.props.theme === 'dark') {\n        return this.props.theme;\n      } else if (this.props.theme === 'no-preference') {\n        return 'light';\n      } else {\n        console.warn(`Invalid theme provided: ${this.props.theme}. Only 'light' and 'dark' are supported. Falling back to 'light'`);\n        return 'light';\n      }\n    };\n\n    render() {\n      let navigation = this.props.navigation;\n      if (this._isStateful()) {\n        const navState = this.state.nav;\n        if (!navState) {\n          return this._renderLoading();\n        }\n        if (!this._navigation || this._navigation.state !== navState) {\n          this._navigation = getNavigation(Component.router, navState, this.dispatch, this._actionEventSubscribers, this._getScreenProps, () => this._navigation);\n        }\n        navigation = this._navigation;\n      }\n      invariant(navigation, 'failed to get navigation');\n\n      return <ThemeProvider value={this._getTheme()}>\n          <NavigationProvider value={navigation}>\n            <Component {...this.props} navigation={navigation} />\n          </NavigationProvider>\n        </ThemeProvider>;\n    }\n  }\n\n  return NavigationContainer;\n}"]},"metadata":{},"sourceType":"script"}