expo-router 4.0.0-preview.0 → 4.0.0-preview.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ExpoRoot.d.ts.map +1 -1
- package/build/ExpoRoot.js +2 -0
- package/build/ExpoRoot.js.map +1 -1
- package/build/exports.d.ts +2 -2
- package/build/exports.d.ts.map +1 -1
- package/build/exports.js.map +1 -1
- package/build/fork/createMemoryHistory.d.ts +1 -1
- package/build/fork/createMemoryHistory.d.ts.map +1 -1
- package/build/fork/createMemoryHistory.js.map +1 -1
- package/build/fork/extractPathFromURL.d.ts.map +1 -1
- package/build/fork/extractPathFromURL.js +10 -1
- package/build/fork/extractPathFromURL.js.map +1 -1
- package/build/fork/useBackButton.d.ts +1 -1
- package/build/fork/useBackButton.d.ts.map +1 -1
- package/build/fork/useBackButton.js.map +1 -1
- package/build/fork/useBackButton.native.d.ts +1 -1
- package/build/fork/useBackButton.native.d.ts.map +1 -1
- package/build/fork/useBackButton.native.js.map +1 -1
- package/build/fork/useDocumentTitle.d.ts +1 -2
- package/build/fork/useDocumentTitle.d.ts.map +1 -1
- package/build/fork/useDocumentTitle.js.map +1 -1
- package/build/fork/useLinking.d.ts +5 -6
- package/build/fork/useLinking.d.ts.map +1 -1
- package/build/fork/useLinking.js +6 -6
- package/build/fork/useLinking.js.map +1 -1
- package/build/fork/useLinking.native.d.ts +5 -5
- package/build/fork/useLinking.native.d.ts.map +1 -1
- package/build/fork/useLinking.native.js +3 -3
- package/build/fork/useLinking.native.js.map +1 -1
- package/build/getRoutesCore.js +22 -4
- package/build/getRoutesCore.js.map +1 -1
- package/build/global-state/router-store.d.ts +1 -0
- package/build/global-state/router-store.d.ts.map +1 -1
- package/build/global-state/router-store.js +2 -0
- package/build/global-state/router-store.js.map +1 -1
- package/build/global-state/routing.d.ts +1 -0
- package/build/global-state/routing.d.ts.map +1 -1
- package/build/global-state/routing.js +33 -1
- package/build/global-state/routing.js.map +1 -1
- package/build/head/ExpoHead.ios.js +2 -2
- package/build/head/ExpoHead.ios.js.map +1 -1
- package/build/hooks.d.ts.map +1 -1
- package/build/hooks.js +2 -1
- package/build/hooks.js.map +1 -1
- package/build/imperative-api.d.ts +5 -0
- package/build/imperative-api.d.ts.map +1 -1
- package/build/imperative-api.js +1 -0
- package/build/imperative-api.js.map +1 -1
- package/build/layouts/Stack.d.ts.map +1 -1
- package/build/layouts/Stack.js +1 -0
- package/build/layouts/Stack.js.map +1 -1
- package/build/layouts/Tabs.d.ts +8 -0
- package/build/layouts/Tabs.d.ts.map +1 -1
- package/build/layouts/Tabs.js +1 -0
- package/build/layouts/Tabs.js.map +1 -1
- package/build/layouts/withLayoutContext.d.ts +2 -2
- package/build/layouts/withLayoutContext.d.ts.map +1 -1
- package/build/layouts/withLayoutContext.js +3 -6
- package/build/layouts/withLayoutContext.js.map +1 -1
- package/build/link/Link.d.ts.map +1 -1
- package/build/link/Link.js +1 -0
- package/build/link/Link.js.map +1 -1
- package/build/link/useDomComponentNavigation.d.ts +9 -0
- package/build/link/useDomComponentNavigation.d.ts.map +1 -0
- package/build/link/useDomComponentNavigation.js +69 -0
- package/build/link/useDomComponentNavigation.js.map +1 -0
- package/build/link/useLinkToPathProps.d.ts.map +1 -1
- package/build/link/useLinkToPathProps.js +4 -0
- package/build/link/useLinkToPathProps.js.map +1 -1
- package/build/primitives.js +3 -3
- package/build/primitives.js.map +1 -1
- package/build/rsc/router/client.d.ts +0 -1
- package/build/rsc/router/client.d.ts.map +1 -1
- package/build/rsc/router/client.js +1 -1
- package/build/rsc/router/client.js.map +1 -1
- package/build/rsc/router/noopRouter.d.ts +7 -0
- package/build/rsc/router/noopRouter.d.ts.map +1 -0
- package/build/rsc/router/noopRouter.js +7 -0
- package/build/rsc/router/noopRouter.js.map +1 -0
- package/build/useFocusEffect.d.ts.map +1 -1
- package/build/useFocusEffect.js +1 -0
- package/build/useFocusEffect.js.map +1 -1
- package/build/useNavigation.d.ts.map +1 -1
- package/build/useNavigation.js +1 -0
- package/build/useNavigation.js.map +1 -1
- package/build/useScreens.d.ts.map +1 -1
- package/build/useScreens.js +1 -0
- package/build/useScreens.js.map +1 -1
- package/build/utils/url.js +2 -2
- package/build/utils/url.js.map +1 -1
- package/build/views/Splash.d.ts.map +1 -1
- package/build/views/Splash.js +1 -0
- package/build/views/Splash.js.map +1 -1
- package/entry-classic.js +6 -0
- package/package.json +10 -8
- package/plugin/build/index.js +3 -1
- package/ui.d.ts +1 -0
- package/ui.js +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.js","sourceRoot":"","sources":["../../src/global-state/routing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA4F;AAC5F,sDAAwC;AACxC,kDAA2C;AAI3C,uCAA0E;AAC1E,0CAA+C;AAE/C,sCAAoD;AAEpD,SAAS,aAAa,CAAC,KAAkB;IACvC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE;QAClC,MAAM,IAAI,KAAK,CACb,gKAAgK,CACjK,CAAC;KACH;AACH,CAAC;AAID,SAAgB,QAAQ,CAAoB,GAAS,EAAE,OAA2B;IAChF,OAAO,IAAI,CAAC,MAAM,CAAC,IAAA,kBAAW,EAAC,GAAG,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;AAC1E,CAAC;AAFD,4BAEC;AAED,SAAgB,IAAI,CAAoB,GAAS,EAAE,OAA2B;IAC5E,OAAO,IAAI,CAAC,MAAM,CAAC,IAAA,kBAAW,EAAC,GAAG,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;AACtE,CAAC;AAFD,oBAEC;AAED,SAAgB,OAAO,CAAoB,KAAc;IACvD,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,qBAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AACxD,C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YAAY,EAAE;gBACzC,OAAO,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAC;aAC1F;SACF;QACD;;;;;;;;WAQG;QACH,WAAW,CAAC,MAAM,CAAC,OAAO,GAAG,CAAC,UAAU,CAAC;KAC1C;IAED,OAAO;QACL,IAAI;QACJ,MAAM,EAAE,eAAe,CAAC,GAAG;QAC3B,OAAO,EAAE;YACP,wBAAwB;YACxB,IAAI,EAAE,WAAW,CAAC,MAAM;YACxB,MAAM,EAAE,WAAW,CAAC,MAAM;SAC3B;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { StackActions, type NavigationState, PartialRoute } from '@react-navigation/native';\nimport * as Linking from 'expo-linking';\nimport { nanoid } from 'nanoid/non-secure';\n\nimport { type RouterStore } from './router-store';\nimport { ResultState } from '../fork/getStateFromPath';\nimport { resolveHref, resolveHrefStringWithSegments } from '../link/href';\nimport { matchDynamicName } from '../matchers';\nimport { Href } from '../types';\nimport { shouldLinkExternally } from '../utils/url';\n\nfunction assertIsReady(store: RouterStore) {\n if (!store.navigationRef.isReady()) {\n throw new Error(\n 'Attempted to navigate before mounting the Root Layout component. Ensure the Root Layout component is rendering a Slot, or other navigator on the first render.'\n );\n }\n}\n\nexport type NavigationOptions = Omit<LinkToOptions, 'event'>;\n\nexport function navigate(this: RouterStore, url: Href, options?: NavigationOptions) {\n return this.linkTo(resolveHref(url), { ...options, event: 'NAVIGATE' });\n}\n\nexport function push(this: RouterStore, url: Href, options?: NavigationOptions) {\n return this.linkTo(resolveHref(url), { ...options, event: 'PUSH' });\n}\n\nexport function dismiss(this: RouterStore, count?: number) {\n this.navigationRef?.dispatch(StackActions.pop(count));\n}\n\nexport function replace(this: RouterStore, url: Href, options?: NavigationOptions) {\n return this.linkTo(resolveHref(url), { ...options, event: 'REPLACE' });\n}\n\nexport function dismissAll(this: RouterStore) {\n this.navigationRef?.dispatch(StackActions.popToTop());\n}\n\nexport function goBack(this: RouterStore) {\n assertIsReady(this);\n this.navigationRef?.current?.goBack();\n}\n\nexport function canGoBack(this: RouterStore): boolean {\n // Return a default value here if the navigation hasn't mounted yet.\n // This can happen if the user calls `canGoBack` from the Root Layout route\n // before mounting a navigator. This behavior exists due to React Navigation being dynamically\n // constructed at runtime. We can get rid of this in the future if we use\n // the static configuration internally.\n if (!this.navigationRef.isReady()) {\n return false;\n }\n return this.navigationRef?.current?.canGoBack() ?? false;\n}\n\nexport function canDismiss(this: RouterStore): boolean {\n let state = this.rootState;\n\n // Keep traversing down the state tree until we find a stack navigator that we can pop\n while (state) {\n if (state.type === 'stack' && state.routes.length > 1) {\n return true;\n }\n if (state.index === undefined) return false;\n\n state = state.routes?.[state.index]?.state as any;\n }\n\n return false;\n}\n\nexport function setParams(\n this: RouterStore,\n params: Record<string, string | number | (string | number)[]> = {}\n) {\n assertIsReady(this);\n return (this.navigationRef?.current?.setParams as any)(params);\n}\n\nexport type LinkToOptions = {\n event?: string;\n\n /**\n * Relative URL references are either relative to the directory or the document. By default, relative paths are relative to the document.\n * @see: [MDN's documentation on Resolving relative references to a URL](https://developer.mozilla.org/en-US/docs/Web/API/URL_API/Resolving_relative_references).\n */\n relativeToDirectory?: boolean;\n\n /**\n *\n */\n withAnchor?: boolean;\n};\n\nexport function linkTo(\n this: RouterStore,\n href: string,\n { event, relativeToDirectory, withAnchor }: LinkToOptions = {}\n) {\n if (shouldLinkExternally(href)) {\n Linking.openURL(href);\n return;\n }\n\n assertIsReady(this);\n const navigationRef = this.navigationRef.current;\n\n if (navigationRef == null) {\n throw new Error(\n \"Couldn't find a navigation object. Is your component inside NavigationContainer?\"\n );\n }\n\n if (!this.linking) {\n throw new Error('Attempted to link to route when no routes are present');\n }\n\n if (href === '..' || href === '../') {\n navigationRef.goBack();\n return;\n }\n\n const rootState = navigationRef.getRootState();\n\n href = resolveHrefStringWithSegments(href, this.routeInfo, relativeToDirectory);\n\n const state = this.linking.getStateFromPath!(href, this.linking.config);\n\n if (!state || state.routes.length === 0) {\n console.error('Could not generate a valid navigation state for the given path: ' + href);\n return;\n }\n\n return navigationRef.dispatch(getNavigateAction(state, rootState, event, withAnchor));\n}\n\nfunction getNavigateAction(\n actionState: ResultState,\n navigationState: NavigationState,\n type = 'NAVIGATE',\n withAnchor?: boolean\n) {\n /**\n * We need to find the deepest navigator where the action and current state diverge, If they do not diverge, the\n * lowest navigator is the target.\n *\n * By default React Navigation will target the current navigator, but this doesn't work for all actions\n * For example:\n * - /deeply/nested/route -> /top-level-route the target needs to be the top-level navigator\n * - /stack/nestedStack/page -> /stack1/nestedStack/other-page needs to target the nestedStack navigator\n *\n * This matching needs to done by comparing the route names and the dynamic path, for example\n * - /1/page -> /2/anotherPage needs to target the /[id] navigator\n *\n * Other parameters such as search params and hash are not evaluated.\n */\n let actionStateRoute: PartialRoute<any> | undefined;\n\n // Traverse the state tree comparing the current state and the action state until we find where they diverge\n while (actionState && navigationState) {\n const stateRoute = navigationState.routes[navigationState.index];\n\n actionStateRoute = actionState.routes[actionState.routes.length - 1];\n\n const childState = actionStateRoute.state;\n const nextNavigationState = stateRoute.state;\n\n const dynamicName = matchDynamicName(actionStateRoute.name);\n\n const didActionAndCurrentStateDiverge =\n actionStateRoute.name !== stateRoute.name ||\n !childState ||\n !nextNavigationState ||\n (dynamicName && actionStateRoute.params?.[dynamicName] !== stateRoute.params?.[dynamicName]);\n\n if (didActionAndCurrentStateDiverge) {\n break;\n }\n\n actionState = childState;\n navigationState = nextNavigationState as NavigationState;\n }\n\n /*\n * We found the target navigator, but the payload is in the incorrect format\n * We need to convert the action state to a payload that can be dispatched\n */\n const rootPayload: Record<string, any> = { params: {} };\n let payload = rootPayload;\n let params = payload.params;\n\n // The root level of payload is a bit weird, its params are in the child object\n while (actionStateRoute) {\n Object.assign(params, { ...payload.params, ...actionStateRoute.params });\n // Assign the screen name to the payload\n payload.screen = actionStateRoute.name;\n // Merge the params, ensuring that we create a new object\n payload.params = { ...params };\n // Params don't include the screen, thats a separate attribute\n delete payload.params['screen'];\n\n // Continue down the payload tree\n // Initially these values are separate, but React Nav merges them after the first layer\n payload = payload.params;\n params = payload;\n\n actionStateRoute = actionStateRoute.state?.routes[actionStateRoute.state?.routes.length - 1];\n }\n\n // Expo Router uses only three actions, but these don't directly translate to all navigator actions\n if (type === 'PUSH') {\n // Only stack navigators have a push action, and even then we want to use NAVIGATE (see below)\n type = 'NAVIGATE';\n\n /*\n * The StackAction.PUSH does not work correctly with Expo Router.\n *\n * Expo Router provides a getId() function for every route, altering how React Navigation handles stack routing.\n * Ordinarily, PUSH always adds a new screen to the stack. However, with getId() present, it navigates to the screen with the matching ID instead (by moving the screen to the top of the stack)\n * When you try and push to a screen with the same ID, no navigation will occur\n * Refer to: https://github.com/react-navigation/react-navigation/blob/13d4aa270b301faf07960b4cd861ffc91e9b2c46/packages/routers/src/StackRouter.tsx#L279-L290\n *\n * Expo Router needs to retain the default behavior of PUSH, consistently adding new screens to the stack, even if their IDs are identical.\n *\n * To resolve this issue, we switch to using a NAVIGATE action with a new key. In the navigate action, screens are matched by either key or getId() function.\n * By generating a unique new key, we ensure that the screen is always pushed onto the stack.\n *\n */\n if (navigationState.type === 'stack') {\n rootPayload.params.__EXPO_ROUTER_key = `${rootPayload.name}-${nanoid()}`; // @see https://github.com/react-navigation/react-navigation/blob/13d4aa270b301faf07960b4cd861ffc91e9b2c46/packages/routers/src/StackRouter.tsx#L406-L407\n }\n }\n\n if (navigationState.type === 'expo-tab') {\n type = 'JUMP_TO';\n }\n\n if (type === 'REPLACE' && (navigationState.type === 'tab' || navigationState.type === 'drawer')) {\n type = 'JUMP_TO';\n }\n\n if (withAnchor !== undefined) {\n if (rootPayload.params.initial) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`The parameter 'initial' is a reserved parameter name in React Navigation`);\n }\n }\n /*\n * The logic for initial can seen backwards depending on your perspective\n * True: The initialRouteName is not loaded. The incoming screen is the initial screen (default)\n * False: The initialRouteName is loaded. THe incoming screen is placed after the initialRouteName\n *\n * withAnchor flips the perspective.\n * True: You want the initialRouteName to load.\n * False: You do not want the initialRouteName to load.\n */\n rootPayload.params.initial = !withAnchor;\n }\n\n return {\n type,\n target: navigationState.key,\n payload: {\n // key: rootPayload.key,\n name: rootPayload.screen,\n params: rootPayload.params,\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"routing.js","sourceRoot":"","sources":["../../src/global-state/routing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA4F;AAC5F,kCAAkC;AAClC,sDAAwC;AACxC,kDAA2C;AAC3C,+CAAwC;AAIxC,uCAA0E;AAC1E,iFAM2C;AAC3C,0CAA+C;AAE/C,sCAAoD;AAEpD,SAAS,aAAa,CAAC,KAAkB;IACvC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE;QAClC,MAAM,IAAI,KAAK,CACb,gKAAgK,CACjK,CAAC;KACH;AACH,CAAC;AAID,SAAgB,QAAQ,CAAoB,GAAS,EAAE,OAA2B;IAChF,OAAO,IAAI,CAAC,MAAM,CAAC,IAAA,kBAAW,EAAC,GAAG,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;AAC1E,CAAC;AAFD,4BAEC;AAED,SAAgB,MAAM;IACpB,yCAAyC;IACzC,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;AACzF,CAAC;AAHD,wBAGC;AAED,SAAgB,IAAI,CAAoB,GAAS,EAAE,OAA2B;IAC5E,OAAO,IAAI,CAAC,MAAM,CAAC,IAAA,kBAAW,EAAC,GAAG,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;AACtE,CAAC;AAFD,oBAEC;AAED,SAAgB,OAAO,CAAoB,KAAc;IACvD,IAAI,IAAA,0CAAc,EAAC,KAAK,CAAC,EAAE;QACzB,OAAO;KACR;IACD,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,qBAAY,CAAC,GAAG,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A8F;QAC9F,IAAI,GAAG,UAAU,CAAC;QAElB;;;;;;;;;;;;;WAaG;QACH,IAAI,eAAe,CAAC,IAAI,KAAK,OAAO,EAAE;YACpC,WAAW,CAAC,MAAM,CAAC,iBAAiB,GAAG,GAAG,WAAW,CAAC,IAAI,IAAI,IAAA,mBAAM,GAAE,EAAE,CAAC,CAAC,yJAAyJ;SACpO;KACF;IAED,IAAI,eAAe,CAAC,IAAI,KAAK,UAAU,EAAE;QACvC,IAAI,GAAG,SAAS,CAAC;KAClB;IAED,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,eAAe,CAAC,IAAI,KAAK,KAAK,IAAI,eAAe,CAAC,IAAI,KAAK,QAAQ,CAAC,EAAE;QAC/F,IAAI,GAAG,SAAS,CAAC;KAClB;IAED,IAAI,UAAU,KAAK,SAAS,EAAE;QAC5B,IAAI,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE;YAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;gBACzC,OAAO,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAC;aAC1F;SACF;QACD;;;;;;;;WAQG;QACH,WAAW,CAAC,MAAM,CAAC,OAAO,GAAG,CAAC,UAAU,CAAC;KAC1C;IAED,OAAO;QACL,IAAI;QACJ,MAAM,EAAE,eAAe,CAAC,GAAG;QAC3B,OAAO,EAAE;YACP,wBAAwB;YACxB,IAAI,EAAE,WAAW,CAAC,MAAM;YACxB,MAAM,EAAE,WAAW,CAAC,MAAM;SAC3B;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { StackActions, type NavigationState, PartialRoute } from '@react-navigation/native';\nimport { IS_DOM } from 'expo/dom';\nimport * as Linking from 'expo-linking';\nimport { nanoid } from 'nanoid/non-secure';\nimport { Platform } from 'react-native';\n\nimport { type RouterStore } from './router-store';\nimport { ResultState } from '../fork/getStateFromPath';\nimport { resolveHref, resolveHrefStringWithSegments } from '../link/href';\nimport {\n emitDomDismiss,\n emitDomDismissAll,\n emitDomGoBack,\n emitDomLinkEvent,\n emitDomSetParams,\n} from '../link/useDomComponentNavigation';\nimport { matchDynamicName } from '../matchers';\nimport { Href } from '../types';\nimport { shouldLinkExternally } from '../utils/url';\n\nfunction assertIsReady(store: RouterStore) {\n if (!store.navigationRef.isReady()) {\n throw new Error(\n 'Attempted to navigate before mounting the Root Layout component. Ensure the Root Layout component is rendering a Slot, or other navigator on the first render.'\n );\n }\n}\n\nexport type NavigationOptions = Omit<LinkToOptions, 'event'>;\n\nexport function navigate(this: RouterStore, url: Href, options?: NavigationOptions) {\n return this.linkTo(resolveHref(url), { ...options, event: 'NAVIGATE' });\n}\n\nexport function reload(this: RouterStore) {\n // TODO(EvanBacon): add `reload` support.\n throw new Error('The reload method is not implemented in the client-side router yet.');\n}\n\nexport function push(this: RouterStore, url: Href, options?: NavigationOptions) {\n return this.linkTo(resolveHref(url), { ...options, event: 'PUSH' });\n}\n\nexport function dismiss(this: RouterStore, count?: number) {\n if (emitDomDismiss(count)) {\n return;\n }\n this.navigationRef?.dispatch(StackActions.pop(count));\n}\n\nexport function replace(this: RouterStore, url: Href, options?: NavigationOptions) {\n return this.linkTo(resolveHref(url), { ...options, event: 'REPLACE' });\n}\n\nexport function dismissAll(this: RouterStore) {\n if (emitDomDismissAll()) {\n return;\n }\n this.navigationRef?.dispatch(StackActions.popToTop());\n}\n\nexport function goBack(this: RouterStore) {\n if (emitDomGoBack()) {\n return;\n }\n assertIsReady(this);\n this.navigationRef?.current?.goBack();\n}\n\nexport function canGoBack(this: RouterStore): boolean {\n if (IS_DOM) {\n throw new Error(\n 'canGoBack imperative method is not supported. Pass the property to the DOM component instead.'\n );\n }\n // Return a default value here if the navigation hasn't mounted yet.\n // This can happen if the user calls `canGoBack` from the Root Layout route\n // before mounting a navigator. This behavior exists due to React Navigation being dynamically\n // constructed at runtime. We can get rid of this in the future if we use\n // the static configuration internally.\n if (!this.navigationRef.isReady()) {\n return false;\n }\n return this.navigationRef?.current?.canGoBack() ?? false;\n}\n\nexport function canDismiss(this: RouterStore): boolean {\n if (IS_DOM) {\n throw new Error(\n 'canDismiss imperative method is not supported. Pass the property to the DOM component instead.'\n );\n }\n let state = this.rootState;\n\n // Keep traversing down the state tree until we find a stack navigator that we can pop\n while (state) {\n if (state.type === 'stack' && state.routes.length > 1) {\n return true;\n }\n if (state.index === undefined) return false;\n\n state = state.routes?.[state.index]?.state as any;\n }\n\n return false;\n}\n\nexport function setParams(\n this: RouterStore,\n params: Record<string, string | number | (string | number)[]> = {}\n) {\n if (emitDomSetParams(params)) {\n return;\n }\n assertIsReady(this);\n return (this.navigationRef?.current?.setParams as any)(params);\n}\n\nexport type LinkToOptions = {\n event?: string;\n\n /**\n * Relative URL references are either relative to the directory or the document. By default, relative paths are relative to the document.\n * @see: [MDN's documentation on Resolving relative references to a URL](https://developer.mozilla.org/en-US/docs/Web/API/URL_API/Resolving_relative_references).\n */\n relativeToDirectory?: boolean;\n\n /**\n *\n */\n withAnchor?: boolean;\n};\n\nexport function linkTo(\n this: RouterStore,\n href: string,\n { event, relativeToDirectory, withAnchor }: LinkToOptions = {}\n) {\n if (emitDomLinkEvent(href, { event, relativeToDirectory, withAnchor })) {\n return;\n }\n\n if (shouldLinkExternally(href)) {\n if (href.startsWith('//') && Platform.OS !== 'web') {\n href = `https:${href}`;\n }\n\n Linking.openURL(href);\n return;\n }\n\n assertIsReady(this);\n const navigationRef = this.navigationRef.current;\n\n if (navigationRef == null) {\n throw new Error(\n \"Couldn't find a navigation object. Is your component inside NavigationContainer?\"\n );\n }\n\n if (!this.linking) {\n throw new Error('Attempted to link to route when no routes are present');\n }\n\n if (href === '..' || href === '../') {\n navigationRef.goBack();\n return;\n }\n\n const rootState = navigationRef.getRootState();\n\n href = resolveHrefStringWithSegments(href, this.routeInfo, relativeToDirectory);\n\n const state = this.linking.getStateFromPath!(href, this.linking.config);\n\n if (!state || state.routes.length === 0) {\n console.error('Could not generate a valid navigation state for the given path: ' + href);\n return;\n }\n\n return navigationRef.dispatch(getNavigateAction(state, rootState, event, withAnchor));\n}\n\nfunction getNavigateAction(\n actionState: ResultState,\n navigationState: NavigationState,\n type = 'NAVIGATE',\n withAnchor?: boolean\n) {\n /**\n * We need to find the deepest navigator where the action and current state diverge, If they do not diverge, the\n * lowest navigator is the target.\n *\n * By default React Navigation will target the current navigator, but this doesn't work for all actions\n * For example:\n * - /deeply/nested/route -> /top-level-route the target needs to be the top-level navigator\n * - /stack/nestedStack/page -> /stack1/nestedStack/other-page needs to target the nestedStack navigator\n *\n * This matching needs to done by comparing the route names and the dynamic path, for example\n * - /1/page -> /2/anotherPage needs to target the /[id] navigator\n *\n * Other parameters such as search params and hash are not evaluated.\n */\n let actionStateRoute: PartialRoute<any> | undefined;\n\n // Traverse the state tree comparing the current state and the action state until we find where they diverge\n while (actionState && navigationState) {\n const stateRoute = navigationState.routes[navigationState.index];\n\n actionStateRoute = actionState.routes[actionState.routes.length - 1];\n\n const childState = actionStateRoute.state;\n const nextNavigationState = stateRoute.state;\n\n const dynamicName = matchDynamicName(actionStateRoute.name);\n\n const didActionAndCurrentStateDiverge =\n actionStateRoute.name !== stateRoute.name ||\n !childState ||\n !nextNavigationState ||\n (dynamicName && actionStateRoute.params?.[dynamicName] !== stateRoute.params?.[dynamicName]);\n\n if (didActionAndCurrentStateDiverge) {\n break;\n }\n\n actionState = childState;\n navigationState = nextNavigationState as NavigationState;\n }\n\n /*\n * We found the target navigator, but the payload is in the incorrect format\n * We need to convert the action state to a payload that can be dispatched\n */\n const rootPayload: Record<string, any> = { params: {} };\n let payload = rootPayload;\n let params = payload.params;\n\n // The root level of payload is a bit weird, its params are in the child object\n while (actionStateRoute) {\n Object.assign(params, { ...payload.params, ...actionStateRoute.params });\n // Assign the screen name to the payload\n payload.screen = actionStateRoute.name;\n // Merge the params, ensuring that we create a new object\n payload.params = { ...params };\n // Params don't include the screen, thats a separate attribute\n delete payload.params['screen'];\n\n // Continue down the payload tree\n // Initially these values are separate, but React Nav merges them after the first layer\n payload = payload.params;\n params = payload;\n\n actionStateRoute = actionStateRoute.state?.routes[actionStateRoute.state?.routes.length - 1];\n }\n\n // Expo Router uses only three actions, but these don't directly translate to all navigator actions\n if (type === 'PUSH') {\n // Only stack navigators have a push action, and even then we want to use NAVIGATE (see below)\n type = 'NAVIGATE';\n\n /*\n * The StackAction.PUSH does not work correctly with Expo Router.\n *\n * Expo Router provides a getId() function for every route, altering how React Navigation handles stack routing.\n * Ordinarily, PUSH always adds a new screen to the stack. However, with getId() present, it navigates to the screen with the matching ID instead (by moving the screen to the top of the stack)\n * When you try and push to a screen with the same ID, no navigation will occur\n * Refer to: https://github.com/react-navigation/react-navigation/blob/13d4aa270b301faf07960b4cd861ffc91e9b2c46/packages/routers/src/StackRouter.tsx#L279-L290\n *\n * Expo Router needs to retain the default behavior of PUSH, consistently adding new screens to the stack, even if their IDs are identical.\n *\n * To resolve this issue, we switch to using a NAVIGATE action with a new key. In the navigate action, screens are matched by either key or getId() function.\n * By generating a unique new key, we ensure that the screen is always pushed onto the stack.\n *\n */\n if (navigationState.type === 'stack') {\n rootPayload.params.__EXPO_ROUTER_key = `${rootPayload.name}-${nanoid()}`; // @see https://github.com/react-navigation/react-navigation/blob/13d4aa270b301faf07960b4cd861ffc91e9b2c46/packages/routers/src/StackRouter.tsx#L406-L407\n }\n }\n\n if (navigationState.type === 'expo-tab') {\n type = 'JUMP_TO';\n }\n\n if (type === 'REPLACE' && (navigationState.type === 'tab' || navigationState.type === 'drawer')) {\n type = 'JUMP_TO';\n }\n\n if (withAnchor !== undefined) {\n if (rootPayload.params.initial) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`The parameter 'initial' is a reserved parameter name in React Navigation`);\n }\n }\n /*\n * The logic for initial can seen backwards depending on your perspective\n * True: The initialRouteName is not loaded. The incoming screen is the initial screen (default)\n * False: The initialRouteName is loaded. THe incoming screen is placed after the initialRouteName\n *\n * withAnchor flips the perspective.\n * True: You want the initialRouteName to load.\n * False: You do not want the initialRouteName to load.\n */\n rootPayload.params.initial = !withAnchor;\n }\n\n return {\n type,\n target: navigationState.key,\n payload: {\n // key: rootPayload.key,\n name: rootPayload.screen,\n params: rootPayload.params,\n },\n };\n}\n"]}
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Head = void 0;
|
|
7
|
-
const
|
|
7
|
+
const native_1 = require("@react-navigation/native");
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const ExpoHeadModule_1 = require("./ExpoHeadModule");
|
|
10
10
|
const url_1 = require("./url");
|
|
@@ -142,7 +142,7 @@ function isTruthy(value) {
|
|
|
142
142
|
return [true, 'true'].includes(value);
|
|
143
143
|
}
|
|
144
144
|
function HeadNative(props) {
|
|
145
|
-
const isFocused = (0,
|
|
145
|
+
const isFocused = (0, native_1.useIsFocused)();
|
|
146
146
|
if (!isFocused) {
|
|
147
147
|
return <UnfocusedHead />;
|
|
148
148
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoHead.ios.js","sourceRoot":"","sources":["../../src/head/ExpoHead.ios.tsx"],"names":[],"mappings":";;;;;;AAAA,iDAAsD;AACtD,kDAA0B;AAE1B,qDAA0D;AAC1D,+BAAmD;AACnD,oCAAiG;AAEjG,SAAS,OAAO,CAAC,GAAW;IAC1B,OAAO,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,cAAc,CAAC,IAAY;IAClC,uBAAuB;IACvB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;IAChD,OAAO,WAAW,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5D,CAAC;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AAQ,CAAC;AAErC,SAAS,QAAQ,CAAC,KAA8B;IAC9C,OAAO,IAAI,CAAC;AACd,CAAC;AAED,QAAQ,CAAC,QAAQ,GAAG,eAAK,CAAC,QAAQ,CAAC;AAEnC,gDAAgD;AACnC,QAAA,IAAI,GAEb,yBAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC","sourcesContent":["import { useIsFocused } from '@react-navigation/core';\nimport React from 'react';\n\nimport { ExpoHead, UserActivity } from './ExpoHeadModule';\nimport { getStaticUrlFromExpoRouter } from './url';\nimport { useLocalSearchParams, useUnstableGlobalHref, usePathname, useSegments } from '../hooks';\n\nfunction urlToId(url: string) {\n return url.replace(/[^a-zA-Z0-9]/g, '-');\n}\n\nfunction getLastSegment(path: string) {\n // Remove the extension\n const lastSegment = path.split('/').pop() ?? '';\n return lastSegment.replace(/\\.[^/.]+$/, '').split('?')[0];\n}\n\n// TODO: Use Head Provider to collect all props so only one Head is rendered for a given route.\n\nfunction useAddressableLink() {\n const pathname = useUnstableGlobalHref();\n const params = useLocalSearchParams<any>();\n const url = getStaticUrlFromExpoRouter(pathname);\n return { url, pathname, params };\n}\n\ntype MetaNode =\n | React.ReactPortal\n | React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;\n\nfunction useMetaChildren(children: React.ReactNode) {\n return React.useMemo(() => {\n const renderableChildren: React.ReactNode[] = [];\n const metaChildren: MetaNode[] = [];\n\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement(child)) {\n return;\n }\n if (typeof child.type === 'string') {\n metaChildren.push(child);\n } else {\n renderableChildren.push(child);\n }\n });\n\n return { children: renderableChildren, metaChildren };\n }, [children]);\n}\n\ntype SerializedMeta = {\n type: string;\n props: Record<string, string | undefined>;\n};\n\nfunction serializedMetaChildren(meta: MetaNode[]): SerializedMeta[] {\n const validMeta = meta.filter((child) => child.type === 'meta' || child.type === 'title');\n\n return validMeta.map((child) => {\n if (child.type === 'title') {\n return {\n type: 'title',\n props: {\n children: typeof child.props.children === 'string' ? child.props.children : undefined,\n },\n };\n }\n return {\n type: 'meta',\n props: {\n property: typeof child.props.property === 'string' ? child.props.property : undefined,\n content: typeof child.props.content === 'string' ? child.props.content : undefined,\n },\n };\n });\n}\n\nfunction useActivityFromMetaChildren(meta: MetaNode[]) {\n const { url: href, pathname } = useAddressableLink();\n\n const previousMeta = React.useRef<SerializedMeta[]>([]);\n const cachedActivity = React.useRef<Partial<UserActivity>>({});\n\n const sortedMeta = React.useMemo(() => serializedMetaChildren(meta), [meta]);\n\n const url = React.useMemo(() => {\n const urlMeta = sortedMeta.find(\n (child) => child.type === 'meta' && child.props.property === 'og:url'\n );\n\n if (urlMeta) {\n // Support =`/foo/bar` -> `https://example.com/foo/bar`\n if (urlMeta.props.content?.startsWith('/')) {\n return getStaticUrlFromExpoRouter(urlMeta.props.content);\n }\n return urlMeta.props.content;\n }\n return href;\n }, [sortedMeta, href]);\n\n const title = React.useMemo(() => {\n const titleTag = sortedMeta.find((child) => child.type === 'title');\n if (titleTag) {\n return titleTag.props.children ?? '';\n }\n const titleMeta = sortedMeta.find(\n (child) => child.type === 'meta' && child.props.property === 'og:title'\n );\n if (titleMeta) {\n return titleMeta.props.content ?? '';\n }\n\n return getLastSegment(pathname);\n }, [sortedMeta, pathname]);\n\n const activity = React.useMemo(() => {\n if (\n !!previousMeta.current &&\n !!cachedActivity.current &&\n deepObjectCompare(previousMeta.current, sortedMeta)\n ) {\n return cachedActivity.current;\n }\n previousMeta.current = sortedMeta;\n\n const userActivity: Partial<UserActivity> = {};\n\n sortedMeta.forEach((child) => {\n if (\n // <meta />\n child.type === 'meta'\n ) {\n const { property, content } = child.props;\n\n switch (property) {\n case 'og:description':\n userActivity.description = content;\n break;\n // Custom properties\n case 'expo:handoff':\n userActivity.isEligibleForHandoff = isTruthy(content);\n break;\n case 'expo:spotlight':\n userActivity.isEligibleForSearch = isTruthy(content);\n break;\n }\n\n // // <meta name=\"keywords\" content=\"foo,bar,baz\" />\n // if ([\"keywords\"].includes(name)) {\n // userActivity.keywords = Array.isArray(content)\n // ? content\n // : content.split(\",\");\n // }\n }\n });\n\n cachedActivity.current = userActivity;\n return userActivity;\n }, [meta, pathname, href]);\n\n const parsedActivity: UserActivity = {\n keywords: [title],\n ...activity,\n title,\n webpageURL: url,\n activityType: ExpoHead!.activities.INDEXED_ROUTE,\n userInfo: {\n // TODO: This may need to be versioned in the future, e.g. `_v1` if we change the format.\n href,\n },\n };\n\n return parsedActivity;\n}\n\nfunction isTruthy(value: any): boolean {\n return [true, 'true'].includes(value);\n}\n\nfunction HeadNative(props: { children?: React.ReactNode }) {\n const isFocused = useIsFocused();\n if (!isFocused) {\n return <UnfocusedHead />;\n }\n return <FocusedHead {...props} />;\n}\n\nfunction UnfocusedHead(props: { children?: React.ReactNode }): JSX.Element {\n const { children } = useMetaChildren(props.children);\n return <>{children}</>;\n}\n\nfunction FocusedHead(props: { children?: React.ReactNode }): JSX.Element {\n const { metaChildren, children } = useMetaChildren(props.children);\n const activity = useActivityFromMetaChildren(metaChildren);\n useRegisterCurrentActivity(activity);\n return <>{children}</>;\n}\n\n// segments => activity\nconst activities: Map<string, UserActivity> = new Map();\n\nfunction useRegisterCurrentActivity(activity: UserActivity) {\n // ID is tied to Expo Router and agnostic of URLs to ensure dynamic parameters are not considered.\n // Using all segments ensures that cascading routes are considered.\n const activityId = urlToId(usePathname() || '/');\n const cascadingId = urlToId(useSegments().join('-') || '-');\n const activityIds = Array.from(activities.keys());\n const cascadingActivity: UserActivity = React.useMemo(() => {\n // Get all nested activities together, then update the id to match the current pathname.\n // This enables cases like `/user/[name]/post/[id]` to match all nesting, while still having a URL-specific ID, i.e. `/user/evanbacon/post/123`\n const cascadingActivity = activities.has(cascadingId)\n ? {\n ...activities.get(cascadingId),\n ...activity,\n id: activityId,\n }\n : {\n ...activity,\n id: activityId,\n };\n activities.set(cascadingId, cascadingActivity);\n\n return cascadingActivity;\n }, [cascadingId, activityId, activity, activityIds]);\n\n const previousActivity = React.useRef<UserActivity | null>(null);\n\n React.useEffect(() => {\n if (!cascadingActivity) {\n return () => {};\n }\n if (\n !!previousActivity.current &&\n deepObjectCompare(previousActivity.current, cascadingActivity)\n ) {\n return () => {};\n }\n\n previousActivity.current = cascadingActivity;\n if (!cascadingActivity.id) {\n throw new Error('Activity must have an ID');\n }\n\n // If no features are enabled, then skip registering the activity\n if (cascadingActivity.isEligibleForHandoff || cascadingActivity.isEligibleForSearch) {\n ExpoHead?.createActivity(cascadingActivity);\n }\n\n return () => {};\n }, [cascadingActivity]);\n\n React.useEffect(() => {\n return () => {\n if (activityId) {\n ExpoHead?.suspendActivity(activityId);\n }\n };\n }, [activityId]);\n}\n\nfunction deepObjectCompare(a: any, b: any) {\n if (typeof a !== typeof b) {\n return false;\n }\n if (typeof a === 'object') {\n if (Array.isArray(a) !== Array.isArray(b)) {\n return false;\n }\n if (Array.isArray(a)) {\n if (a.length !== b.length) {\n return false;\n }\n return a.every((item, index) => deepObjectCompare(item, b[index]));\n }\n // handle null\n if (a === null || b === null) {\n return a === b;\n }\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n return aKeys.every((key) => deepObjectCompare(a[key], b[key]));\n }\n return a === b;\n}\n\nHeadNative.Provider = React.Fragment;\n\nfunction HeadShim(props: React.PropsWithChildren) {\n return null;\n}\n\nHeadShim.Provider = React.Fragment;\n\n// Native Head is only enabled in bare iOS apps.\nexport const Head: ((props: React.PropsWithChildren) => React.ReactNode) & {\n Provider: React.ComponentType;\n} = ExpoHead ? HeadNative : HeadShim;\n"]}
|
|
1
|
+
{"version":3,"file":"ExpoHead.ios.js","sourceRoot":"","sources":["../../src/head/ExpoHead.ios.tsx"],"names":[],"mappings":";;;;;;AAAA,qDAAwD;AACxD,kDAA0B;AAE1B,qDAA0D;AAC1D,+BAAmD;AACnD,oCAAiG;AAEjG,SAAS,OAAO,CAAC,GAAW;IAC1B,OAAO,GAAG,CAAC,OAAO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AAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE;YACjC,OAAO,KAAK,CAAC;SACd;QACD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAChE;IACD,OAAO,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC;AAED,UAAU,CAAC,QAAQ,GAAG,eAAK,CAAC,QAAQ,CAAC;AAErC,SAAS,QAAQ,CAAC,KAA8B;IAC9C,OAAO,IAAI,CAAC;AACd,CAAC;AAED,QAAQ,CAAC,QAAQ,GAAG,eAAK,CAAC,QAAQ,CAAC;AAEnC,gDAAgD;AACnC,QAAA,IAAI,GAEb,yBAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC","sourcesContent":["import { useIsFocused } from '@react-navigation/native';\nimport React from 'react';\n\nimport { ExpoHead, UserActivity } from './ExpoHeadModule';\nimport { getStaticUrlFromExpoRouter } from './url';\nimport { useLocalSearchParams, useUnstableGlobalHref, usePathname, useSegments } from '../hooks';\n\nfunction urlToId(url: string) {\n return url.replace(/[^a-zA-Z0-9]/g, '-');\n}\n\nfunction getLastSegment(path: string) {\n // Remove the extension\n const lastSegment = path.split('/').pop() ?? '';\n return lastSegment.replace(/\\.[^/.]+$/, '').split('?')[0];\n}\n\n// TODO: Use Head Provider to collect all props so only one Head is rendered for a given route.\n\nfunction useAddressableLink() {\n const pathname = useUnstableGlobalHref();\n const params = useLocalSearchParams<any>();\n const url = getStaticUrlFromExpoRouter(pathname);\n return { url, pathname, params };\n}\n\ntype MetaNode =\n | React.ReactPortal\n | React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;\n\nfunction useMetaChildren(children: React.ReactNode) {\n return React.useMemo(() => {\n const renderableChildren: React.ReactNode[] = [];\n const metaChildren: MetaNode[] = [];\n\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement(child)) {\n return;\n }\n if (typeof child.type === 'string') {\n metaChildren.push(child);\n } else {\n renderableChildren.push(child);\n }\n });\n\n return { children: renderableChildren, metaChildren };\n }, [children]);\n}\n\ntype SerializedMeta = {\n type: string;\n props: Record<string, string | undefined>;\n};\n\nfunction serializedMetaChildren(meta: MetaNode[]): SerializedMeta[] {\n const validMeta = meta.filter((child) => child.type === 'meta' || child.type === 'title');\n\n return validMeta.map((child) => {\n if (child.type === 'title') {\n return {\n type: 'title',\n props: {\n children: typeof child.props.children === 'string' ? child.props.children : undefined,\n },\n };\n }\n return {\n type: 'meta',\n props: {\n property: typeof child.props.property === 'string' ? child.props.property : undefined,\n content: typeof child.props.content === 'string' ? child.props.content : undefined,\n },\n };\n });\n}\n\nfunction useActivityFromMetaChildren(meta: MetaNode[]) {\n const { url: href, pathname } = useAddressableLink();\n\n const previousMeta = React.useRef<SerializedMeta[]>([]);\n const cachedActivity = React.useRef<Partial<UserActivity>>({});\n\n const sortedMeta = React.useMemo(() => serializedMetaChildren(meta), [meta]);\n\n const url = React.useMemo(() => {\n const urlMeta = sortedMeta.find(\n (child) => child.type === 'meta' && child.props.property === 'og:url'\n );\n\n if (urlMeta) {\n // Support =`/foo/bar` -> `https://example.com/foo/bar`\n if (urlMeta.props.content?.startsWith('/')) {\n return getStaticUrlFromExpoRouter(urlMeta.props.content);\n }\n return urlMeta.props.content;\n }\n return href;\n }, [sortedMeta, href]);\n\n const title = React.useMemo(() => {\n const titleTag = sortedMeta.find((child) => child.type === 'title');\n if (titleTag) {\n return titleTag.props.children ?? '';\n }\n const titleMeta = sortedMeta.find(\n (child) => child.type === 'meta' && child.props.property === 'og:title'\n );\n if (titleMeta) {\n return titleMeta.props.content ?? '';\n }\n\n return getLastSegment(pathname);\n }, [sortedMeta, pathname]);\n\n const activity = React.useMemo(() => {\n if (\n !!previousMeta.current &&\n !!cachedActivity.current &&\n deepObjectCompare(previousMeta.current, sortedMeta)\n ) {\n return cachedActivity.current;\n }\n previousMeta.current = sortedMeta;\n\n const userActivity: Partial<UserActivity> = {};\n\n sortedMeta.forEach((child) => {\n if (\n // <meta />\n child.type === 'meta'\n ) {\n const { property, content } = child.props;\n\n switch (property) {\n case 'og:description':\n userActivity.description = content;\n break;\n // Custom properties\n case 'expo:handoff':\n userActivity.isEligibleForHandoff = isTruthy(content);\n break;\n case 'expo:spotlight':\n userActivity.isEligibleForSearch = isTruthy(content);\n break;\n }\n\n // // <meta name=\"keywords\" content=\"foo,bar,baz\" />\n // if ([\"keywords\"].includes(name)) {\n // userActivity.keywords = Array.isArray(content)\n // ? content\n // : content.split(\",\");\n // }\n }\n });\n\n cachedActivity.current = userActivity;\n return userActivity;\n }, [meta, pathname, href]);\n\n const parsedActivity: UserActivity = {\n keywords: [title],\n ...activity,\n title,\n webpageURL: url,\n activityType: ExpoHead!.activities.INDEXED_ROUTE,\n userInfo: {\n // TODO: This may need to be versioned in the future, e.g. `_v1` if we change the format.\n href,\n },\n };\n\n return parsedActivity;\n}\n\nfunction isTruthy(value: any): boolean {\n return [true, 'true'].includes(value);\n}\n\nfunction HeadNative(props: { children?: React.ReactNode }) {\n const isFocused = useIsFocused();\n if (!isFocused) {\n return <UnfocusedHead />;\n }\n return <FocusedHead {...props} />;\n}\n\nfunction UnfocusedHead(props: { children?: React.ReactNode }): JSX.Element {\n const { children } = useMetaChildren(props.children);\n return <>{children}</>;\n}\n\nfunction FocusedHead(props: { children?: React.ReactNode }): JSX.Element {\n const { metaChildren, children } = useMetaChildren(props.children);\n const activity = useActivityFromMetaChildren(metaChildren);\n useRegisterCurrentActivity(activity);\n return <>{children}</>;\n}\n\n// segments => activity\nconst activities: Map<string, UserActivity> = new Map();\n\nfunction useRegisterCurrentActivity(activity: UserActivity) {\n // ID is tied to Expo Router and agnostic of URLs to ensure dynamic parameters are not considered.\n // Using all segments ensures that cascading routes are considered.\n const activityId = urlToId(usePathname() || '/');\n const cascadingId = urlToId(useSegments().join('-') || '-');\n const activityIds = Array.from(activities.keys());\n const cascadingActivity: UserActivity = React.useMemo(() => {\n // Get all nested activities together, then update the id to match the current pathname.\n // This enables cases like `/user/[name]/post/[id]` to match all nesting, while still having a URL-specific ID, i.e. `/user/evanbacon/post/123`\n const cascadingActivity = activities.has(cascadingId)\n ? {\n ...activities.get(cascadingId),\n ...activity,\n id: activityId,\n }\n : {\n ...activity,\n id: activityId,\n };\n activities.set(cascadingId, cascadingActivity);\n\n return cascadingActivity;\n }, [cascadingId, activityId, activity, activityIds]);\n\n const previousActivity = React.useRef<UserActivity | null>(null);\n\n React.useEffect(() => {\n if (!cascadingActivity) {\n return () => {};\n }\n if (\n !!previousActivity.current &&\n deepObjectCompare(previousActivity.current, cascadingActivity)\n ) {\n return () => {};\n }\n\n previousActivity.current = cascadingActivity;\n if (!cascadingActivity.id) {\n throw new Error('Activity must have an ID');\n }\n\n // If no features are enabled, then skip registering the activity\n if (cascadingActivity.isEligibleForHandoff || cascadingActivity.isEligibleForSearch) {\n ExpoHead?.createActivity(cascadingActivity);\n }\n\n return () => {};\n }, [cascadingActivity]);\n\n React.useEffect(() => {\n return () => {\n if (activityId) {\n ExpoHead?.suspendActivity(activityId);\n }\n };\n }, [activityId]);\n}\n\nfunction deepObjectCompare(a: any, b: any) {\n if (typeof a !== typeof b) {\n return false;\n }\n if (typeof a === 'object') {\n if (Array.isArray(a) !== Array.isArray(b)) {\n return false;\n }\n if (Array.isArray(a)) {\n if (a.length !== b.length) {\n return false;\n }\n return a.every((item, index) => deepObjectCompare(item, b[index]));\n }\n // handle null\n if (a === null || b === null) {\n return a === b;\n }\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n return aKeys.every((key) => deepObjectCompare(a[key], b[key]));\n }\n return a === b;\n}\n\nHeadNative.Provider = React.Fragment;\n\nfunction HeadShim(props: React.PropsWithChildren) {\n return null;\n}\n\nHeadShim.Provider = React.Fragment;\n\n// Native Head is only enabled in bare iOS apps.\nexport const Head: ((props: React.PropsWithChildren) => React.ReactNode) & {\n Provider: React.ComponentType;\n} = ExpoHead ? HeadNative : HeadShim;\n"]}
|
package/build/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAElF,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AACtD,wBAAgB,sBAAsB,QAErC;AAED,wBAAgB,YAAY,2CAE3B;AAED,sHAAsH;AACtH,wBAAgB,iBAAiB,kGAEhC;AAED,uJAAuJ;AACvJ,wBAAgB,yBAAyB,sGAExC;AAED,wBAAgB,SAAS,IAAI,MAAM,CAgBlC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,WAAW,CACzB,SAAS,SAAS,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,KACtD,SAAS,SAAS,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,GAAG,SAAS,CAInE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,SAAS,YAAY,GAAG,mBAAmB,KAC/C,WAAW,CAAC,OAAO,CAAC,CAAC;AAC1B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,SAAS,MAAM,EACrB,OAAO,SAAS,YAAY,GAAG,mBAAmB,KAC/C,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAQlC;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,SAAS,YAAY,GAAG,mBAAmB,KAC/C,WAAW,CAAC,OAAO,CAAC,CAAC;AAC1B;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,SAAS,MAAM,EACrB,OAAO,SAAS,YAAY,GAAG,mBAAmB,KAC/C,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AA8BlC,wBAAgB,eAAe,CAAC,EAAE,MAAc,EAAE;;CAAK,GAAG,eAAe,CAsBxE"}
|
package/build/hooks.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -36,7 +37,7 @@ function useRouter() {
|
|
|
36
37
|
setParams: router_store_1.store.setParams,
|
|
37
38
|
canGoBack: router_store_1.store.canGoBack,
|
|
38
39
|
navigate: router_store_1.store.navigate,
|
|
39
|
-
|
|
40
|
+
reload: router_store_1.store.reload,
|
|
40
41
|
}), []);
|
|
41
42
|
}
|
|
42
43
|
exports.useRouter = useRouter;
|
package/build/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,mCAAkD;AAClD,8DAA0F;AAK1F,SAAgB,sBAAsB;IACpC,OAAO,IAAA,gCAAiB,GAAE,CAAC;AAC7B,CAAC;AAFD,wDAEC;AAED,SAAgB,YAAY;IAC1B,OAAO,IAAA,gCAAiB,GAAE,CAAC;AAC7B,CAAC;AAFD,oCAEC;AAED,sHAAsH;AACtH,SAAgB,iBAAiB;IAC/B,OAAO,oBAAK,CAAC,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E,OAAO,EAAE,CAAC;YAChC,IAAI,GAAG,KAAK,QAAQ;gBAAE,OAAO,EAAE,CAAC;SACjC;QAED,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,uBAAuB,CAAC,OAAO,CAAC,CAAC;AAC9C,CAAC;AAtBD,0CAsBC;AAED,MAAM,uBAAwB,SAAQ,eAAe;IACnD,GAAG;QACD,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;IACD,MAAM;QACJ,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;IACD,MAAM;QACJ,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;CACF","sourcesContent":["import React from 'react';\n\nimport { LocalRouteParamsContext } from './Route';\nimport { store, useStoreRootState, useStoreRouteInfo } from './global-state/router-store';\nimport { Router } from './imperative-api';\nimport { RouteParams, RouteSegments, Routes, UnknownOutputParams } from './types';\n\ntype SearchParams = Record<string, string | string[]>;\nexport function useRootNavigationState() {\n return useStoreRootState();\n}\n\nexport function useRouteInfo() {\n return useStoreRouteInfo();\n}\n\n/** @deprecated Use [`useNavigationContainerRef`](#usenavigationcontainerref) instead, which returns a React `ref`. */\nexport function useRootNavigation() {\n return store.navigationRef.current;\n}\n\n/** @return The root `<NavigationContainer />` ref for the app. The `ref.current` may be `null` if the `<NavigationContainer />` hasn't mounted yet. */\nexport function useNavigationContainerRef() {\n return store.navigationRef;\n}\n\nexport function useRouter(): Router {\n return React.useMemo(\n () => ({\n push: store.push,\n dismiss: store.dismiss,\n dismissAll: store.dismissAll,\n canDismiss: store.canDismiss,\n back: store.goBack,\n replace: store.replace,\n setParams: store.setParams,\n canGoBack: store.canGoBack,\n navigate: store.navigate,\n // TODO(EvanBacon): add `reload`\n }),\n []\n );\n}\n\n/**\n * @private\n * @returns The current global pathname with query params attached. This may change in the future to include the hostname from a predefined universal link. For example, `/foobar?hey=world` becomes `https://acme.dev/foobar?hey=world`.\n */\nexport function useUnstableGlobalHref(): string {\n return useStoreRouteInfo().unstable_globalHref;\n}\n\n/**\n * Get a list of selected file segments for the currently selected route. Segments are not normalized, so they will be the same as the file path. For example: `/[id]?id=normal -> [\"[id]\"]`.\n *\n * @example\n * ```tsx app/profile/[user].tsx\n * import { Text } from 'react-native';\n * import { useSegments } from 'expo-router';\n *\n * export default function Route() {\n * // segments = [\"profile\", \"[user]\"]\n * const segments = useSegments();\n *\n * return <Text>Hello</Text>;\n * }\n * ```\n *\n *\n * `useSegments` can be typed using an abstract. Consider the following file structure, and strictly typed `useSegments` function:\n *\n * ```md\n * - app\n * - [user]\n * - index.js\n * - followers.js\n * - settings.js\n * ```\n *\n *\n * This can be strictly typed using the following abstract:\n *\n * ```ts\n * const [first, second] = useSegments<['settings'] | ['[user]'] | ['[user]', 'followers']>()\n * ```\n */\nexport function useSegments<\n TSegments extends Routes | RouteSegments<Routes> = Routes,\n>(): TSegments extends string ? RouteSegments<TSegments> : TSegments {\n return useStoreRouteInfo().segments as TSegments extends string\n ? RouteSegments<TSegments>\n : TSegments;\n}\n\n/**\n * Global selected route location without search parameters. For example, `/acme?foo=bar` -> `/acme`. Segments will be normalized: `/[id]?id=normal` -> `/normal`.\n *\n * @example\n * ```tsx app/profile/[user].tsx\n * import { Text } from 'react-native';\n * import { useSegments } from 'expo-router';\n *\n * export default function Route() {\n * // segments = [\"profile\", \"[user]\"]</b>\n * const segments = useSegments();\n *\n * return <Text>Hello</Text>;\n * }\n * ```\n */\nexport function usePathname(): string {\n return useStoreRouteInfo().pathname;\n}\n\n/**\n * @hidden\n */\nexport function useGlobalSearchParams<\n TParams extends SearchParams = UnknownOutputParams,\n>(): RouteParams<TParams>;\n/**\n * Get the globally selected query parameters, including dynamic path segments. This function will update even when the route is not focused.\n * Useful for analytics or other background operations that don't draw to the screen.\n *\n * When querying search params in a stack, opt-towards using [`useLocalSearchParams`](#uselocalsearchparams) as these will only update when the route is focused.\n *\n * Route URL example: `acme://profile/baconbrix?extra=info`.\n *\n * > **Note:** See [local versus global search parameters](/router/reference/search-parameters/#local-versus-global-search-parameters) for usage\n * > information.\n *\n *\n * @example\n * ```tsx app/profile/[user].tsx\n * import { Text } from 'react-native';\n * import { useGlobalSearchParams } from 'expo-router';\n *\n * export default function Route() {\n * // user=baconbrix & extra=info\n * const { user, extra } = useGlobalSearchParams();\n * return <Text>User: {user}</Text>;\n * }\n * ```\n *\n */\nexport function useGlobalSearchParams<\n TRoute extends Routes,\n TParams extends SearchParams = UnknownOutputParams,\n>(): RouteParams<TRoute, TParams>;\nexport function useGlobalSearchParams<\n TParams1 extends SearchParams | Routes = UnknownOutputParams,\n TParams2 extends SearchParams = UnknownOutputParams,\n>(): RouteParams<TParams1, TParams2> {\n return useStoreRouteInfo().params as RouteParams<TParams1, TParams2>;\n}\n\n/**\n * @hidden\n */\nexport function useLocalSearchParams<\n TParams extends SearchParams = UnknownOutputParams,\n>(): RouteParams<TParams>;\n/**\n * Returns the URL parameters for the contextually focused route. e.g. `/acme?foo=bar` -> `{ foo: \"bar\" }`.\n * This is useful for stacks where you may push a new screen that changes the query parameters.\n * For dynamic routes, both the route parameters and the search parameters are returned.\n *\n * To observe updates even when the invoking route is not focused, use `useGlobalSearchParams()`.\n *\n * @see [`useGlobalSearchParams`](#useglobalsearchparams)\n */\nexport function useLocalSearchParams<\n TRoute extends Routes,\n TParams extends SearchParams = UnknownOutputParams,\n>(): RouteParams<TRoute, TParams>;\nexport function useLocalSearchParams<\n TParams1 extends SearchParams | Routes = UnknownOutputParams,\n TParams2 extends SearchParams = UnknownOutputParams,\n>(): RouteParams<TParams1, TParams2> {\n const params = React.useContext(LocalRouteParamsContext) ?? {};\n return Object.fromEntries(\n Object.entries(params).map(([key, value]) => {\n if (Array.isArray(value)) {\n return [\n key,\n value.map((v) => {\n try {\n return decodeURIComponent(v);\n } catch {\n return v;\n }\n }),\n ];\n } else {\n try {\n return [key, decodeURIComponent(value as string)];\n } catch {\n return [key, value];\n }\n }\n })\n ) as RouteParams<TParams1, TParams2>;\n}\n\nexport function useSearchParams({ global = false } = {}): URLSearchParams {\n const globalRef = React.useRef(global);\n if (process.env.NODE_ENV !== 'production') {\n if (global !== globalRef.current) {\n console.warn(\n `Detected change in 'global' option of useSearchParams. This value cannot change between renders`\n );\n }\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const params = global ? useGlobalSearchParams() : useLocalSearchParams();\n const entries = Object.entries(params).flatMap(([key, value]) => {\n if (global) {\n if (key === 'params') return [];\n if (key === 'screen') return [];\n }\n\n return Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]];\n });\n\n return new ReadOnlyURLSearchParams(entries);\n}\n\nclass ReadOnlyURLSearchParams extends URLSearchParams {\n set() {\n throw new Error('The URLSearchParams object return from useSearchParams is read-only');\n }\n append() {\n throw new Error('The URLSearchParams object return from useSearchParams is read-only');\n }\n delete() {\n throw new Error('The URLSearchParams object return from useSearchParams is read-only');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AAEb,kDAA0B;AAE1B,mCAAkD;AAClD,8DAA0F;AAK1F,SAAgB,sBAAsB;IACpC,OAAO,IAAA,gCAAiB,GAAE,CAAC;AAC7B,CAAC;AAFD,wDAEC;AAED,SAAgB,YAAY;IAC1B,OAAO,IAAA,gCAAiB,GAAE,CAAC;AAC7B,CAAC;AAFD,oCAEC;AAED,sHAAsH;AACtH,SAAgB,iBAAiB;IAC/B,OAAO,oBAAK,CAAC,aAAa,CAAC,OAAO,CAAC;AACrC,CAAC;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,CAAC;YAChC,IAAI,GAAG,KAAK,QAAQ;gBAAE,OAAO,EAAE,CAAC;SACjC;QAED,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,uBAAuB,CAAC,OAAO,CAAC,CAAC;AAC9C,CAAC;AAtBD,0CAsBC;AAED,MAAM,uBAAwB,SAAQ,eAAe;IACnD,GAAG;QACD,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;IACD,MAAM;QACJ,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;IACD,MAAM;QACJ,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;CACF","sourcesContent":["'use client';\n\nimport React from 'react';\n\nimport { LocalRouteParamsContext } from './Route';\nimport { store, useStoreRootState, useStoreRouteInfo } from './global-state/router-store';\nimport { Router } from './imperative-api';\nimport { RouteParams, RouteSegments, Routes, UnknownOutputParams } from './types';\n\ntype SearchParams = Record<string, string | string[]>;\nexport function useRootNavigationState() {\n return useStoreRootState();\n}\n\nexport function useRouteInfo() {\n return useStoreRouteInfo();\n}\n\n/** @deprecated Use [`useNavigationContainerRef`](#usenavigationcontainerref) instead, which returns a React `ref`. */\nexport function useRootNavigation() {\n return store.navigationRef.current;\n}\n\n/** @return The root `<NavigationContainer />` ref for the app. The `ref.current` may be `null` if the `<NavigationContainer />` hasn't mounted yet. */\nexport function useNavigationContainerRef() {\n return store.navigationRef;\n}\n\nexport function useRouter(): Router {\n return React.useMemo(\n () => ({\n push: store.push,\n dismiss: store.dismiss,\n dismissAll: store.dismissAll,\n canDismiss: store.canDismiss,\n back: store.goBack,\n replace: store.replace,\n setParams: store.setParams,\n canGoBack: store.canGoBack,\n navigate: store.navigate,\n reload: store.reload,\n }),\n []\n );\n}\n\n/**\n * @private\n * @returns The current global pathname with query params attached. This may change in the future to include the hostname from a predefined universal link. For example, `/foobar?hey=world` becomes `https://acme.dev/foobar?hey=world`.\n */\nexport function useUnstableGlobalHref(): string {\n return useStoreRouteInfo().unstable_globalHref;\n}\n\n/**\n * Get a list of selected file segments for the currently selected route. Segments are not normalized, so they will be the same as the file path. For example: `/[id]?id=normal -> [\"[id]\"]`.\n *\n * @example\n * ```tsx app/profile/[user].tsx\n * import { Text } from 'react-native';\n * import { useSegments } from 'expo-router';\n *\n * export default function Route() {\n * // segments = [\"profile\", \"[user]\"]\n * const segments = useSegments();\n *\n * return <Text>Hello</Text>;\n * }\n * ```\n *\n *\n * `useSegments` can be typed using an abstract. Consider the following file structure, and strictly typed `useSegments` function:\n *\n * ```md\n * - app\n * - [user]\n * - index.js\n * - followers.js\n * - settings.js\n * ```\n *\n *\n * This can be strictly typed using the following abstract:\n *\n * ```ts\n * const [first, second] = useSegments<['settings'] | ['[user]'] | ['[user]', 'followers']>()\n * ```\n */\nexport function useSegments<\n TSegments extends Routes | RouteSegments<Routes> = Routes,\n>(): TSegments extends string ? RouteSegments<TSegments> : TSegments {\n return useStoreRouteInfo().segments as TSegments extends string\n ? RouteSegments<TSegments>\n : TSegments;\n}\n\n/**\n * Global selected route location without search parameters. For example, `/acme?foo=bar` -> `/acme`. Segments will be normalized: `/[id]?id=normal` -> `/normal`.\n *\n * @example\n * ```tsx app/profile/[user].tsx\n * import { Text } from 'react-native';\n * import { useSegments } from 'expo-router';\n *\n * export default function Route() {\n * // segments = [\"profile\", \"[user]\"]</b>\n * const segments = useSegments();\n *\n * return <Text>Hello</Text>;\n * }\n * ```\n */\nexport function usePathname(): string {\n return useStoreRouteInfo().pathname;\n}\n\n/**\n * @hidden\n */\nexport function useGlobalSearchParams<\n TParams extends SearchParams = UnknownOutputParams,\n>(): RouteParams<TParams>;\n/**\n * Get the globally selected query parameters, including dynamic path segments. This function will update even when the route is not focused.\n * Useful for analytics or other background operations that don't draw to the screen.\n *\n * When querying search params in a stack, opt-towards using [`useLocalSearchParams`](#uselocalsearchparams) as these will only update when the route is focused.\n *\n * Route URL example: `acme://profile/baconbrix?extra=info`.\n *\n * > **Note:** See [local versus global search parameters](/router/reference/search-parameters/#local-versus-global-search-parameters) for usage\n * > information.\n *\n *\n * @example\n * ```tsx app/profile/[user].tsx\n * import { Text } from 'react-native';\n * import { useGlobalSearchParams } from 'expo-router';\n *\n * export default function Route() {\n * // user=baconbrix & extra=info\n * const { user, extra } = useGlobalSearchParams();\n * return <Text>User: {user}</Text>;\n * }\n * ```\n *\n */\nexport function useGlobalSearchParams<\n TRoute extends Routes,\n TParams extends SearchParams = UnknownOutputParams,\n>(): RouteParams<TRoute, TParams>;\nexport function useGlobalSearchParams<\n TParams1 extends SearchParams | Routes = UnknownOutputParams,\n TParams2 extends SearchParams = UnknownOutputParams,\n>(): RouteParams<TParams1, TParams2> {\n return useStoreRouteInfo().params as RouteParams<TParams1, TParams2>;\n}\n\n/**\n * @hidden\n */\nexport function useLocalSearchParams<\n TParams extends SearchParams = UnknownOutputParams,\n>(): RouteParams<TParams>;\n/**\n * Returns the URL parameters for the contextually focused route. e.g. `/acme?foo=bar` -> `{ foo: \"bar\" }`.\n * This is useful for stacks where you may push a new screen that changes the query parameters.\n * For dynamic routes, both the route parameters and the search parameters are returned.\n *\n * To observe updates even when the invoking route is not focused, use `useGlobalSearchParams()`.\n *\n * @see [`useGlobalSearchParams`](#useglobalsearchparams)\n */\nexport function useLocalSearchParams<\n TRoute extends Routes,\n TParams extends SearchParams = UnknownOutputParams,\n>(): RouteParams<TRoute, TParams>;\nexport function useLocalSearchParams<\n TParams1 extends SearchParams | Routes = UnknownOutputParams,\n TParams2 extends SearchParams = UnknownOutputParams,\n>(): RouteParams<TParams1, TParams2> {\n const params = React.useContext(LocalRouteParamsContext) ?? {};\n return Object.fromEntries(\n Object.entries(params).map(([key, value]) => {\n if (Array.isArray(value)) {\n return [\n key,\n value.map((v) => {\n try {\n return decodeURIComponent(v);\n } catch {\n return v;\n }\n }),\n ];\n } else {\n try {\n return [key, decodeURIComponent(value as string)];\n } catch {\n return [key, value];\n }\n }\n })\n ) as RouteParams<TParams1, TParams2>;\n}\n\nexport function useSearchParams({ global = false } = {}): URLSearchParams {\n const globalRef = React.useRef(global);\n if (process.env.NODE_ENV !== 'production') {\n if (global !== globalRef.current) {\n console.warn(\n `Detected change in 'global' option of useSearchParams. This value cannot change between renders`\n );\n }\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const params = global ? useGlobalSearchParams() : useLocalSearchParams();\n const entries = Object.entries(params).flatMap(([key, value]) => {\n if (global) {\n if (key === 'params') return [];\n if (key === 'screen') return [];\n }\n\n return Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]];\n });\n\n return new ReadOnlyURLSearchParams(entries);\n}\n\nclass ReadOnlyURLSearchParams extends URLSearchParams {\n set() {\n throw new Error('The URLSearchParams object return from useSearchParams is read-only');\n }\n append() {\n throw new Error('The URLSearchParams object return from useSearchParams is read-only');\n }\n delete() {\n throw new Error('The URLSearchParams object return from useSearchParams is read-only');\n }\n}\n"]}
|
|
@@ -19,6 +19,11 @@ export type Router = {
|
|
|
19
19
|
canDismiss: () => boolean;
|
|
20
20
|
/** Update the current route query params. */
|
|
21
21
|
setParams: <T extends Routes>(params: Partial<RouteParamInput<T>>) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Reload the currently mounted route in experimental server mode. This can be used to re-fetch data.
|
|
24
|
+
* @hidden
|
|
25
|
+
*/
|
|
26
|
+
reload: () => void;
|
|
22
27
|
};
|
|
23
28
|
/**
|
|
24
29
|
* @hidden
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imperative-api.d.ts","sourceRoot":"","sources":["../src/imperative-api.ts"],"names":[],"mappings":"AACA,OA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AE,MAAM,EAAE,MAAM,SAAS,CAAC;AAExD,MAAM,MAAM,MAAM,GAAG;IACnB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,qEAAqE;IACrE,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,wEAAwE;IACxE,IAAI,EAAE,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACtF,qCAAqC;IACrC,QAAQ,EAAE,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC1F,0DAA0D;IAC1D,OAAO,EAAE,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACzF,0HAA0H;IAC1H,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,wDAAwD;IACxD,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,yFAAyF;IACzF,UAAU,EAAE,MAAM,OAAO,CAAC;IAC1B,6CAA6C;IAC7C,SAAS,EAAE,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAE3E;;;OAGG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,MAWpB,CAAC"}
|
package/build/imperative-api.js
CHANGED
|
@@ -15,5 +15,6 @@ exports.router = {
|
|
|
15
15
|
back: () => router_store_1.store.goBack(),
|
|
16
16
|
canGoBack: () => router_store_1.store.canGoBack(),
|
|
17
17
|
setParams: (params) => router_store_1.store.setParams(params),
|
|
18
|
+
reload: () => router_store_1.store.reload(),
|
|
18
19
|
};
|
|
19
20
|
//# sourceMappingURL=imperative-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imperative-api.js","sourceRoot":"","sources":["../src/imperative-api.ts"],"names":[],"mappings":";;;AAAA,8DAAoD;
|
|
1
|
+
{"version":3,"file":"imperative-api.js","sourceRoot":"","sources":["../src/imperative-api.ts"],"names":[],"mappings":";;;AAAA,8DAAoD;AA+BpD;;GAEG;AACU,QAAA,MAAM,GAAW;IAC5B,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,oBAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAC1D,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,oBAAK,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC;IAClD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAK,CAAC,OAAO,CAAC,KAAK,CAAC;IACxC,UAAU,EAAE,GAAG,EAAE,CAAC,oBAAK,CAAC,UAAU,EAAE;IACpC,UAAU,EAAE,GAAG,EAAE,CAAC,oBAAK,CAAC,UAAU,EAAE;IACpC,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,oBAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;IACxD,IAAI,EAAE,GAAG,EAAE,CAAC,oBAAK,CAAC,MAAM,EAAE;IAC1B,SAAS,EAAE,GAAG,EAAE,CAAC,oBAAK,CAAC,SAAS,EAAE;IAClC,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,oBAAK,CAAC,SAAS,CAAC,MAAM,CAAC;IAC9C,MAAM,EAAE,GAAG,EAAE,CAAC,oBAAK,CAAC,MAAM,EAAE;CAC7B,CAAC","sourcesContent":["import { store } from './global-state/router-store';\nimport { NavigationOptions } from './global-state/routing';\nimport { Href, RouteParamInput, Routes } from './types';\n\nexport type Router = {\n /** Go back in the history. */\n back: () => void;\n /** If there's history that supports invoking the `back` function. */\n canGoBack: () => boolean;\n /** Navigate to the provided href using a push operation if possible. */\n push: <T extends string | object>(href: Href<T>, options?: NavigationOptions) => void;\n /** Navigate to the provided href. */\n navigate: <T extends string | object>(href: Href<T>, options?: NavigationOptions) => void;\n /** Navigate to route without appending to the history. */\n replace: <T extends string | object>(href: Href<T>, options?: NavigationOptions) => void;\n /** Navigate to a screen with a stack lower than the current screen. Using the provided count if possible, otherwise 1. */\n dismiss: (count?: number) => void;\n /** Navigate to first screen within the lowest stack. */\n dismissAll: () => void;\n /** If there's history that supports invoking the `dismiss` and `dismissAll` function. */\n canDismiss: () => boolean;\n /** Update the current route query params. */\n setParams: <T extends Routes>(params: Partial<RouteParamInput<T>>) => void;\n\n /**\n * Reload the currently mounted route in experimental server mode. This can be used to re-fetch data.\n * @hidden\n */\n reload: () => void;\n};\n\n/**\n * @hidden\n */\nexport const router: Router = {\n navigate: (href, options) => store.navigate(href, options),\n push: (href, options) => store.push(href, options),\n dismiss: (count) => store.dismiss(count),\n dismissAll: () => store.dismissAll(),\n canDismiss: () => store.canDismiss(),\n replace: (href, options) => store.replace(href, options),\n back: () => store.goBack(),\n canGoBack: () => store.canGoBack(),\n setParams: (params) => store.setParams(params),\n reload: () => store.reload(),\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../src/layouts/Stack.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../src/layouts/Stack.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAEL,6BAA6B,EAC7B,4BAA4B,EAC7B,MAAM,gCAAgC,CAAC;AAMxC,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKK,CAAC;AAExB,eAAe,KAAK,CAAC"}
|
package/build/layouts/Stack.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stack.js","sourceRoot":"","sources":["../../src/layouts/Stack.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Stack.js","sourceRoot":"","sources":["../../src/layouts/Stack.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;AAEb,iEAIwC;AAExC,2DAAwD;AAExD,MAAM,oBAAoB,GAAG,IAAA,yCAA0B,GAAE,CAAC,SAAS,CAAC;AAEvD,QAAA,KAAK,GAAG,IAAA,qCAAiB,EAKpC,oBAAoB,CAAC,CAAC;AAExB,kBAAe,aAAK,CAAC","sourcesContent":["'use client';\nimport { ParamListBase, StackNavigationState } from '@react-navigation/native';\nimport {\n createNativeStackNavigator,\n NativeStackNavigationEventMap,\n NativeStackNavigationOptions,\n} from '@react-navigation/native-stack';\n\nimport { withLayoutContext } from './withLayoutContext';\n\nconst NativeStackNavigator = createNativeStackNavigator().Navigator;\n\nexport const Stack = withLayoutContext<\n NativeStackNavigationOptions,\n typeof NativeStackNavigator,\n StackNavigationState<ParamListBase>,\n NativeStackNavigationEventMap\n>(NativeStackNavigator);\n\nexport default Stack;\n"]}
|
package/build/layouts/Tabs.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export declare const Tabs: React.ForwardRefExoticComponent<Omit<Omit<import("@re
|
|
|
18
18
|
screenListeners?: Partial<{
|
|
19
19
|
tabPress: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "tabPress", true>;
|
|
20
20
|
tabLongPress: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "tabLongPress", unknown>;
|
|
21
|
+
transitionStart: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "transitionStart", unknown>;
|
|
22
|
+
transitionEnd: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "transitionEnd", unknown>;
|
|
21
23
|
focus: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "focus", unknown>;
|
|
22
24
|
blur: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "blur", unknown>;
|
|
23
25
|
state: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "state", unknown>;
|
|
@@ -28,6 +30,8 @@ export declare const Tabs: React.ForwardRefExoticComponent<Omit<Omit<import("@re
|
|
|
28
30
|
}) => Partial<{
|
|
29
31
|
tabPress: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "tabPress", true>;
|
|
30
32
|
tabLongPress: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "tabLongPress", unknown>;
|
|
33
|
+
transitionStart: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "transitionStart", unknown>;
|
|
34
|
+
transitionEnd: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "transitionEnd", unknown>;
|
|
31
35
|
focus: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "focus", unknown>;
|
|
32
36
|
blur: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "blur", unknown>;
|
|
33
37
|
state: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "state", unknown>;
|
|
@@ -76,6 +80,8 @@ export declare const Tabs: React.ForwardRefExoticComponent<Omit<Omit<import("@re
|
|
|
76
80
|
screenListeners?: Partial<{
|
|
77
81
|
tabPress: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "tabPress", true>;
|
|
78
82
|
tabLongPress: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "tabLongPress", unknown>;
|
|
83
|
+
transitionStart: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "transitionStart", unknown>;
|
|
84
|
+
transitionEnd: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "transitionEnd", unknown>;
|
|
79
85
|
focus: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "focus", unknown>;
|
|
80
86
|
blur: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "blur", unknown>;
|
|
81
87
|
state: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "state", unknown>;
|
|
@@ -86,6 +92,8 @@ export declare const Tabs: React.ForwardRefExoticComponent<Omit<Omit<import("@re
|
|
|
86
92
|
}) => Partial<{
|
|
87
93
|
tabPress: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "tabPress", true>;
|
|
88
94
|
tabLongPress: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "tabLongPress", unknown>;
|
|
95
|
+
transitionStart: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "transitionStart", unknown>;
|
|
96
|
+
transitionEnd: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "transitionEnd", unknown>;
|
|
89
97
|
focus: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "focus", unknown>;
|
|
90
98
|
blur: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "blur", unknown>;
|
|
91
99
|
state: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "state", unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../src/layouts/Tabs.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../src/layouts/Tabs.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAE3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAKhC,KAAK,SAAS,GAAG,0BAA0B,GAAG;IAAE,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CAAE,CAAC;AAErE,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCf,CAAC;AAEH,eAAe,IAAI,CAAC"}
|
package/build/layouts/Tabs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../src/layouts/Tabs.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../src/layouts/Tabs.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AAEb,+DAIuC;AAEvC,kDAA0B;AAC1B,+CAAmD;AAEnD,2DAAwD;AACxD,uCAAoC;AAGpC,gDAAgD;AAChD,MAAM,kBAAkB,GAAG,IAAA,sCAAwB,GAAE,CAAC,SAAS,CAAC;AAInD,QAAA,IAAI,GAAG,IAAA,qCAAiB,EAKnC,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE;IAChC,oCAAoC;IACpC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QAC5B,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,UAAU,IAAI,MAAM,CAAC,OAAO,EAAE,IAAI,KAAK,SAAS,EAAE;YAC9E,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC;YAC5C,IAAI,OAAO,CAAC,YAAY,EAAE;gBACxB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;aACnE;YACD,OAAO;gBACL,GAAG,MAAM;gBACT,OAAO,EAAE;oBACP,GAAG,OAAO;oBACV,eAAe,EAAE,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe;oBAC7E,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE;wBACtB,IAAI,IAAI,IAAI,IAAI,EAAE;4BAChB,OAAO,IAAI,CAAC;yBACb;wBACD,MAAM,QAAQ,GACZ,uBAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,wBAAS,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,wBAAS,CAAC,CAAC;wBACnF,+FAA+F;wBAC/F,0EAA0E;wBAC1E,OAAO,CACL,CAAC,WAAI,CACH,IAAK,KAAa,CAAC,CACnB,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,CAAC,KAAY,CAAC,CAAC,CACjD,IAAI,CAAC,CAAC,IAAI,CAAC,CACX,OAAO,CAAC,CAAC,uBAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAC/B,QAAQ,CAAC,CAAC,QAAQ,CAAC,EACnB,CACH,CAAC;oBACJ,CAAC;iBACF;aACF,CAAC;SACH;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,kBAAe,YAAI,CAAC","sourcesContent":["'use client';\n\nimport {\n BottomTabNavigationEventMap,\n BottomTabNavigationOptions,\n createBottomTabNavigator,\n} from '@react-navigation/bottom-tabs';\nimport { ParamListBase, TabNavigationState } from '@react-navigation/native';\nimport React from 'react';\nimport { Pressable, Platform } from 'react-native';\n\nimport { withLayoutContext } from './withLayoutContext';\nimport { Link } from '../link/Link';\nimport { Href } from '../types';\n\n// This is the only way to access the navigator.\nconst BottomTabNavigator = createBottomTabNavigator().Navigator;\n\ntype TabsProps = BottomTabNavigationOptions & { href?: Href | null };\n\nexport const Tabs = withLayoutContext<\n TabsProps,\n typeof BottomTabNavigator,\n TabNavigationState<ParamListBase>,\n BottomTabNavigationEventMap\n>(BottomTabNavigator, (screens) => {\n // Support the `href` shortcut prop.\n return screens.map((screen) => {\n if (typeof screen.options !== 'function' && screen.options?.href !== undefined) {\n const { href, ...options } = screen.options;\n if (options.tabBarButton) {\n throw new Error('Cannot use `href` and `tabBarButton` together.');\n }\n return {\n ...screen,\n options: {\n ...options,\n tabBarItemStyle: href == null ? { display: 'none' } : options.tabBarItemStyle,\n tabBarButton: (props) => {\n if (href == null) {\n return null;\n }\n const children =\n Platform.OS === 'web' ? props.children : <Pressable>{props.children}</Pressable>;\n // TODO: React Navigation types these props as Animated.WithAnimatedValue<StyleProp<ViewStyle>>\n // While Link expects a TextStyle. We need to reconcile these types.\n return (\n <Link\n {...(props as any)}\n style={[{ display: 'flex' }, props.style as any]}\n href={href}\n asChild={Platform.OS !== 'web'}\n children={children}\n />\n );\n },\n },\n };\n }\n return screen;\n });\n});\n\nexport default Tabs;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventMapBase, NavigationState } from '@react-navigation/native';
|
|
2
|
-
import {
|
|
2
|
+
import React, { ComponentType, ReactNode } from 'react';
|
|
3
3
|
import { PickPartial } from '../types';
|
|
4
4
|
import { ScreenProps } from '../useScreens';
|
|
5
5
|
export declare function useFilterScreenChildren(children: ReactNode, { isCustomNavigator, contextKey, }?: {
|
|
@@ -11,7 +11,7 @@ export declare function useFilterScreenChildren(children: ReactNode, { isCustomN
|
|
|
11
11
|
children: any[];
|
|
12
12
|
};
|
|
13
13
|
/** Return a navigator that automatically injects matched routes and renders nothing when there are no children. Return type with children prop optional */
|
|
14
|
-
export declare function withLayoutContext<TOptions extends object, T extends ComponentType<any>, TState extends NavigationState, TEventMap extends EventMapBase>(Nav: T, processor?: (options: ScreenProps<TOptions, TState, TEventMap>[]) => ScreenProps<TOptions, TState, TEventMap>[]): ForwardRefExoticComponent<PropsWithoutRef<PickPartial<ComponentProps<T>,
|
|
14
|
+
export declare function withLayoutContext<TOptions extends object, T extends ComponentType<any>, TState extends NavigationState, TEventMap extends EventMapBase>(Nav: T, processor?: (options: ScreenProps<TOptions, TState, TEventMap>[]) => ScreenProps<TOptions, TState, TEventMap>[]): React.ForwardRefExoticComponent<React.PropsWithoutRef<PickPartial<React.ComponentProps<T>, "children">> & React.RefAttributes<unknown>> & {
|
|
15
15
|
Screen: (props: ScreenProps<TOptions, TState, TEventMap>) => null;
|
|
16
16
|
};
|
|
17
17
|
//# sourceMappingURL=withLayoutContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withLayoutContext.d.ts","sourceRoot":"","sources":["../../src/layouts/withLayoutContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACzE,
|
|
1
|
+
{"version":3,"file":"withLayoutContext.d.ts","sourceRoot":"","sources":["../../src/layouts/withLayoutContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,KAAK,EAAE,EAIZ,aAAa,EAGb,SAAS,EAIV,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAoB,WAAW,EAAE,MAAM,eAAe,CAAC;AAG9D,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,SAAS,EACnB,EACE,iBAAiB,EACjB,UAAU,GACX,GAAE;IACD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;CAChB;;;EA4CP;AAED,2JAA2J;AAC3J,wBAAgB,iBAAiB,CAC/B,QAAQ,SAAS,MAAM,EACvB,CAAC,SAAS,aAAa,CAAC,GAAG,CAAC,EAC5B,MAAM,SAAS,eAAe,EAC9B,SAAS,SAAS,YAAY,EAE9B,GAAG,EAAE,CAAC,EACN,SAAS,CAAC,EAAE,CACV,OAAO,EAAE,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAChD,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE;oBA2B7B,YAAY,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,KAAK,IAAI;EAEpE"}
|
|
@@ -69,7 +69,7 @@ function useFilterScreenChildren(children, { isCustomNavigator, contextKey, } =
|
|
|
69
69
|
exports.useFilterScreenChildren = useFilterScreenChildren;
|
|
70
70
|
/** Return a navigator that automatically injects matched routes and renders nothing when there are no children. Return type with children prop optional */
|
|
71
71
|
function withLayoutContext(Nav, processor) {
|
|
72
|
-
|
|
72
|
+
return Object.assign((0, react_1.forwardRef)(({ children: userDefinedChildren, ...props }, ref) => {
|
|
73
73
|
const contextKey = (0, Route_1.useContextKey)();
|
|
74
74
|
const { screens } = useFilterScreenChildren(userDefinedChildren, {
|
|
75
75
|
contextKey,
|
|
@@ -80,13 +80,10 @@ function withLayoutContext(Nav, processor) {
|
|
|
80
80
|
if (!sorted.length) {
|
|
81
81
|
return null;
|
|
82
82
|
}
|
|
83
|
-
// @ts-expect-error
|
|
84
83
|
return <Nav {...props} id={contextKey} ref={ref} children={sorted}/>;
|
|
84
|
+
}), {
|
|
85
|
+
Screen: Screen_1.Screen,
|
|
85
86
|
});
|
|
86
|
-
// @ts-expect-error
|
|
87
|
-
Navigator.Screen = Screen_1.Screen;
|
|
88
|
-
// @ts-expect-error
|
|
89
|
-
return Navigator;
|
|
90
87
|
}
|
|
91
88
|
exports.withLayoutContext = withLayoutContext;
|
|
92
89
|
//# sourceMappingURL=withLayoutContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withLayoutContext.js","sourceRoot":"","sources":["../../src/layouts/withLayoutContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;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CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAEjE,MAAM,MAAM,GAAG,IAAA,6BAAgB,EAAC,SAAS,IAAI,EAAE,CAAC,CAAC;QAEjD,uDAAuD;QACvD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAClB,OAAO,IAAI,CAAC;SACb;QAED,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAG,CAAC;IACxE,CAAC,CAAC,EACF;QACE,MAAM,EAAN,eAAM;KACP,CAKF,CAAC;AACJ,CAAC;AAtCD,8CAsCC","sourcesContent":["import { EventMapBase, NavigationState } from '@react-navigation/native';\nimport React, {\n Children,\n forwardRef,\n ComponentProps,\n ComponentType,\n ForwardRefExoticComponent,\n PropsWithoutRef,\n ReactNode,\n RefAttributes,\n isValidElement,\n useMemo,\n} from 'react';\n\nimport { useContextKey } from '../Route';\nimport { PickPartial } from '../types';\nimport { useSortedScreens, ScreenProps } from '../useScreens';\nimport { Screen } from '../views/Screen';\n\nexport function useFilterScreenChildren(\n children: ReactNode,\n {\n isCustomNavigator,\n contextKey,\n }: {\n isCustomNavigator?: boolean;\n /** Used for sending developer hints */\n contextKey?: string;\n } = {}\n) {\n return useMemo(() => {\n const customChildren: any[] = [];\n const screens = Children.map(children, (child) => {\n if (isValidElement(child) && child && child.type === Screen) {\n if (!child.props.name) {\n throw new Error(\n `<Screen /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must have a \\`name\\` prop when used as a child of a Layout Route.`\n );\n }\n if (process.env.NODE_ENV !== 'production') {\n if (['children', 'component', 'getComponent'].some((key) => key in child.props)) {\n throw new Error(\n `<Screen /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must not have a \\`children\\`, \\`component\\`, or \\`getComponent\\` prop when used as a child of a Layout Route`\n );\n }\n }\n return child.props;\n } else {\n if (isCustomNavigator) {\n customChildren.push(child);\n } else {\n console.warn(\n `Layout children must be of type Screen, all other children are ignored. To use custom children, create a custom <Layout />. Update Layout Route at: \"app${contextKey}/_layout\"`\n );\n }\n }\n });\n\n // Add an assertion for development\n if (process.env.NODE_ENV !== 'production') {\n // Assert if names are not unique\n const names = screens?.map((screen) => screen.name);\n if (names && new Set(names).size !== names.length) {\n throw new Error('Screen names must be unique: ' + names);\n }\n }\n\n return {\n screens,\n children: customChildren,\n };\n }, [children]);\n}\n\n/** Return a navigator that automatically injects matched routes and renders nothing when there are no children. Return type with children prop optional */\nexport function withLayoutContext<\n TOptions extends object,\n T extends ComponentType<any>,\n TState extends NavigationState,\n TEventMap extends EventMapBase,\n>(\n Nav: T,\n processor?: (\n options: ScreenProps<TOptions, TState, TEventMap>[]\n ) => ScreenProps<TOptions, TState, TEventMap>[]\n) {\n return Object.assign(\n forwardRef(({ children: userDefinedChildren, ...props }: any, ref) => {\n const contextKey = useContextKey();\n\n const { screens } = useFilterScreenChildren(userDefinedChildren, {\n contextKey,\n });\n\n const processed = processor ? processor(screens ?? []) : screens;\n\n const sorted = useSortedScreens(processed ?? []);\n\n // Prevent throwing an error when there are no screens.\n if (!sorted.length) {\n return null;\n }\n\n return <Nav {...props} id={contextKey} ref={ref} children={sorted} />;\n }),\n {\n Screen,\n }\n ) as ForwardRefExoticComponent<\n PropsWithoutRef<PickPartial<ComponentProps<T>, 'children'>> & RefAttributes<unknown>\n > & {\n Screen: (props: ScreenProps<TOptions, TState, TEventMap>) => null;\n };\n}\n"]}
|
package/build/link/Link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAiD,MAAM,OAAO,CAAC;AAOzF,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAqC,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE9F,MAAM,WAAW,aAAa;IAC5B,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC;IACjF,4DAA4D;IAC5D,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC;CACrC;AAED,iEAAiE;AACjE,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,QAUhD;AAED;;;GAGG;AACH,eAAO,MAAM,IAAI,eAAyD,CAAC;AAuE3E,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC"}
|
package/build/link/Link.js
CHANGED
package/build/link/Link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AACb,wFAAwF;AACxF,mCAAmC;AACnC,iCAAyF;AACzF,+CAAqE;AAErE,yCAAkC;AAClC,iCAAqC;AACrC,8EAAsD;AACtD,oCAAqC;AAErC,sDAAmD;AACnD,iDAA8F;AAQ9F,iEAAiE;AACjE,SAAgB,QAAQ,CAAC,EAAE,IAAI,EAAkB;IAC/C,MAAM,MAAM,GAAG,IAAA,iBAAS,GAAE,CAAC;IAC3B,IAAA,+BAAc,EAAC,GAAG,EAAE;QAClB,IAAI;YACF,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SACtB;QAAC,OAAO,KAAK,EAAE;YACd,OA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,CAAC,CAAC,CAAC;SACnB;QACD,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,eAAI,CAAC,CAAC,CAAC,mBAAI,CAAC;IAEtC,6HAA6H;IAC7H,OAAO,CACL,CAAC,OAAO,CACN,GAAG,CAAC,CAAC,GAAG,CAAC,CACT,IAAI,KAAK,CAAC,CACV,IAAI,SAAS,CAAC,CACd,IAAI,IAAI,CAAC,CACT,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,IAAI,uBAAQ,CAAC,MAAM,CAAC;QAClB,GAAG,EAAE;YACH,OAAO,EAAE,OAAO;SACV;QACR,OAAO,EAAE,EAAE,OAAO,EAAE;KACrB,CAAC,CAAC,EACH,CACH,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n// Fork of @react-navigation/native Link.tsx with `href` and `replace` support added and\n// `to` / `action` support removed.\nimport { PropsWithChildren, forwardRef, useMemo, MouseEvent, ForwardedRef } from 'react';\nimport { Text, GestureResponderEvent, Platform } from 'react-native';\n\nimport { Slot } from './LinkSlot';\nimport { resolveHref } from './href';\nimport useLinkToPathProps from './useLinkToPathProps';\nimport { useRouter } from '../hooks';\nimport { Href } from '../types';\nimport { useFocusEffect } from '../useFocusEffect';\nimport { useInteropClassName, useHrefAttrs, LinkProps, WebAnchorProps } from './useLinkHooks';\n\nexport interface LinkComponent {\n <T extends string | object>(props: PropsWithChildren<LinkProps<T>>): JSX.Element;\n /** Helper method to resolve a Href object into a string. */\n resolveHref: (href: Href) => string;\n}\n\n/** Redirects to the href as soon as the component is mounted. */\nexport function Redirect({ href }: { href: Href }) {\n const router = useRouter();\n useFocusEffect(() => {\n try {\n router.replace(href);\n } catch (error) {\n console.error(error);\n }\n });\n return null;\n}\n\n/**\n * Component to render link to another route using a path.\n * Uses an anchor tag on the web.\n */\nexport const Link = forwardRef(ExpoRouterLink) as unknown as LinkComponent;\n\nLink.resolveHref = resolveHref;\n\nfunction ExpoRouterLink(\n {\n href,\n replace,\n push,\n // TODO: This does not prevent default on the anchor tag.\n relativeToDirectory,\n asChild,\n rel,\n target,\n download,\n withAnchor,\n ...rest\n }: LinkProps<any>,\n ref: ForwardedRef<Text>\n) {\n // Mutate the style prop to add the className on web.\n const style = useInteropClassName(rest);\n\n // If not passing asChild, we need to forward the props to the anchor tag using React Native Web's `hrefAttrs`.\n const hrefAttrs = useHrefAttrs({ asChild, rel, target, download });\n\n const resolvedHref = useMemo(() => {\n if (href == null) {\n throw new Error('Link: href is required');\n }\n return resolveHref(href);\n }, [href]);\n\n let event;\n if (push) event = 'PUSH';\n if (replace) event = 'REPLACE';\n\n const props = useLinkToPathProps({\n href: resolvedHref,\n event,\n relativeToDirectory,\n withAnchor,\n });\n\n const onPress = (e: MouseEvent<HTMLAnchorElement> | GestureResponderEvent) => {\n if ('onPress' in rest) {\n rest.onPress?.(e);\n }\n props.onPress(e);\n };\n\n const Element = asChild ? Slot : Text;\n\n // Avoid using createElement directly, favoring JSX, to allow tools like NativeWind to perform custom JSX handling on native.\n return (\n <Element\n ref={ref}\n {...props}\n {...hrefAttrs}\n {...rest}\n style={style}\n {...Platform.select({\n web: {\n onClick: onPress,\n } as any,\n default: { onPress },\n })}\n />\n );\n}\n\nexport { LinkProps, WebAnchorProps };\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RouterStore } from '../global-state/router-store';
|
|
2
|
+
import type { LinkToOptions } from '../global-state/routing';
|
|
3
|
+
export declare function emitDomSetParams(params?: Record<string, string | number | (string | number)[]>): boolean;
|
|
4
|
+
export declare function emitDomDismiss(count?: number): boolean;
|
|
5
|
+
export declare function emitDomGoBack(): boolean;
|
|
6
|
+
export declare function emitDomDismissAll(): boolean;
|
|
7
|
+
export declare function emitDomLinkEvent(href: string, options: LinkToOptions): boolean;
|
|
8
|
+
export declare function useDomComponentNavigation(store: RouterStore): void;
|
|
9
|
+
//# sourceMappingURL=useDomComponentNavigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDomComponentNavigation.d.ts","sourceRoot":"","sources":["../../src/link/useDomComponentNavigation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAiB7D,wBAAgB,gBAAgB,CAC9B,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAM,WAGnE;AAED,wBAAgB,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,WAE5C;AAED,wBAAgB,aAAa,YAE5B;AAED,wBAAgB,iBAAiB,YAEhC;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,WAEpE;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,WAAW,QAyB3D"}
|