You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
58 KiB
1 line
58 KiB
{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/objectWithoutProperties\";\nimport _toConsumableArray from \"@babel/runtime/helpers/toConsumableArray\";\nvar _excluded = [\"children\", \"screenListeners\"];\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nimport { CommonActions } from '@react-navigation/routers';\nimport * as React from 'react';\nimport { isValidElementType } from 'react-is';\nimport Group from \"./Group\";\nimport isArrayEqual from \"./isArrayEqual\";\nimport isRecordEqual from \"./isRecordEqual\";\nimport NavigationHelpersContext from \"./NavigationHelpersContext\";\nimport NavigationRouteContext from \"./NavigationRouteContext\";\nimport NavigationStateContext from \"./NavigationStateContext\";\nimport PreventRemoveProvider from \"./PreventRemoveProvider\";\nimport Screen from \"./Screen\";\nimport { PrivateValueStore } from \"./types\";\nimport useChildListeners from \"./useChildListeners\";\nimport useComponent from \"./useComponent\";\nimport useCurrentRender from \"./useCurrentRender\";\nimport useDescriptors from \"./useDescriptors\";\nimport useEventEmitter from \"./useEventEmitter\";\nimport useFocusedListenersChildrenAdapter from \"./useFocusedListenersChildrenAdapter\";\nimport useFocusEvents from \"./useFocusEvents\";\nimport useKeyedChildListeners from \"./useKeyedChildListeners\";\nimport useNavigationHelpers from \"./useNavigationHelpers\";\nimport useOnAction from \"./useOnAction\";\nimport useOnGetState from \"./useOnGetState\";\nimport useOnRouteFocus from \"./useOnRouteFocus\";\nimport useRegisterNavigator from \"./useRegisterNavigator\";\nimport useScheduleUpdate from \"./useScheduleUpdate\";\nPrivateValueStore;\nvar isValidKey = function isValidKey(key) {\n return key === undefined || typeof key === 'string' && key !== '';\n};\nvar getRouteConfigsFromChildren = function getRouteConfigsFromChildren(children, groupKey, groupOptions) {\n var configs = React.Children.toArray(children).reduce(function (acc, child) {\n var _child$type, _child$props;\n if (React.isValidElement(child)) {\n if (child.type === Screen) {\n if (!isValidKey(child.props.navigationKey)) {\n throw new Error(\"Got an invalid 'navigationKey' prop (\" + JSON.stringify(child.props.navigationKey) + \") for the screen '\" + child.props.name + \"'. It must be a non-empty string or 'undefined'.\");\n }\n acc.push({\n keys: [groupKey, child.props.navigationKey],\n options: groupOptions,\n props: child.props\n });\n return acc;\n }\n if (child.type === React.Fragment || child.type === Group) {\n if (!isValidKey(child.props.navigationKey)) {\n throw new Error(\"Got an invalid 'navigationKey' prop (\" + JSON.stringify(child.props.navigationKey) + \") for the group. It must be a non-empty string or 'undefined'.\");\n }\n acc.push.apply(acc, _toConsumableArray(getRouteConfigsFromChildren(child.props.children, child.props.navigationKey, child.type !== Group ? groupOptions : groupOptions != null ? [].concat(_toConsumableArray(groupOptions), [child.props.screenOptions]) : [child.props.screenOptions])));\n return acc;\n }\n }\n throw new Error(\"A navigator can only contain 'Screen', 'Group' or 'React.Fragment' as its direct children (found \" + (React.isValidElement(child) ? \"'\" + (typeof child.type === 'string' ? child.type : (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.name) + \"'\" + ((_child$props = child.props) !== null && _child$props !== void 0 && _child$props.name ? \" for the screen '\" + child.props.name + \"'\" : '') : typeof child === 'object' ? JSON.stringify(child) : \"'\" + String(child) + \"'\") + \"). To render this component in the navigator, pass it in the 'component' prop to 'Screen'.\");\n }, []);\n if (process.env.NODE_ENV !== 'production') {\n configs.forEach(function (config) {\n var _config$props = config.props,\n name = _config$props.name,\n children = _config$props.children,\n component = _config$props.component,\n getComponent = _config$props.getComponent;\n if (typeof name !== 'string' || !name) {\n throw new Error(\"Got an invalid name (\" + JSON.stringify(name) + \") for the screen. It must be a non-empty string.\");\n }\n if (children != null || component !== undefined || getComponent !== undefined) {\n if (children != null && component !== undefined) {\n throw new Error(\"Got both 'component' and 'children' props for the screen '\" + name + \"'. You must pass only one of them.\");\n }\n if (children != null && getComponent !== undefined) {\n throw new Error(\"Got both 'getComponent' and 'children' props for the screen '\" + name + \"'. You must pass only one of them.\");\n }\n if (component !== undefined && getComponent !== undefined) {\n throw new Error(\"Got both 'component' and 'getComponent' props for the screen '\" + name + \"'. You must pass only one of them.\");\n }\n if (children != null && typeof children !== 'function') {\n throw new Error(\"Got an invalid value for 'children' prop for the screen '\" + name + \"'. It must be a function returning a React Element.\");\n }\n if (component !== undefined && !isValidElementType(component)) {\n throw new Error(\"Got an invalid value for 'component' prop for the screen '\" + name + \"'. It must be a valid React Component.\");\n }\n if (getComponent !== undefined && typeof getComponent !== 'function') {\n throw new Error(\"Got an invalid value for 'getComponent' prop for the screen '\" + name + \"'. It must be a function returning a React Component.\");\n }\n if (typeof component === 'function') {\n if (component.name === 'component') {\n console.warn(\"Looks like you're passing an inline function for 'component' prop for the screen '\" + name + \"' (e.g. component={() => <SomeComponent />}). Passing an inline function will cause the component state to be lost on re-render and cause perf issues since it's re-created every render. You can pass the function as children to 'Screen' instead to achieve the desired behaviour.\");\n } else if (/^[a-z]/.test(component.name)) {\n console.warn(\"Got a component with the name '\" + component.name + \"' for the screen '\" + name + \"'. React Components must start with an uppercase letter. If you're passing a regular function and not a component, pass it as children to 'Screen' instead. Otherwise capitalize your component's name.\");\n }\n }\n } else {\n throw new Error(\"Couldn't find a 'component', 'getComponent' or 'children' prop for the screen '\" + name + \"'. This can happen if you passed 'undefined'. You likely forgot to export your component from the file it's defined in, or mixed up default import and named import when importing.\");\n }\n });\n }\n return configs;\n};\nexport default function useNavigationBuilder(createRouter, options) {\n var navigatorKey = useRegisterNavigator();\n var route = React.useContext(NavigationRouteContext);\n var children = options.children,\n screenListeners = options.screenListeners,\n rest = _objectWithoutProperties(options, _excluded);\n var _React$useRef = React.useRef(createRouter(_objectSpread(_objectSpread({}, rest), route !== null && route !== void 0 && route.params && route.params.state == null && route.params.initial !== false && typeof route.params.screen === 'string' ? {\n initialRouteName: route.params.screen\n } : null))),\n router = _React$useRef.current;\n var routeConfigs = getRouteConfigsFromChildren(children);\n var screens = routeConfigs.reduce(function (acc, config) {\n if (config.props.name in acc) {\n throw new Error(\"A navigator cannot contain multiple 'Screen' components with the same name (found duplicate screen named '\" + config.props.name + \"')\");\n }\n acc[config.props.name] = config;\n return acc;\n }, {});\n var routeNames = routeConfigs.map(function (config) {\n return config.props.name;\n });\n var routeKeyList = routeNames.reduce(function (acc, curr) {\n acc[curr] = screens[curr].keys.map(function (key) {\n return key != null ? key : '';\n }).join(':');\n return acc;\n }, {});\n var routeParamList = routeNames.reduce(function (acc, curr) {\n var initialParams = screens[curr].props.initialParams;\n acc[curr] = initialParams;\n return acc;\n }, {});\n var routeGetIdList = routeNames.reduce(function (acc, curr) {\n return Object.assign(acc, _defineProperty({}, curr, screens[curr].props.getId));\n }, {});\n if (!routeNames.length) {\n throw new Error(\"Couldn't find any screens for the navigator. Have you defined any screens as its children?\");\n }\n var isStateValid = React.useCallback(function (state) {\n return state.type === undefined || state.type === router.type;\n }, [router.type]);\n var isStateInitialized = React.useCallback(function (state) {\n return state !== undefined && state.stale === false && isStateValid(state);\n }, [isStateValid]);\n var _React$useContext = React.useContext(NavigationStateContext),\n currentState = _React$useContext.state,\n getCurrentState = _React$useContext.getState,\n setCurrentState = _React$useContext.setState,\n setKey = _React$useContext.setKey,\n getKey = _React$useContext.getKey,\n getIsInitial = _React$useContext.getIsInitial;\n var stateCleanedUp = React.useRef(false);\n var cleanUpState = React.useCallback(function () {\n setCurrentState(undefined);\n stateCleanedUp.current = true;\n }, [setCurrentState]);\n var setState = React.useCallback(function (state) {\n if (stateCleanedUp.current) {\n return;\n }\n setCurrentState(state);\n }, [setCurrentState]);\n var _React$useMemo = React.useMemo(function () {\n var _route$params4;\n var initialRouteParamList = routeNames.reduce(function (acc, curr) {\n var _route$params, _route$params2, _route$params3;\n var initialParams = screens[curr].props.initialParams;\n var initialParamsFromParams = (route === null || route === void 0 ? void 0 : (_route$params = route.params) === null || _route$params === void 0 ? void 0 : _route$params.state) == null && (route === null || route === void 0 ? void 0 : (_route$params2 = route.params) === null || _route$params2 === void 0 ? void 0 : _route$params2.initial) !== false && (route === null || route === void 0 ? void 0 : (_route$params3 = route.params) === null || _route$params3 === void 0 ? void 0 : _route$params3.screen) === curr ? route.params.params : undefined;\n acc[curr] = initialParams !== undefined || initialParamsFromParams !== undefined ? _objectSpread(_objectSpread({}, initialParams), initialParamsFromParams) : undefined;\n return acc;\n }, {});\n if ((currentState === undefined || !isStateValid(currentState)) && (route === null || route === void 0 ? void 0 : (_route$params4 = route.params) === null || _route$params4 === void 0 ? void 0 : _route$params4.state) == null) {\n return [router.getInitialState({\n routeNames: routeNames,\n routeParamList: initialRouteParamList,\n routeGetIdList: routeGetIdList\n }), true];\n } else {\n var _ref;\n var _route$params5;\n return [router.getRehydratedState((_ref = route === null || route === void 0 ? void 0 : (_route$params5 = route.params) === null || _route$params5 === void 0 ? void 0 : _route$params5.state) != null ? _ref : currentState, {\n routeNames: routeNames,\n routeParamList: initialRouteParamList,\n routeGetIdList: routeGetIdList\n }), false];\n }\n }, [currentState, router, isStateValid]),\n _React$useMemo2 = _slicedToArray(_React$useMemo, 2),\n initializedState = _React$useMemo2[0],\n isFirstStateInitialization = _React$useMemo2[1];\n var previousRouteKeyListRef = React.useRef(routeKeyList);\n React.useEffect(function () {\n previousRouteKeyListRef.current = routeKeyList;\n });\n var previousRouteKeyList = previousRouteKeyListRef.current;\n var state = isStateInitialized(currentState) ? currentState : initializedState;\n var nextState = state;\n if (!isArrayEqual(state.routeNames, routeNames) || !isRecordEqual(routeKeyList, previousRouteKeyList)) {\n nextState = router.getStateForRouteNamesChange(state, {\n routeNames: routeNames,\n routeParamList: routeParamList,\n routeGetIdList: routeGetIdList,\n routeKeyChanges: Object.keys(routeKeyList).filter(function (name) {\n return previousRouteKeyList.hasOwnProperty(name) && routeKeyList[name] !== previousRouteKeyList[name];\n })\n });\n }\n var previousNestedParamsRef = React.useRef(route === null || route === void 0 ? void 0 : route.params);\n React.useEffect(function () {\n previousNestedParamsRef.current = route === null || route === void 0 ? void 0 : route.params;\n }, [route === null || route === void 0 ? void 0 : route.params]);\n if (route !== null && route !== void 0 && route.params) {\n var previousParams = previousNestedParamsRef.current;\n var action;\n if (typeof route.params.state === 'object' && route.params.state != null && route.params !== previousParams) {\n action = CommonActions.reset(route.params.state);\n } else if (typeof route.params.screen === 'string' && (route.params.initial === false && isFirstStateInitialization || route.params !== previousParams)) {\n action = CommonActions.navigate({\n name: route.params.screen,\n params: route.params.params,\n path: route.params.path\n });\n }\n var updatedState = action ? router.getStateForAction(nextState, action, {\n routeNames: routeNames,\n routeParamList: routeParamList,\n routeGetIdList: routeGetIdList\n }) : null;\n nextState = updatedState !== null ? router.getRehydratedState(updatedState, {\n routeNames: routeNames,\n routeParamList: routeParamList,\n routeGetIdList: routeGetIdList\n }) : nextState;\n }\n var shouldUpdate = state !== nextState;\n useScheduleUpdate(function () {\n if (shouldUpdate) {\n setState(nextState);\n }\n });\n state = nextState;\n React.useEffect(function () {\n setKey(navigatorKey);\n if (!getIsInitial()) {\n setState(nextState);\n }\n return function () {\n setTimeout(function () {\n if (getCurrentState() !== undefined && getKey() === navigatorKey) {\n cleanUpState();\n }\n }, 0);\n };\n }, []);\n var initializedStateRef = React.useRef();\n initializedStateRef.current = initializedState;\n var getState = React.useCallback(function () {\n var currentState = getCurrentState();\n return isStateInitialized(currentState) ? currentState : initializedStateRef.current;\n }, [getCurrentState, isStateInitialized]);\n var emitter = useEventEmitter(function (e) {\n var _ref2;\n var routeNames = [];\n var route;\n if (e.target) {\n var _route;\n route = state.routes.find(function (route) {\n return route.key === e.target;\n });\n if ((_route = route) !== null && _route !== void 0 && _route.name) {\n routeNames.push(route.name);\n }\n } else {\n route = state.routes[state.index];\n routeNames.push.apply(routeNames, _toConsumableArray(Object.keys(screens).filter(function (name) {\n var _route2;\n return ((_route2 = route) === null || _route2 === void 0 ? void 0 : _route2.name) === name;\n })));\n }\n if (route == null) {\n return;\n }\n var navigation = descriptors[route.key].navigation;\n var listeners = (_ref2 = []).concat.apply(_ref2, _toConsumableArray([screenListeners].concat(_toConsumableArray(routeNames.map(function (name) {\n var listeners = screens[name].props.listeners;\n return listeners;\n }))).map(function (listeners) {\n var map = typeof listeners === 'function' ? listeners({\n route: route,\n navigation: navigation\n }) : listeners;\n return map ? Object.keys(map).filter(function (type) {\n return type === e.type;\n }).map(function (type) {\n return map === null || map === void 0 ? void 0 : map[type];\n }) : undefined;\n }))).filter(function (cb, i, self) {\n return cb && self.lastIndexOf(cb) === i;\n });\n listeners.forEach(function (listener) {\n return listener === null || listener === void 0 ? void 0 : listener(e);\n });\n });\n useFocusEvents({\n state: state,\n emitter: emitter\n });\n React.useEffect(function () {\n emitter.emit({\n type: 'state',\n data: {\n state: state\n }\n });\n }, [emitter, state]);\n var _useChildListeners = useChildListeners(),\n childListeners = _useChildListeners.listeners,\n addListener = _useChildListeners.addListener;\n var _useKeyedChildListene = useKeyedChildListeners(),\n keyedListeners = _useKeyedChildListene.keyedListeners,\n addKeyedListener = _useKeyedChildListene.addKeyedListener;\n var onAction = useOnAction({\n router: router,\n getState: getState,\n setState: setState,\n key: route === null || route === void 0 ? void 0 : route.key,\n actionListeners: childListeners.action,\n beforeRemoveListeners: keyedListeners.beforeRemove,\n routerConfigOptions: {\n routeNames: routeNames,\n routeParamList: routeParamList,\n routeGetIdList: routeGetIdList\n },\n emitter: emitter\n });\n var onRouteFocus = useOnRouteFocus({\n router: router,\n key: route === null || route === void 0 ? void 0 : route.key,\n getState: getState,\n setState: setState\n });\n var navigation = useNavigationHelpers({\n id: options.id,\n onAction: onAction,\n getState: getState,\n emitter: emitter,\n router: router\n });\n useFocusedListenersChildrenAdapter({\n navigation: navigation,\n focusedListeners: childListeners.focus\n });\n useOnGetState({\n getState: getState,\n getStateListeners: keyedListeners.getState\n });\n var descriptors = useDescriptors({\n state: state,\n screens: screens,\n navigation: navigation,\n screenOptions: options.screenOptions,\n defaultScreenOptions: options.defaultScreenOptions,\n onAction: onAction,\n getState: getState,\n setState: setState,\n onRouteFocus: onRouteFocus,\n addListener: addListener,\n addKeyedListener: addKeyedListener,\n router: router,\n emitter: emitter\n });\n useCurrentRender({\n state: state,\n navigation: navigation,\n descriptors: descriptors\n });\n var NavigationContent = useComponent(function (children) {\n return React.createElement(NavigationHelpersContext.Provider, {\n value: navigation\n }, React.createElement(PreventRemoveProvider, null, children));\n });\n return {\n state: state,\n navigation: navigation,\n descriptors: descriptors,\n NavigationContent: NavigationContent\n };\n}","map":{"version":3,"sources":["useNavigationBuilder.tsx"],"names":["CommonActions","React","isValidElementType","Group","isArrayEqual","isRecordEqual","NavigationHelpersContext","NavigationRouteContext","NavigationStateContext","PreventRemoveProvider","Screen","PrivateValueStore","useChildListeners","useComponent","useCurrentRender","useDescriptors","useEventEmitter","useFocusedListenersChildrenAdapter","useFocusEvents","useKeyedChildListeners","useNavigationHelpers","useOnAction","useOnGetState","useOnRouteFocus","useRegisterNavigator","useScheduleUpdate","isValidKey","key","undefined","getRouteConfigsFromChildren","children","groupKey","groupOptions","configs","Children","toArray","reduce","acc","child","isValidElement","type","props","navigationKey","Error","JSON","stringify","name","push","keys","options","Fragment","screenOptions","String","process","env","NODE_ENV","forEach","config","component","getComponent","console","warn","test","useNavigationBuilder","createRouter","navigatorKey","route","useContext","screenListeners","rest","current","router","useRef","params","state","initial","screen","initialRouteName","routeConfigs","screens","routeNames","map","routeKeyList","curr","join","routeParamList","initialParams","routeGetIdList","Object","assign","getId","length","isStateValid","useCallback","isStateInitialized","stale","currentState","getState","getCurrentState","setState","setCurrentState","setKey","getKey","getIsInitial","stateCleanedUp","cleanUpState","initializedState","isFirstStateInitialization","useMemo","initialRouteParamList","initialParamsFromParams","getInitialState","getRehydratedState","previousRouteKeyListRef","useEffect","previousRouteKeyList","nextState","getStateForRouteNamesChange","routeKeyChanges","filter","hasOwnProperty","previousNestedParamsRef","previousParams","action","reset","navigate","path","updatedState","getStateForAction","shouldUpdate","setTimeout","initializedStateRef","emitter","e","target","routes","find","index","navigation","descriptors","listeners","concat","cb","i","self","lastIndexOf","listener","emit","data","childListeners","addListener","keyedListeners","addKeyedListener","onAction","actionListeners","beforeRemoveListeners","beforeRemove","routerConfigOptions","onRouteFocus","id","focusedListeners","focus","getStateListeners","defaultScreenOptions","NavigationContent"],"mappings":";;;;;;;AAAA,SACEA,aAAa,QAUR,2BAA2B;AAClC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,kBAAkB,QAAQ,UAAU;AAE7C,OAAOC,KAAK;AACZ,OAAOC,YAAY;AACnB,OAAOC,aAAa;AACpB,OAAOC,wBAAwB;AAC/B,OAAOC,sBAAsB;AAC7B,OAAOC,sBAAsB;AAC7B,OAAOC,qBAAqB;AAC5B,OAAOC,MAAM;AACb,SAKEC,iBAAiB;AAInB,OAAOC,iBAAiB;AACxB,OAAOC,YAAY;AACnB,OAAOC,gBAAgB;AACvB,OAAOC,cAAc;AACrB,OAAOC,eAAe;AACtB,OAAOC,kCAAkC;AACzC,OAAOC,cAAc;AACrB,OAAOC,sBAAsB;AAC7B,OAAOC,oBAAoB;AAC3B,OAAOC,WAAW;AAClB,OAAOC,aAAa;AACpB,OAAOC,eAAe;AACtB,OAAOC,oBAAoB;AAC3B,OAAOC,iBAAiB;AAIxBd,iBAAiB;AAqBjB,IAAMe,UAAU,GAA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AA,QAAyB;IAAA,OAC/D,KAAA,CAAA,aAAA,CAAC,wBAAwB,CAAC,QAAQ,EAAA;MAAC,KAAK,EAAE4G;IAAW,CAAA,EACnD,KAAA,CAAA,aAAA,CAAC,qBAAqB,EAAA,IAAA,EAAE5G,QAAQ,CAAyB,CAE5D;EAAA,EAAC;EAEF,OAAO;IACL4C,KAAK,EAALA,KAAK;IACLgE,UAAU,EAAVA,UAAU;IACVC,WAAW,EAAXA,WAAW;IACXyB,iBAAAA,EAAAA;EACF,CAAC;AACH","sourceRoot":"../../src","sourcesContent":["import { CommonActions } from '@react-navigation/routers';\nimport * as React from 'react';\nimport { isValidElementType } from 'react-is';\nimport Group from './Group';\nimport isArrayEqual from './isArrayEqual';\nimport isRecordEqual from './isRecordEqual';\nimport NavigationHelpersContext from './NavigationHelpersContext';\nimport NavigationRouteContext from './NavigationRouteContext';\nimport NavigationStateContext from './NavigationStateContext';\nimport PreventRemoveProvider from './PreventRemoveProvider';\nimport Screen from './Screen';\nimport { PrivateValueStore } from './types';\nimport useChildListeners from './useChildListeners';\nimport useComponent from './useComponent';\nimport useCurrentRender from './useCurrentRender';\nimport useDescriptors from './useDescriptors';\nimport useEventEmitter from './useEventEmitter';\nimport useFocusedListenersChildrenAdapter from './useFocusedListenersChildrenAdapter';\nimport useFocusEvents from './useFocusEvents';\nimport useKeyedChildListeners from './useKeyedChildListeners';\nimport useNavigationHelpers from './useNavigationHelpers';\nimport useOnAction from './useOnAction';\nimport useOnGetState from './useOnGetState';\nimport useOnRouteFocus from './useOnRouteFocus';\nimport useRegisterNavigator from './useRegisterNavigator';\nimport useScheduleUpdate from './useScheduleUpdate';\n\n// This is to make TypeScript compiler happy\n// eslint-disable-next-line babel/no-unused-expressions\nPrivateValueStore;\nconst isValidKey = key => key === undefined || typeof key === 'string' && key !== '';\n\n/**\n * Extract route config object from React children elements.\n *\n * @param children React Elements to extract the config from.\n */\nconst getRouteConfigsFromChildren = (children, groupKey, groupOptions) => {\n const configs = React.Children.toArray(children).reduce((acc, child) => {\n var _child$type, _child$props;\n if ( /*#__PURE__*/React.isValidElement(child)) {\n if (child.type === Screen) {\n // We can only extract the config from `Screen` elements\n // If something else was rendered, it's probably a bug\n\n if (!isValidKey(child.props.navigationKey)) {\n throw new Error(`Got an invalid 'navigationKey' prop (${JSON.stringify(child.props.navigationKey)}) for the screen '${child.props.name}'. It must be a non-empty string or 'undefined'.`);\n }\n acc.push({\n keys: [groupKey, child.props.navigationKey],\n options: groupOptions,\n props: child.props\n });\n return acc;\n }\n if (child.type === React.Fragment || child.type === Group) {\n if (!isValidKey(child.props.navigationKey)) {\n throw new Error(`Got an invalid 'navigationKey' prop (${JSON.stringify(child.props.navigationKey)}) for the group. It must be a non-empty string or 'undefined'.`);\n }\n\n // When we encounter a fragment or group, we need to dive into its children to extract the configs\n // This is handy to conditionally define a group of screens\n acc.push(...getRouteConfigsFromChildren(child.props.children, child.props.navigationKey, child.type !== Group ? groupOptions : groupOptions != null ? [...groupOptions, child.props.screenOptions] : [child.props.screenOptions]));\n return acc;\n }\n }\n throw new Error(`A navigator can only contain 'Screen', 'Group' or 'React.Fragment' as its direct children (found ${/*#__PURE__*/React.isValidElement(child) ? `'${typeof child.type === 'string' ? child.type : (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.name}'${(_child$props = child.props) !== null && _child$props !== void 0 && _child$props.name ? ` for the screen '${child.props.name}'` : ''}` : typeof child === 'object' ? JSON.stringify(child) : `'${String(child)}'`}). To render this component in the navigator, pass it in the 'component' prop to 'Screen'.`);\n }, []);\n if (process.env.NODE_ENV !== 'production') {\n configs.forEach(config => {\n const {\n name,\n children,\n component,\n getComponent\n } = config.props;\n if (typeof name !== 'string' || !name) {\n throw new Error(`Got an invalid name (${JSON.stringify(name)}) for the screen. It must be a non-empty string.`);\n }\n if (children != null || component !== undefined || getComponent !== undefined) {\n if (children != null && component !== undefined) {\n throw new Error(`Got both 'component' and 'children' props for the screen '${name}'. You must pass only one of them.`);\n }\n if (children != null && getComponent !== undefined) {\n throw new Error(`Got both 'getComponent' and 'children' props for the screen '${name}'. You must pass only one of them.`);\n }\n if (component !== undefined && getComponent !== undefined) {\n throw new Error(`Got both 'component' and 'getComponent' props for the screen '${name}'. You must pass only one of them.`);\n }\n if (children != null && typeof children !== 'function') {\n throw new Error(`Got an invalid value for 'children' prop for the screen '${name}'. It must be a function returning a React Element.`);\n }\n if (component !== undefined && !isValidElementType(component)) {\n throw new Error(`Got an invalid value for 'component' prop for the screen '${name}'. It must be a valid React Component.`);\n }\n if (getComponent !== undefined && typeof getComponent !== 'function') {\n throw new Error(`Got an invalid value for 'getComponent' prop for the screen '${name}'. It must be a function returning a React Component.`);\n }\n if (typeof component === 'function') {\n if (component.name === 'component') {\n // Inline anonymous functions passed in the `component` prop will have the name of the prop\n // It's relatively safe to assume that it's not a component since it should also have PascalCase name\n // We won't catch all scenarios here, but this should catch a good chunk of incorrect use.\n console.warn(`Looks like you're passing an inline function for 'component' prop for the screen '${name}' (e.g. component={() => <SomeComponent />}). Passing an inline function will cause the component state to be lost on re-render and cause perf issues since it's re-created every render. You can pass the function as children to 'Screen' instead to achieve the desired behaviour.`);\n } else if (/^[a-z]/.test(component.name)) {\n console.warn(`Got a component with the name '${component.name}' for the screen '${name}'. React Components must start with an uppercase letter. If you're passing a regular function and not a component, pass it as children to 'Screen' instead. Otherwise capitalize your component's name.`);\n }\n }\n } else {\n throw new Error(`Couldn't find a 'component', 'getComponent' or 'children' prop for the screen '${name}'. This can happen if you passed 'undefined'. You likely forgot to export your component from the file it's defined in, or mixed up default import and named import when importing.`);\n }\n });\n }\n return configs;\n};\n\n/**\n * Hook for building navigators.\n *\n * @param createRouter Factory method which returns router object.\n * @param options Options object containing `children` and additional options for the router.\n * @returns An object containing `state`, `navigation`, `descriptors` objects.\n */\nexport default function useNavigationBuilder(createRouter, options) {\n const navigatorKey = useRegisterNavigator();\n const route = React.useContext(NavigationRouteContext);\n const {\n children,\n screenListeners,\n ...rest\n } = options;\n const {\n current: router\n } = React.useRef(createRouter({\n ...rest,\n ...(route !== null && route !== void 0 && route.params && route.params.state == null && route.params.initial !== false && typeof route.params.screen === 'string' ? {\n initialRouteName: route.params.screen\n } : null)\n }));\n const routeConfigs = getRouteConfigsFromChildren(children);\n const screens = routeConfigs.reduce((acc, config) => {\n if (config.props.name in acc) {\n throw new Error(`A navigator cannot contain multiple 'Screen' components with the same name (found duplicate screen named '${config.props.name}')`);\n }\n acc[config.props.name] = config;\n return acc;\n }, {});\n const routeNames = routeConfigs.map(config => config.props.name);\n const routeKeyList = routeNames.reduce((acc, curr) => {\n acc[curr] = screens[curr].keys.map(key => key ?? '').join(':');\n return acc;\n }, {});\n const routeParamList = routeNames.reduce((acc, curr) => {\n const {\n initialParams\n } = screens[curr].props;\n acc[curr] = initialParams;\n return acc;\n }, {});\n const routeGetIdList = routeNames.reduce((acc, curr) => Object.assign(acc, {\n [curr]: screens[curr].props.getId\n }), {});\n if (!routeNames.length) {\n throw new Error(\"Couldn't find any screens for the navigator. Have you defined any screens as its children?\");\n }\n const isStateValid = React.useCallback(state => state.type === undefined || state.type === router.type, [router.type]);\n const isStateInitialized = React.useCallback(state => state !== undefined && state.stale === false && isStateValid(state), [isStateValid]);\n const {\n state: currentState,\n getState: getCurrentState,\n setState: setCurrentState,\n setKey,\n getKey,\n getIsInitial\n } = React.useContext(NavigationStateContext);\n const stateCleanedUp = React.useRef(false);\n const cleanUpState = React.useCallback(() => {\n setCurrentState(undefined);\n stateCleanedUp.current = true;\n }, [setCurrentState]);\n const setState = React.useCallback(state => {\n if (stateCleanedUp.current) {\n // State might have been already cleaned up due to unmount\n // We do not want to expose API allowing to override this\n // This would lead to old data preservation on main navigator unmount\n return;\n }\n setCurrentState(state);\n }, [setCurrentState]);\n const [initializedState, isFirstStateInitialization] = React.useMemo(() => {\n var _route$params4;\n const initialRouteParamList = routeNames.reduce((acc, curr) => {\n var _route$params, _route$params2, _route$params3;\n const {\n initialParams\n } = screens[curr].props;\n const initialParamsFromParams = (route === null || route === void 0 ? void 0 : (_route$params = route.params) === null || _route$params === void 0 ? void 0 : _route$params.state) == null && (route === null || route === void 0 ? void 0 : (_route$params2 = route.params) === null || _route$params2 === void 0 ? void 0 : _route$params2.initial) !== false && (route === null || route === void 0 ? void 0 : (_route$params3 = route.params) === null || _route$params3 === void 0 ? void 0 : _route$params3.screen) === curr ? route.params.params : undefined;\n acc[curr] = initialParams !== undefined || initialParamsFromParams !== undefined ? {\n ...initialParams,\n ...initialParamsFromParams\n } : undefined;\n return acc;\n }, {});\n\n // If the current state isn't initialized on first render, we initialize it\n // We also need to re-initialize it if the state passed from parent was changed (maybe due to reset)\n // Otherwise assume that the state was provided as initial state\n // So we need to rehydrate it to make it usable\n if ((currentState === undefined || !isStateValid(currentState)) && (route === null || route === void 0 ? void 0 : (_route$params4 = route.params) === null || _route$params4 === void 0 ? void 0 : _route$params4.state) == null) {\n return [router.getInitialState({\n routeNames,\n routeParamList: initialRouteParamList,\n routeGetIdList\n }), true];\n } else {\n var _route$params5;\n return [router.getRehydratedState((route === null || route === void 0 ? void 0 : (_route$params5 = route.params) === null || _route$params5 === void 0 ? void 0 : _route$params5.state) ?? currentState, {\n routeNames,\n routeParamList: initialRouteParamList,\n routeGetIdList\n }), false];\n }\n // We explicitly don't include routeNames, route.params etc. in the dep list\n // below. We want to avoid forcing a new state to be calculated in those cases\n // Instead, we handle changes to these in the nextState code below. Note\n // that some changes to routeConfigs are explicitly ignored, such as changes\n // to initialParams\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentState, router, isStateValid]);\n const previousRouteKeyListRef = React.useRef(routeKeyList);\n React.useEffect(() => {\n previousRouteKeyListRef.current = routeKeyList;\n });\n const previousRouteKeyList = previousRouteKeyListRef.current;\n let state =\n // If the state isn't initialized, or stale, use the state we initialized instead\n // The state won't update until there's a change needed in the state we have initalized locally\n // So it'll be `undefined` or stale until the first navigation event happens\n isStateInitialized(currentState) ? currentState : initializedState;\n let nextState = state;\n if (!isArrayEqual(state.routeNames, routeNames) || !isRecordEqual(routeKeyList, previousRouteKeyList)) {\n // When the list of route names change, the router should handle it to remove invalid routes\n nextState = router.getStateForRouteNamesChange(state, {\n routeNames,\n routeParamList,\n routeGetIdList,\n routeKeyChanges: Object.keys(routeKeyList).filter(name => previousRouteKeyList.hasOwnProperty(name) && routeKeyList[name] !== previousRouteKeyList[name])\n });\n }\n const previousNestedParamsRef = React.useRef(route === null || route === void 0 ? void 0 : route.params);\n React.useEffect(() => {\n previousNestedParamsRef.current = route === null || route === void 0 ? void 0 : route.params;\n }, [route === null || route === void 0 ? void 0 : route.params]);\n if (route !== null && route !== void 0 && route.params) {\n const previousParams = previousNestedParamsRef.current;\n let action;\n if (typeof route.params.state === 'object' && route.params.state != null && route.params !== previousParams) {\n // If the route was updated with new state, we should reset to it\n action = CommonActions.reset(route.params.state);\n } else if (typeof route.params.screen === 'string' && (route.params.initial === false && isFirstStateInitialization || route.params !== previousParams)) {\n // If the route was updated with new screen name and/or params, we should navigate there\n action = CommonActions.navigate({\n name: route.params.screen,\n params: route.params.params,\n path: route.params.path\n });\n }\n\n // The update should be limited to current navigator only, so we call the router manually\n const updatedState = action ? router.getStateForAction(nextState, action, {\n routeNames,\n routeParamList,\n routeGetIdList\n }) : null;\n nextState = updatedState !== null ? router.getRehydratedState(updatedState, {\n routeNames,\n routeParamList,\n routeGetIdList\n }) : nextState;\n }\n const shouldUpdate = state !== nextState;\n useScheduleUpdate(() => {\n if (shouldUpdate) {\n // If the state needs to be updated, we'll schedule an update\n setState(nextState);\n }\n });\n\n // The up-to-date state will come in next render, but we don't need to wait for it\n // We can't use the outdated state since the screens have changed, which will cause error due to mismatched config\n // So we override the state object we return to use the latest state as soon as possible\n state = nextState;\n React.useEffect(() => {\n setKey(navigatorKey);\n if (!getIsInitial()) {\n // If it's not initial render, we need to update the state\n // This will make sure that our container gets notifier of state changes due to new mounts\n // This is necessary for proper screen tracking, URL updates etc.\n setState(nextState);\n }\n return () => {\n // We need to clean up state for this navigator on unmount\n // We do it in a timeout because we need to detect if another navigator mounted in the meantime\n // For example, if another navigator has started rendering, we should skip cleanup\n // Otherwise, our cleanup step will cleanup state for the other navigator and re-initialize it\n setTimeout(() => {\n if (getCurrentState() !== undefined && getKey() === navigatorKey) {\n cleanUpState();\n }\n }, 0);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // We initialize this ref here to avoid a new getState getting initialized\n // whenever initializedState changes. We want getState to have access to the\n // latest initializedState, but don't need it to change when that happens\n const initializedStateRef = React.useRef();\n initializedStateRef.current = initializedState;\n const getState = React.useCallback(() => {\n const currentState = getCurrentState();\n return isStateInitialized(currentState) ? currentState : initializedStateRef.current;\n }, [getCurrentState, isStateInitialized]);\n const emitter = useEventEmitter(e => {\n let routeNames = [];\n let route;\n if (e.target) {\n var _route;\n route = state.routes.find(route => route.key === e.target);\n if ((_route = route) !== null && _route !== void 0 && _route.name) {\n routeNames.push(route.name);\n }\n } else {\n route = state.routes[state.index];\n routeNames.push(...Object.keys(screens).filter(name => {\n var _route2;\n return ((_route2 = route) === null || _route2 === void 0 ? void 0 : _route2.name) === name;\n }));\n }\n if (route == null) {\n return;\n }\n const navigation = descriptors[route.key].navigation;\n const listeners = [].concat(\n // Get an array of listeners for all screens + common listeners on navigator\n ...[screenListeners, ...routeNames.map(name => {\n const {\n listeners\n } = screens[name].props;\n return listeners;\n })].map(listeners => {\n const map = typeof listeners === 'function' ? listeners({\n route: route,\n navigation\n }) : listeners;\n return map ? Object.keys(map).filter(type => type === e.type).map(type => map === null || map === void 0 ? void 0 : map[type]) : undefined;\n }))\n // We don't want same listener to be called multiple times for same event\n // So we remove any duplicate functions from the array\n .filter((cb, i, self) => cb && self.lastIndexOf(cb) === i);\n listeners.forEach(listener => listener === null || listener === void 0 ? void 0 : listener(e));\n });\n useFocusEvents({\n state,\n emitter\n });\n React.useEffect(() => {\n emitter.emit({\n type: 'state',\n data: {\n state\n }\n });\n }, [emitter, state]);\n const {\n listeners: childListeners,\n addListener\n } = useChildListeners();\n const {\n keyedListeners,\n addKeyedListener\n } = useKeyedChildListeners();\n const onAction = useOnAction({\n router,\n getState,\n setState,\n key: route === null || route === void 0 ? void 0 : route.key,\n actionListeners: childListeners.action,\n beforeRemoveListeners: keyedListeners.beforeRemove,\n routerConfigOptions: {\n routeNames,\n routeParamList,\n routeGetIdList\n },\n emitter\n });\n const onRouteFocus = useOnRouteFocus({\n router,\n key: route === null || route === void 0 ? void 0 : route.key,\n getState,\n setState\n });\n const navigation = useNavigationHelpers({\n id: options.id,\n onAction,\n getState,\n emitter,\n router\n });\n useFocusedListenersChildrenAdapter({\n navigation,\n focusedListeners: childListeners.focus\n });\n useOnGetState({\n getState,\n getStateListeners: keyedListeners.getState\n });\n const descriptors = useDescriptors({\n state,\n screens,\n navigation,\n screenOptions: options.screenOptions,\n defaultScreenOptions: options.defaultScreenOptions,\n onAction,\n getState,\n setState,\n onRouteFocus,\n addListener,\n addKeyedListener,\n router,\n // @ts-expect-error: this should have both core and custom events, but too much work right now\n emitter\n });\n useCurrentRender({\n state,\n navigation,\n descriptors\n });\n const NavigationContent = useComponent(children => /*#__PURE__*/React.createElement(NavigationHelpersContext.Provider, {\n value: navigation\n }, /*#__PURE__*/React.createElement(PreventRemoveProvider, null, children)));\n return {\n state,\n navigation,\n descriptors,\n NavigationContent\n };\n}\n//# sourceMappingURL=useNavigationBuilder.js.map"]},"metadata":{},"sourceType":"module"} |