expo-router 5.0.4 → 5.0.5

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.
Files changed (43) hide show
  1. package/build/Route.d.ts.map +1 -1
  2. package/build/Route.js +1 -1
  3. package/build/Route.js.map +1 -1
  4. package/build/fork/native-stack/NativeStackView.d.ts.map +1 -1
  5. package/build/fork/native-stack/NativeStackView.js +1 -1
  6. package/build/fork/native-stack/NativeStackView.js.map +1 -1
  7. package/build/fork/useLinking.js +1 -1
  8. package/build/fork/useLinking.js.map +1 -1
  9. package/build/global-state/routeInfo.d.ts.map +1 -1
  10. package/build/global-state/routeInfo.js +9 -3
  11. package/build/global-state/routeInfo.js.map +1 -1
  12. package/build/global-state/router-store.d.ts +2 -4
  13. package/build/global-state/router-store.d.ts.map +1 -1
  14. package/build/global-state/router-store.js +38 -17
  15. package/build/global-state/router-store.js.map +1 -1
  16. package/build/global-state/storeContext.d.ts +2 -4
  17. package/build/global-state/storeContext.d.ts.map +1 -1
  18. package/build/hooks.js +1 -1
  19. package/build/hooks.js.map +1 -1
  20. package/build/layouts/RootModal.js +1 -1
  21. package/build/layouts/RootModal.js.map +1 -1
  22. package/build/layouts/withLayoutContext.d.ts.map +1 -1
  23. package/build/layouts/withLayoutContext.js +1 -0
  24. package/build/layouts/withLayoutContext.js.map +1 -1
  25. package/build/rsc/router/client.js +2 -2
  26. package/build/rsc/router/client.js.map +1 -1
  27. package/build/testing-library/index.d.ts +0 -11
  28. package/build/testing-library/index.d.ts.map +1 -1
  29. package/build/testing-library/index.js.map +1 -1
  30. package/build/ui/TabTrigger.d.ts.map +1 -1
  31. package/build/ui/TabTrigger.js +1 -1
  32. package/build/ui/TabTrigger.js.map +1 -1
  33. package/build/ui/Tabs.d.ts.map +1 -1
  34. package/build/ui/Tabs.js +2 -2
  35. package/build/ui/Tabs.js.map +1 -1
  36. package/build/views/ErrorBoundary.js +1 -1
  37. package/build/views/ErrorBoundary.js.map +1 -1
  38. package/build/views/Navigator.js +2 -2
  39. package/build/views/Navigator.js.map +1 -1
  40. package/build/views/Toast.js +1 -1
  41. package/build/views/Toast.js.map +1 -1
  42. package/package.json +3 -3
  43. package/types/expect.d.ts +10 -0
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;AA4Bb,wDAIC;AAMD,8CAEC;AAMD,8DAEC;AAoBD,8BAEC;AAOD,sDAEC;AA2CD,kCAEC;AAmBD,kCAEC;AA4CD,sDAEC;AAyCD,oDAwBC;AAED,0CAsBC;AAtRD,qDAAyE;AACzE,kDAA0B;AAE1B,mCAAkD;AAClD,2CAAiD;AACjD,8DAAkE;AAIzD,6FAJO,2BAAY,OAIP;AAHrB,qDAAkD;AAKlD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,sBAAsB;IACpC,OAAO,IAAA,sBAAa,GAAyC;SAC1D,SAAS,CAAC,8BAAkB,CAAE;SAC9B,QAAQ,EAAE,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAgB,iBAAiB;IAC/B,OAAO,oBAAK,CAAC,aAAa,CAAC,OAAO,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,SAAgB,yBAAyB;IACvC,OAAO,oBAAK,CAAC,aAAa,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,SAAS;IACvB,OAAO,uBAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB;IACnC,OAAO,IAAA,2BAAY,GAAE,CAAC,mBAAmB,CAAC;AAC5C,CAAC;AA2CD,SAAgB,WAAW;IACzB,OAAO,IAAA,2BAAY,GAAE,CAAC,QAAQ,CAAC;AACjC,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,WAAW;IACzB,OAAO,IAAA,2BAAY,GAAE,CAAC,QAAQ,CAAC;AACjC,CAAC;AA4CD,SAAg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AAM,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC,oBAAoB,EAAE,CAAC;IACzE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC9D,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,GAAG,KAAK,QAAQ;gBAAE,OAAO,EAAE,CAAC;YAChC,IAAI,GAAG,KAAK,QAAQ;gBAAE,OAAO,EAAE,CAAC;QAClC,CAAC;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;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 { NavigationProp, useNavigation } from '@react-navigation/native';\nimport React from 'react';\n\nimport { LocalRouteParamsContext } from './Route';\nimport { INTERNAL_SLOT_NAME } from './constants';\nimport { store, useRouteInfo } from './global-state/router-store';\nimport { router, Router } from './imperative-api';\nimport { RouteParams, RouteSegments, UnknownOutputParams, Route } from './types';\n\nexport { useRouteInfo };\n\n/**\n * Returns the [navigation state](https://reactnavigation.org/docs/navigation-state/)\n * of the navigator which contains the current screen.\n *\n * @example\n * ```tsx\n * import { useRootNavigationState } from 'expo-router';\n *\n * export default function Route() {\n * const { routes } = useRootNavigationState();\n *\n * return <Text>{routes[0].name}</Text>;\n * }\n * ```\n */\nexport function useRootNavigationState() {\n return useNavigation<NavigationProp<object, never, string>>()\n .getParent(INTERNAL_SLOT_NAME)!\n .getState();\n}\n\n/**\n * @deprecated Use [`useNavigationContainerRef`](#usenavigationcontainerref) instead,\n * which returns a React `ref`.\n */\nexport function useRootNavigation() {\n return store.navigationRef.current;\n}\n\n/**\n * @return The root `<NavigationContainer />` ref for the app. The `ref.current` may be `null`\n * if the `<NavigationContainer />` hasn't mounted yet.\n */\nexport function useNavigationContainerRef() {\n return store.navigationRef;\n}\n\n/**\n *\n * Returns the [Router](#router) object for imperative navigation.\n *\n * @example\n *```tsx\n * import { useRouter } from 'expo-router';\n * import { Text } from 'react-native';\n *\n * export default function Route() {\n * const router = useRouter();\n *\n * return (\n * <Text onPress={() => router.push('/home')}>Go Home</Text>\n * );\n *}\n * ```\n */\nexport function useRouter(): Router {\n return router;\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\n * from a predefined universal link. For example, `/foobar?hey=world` becomes `https://acme.dev/foobar?hey=world`.\n */\nexport function useUnstableGlobalHref(): string {\n return useRouteInfo().unstable_globalHref;\n}\n\n/**\n * Returns a list of selected file segments for the currently selected route. Segments are not normalized,\n * so they will be the same as the file path. For example, `/[id]?id=normal` becomes `[\"[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:\n *\n * ```md\n * - app\n * - [user]\n * - index.tsx\n * - followers.tsx\n * - settings.tsx\n * ```\n *\n *\n * This can be strictly typed using the following abstract with `useSegments` hook:\n *\n * ```tsx\n * const [first, second] = useSegments<['settings'] | ['[user]'] | ['[user]', 'followers']>()\n * ```\n */\nexport function useSegments<TSegments extends Route = Route>(): RouteSegments<TSegments>;\n\n/**\n * @hidden\n */\nexport function useSegments<TSegments extends RouteSegments<Route>>(): TSegments;\nexport function useSegments() {\n return useRouteInfo().segments;\n}\n\n/**\n * Returns the currently selected route location without search parameters. For example, `/acme?foo=bar` returns `/acme`.\n * Segments will be normalized. For example, `/[id]?id=normal` becomes `/normal`.\n *\n * @example\n * ```tsx app/profile/[user].tsx\n * import { Text } from 'react-native';\n * import { usePathname } from 'expo-router';\n *\n * export default function Route() {\n * // pathname = \"/profile/baconbrix\"\n * const pathname = usePathname();\n *\n * return <Text>User: {user}</Text>;\n * }\n * ```\n */\nexport function usePathname(): string {\n return useRouteInfo().pathname;\n}\n\n/**\n * @hidden\n */\nexport function useGlobalSearchParams<\n TParams extends UnknownOutputParams = UnknownOutputParams,\n>(): TParams;\n\n/**\n * @hidden\n */\nexport function useGlobalSearchParams<TRoute extends Route>(): RouteParams<TRoute>;\n\n/**\n * Returns URL parameters for globally selected route, including dynamic path segments.\n * This function updates even when the route is not focused. Useful for analytics or\n * other background operations that don't draw to the screen.\n *\n * Route URL example: `acme://profile/baconbrix?extra=info`.\n *\n * When querying search params in a stack, opt-towards using\n * [`useLocalSearchParams`](#uselocalsearchparams) because it will only update when the route is focused.\n *\n * > **Note:** For usage information, see\n * [Local versus global search parameters](/router/reference/url-parameters/#local-versus-global-url-parameters).\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 *\n * return <Text>User: {user}</Text>;\n * }\n * ```\n */\nexport function useGlobalSearchParams<\n TRoute extends Route,\n TParams extends UnknownOutputParams = UnknownOutputParams,\n>(): RouteParams<TRoute> & TParams;\nexport function useGlobalSearchParams() {\n return useRouteInfo().params;\n}\n\n/**\n * @hidden\n */\nexport function useLocalSearchParams<\n TParams extends UnknownOutputParams = UnknownOutputParams,\n>(): TParams;\n\n/**\n * @hidden\n */\nexport function useLocalSearchParams<TRoute extends Route>(): RouteParams<TRoute>;\n\n/**\n * Returns the URL parameters for the contextually focused route. Useful for stacks where you may push a new screen\n * that changes the query parameters. For dynamic routes, both the route parameters and the search parameters are returned.\n *\n * Route URL example: `acme://profile/baconbrix?extra=info`.\n *\n * To observe updates even when the invoking route is not focused, use [`useGlobalSearchParams`](#useglobalsearchparams).\n *\n * > **Note:** For usage information, see\n * [Local versus global search parameters](/router/reference/url-parameters/#local-versus-global-url-parameters).\n *\n * @example\n * ```tsx app/profile/[user].tsx\n * import { Text } from 'react-native';\n * import { useLocalSearchParams } from 'expo-router';\n *\n * export default function Route() {\n * // user=baconbrix & extra=info\n * const { user, extra } = useLocalSearchParams();\n *\n * return <Text>User: {user}</Text>;\n * }\n */\nexport function useLocalSearchParams<\n TRoute extends Route,\n TParams extends UnknownOutputParams = UnknownOutputParams,\n>(): RouteParams<TRoute> & TParams;\nexport function useLocalSearchParams() {\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 any;\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;;;;;;AA4Bb,wDAIC;AAMD,8CAEC;AAMD,8DAEC;AAoBD,8BAEC;AAOD,sDAEC;AA2CD,kCAEC;AAmBD,kCAEC;AA4CD,sDAEC;AAyCD,oDAwBC;AAED,0CAsBC;AAtRD,qDAAyE;AACzE,kDAA0B;AAE1B,mCAAkD;AAClD,2CAAiD;AACjD,8DAAkE;AAIzD,6FAJO,2BAAY,OAIP;AAHrB,qDAAkD;AAKlD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,sBAAsB;IACpC,OAAO,IAAA,sBAAa,GAAyC;SAC1D,SAAS,CAAC,8BAAkB,CAAE;SAC9B,QAAQ,EAAE,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAgB,iBAAiB;IAC/B,OAAO,oBAAK,CAAC,aAAa,CAAC,OAAO,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,SAAgB,yBAAyB;IACvC,OAAO,oBAAK,CAAC,aAAa,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,SAAS;IACvB,OAAO,uBAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB;IACnC,OAAO,IAAA,2BAAY,GAAE,CAAC,mBAAmB,CAAC;AAC5C,CAAC;AA2CD,SAAgB,WAAW;IACzB,OAAO,IAAA,2BAAY,GAAE,CAAC,QAAQ,CAAC;AACjC,CAAC;AAED;;;;;;;;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jC,OAAO,CAAC,IAAI,CACV,iGAAiG,CAClG,CAAC;QACJ,CAAC;IACH,CAAC;IAED,sDAAsD;IACtD,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC,oBAAoB,EAAE,CAAC;IACzE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC9D,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,GAAG,KAAK,QAAQ;gBAAE,OAAO,EAAE,CAAC;YAChC,IAAI,GAAG,KAAK,QAAQ;gBAAE,OAAO,EAAE,CAAC;QAClC,CAAC;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;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 { NavigationProp, useNavigation } from '@react-navigation/native';\nimport React from 'react';\n\nimport { LocalRouteParamsContext } from './Route';\nimport { INTERNAL_SLOT_NAME } from './constants';\nimport { store, useRouteInfo } from './global-state/router-store';\nimport { router, Router } from './imperative-api';\nimport { RouteParams, RouteSegments, UnknownOutputParams, Route } from './types';\n\nexport { useRouteInfo };\n\n/**\n * Returns the [navigation state](https://reactnavigation.org/docs/navigation-state/)\n * of the navigator which contains the current screen.\n *\n * @example\n * ```tsx\n * import { useRootNavigationState } from 'expo-router';\n *\n * export default function Route() {\n * const { routes } = useRootNavigationState();\n *\n * return <Text>{routes[0].name}</Text>;\n * }\n * ```\n */\nexport function useRootNavigationState() {\n return useNavigation<NavigationProp<object, never, string>>()\n .getParent(INTERNAL_SLOT_NAME)!\n .getState();\n}\n\n/**\n * @deprecated Use [`useNavigationContainerRef`](#usenavigationcontainerref) instead,\n * which returns a React `ref`.\n */\nexport function useRootNavigation() {\n return store.navigationRef.current;\n}\n\n/**\n * @return The root `<NavigationContainer />` ref for the app. The `ref.current` may be `null`\n * if the `<NavigationContainer />` hasn't mounted yet.\n */\nexport function useNavigationContainerRef() {\n return store.navigationRef;\n}\n\n/**\n *\n * Returns the [Router](#router) object for imperative navigation.\n *\n * @example\n *```tsx\n * import { useRouter } from 'expo-router';\n * import { Text } from 'react-native';\n *\n * export default function Route() {\n * const router = useRouter();\n *\n * return (\n * <Text onPress={() => router.push('/home')}>Go Home</Text>\n * );\n *}\n * ```\n */\nexport function useRouter(): Router {\n return router;\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\n * from a predefined universal link. For example, `/foobar?hey=world` becomes `https://acme.dev/foobar?hey=world`.\n */\nexport function useUnstableGlobalHref(): string {\n return useRouteInfo().unstable_globalHref;\n}\n\n/**\n * Returns a list of selected file segments for the currently selected route. Segments are not normalized,\n * so they will be the same as the file path. For example, `/[id]?id=normal` becomes `[\"[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:\n *\n * ```md\n * - app\n * - [user]\n * - index.tsx\n * - followers.tsx\n * - settings.tsx\n * ```\n *\n *\n * This can be strictly typed using the following abstract with `useSegments` hook:\n *\n * ```tsx\n * const [first, second] = useSegments<['settings'] | ['[user]'] | ['[user]', 'followers']>()\n * ```\n */\nexport function useSegments<TSegments extends Route = Route>(): RouteSegments<TSegments>;\n\n/**\n * @hidden\n */\nexport function useSegments<TSegments extends RouteSegments<Route>>(): TSegments;\nexport function useSegments() {\n return useRouteInfo().segments;\n}\n\n/**\n * Returns the currently selected route location without search parameters. For example, `/acme?foo=bar` returns `/acme`.\n * Segments will be normalized. For example, `/[id]?id=normal` becomes `/normal`.\n *\n * @example\n * ```tsx app/profile/[user].tsx\n * import { Text } from 'react-native';\n * import { usePathname } from 'expo-router';\n *\n * export default function Route() {\n * // pathname = \"/profile/baconbrix\"\n * const pathname = usePathname();\n *\n * return <Text>User: {user}</Text>;\n * }\n * ```\n */\nexport function usePathname(): string {\n return useRouteInfo().pathname;\n}\n\n/**\n * @hidden\n */\nexport function useGlobalSearchParams<\n TParams extends UnknownOutputParams = UnknownOutputParams,\n>(): TParams;\n\n/**\n * @hidden\n */\nexport function useGlobalSearchParams<TRoute extends Route>(): RouteParams<TRoute>;\n\n/**\n * Returns URL parameters for globally selected route, including dynamic path segments.\n * This function updates even when the route is not focused. Useful for analytics or\n * other background operations that don't draw to the screen.\n *\n * Route URL example: `acme://profile/baconbrix?extra=info`.\n *\n * When querying search params in a stack, opt-towards using\n * [`useLocalSearchParams`](#uselocalsearchparams) because it will only update when the route is focused.\n *\n * > **Note:** For usage information, see\n * [Local versus global search parameters](/router/reference/url-parameters/#local-versus-global-url-parameters).\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 *\n * return <Text>User: {user}</Text>;\n * }\n * ```\n */\nexport function useGlobalSearchParams<\n TRoute extends Route,\n TParams extends UnknownOutputParams = UnknownOutputParams,\n>(): RouteParams<TRoute> & TParams;\nexport function useGlobalSearchParams() {\n return useRouteInfo().params;\n}\n\n/**\n * @hidden\n */\nexport function useLocalSearchParams<\n TParams extends UnknownOutputParams = UnknownOutputParams,\n>(): TParams;\n\n/**\n * @hidden\n */\nexport function useLocalSearchParams<TRoute extends Route>(): RouteParams<TRoute>;\n\n/**\n * Returns the URL parameters for the contextually focused route. Useful for stacks where you may push a new screen\n * that changes the query parameters. For dynamic routes, both the route parameters and the search parameters are returned.\n *\n * Route URL example: `acme://profile/baconbrix?extra=info`.\n *\n * To observe updates even when the invoking route is not focused, use [`useGlobalSearchParams`](#useglobalsearchparams).\n *\n * > **Note:** For usage information, see\n * [Local versus global search parameters](/router/reference/url-parameters/#local-versus-global-url-parameters).\n *\n * @example\n * ```tsx app/profile/[user].tsx\n * import { Text } from 'react-native';\n * import { useLocalSearchParams } from 'expo-router';\n *\n * export default function Route() {\n * // user=baconbrix & extra=info\n * const { user, extra } = useLocalSearchParams();\n *\n * return <Text>User: {user}</Text>;\n * }\n */\nexport function useLocalSearchParams<\n TRoute extends Route,\n TParams extends UnknownOutputParams = UnknownOutputParams,\n>(): RouteParams<TRoute> & TParams;\nexport function useLocalSearchParams() {\n const params = React.use(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 any;\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"]}
@@ -10,7 +10,7 @@ exports.RootModalContext = (0, react_1.createContext)({
10
10
  removeModal: () => { },
11
11
  });
12
12
  function RootModalProvider({ children }) {
13
- const parent = (0, react_1.useContext)(exports.RootModalContext);
13
+ const parent = (0, react_1.use)(exports.RootModalContext);
14
14
  const [state, setState] = (0, react_1.useState)(() => ({
15
15
  root: false,
16
16
  routes: [],
@@ -1 +1 @@
1
- {"version":3,"file":"RootModal.js","sourceRoot":"","sources":["../../src/layouts/RootModal.tsx"],"names":[],"mappings":";;;AAgBA,8CAeC;AA/BD,iCAA4D;AAS/C,QAAA,gBAAgB,GAAG,IAAA,qBAAa,EAAwB;IACnE,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;CACtB,CAAC,CAAC;AAEH,SAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAiC;IAC3E,MAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,wBAAgB,CAAC,CAAC;IAE5C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAwB,GAAG,EAAE,CAAC,CAAC;QAC/D,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,CAAC,IAAY,EAAE,EAAE;YACzB,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnF,CAAC;QACD,WAAW,EAAE,CAAC,IAAY,EAAE,EAAE;YAC5B,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnF,CAAC;KACF,CAAC,CAAC,CAAC;IAEJ,OAAO,CAAC,wBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,wBAAgB,CAAC,QAAQ,CAAC,CAAC;AACzF,CAAC","sourcesContent":["import { createContext, useContext, useState } from 'react';\n\ntype RootModalContextValue = {\n root: boolean;\n routes: never[];\n addModal: (name: string) => void;\n removeModal: (name: string) => void;\n};\n\nexport const RootModalContext = createContext<RootModalContextValue>({\n root: true,\n routes: [],\n addModal: () => {},\n removeModal: () => {},\n});\n\nexport function RootModalProvider({ children }: { children: React.ReactNode }) {\n const parent = useContext(RootModalContext);\n\n const [state, setState] = useState<RootModalContextValue>(() => ({\n root: false,\n routes: [],\n addModal: (name: string) => {\n return parent.root ? setState((state) => ({ ...state })) : parent.addModal(name);\n },\n removeModal: (name: string) => {\n return parent.root ? setState((state) => ({ ...state })) : parent.addModal(name);\n },\n }));\n\n return <RootModalContext.Provider value={state}>{children}</RootModalContext.Provider>;\n}\n"]}
1
+ {"version":3,"file":"RootModal.js","sourceRoot":"","sources":["../../src/layouts/RootModal.tsx"],"names":[],"mappings":";;;AAgBA,8CAeC;AA/BD,iCAAqD;AASxC,QAAA,gBAAgB,GAAG,IAAA,qBAAa,EAAwB;IACnE,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;CACtB,CAAC,CAAC;AAEH,SAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAiC;IAC3E,MAAM,MAAM,GAAG,IAAA,WAAG,EAAC,wBAAgB,CAAC,CAAC;IAErC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAwB,GAAG,EAAE,CAAC,CAAC;QAC/D,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,CAAC,IAAY,EAAE,EAAE;YACzB,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnF,CAAC;QACD,WAAW,EAAE,CAAC,IAAY,EAAE,EAAE;YAC5B,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnF,CAAC;KACF,CAAC,CAAC,CAAC;IAEJ,OAAO,CAAC,wBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,wBAAgB,CAAC,QAAQ,CAAC,CAAC;AACzF,CAAC","sourcesContent":["import { createContext, use, useState } from 'react';\n\ntype RootModalContextValue = {\n root: boolean;\n routes: never[];\n addModal: (name: string) => void;\n removeModal: (name: string) => void;\n};\n\nexport const RootModalContext = createContext<RootModalContextValue>({\n root: true,\n routes: [],\n addModal: () => {},\n removeModal: () => {},\n});\n\nexport function RootModalProvider({ children }: { children: React.ReactNode }) {\n const parent = use(RootModalContext);\n\n const [state, setState] = useState<RootModalContextValue>(() => ({\n root: false,\n routes: [],\n addModal: (name: string) => {\n return parent.root ? setState((state) => ({ ...state })) : parent.addModal(name);\n },\n removeModal: (name: string) => {\n return parent.root ? setState((state) => ({ ...state })) : parent.addModal(name);\n },\n }));\n\n return <RootModalContext.Provider value={state}>{children}</RootModalContext.Provider>;\n}\n"]}
@@ -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,OAAc,EAGZ,cAAc,EACd,aAAa,EACb,yBAAyB,EACzB,eAAe,EACf,SAAS,EACT,aAAa,EAEd,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAoB,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAA2B,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGxE,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;;cAKkC,MAAM;;;;EAsD/C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,SAAS,MAAM,EACvB,CAAC,SAAS,aAAa,CAAC,GAAG,CAAC,EAC5B,MAAM,SAAS,eAAe,EAC9B,SAAS,SAAS,YAAY,EAC9B,GAAG,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE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AC5B,eAAe,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,CACrF,GAAG;IACF,MAAM,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,KAAK,IAAI,CAAC;IAClE,SAAS,EAAE,OAAO,SAAS,CAAC;CAC7B,CACF"}
@@ -68,6 +68,7 @@ function useFilterScreenChildren(children, { isCustomNavigator, contextKey, } =
68
68
  }
69
69
  if (isCustomNavigator) {
70
70
  customChildren.push(child);
71
+ return null;
71
72
  }
72
73
  console.warn(`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"`);
73
74
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"withLayoutContext.js","sourceRoot":"","sources":["../../src/layouts/withLayoutContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,0DAoEC;AAgCD,8CAmCC;AAzJD,+CAUe;AAEf,oCAAyC;AAEzC,8CAA8D;AAC9D,kDAAwE;AACxE,4CAAmD;AAEnD,SAAgB,uBAAuB,CACrC,QAAmB,EACnB,EACE,iBAAiB,EACjB,UAAU,MAKR,EAAE;IAEN,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE;QAClB,MAAM,cAAc,GAAU,EAAE,CAAC;QAEjC,MAAM,OAAO,GAAuC,EAAE,CAAC;QACvD,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;QAE3C,SAAS,YAAY,CAAC,KAAgB,EAAE,OAAO,GAAG,KAAK;YACrD,IAAI,IAAA,iBAAQ,EAAC,KAAK,EAAE,UAAU,CAAC,EAAE,CAAC;gBAChC,IAAI,OAAO,EAAE,CAAC;oBACZ,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBACzC,CAAC;qB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NavigationState } from '@react-navigation/native';\nimport React, {\n Children,\n forwardRef,\n ComponentProps,\n ComponentType,\n ForwardRefExoticComponent,\n PropsWithoutRef,\n ReactNode,\n RefAttributes,\n useMemo,\n} from 'react';\n\nimport { useContextKey } from '../Route';\nimport { PickPartial } from '../types';\nimport { useSortedScreens, ScreenProps } from '../useScreens';\nimport { isProtectedReactElement, Protected } from '../views/Protected';\nimport { isScreen, 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\n const screens: (ScreenProps & { name: string })[] = [];\n const protectedScreens = new Set<string>();\n\n function flattenChild(child: ReactNode, exclude = false) {\n if (isScreen(child, contextKey)) {\n if (exclude) {\n protectedScreens.add(child.props.name);\n } else {\n screens.push(child.props);\n }\n return;\n }\n\n if (isProtectedReactElement(child)) {\n if (child.props.guard) {\n Children.forEach(child.props.children, (protectedChild) => flattenChild(protectedChild));\n } else {\n Children.forEach(child.props.children, (protectedChild) => {\n flattenChild(protectedChild, true);\n });\n }\n return;\n }\n\n if (isCustomNavigator) {\n customChildren.push(child);\n }\n\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 return null;\n }\n\n Children.forEach(children, (child) => flattenChild(child));\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(\n (screen) => screen && typeof screen === 'object' && 'name' in screen && screen.name\n );\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 protectedScreens,\n };\n }, [children]);\n}\n\n/**\n * Returns a navigator that automatically injects matched routes and renders nothing when there are no children.\n * Return type with `children` prop optional.\n * \n * Enables use of other built-in React Navigation navigators and other navigators built with the React Navigation custom navigator API.\n *\n * @example\n * ```tsx app/_layout.tsx\n * import { ParamListBase, TabNavigationState } from \"@react-navigation/native\";\n * import {\n * createMaterialTopTabNavigator,\n * MaterialTopTabNavigationOptions,\n * MaterialTopTabNavigationEventMap,\n * } from \"@react-navigation/material-top-tabs\";\n * import { withLayoutContext } from \"expo-router\";\n * \n * const MaterialTopTabs = createMaterialTopTabNavigator();\n * \n * const ExpoRouterMaterialTopTabs = withLayoutContext<\n * MaterialTopTabNavigationOptions,\n * typeof MaterialTopTabs.Navigator,\n * TabNavigationState<ParamListBase>,\n * MaterialTopTabNavigationEventMap\n * >(MaterialTopTabs.Navigator);\n\n * export default function TabLayout() {\n * return <ExpoRouterMaterialTopTabs />;\n * }\n * ```\n */\nexport function withLayoutContext<\n TOptions extends object,\n T extends ComponentType<any>,\n TState extends NavigationState,\n TEventMap extends EventMapBase,\n>(Nav: T, processor?: (options: ScreenProps[]) => ScreenProps[]) {\n return Object.assign(\n forwardRef(({ children: userDefinedChildren, ...props }: any, ref) => {\n const contextKey = useContextKey();\n\n const { screens, protectedScreens } = useFilterScreenChildren(userDefinedChildren, {\n contextKey,\n });\n\n const processed = processor ? processor(screens ?? []) : screens;\n\n const sorted = useSortedScreens(processed ?? [], protectedScreens);\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 Protected,\n }\n ) as ForwardRefExoticComponent<\n PropsWithoutRef<PickPartial<ComponentProps<T>, 'children'>> & RefAttributes<unknown>\n > & {\n Screen: (props: ScreenProps<TOptions, TState, TEventMap>) => null;\n Protected: typeof Protected;\n };\n}\n"]}
1
+ {"version":3,"file":"withLayoutContext.js","sourceRoot":"","sources":["../../src/layouts/withLayoutContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,0DAqEC;AAgCD,8CAmCC;AA1JD,+CAUe;AA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AS,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAEjE,MAAM,MAAM,GAAG,IAAA,6BAAgB,EAAC,SAAS,IAAI,EAAE,EAAE,gBAAgB,CAAC,CAAC;QAEnE,uDAAuD;QACvD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC;QACd,CAAC;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;QACN,SAAS,EAAT,qBAAS;KACV,CAMF,CAAC;AACJ,CAAC","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 useMemo,\n} from 'react';\n\nimport { useContextKey } from '../Route';\nimport { PickPartial } from '../types';\nimport { useSortedScreens, ScreenProps } from '../useScreens';\nimport { isProtectedReactElement, Protected } from '../views/Protected';\nimport { isScreen, 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\n const screens: (ScreenProps & { name: string })[] = [];\n const protectedScreens = new Set<string>();\n\n function flattenChild(child: ReactNode, exclude = false) {\n if (isScreen(child, contextKey)) {\n if (exclude) {\n protectedScreens.add(child.props.name);\n } else {\n screens.push(child.props);\n }\n return;\n }\n\n if (isProtectedReactElement(child)) {\n if (child.props.guard) {\n Children.forEach(child.props.children, (protectedChild) => flattenChild(protectedChild));\n } else {\n Children.forEach(child.props.children, (protectedChild) => {\n flattenChild(protectedChild, true);\n });\n }\n return;\n }\n\n if (isCustomNavigator) {\n customChildren.push(child);\n return null;\n }\n\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 return null;\n }\n\n Children.forEach(children, (child) => flattenChild(child));\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(\n (screen) => screen && typeof screen === 'object' && 'name' in screen && screen.name\n );\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 protectedScreens,\n };\n }, [children]);\n}\n\n/**\n * Returns a navigator that automatically injects matched routes and renders nothing when there are no children.\n * Return type with `children` prop optional.\n * \n * Enables use of other built-in React Navigation navigators and other navigators built with the React Navigation custom navigator API.\n *\n * @example\n * ```tsx app/_layout.tsx\n * import { ParamListBase, TabNavigationState } from \"@react-navigation/native\";\n * import {\n * createMaterialTopTabNavigator,\n * MaterialTopTabNavigationOptions,\n * MaterialTopTabNavigationEventMap,\n * } from \"@react-navigation/material-top-tabs\";\n * import { withLayoutContext } from \"expo-router\";\n * \n * const MaterialTopTabs = createMaterialTopTabNavigator();\n * \n * const ExpoRouterMaterialTopTabs = withLayoutContext<\n * MaterialTopTabNavigationOptions,\n * typeof MaterialTopTabs.Navigator,\n * TabNavigationState<ParamListBase>,\n * MaterialTopTabNavigationEventMap\n * >(MaterialTopTabs.Navigator);\n\n * export default function TabLayout() {\n * return <ExpoRouterMaterialTopTabs />;\n * }\n * ```\n */\nexport function withLayoutContext<\n TOptions extends object,\n T extends ComponentType<any>,\n TState extends NavigationState,\n TEventMap extends EventMapBase,\n>(Nav: T, processor?: (options: ScreenProps[]) => ScreenProps[]) {\n return Object.assign(\n forwardRef(({ children: userDefinedChildren, ...props }: any, ref) => {\n const contextKey = useContextKey();\n\n const { screens, protectedScreens } = useFilterScreenChildren(userDefinedChildren, {\n contextKey,\n });\n\n const processed = processor ? processor(screens ?? []) : screens;\n\n const sorted = useSortedScreens(processed ?? [], protectedScreens);\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 Protected,\n }\n ) as ForwardRefExoticComponent<\n PropsWithoutRef<PickPartial<ComponentProps<T>, 'children'>> & RefAttributes<unknown>\n > & {\n Screen: (props: ScreenProps<TOptions, TState, TEventMap>) => null;\n Protected: typeof Protected;\n };\n}\n"]}
@@ -212,7 +212,7 @@ function getHistory() {
212
212
  };
213
213
  }
214
214
  function useRouter_UNSTABLE() {
215
- const router = (0, react_1.useContext)(RouterContext);
215
+ const router = (0, react_1.use)(RouterContext);
216
216
  if (!router) {
217
217
  throw new Error('Missing Router');
218
218
  }
@@ -356,7 +356,7 @@ children, ...props }, ref) {
356
356
  }
357
357
  return (0, href_1.resolveHref)(href);
358
358
  }, [href]);
359
- const router = (0, react_1.useContext)(RouterContext);
359
+ const router = (0, react_1.use)(RouterContext);
360
360
  const changeRoute = router
361
361
  ? router.changeRoute
362
362
  : () => {
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/rsc/router/client.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;AAEH,YAAY,CAAC;AAVb;;;;;;;;GAQG;;;AAqRH,gDAgGC;AAoED,wBAUC;AASD,oCAgBC;AAxdD,qDAAyD;AACzD,iCAae;AAUf,+CAAoC;AAEpC,2CAA8E;AAE9E,uCAAgE;AAIhE,0CAA8C;AAC9C,0DAA4E;AAG5E,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,EAAE;IAC1C,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC;QAC1C,IAAI,IAAI,CAAC,QAAQ,CAAC,M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AM,GAAG,GAAG,IAAI,GAAG,CAAC,YAAY,EAAE,OAAO,EAAE,CAAC,CAAC;QAC7C,kDAAkD;QAClD,gCAAgC;QAChC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;QAC9B,aAAa,CAAC,KAAK,CAAC,CAAC;QACrB,eAAe,CAAC,GAAG,EAAE;YACnB,UAAU,EAAE,CAAC,SAAS,CACpB;gBACE,GAAG,UAAU,EAAE,CAAC,KAAK;gBACrB,aAAa,EAAE,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC,QAAQ;aACzD,EACD,EAAE,EACF,GAAG,CACJ,CAAC;YACF,WAAW,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;QACH,IAAI;QACJ,KAAK,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC,CAAC;IACF,gDAAgD;IAChD,kDAAkD;IAClD,4CAA4C;IAC5C,sCAAsC;IACtC,yCAAyC;IACzC,gCAAgC;IAChC,UAAU;IACV,qCAAqC;IACrC,QAAQ;IACR,0BAA0B;IAE1B,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,iBAAS,CAAC,CAAC,CAAC,mBAAI,CAAC;IAE3C,MAAM,GAAG,GAAG,IAAA,qBAAa;IACvB,mBAAmB;IACnB,OAAO,EACP;QACE,GAAG,SAAS;QACZ,GAAG,KAAK;QACR,KAAK;QACL,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,OAAO;QAChB,gBAAgB;QAChB,GAAG;KACJ,EACD,QAAQ,CACT,CAAC;IACF,4CAA4C;IAC5C,wDAAwD;IACxD,IAAI;IACJ,gDAAgD;IAChD,2DAA2D;IAC3D,IAAI;IACJ,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * Copyright © 2024 650 Industries.\n * Copyright © 2024 2023 Daishi Kato\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * https://github.com/dai-shi/waku/blob/3d1cc7d714b67b142c847e879c30f0724fc457a7/packages/waku/src/router/client.ts#L1\n */\n\n'use client';\n\nimport { Slot as ReactSlot } from '@radix-ui/react-slot';\nimport {\n startTransition,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useTransition,\n createElement,\n createContext,\n useState,\n Fragment,\n forwardRef,\n useMemo,\n} from 'react';\nimport type {\n ComponentProps,\n FunctionComponent,\n ReactNode,\n MutableRefObject,\n AnchorHTMLAttributes,\n MouseEvent,\n ForwardedRef,\n} from 'react';\nimport { Text } from 'react-native';\n\nimport { PARAM_KEY_SKIP, getComponentIds, getInputString } from './common.js';\nimport type { RouteProps } from './common.js';\nimport { prefetchRSC, Root, Slot, useRefetch } from './host.js';\nimport type { NavigationOptions } from '../../global-state/routing.js';\nimport type { Router as ClassicExpoRouterType } from '../../imperative-api';\nimport type { LinkProps as ClassicLinkProps, LinkComponent } from '../../link/Link.js';\nimport { resolveHref } from '../../link/href';\nimport { useInteropClassName, useHrefAttrs } from '../../link/useLinkHooks';\nimport type { Href } from '../../types.js';\n\nconst normalizeRoutePath = (path: string) => {\n for (const suffix of ['/', '/index.html']) {\n if (path.endsWith(suffix)) {\n return path.slice(0, -suffix.length) || '/';\n }\n }\n return path;\n};\n\nconst parseRoute = (url: URL): RouteProps => {\n if ((globalThis as any).__EXPO_ROUTER_404__) {\n return { path: '/404', query: '', hash: '' };\n }\n const { pathname, searchParams, hash } = url;\n if (searchParams.has(PARAM_KEY_SKIP)) {\n console.warn(`The search param \"${PARAM_KEY_SKIP}\" is reserved`);\n }\n return {\n path: normalizeRoutePath(pathname),\n query: searchParams.toString(),\n hash,\n };\n};\nconst getHref = () =>\n process.env.EXPO_OS === 'web'\n ? window.location.href\n : // TODO: This is hardcoded on native to simplify the initial PR.\n 'http://localhost:8081/';\n\ntype ChangeRoute = (\n route: RouteProps,\n options?: {\n checkCache?: boolean;\n skipRefetch?: boolean;\n }\n) => void;\n\ntype PrefetchRoute = (route: RouteProps) => void;\n\nconst equalRouteProps = (a: RouteProps, b: RouteProps) => {\n if (a.path !== b.path) {\n return false;\n }\n if (a.query !== b.query) {\n return false;\n }\n return true;\n};\n\nconst RouterContext = createContext<{\n route: RouteProps;\n changeRoute: ChangeRoute;\n prefetchRoute: PrefetchRoute;\n} | null>(null);\n\nconst InnerRouter = ({ routerData }: { routerData: RouterData }) => {\n const refetch = useRefetch();\n\n const initialRouteRef = useRef<RouteProps>(null);\n if (!initialRouteRef.current) {\n initialRouteRef.current = parseRoute(new URL(getHref()));\n }\n const [route, setRoute] = useState(() => ({\n // This is the first initialization of the route, and it has\n // to ignore the hash, because on server side there is none.\n // Otherwise there will be a hydration error.\n // The client side route, including the hash, will be updated in the effect below.\n ...initialRouteRef.current!,\n hash: '',\n }));\n\n // Update the route post-load to include the current hash.\n useEffect(() => {\n const initialRoute = initialRouteRef.current!;\n setRoute((prev) => {\n if (\n prev.path === initialRoute.path &&\n prev.query === initialRoute.query &&\n prev.hash === initialRoute.hash\n ) {\n return prev;\n }\n return initialRoute;\n });\n }, []);\n\n const componentIds = getComponentIds(route.path);\n\n // const refetchRoute = () => {\n // const loc = parseRoute(new URL(getHref()));\n // const input = getInputString(loc.path);\n // refetch(input, loc.query);\n // refetch(input, JSON.stringify({ query: route.query }));\n // };\n // globalThis.__EXPO_REFETCH_ROUTE_NO_CACHE__ = refetchRoute;\n\n const [cached, setCached] = useState<Record<string, RouteProps>>(() => {\n return Object.fromEntries(componentIds.map((id) => [id, route]));\n });\n const cachedRef = useRef(cached);\n useEffect(() => {\n cachedRef.current = cached;\n }, [cached]);\n\n const changeRoute: ChangeRoute = useCallback(\n (route, options) => {\n const { checkCache, skipRefetch } = options || {};\n startTransition(() => {\n setRoute(route);\n });\n const componentIds = getComponentIds(route.path);\n if (\n checkCache &&\n componentIds.every((id) => {\n const cachedLoc = cachedRef.current[id];\n return cachedLoc && equalRouteProps(cachedLoc, route);\n })\n ) {\n return; // everything is cached\n }\n const shouldSkip = routerData[0];\n const skip = getSkipList(shouldSkip, componentIds, route, cachedRef.current);\n if (componentIds.every((id) => skip.includes(id))) {\n return; // everything is skipped\n }\n const input = getInputString(route.path);\n if (!skipRefetch) {\n refetch(input, JSON.stringify({ query: route.query, skip }));\n }\n startTransition(() => {\n setCached((prev) => ({\n ...prev,\n ...Object.fromEntries(\n componentIds.flatMap((id) => (skip.includes(id) ? [] : [[id, route]]))\n ),\n }));\n });\n },\n [refetch, routerData]\n );\n\n const prefetchRoute: PrefetchRoute = useCallback(\n (route) => {\n const componentIds = getComponentIds(route.path);\n const shouldSkip = routerData[0];\n const skip = getSkipList(shouldSkip, componentIds, route, cachedRef.current);\n if (componentIds.every((id) => skip.includes(id))) {\n return; // everything is cached\n }\n const input = getInputString(route.path);\n prefetchRSC(input, JSON.stringify({ query: route.query, skip }));\n (globalThis as any).__EXPO_ROUTER_PREFETCH__?.(route.path);\n },\n [routerData]\n );\n\n useEffect(() => {\n const callback = () => {\n const route = parseRoute(new URL(getHref()));\n changeRoute(route, { checkCache: true });\n };\n if (window.addEventListener) {\n window.addEventListener('popstate', callback);\n return () => {\n window.removeEventListener('popstate', callback);\n };\n }\n return () => {};\n }, [changeRoute]);\n\n useEffect(() => {\n const callback = (pathname: string, searchParamsString: string) => {\n const url = new URL(getHref());\n url.pathname = pathname;\n url.search = searchParamsString;\n url.hash = '';\n getHistory().pushState(\n {\n ...getHistory().state,\n expo_new_path: url.pathname !== window.location.pathname,\n },\n '',\n url\n );\n changeRoute(parseRoute(url), { skipRefetch: true });\n };\n // eslint-disable-next-line no-multi-assign\n const listeners = (routerData[1] ||= new Set());\n listeners.add(callback);\n return () => {\n listeners.delete(callback);\n };\n }, [changeRoute, routerData]);\n\n useEffect(() => {\n const { hash } = window.location;\n const { state } = getHistory();\n const element = hash && document.getElementById(hash.slice(1));\n if (window.scrollTo) {\n window.scrollTo({\n left: 0,\n top: element ? element.getBoundingClientRect().top + window.scrollY : 0,\n behavior: state?.expo_new_path ? 'instant' : 'auto',\n });\n } else {\n // TODO: Native\n // console.log('window.scrollTo is not available');\n }\n });\n\n const children = componentIds.reduceRight(\n (acc: ReactNode, id) =>\n createElement(RouterSlot, { route, routerData, cachedRef, id, fallback: acc }, acc),\n null\n );\n\n return createElement(\n RouterContext.Provider,\n { value: { route, changeRoute, prefetchRoute } },\n children\n );\n};\n\nfunction getHistory() {\n if (process.env.EXPO_OS === 'web') {\n return window.history;\n }\n // Native shim\n return {\n pushState: () => {},\n replaceState: () => {},\n back: () => {},\n forward: () => {},\n state: {},\n };\n}\n\nexport function useRouter_UNSTABLE(): ClassicExpoRouterType &\n RouteProps & {\n forward: () => void;\n prefetch: (href: Href) => void;\n } {\n const router = useContext(RouterContext);\n if (!router) {\n throw new Error('Missing Router');\n }\n const { route, changeRoute, prefetchRoute } = router;\n const push: ClassicExpoRouterType['push'] = useCallback(\n (href: Href, options?: NavigationOptions) => {\n if (options) {\n // TODO(Bacon): Implement options\n console.warn(\n 'options prop of router.push() is not supported in React Server Components yet'\n );\n }\n\n const url = new URL(resolveHref(href), getHref());\n getHistory().pushState(\n {\n ...getHistory().state,\n expo_new_path: url.pathname !== window.location.pathname,\n },\n '',\n url\n );\n changeRoute(parseRoute(url));\n },\n [changeRoute]\n );\n const replace: ClassicExpoRouterType['replace'] = useCallback(\n (href: Href, options?: NavigationOptions) => {\n if (options) {\n // TODO(Bacon): Implement options\n console.warn(\n 'options prop of router.replace() is not supported in React Server Components yet'\n );\n }\n\n const url = new URL(resolveHref(href), getHref());\n getHistory().replaceState(getHistory().state, '', url);\n changeRoute(parseRoute(url));\n },\n [changeRoute]\n );\n const reload = useCallback(() => {\n const url = new URL(getHref());\n changeRoute(parseRoute(url));\n }, [changeRoute]);\n const back = useCallback(() => {\n // FIXME is this correct?\n getHistory().back();\n }, []);\n const forward = useCallback(() => {\n // FIXME is this correct?\n getHistory().forward();\n }, []);\n const prefetch = useCallback(\n (href: Href) => {\n const url = new URL(resolveHref(href), getHref());\n prefetchRoute(parseRoute(url));\n },\n [prefetchRoute]\n );\n return {\n ...route,\n canDismiss() {\n throw new Error('router.canDismiss() is not supported in React Server Components yet');\n },\n canGoBack() {\n throw new Error('router.canGoBack() is not supported in React Server Components yet');\n },\n dismiss() {\n throw new Error('router.dismiss() is not supported in React Server Components yet');\n },\n dismissTo() {\n throw new Error('router.dismissTo() is not supported in React Server Components yet');\n },\n dismissAll() {\n throw new Error('router.dismissAll() is not supported in React Server Components yet');\n },\n setParams() {\n throw new Error('router.setParams() is not supported in React Server Components yet');\n },\n\n // TODO: The behavior here is not the same as before.\n navigate: push,\n push,\n replace,\n reload,\n back,\n forward,\n prefetch,\n };\n}\n\nconst RouterSlot = ({\n route,\n routerData,\n cachedRef,\n id,\n fallback,\n children,\n}: {\n route: RouteProps;\n routerData: RouterData;\n cachedRef: MutableRefObject<Record<string, RouteProps>>;\n id: string;\n fallback?: ReactNode;\n children?: ReactNode;\n}) => {\n // const unstable_shouldRenderPrev = (_err: unknown) => {\n // const shouldSkip = routerData[0];\n // const skip = getSkipList(shouldSkip, [id], route, cachedRef.current);\n // return skip.length > 0;\n // };\n return createElement(Slot, { id, fallback }, children);\n};\n\nconst getSkipList = (\n shouldSkip: ShouldSkip | undefined,\n componentIds: readonly string[],\n route: RouteProps,\n cached: Record<string, RouteProps>\n): string[] => {\n const shouldSkipObj = Object.fromEntries(shouldSkip || []);\n return componentIds.filter((id) => {\n const prevProps = cached[id];\n if (!prevProps) {\n return false;\n }\n const shouldCheck = shouldSkipObj[id];\n if (!shouldCheck) {\n return false;\n }\n if (shouldCheck[0] && route.path !== prevProps.path) {\n return false;\n }\n if (shouldCheck[0] && route.query !== prevProps.query) {\n return false;\n }\n return true;\n });\n};\n\n// TODO revisit shouldSkip API\ntype ShouldSkip = (readonly [\n string,\n readonly [\n boolean, // if we compare path\n string[], // searchParams keys to compare\n ],\n])[];\n\n// Note: The router data must be a stable mutable object (array).\ntype RouterData = [\n shouldSkip?: ShouldSkip,\n locationListeners?: Set<(path: string, query: string) => void>,\n];\n\nconst DEFAULT_ROUTER_DATA: RouterData = [];\n\nexport function Router({ routerData = DEFAULT_ROUTER_DATA }) {\n const route = parseRoute(new URL(getHref()));\n const initialInput = getInputString(route.path);\n const initialParams = JSON.stringify({ query: route.query });\n const unstable_onFetchData = () => {};\n return createElement(\n Root as FunctionComponent<Omit<ComponentProps<typeof Root>, 'children'>>,\n { initialInput, initialParams, unstable_onFetchData },\n createElement(InnerRouter, { routerData })\n );\n}\n\nconst notAvailableInServer = (name: string) => () => {\n throw new Error(`${name} is not in the server`);\n};\n/**\n * ServerRouter for SSR\n * This is not a public API.\n */\nexport function ServerRouter({ children, route }: { children: ReactNode; route: RouteProps }) {\n return createElement(\n Fragment,\n null,\n createElement(\n RouterContext.Provider,\n {\n value: {\n route,\n changeRoute: notAvailableInServer('changeRoute'),\n prefetchRoute: notAvailableInServer('prefetchRoute'),\n },\n },\n children\n )\n );\n}\n\nexport type LinkProps = ClassicLinkProps & {\n href: string;\n // pending?: ReactNode;\n // notPending?: ReactNode;\n\n // unstable_prefetchOnEnter?: boolean;\n // unstable_prefetchOnView?: boolean;\n} & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;\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 // pending,\n // notPending,\n // unstable_prefetchOnEnter,\n // unstable_prefetchOnView,\n children,\n ...props\n }: LinkProps,\n ref: ForwardedRef<Text>\n) {\n // Mutate the style prop to add the className on web.\n const style = useInteropClassName(props);\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 const router = useContext(RouterContext);\n const changeRoute = router\n ? router.changeRoute\n : () => {\n throw new Error('Missing Router');\n };\n const prefetchRoute = router\n ? router.prefetchRoute\n : () => {\n throw new Error('Missing Router');\n };\n // TODO: Implement support for pending states in the future.\n const [, startTransition] = useTransition();\n // const elementRef = useRef<HTMLAnchorElement>();\n\n // useEffect(() => {\n // if (unstable_prefetchOnView && process.env.EXPO_OS === 'web' && ref.current) {\n // const observer = new IntersectionObserver(\n // (entries) => {\n // entries.forEach((entry) => {\n // if (entry.isIntersecting) {\n // const url = new URL(resolvedHref, getHref());\n // if (router && url.href !== getHref()) {\n // const route = parseRoute(url);\n // router.prefetchRoute(route);\n // }\n // }\n // });\n // },\n // { threshold: 0.1 }\n // );\n\n // observer.observe(ref.current);\n\n // return () => {\n // observer.disconnect();\n // };\n // }\n // return () => {};\n // }, [unstable_prefetchOnView, router, resolvedHref]);\n\n const onClick = (event: MouseEvent<HTMLAnchorElement>) => {\n event.preventDefault();\n const url = new URL(resolvedHref, getHref());\n // TODO: Use in-memory route for native platforms.\n // if (url.href !== getHref()) {\n const route = parseRoute(url);\n prefetchRoute(route);\n startTransition(() => {\n getHistory().pushState(\n {\n ...getHistory().state,\n expo_new_path: url.pathname !== window.location.pathname,\n },\n '',\n url\n );\n changeRoute(route);\n });\n // }\n props.onClick?.(event);\n };\n // const onMouseEnter = unstable_prefetchOnEnter\n // ? (event: MouseEvent<HTMLAnchorElement>) => {\n // const url = new URL(to, getHref());\n // if (url.href !== getHref()) {\n // const route = parseRoute(url);\n // prefetchRoute(route);\n // }\n // props.onMouseEnter?.(event);\n // }\n // : props.onMouseEnter;\n\n const Element = asChild ? ReactSlot : Text;\n\n const ele = createElement(\n // @ts-expect-error\n Element,\n {\n ...hrefAttrs,\n ...props,\n style,\n href: resolvedHref,\n onPress: onClick,\n // onMouseEnter,\n ref,\n },\n children\n );\n // if (isPending && pending !== undefined) {\n // return createElement(Fragment, null, ele, pending);\n // }\n // if (!isPending && notPending !== undefined) {\n // return createElement(Fragment, null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,CAAC,mBAAI,CAAC;IAE3C,MAAM,GAAG,GAAG,IAAA,qBAAa;IACvB,mBAAmB;IACnB,OAAO,EACP;QACE,GAAG,SAAS;QACZ,GAAG,KAAK;QACR,KAAK;QACL,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,OAAO;QAChB,gBAAgB;QAChB,GAAG;KACJ,EACD,QAAQ,CACT,CAAC;IACF,4CAA4C;IAC5C,wDAAwD;IACxD,IAAI;IACJ,gDAAgD;IAChD,2DAA2D;IAC3D,IAAI;IACJ,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * Copyright © 2024 650 Industries.\n * Copyright © 2024 2023 Daishi Kato\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * https://github.com/dai-shi/waku/blob/3d1cc7d714b67b142c847e879c30f0724fc457a7/packages/waku/src/router/client.ts#L1\n */\n\n'use client';\n\nimport { Slot as ReactSlot } from '@radix-ui/react-slot';\nimport {\n startTransition,\n useCallback,\n use,\n useEffect,\n useRef,\n useTransition,\n createElement,\n createContext,\n useState,\n Fragment,\n forwardRef,\n useMemo,\n} from 'react';\nimport type {\n ComponentProps,\n FunctionComponent,\n ReactNode,\n MutableRefObject,\n AnchorHTMLAttributes,\n MouseEvent,\n ForwardedRef,\n} from 'react';\nimport { Text } from 'react-native';\n\nimport { PARAM_KEY_SKIP, getComponentIds, getInputString } from './common.js';\nimport type { RouteProps } from './common.js';\nimport { prefetchRSC, Root, Slot, useRefetch } from './host.js';\nimport type { NavigationOptions } from '../../global-state/routing.js';\nimport type { Router as ClassicExpoRouterType } from '../../imperative-api';\nimport type { LinkProps as ClassicLinkProps, LinkComponent } from '../../link/Link.js';\nimport { resolveHref } from '../../link/href';\nimport { useInteropClassName, useHrefAttrs } from '../../link/useLinkHooks';\nimport type { Href } from '../../types.js';\n\nconst normalizeRoutePath = (path: string) => {\n for (const suffix of ['/', '/index.html']) {\n if (path.endsWith(suffix)) {\n return path.slice(0, -suffix.length) || '/';\n }\n }\n return path;\n};\n\nconst parseRoute = (url: URL): RouteProps => {\n if ((globalThis as any).__EXPO_ROUTER_404__) {\n return { path: '/404', query: '', hash: '' };\n }\n const { pathname, searchParams, hash } = url;\n if (searchParams.has(PARAM_KEY_SKIP)) {\n console.warn(`The search param \"${PARAM_KEY_SKIP}\" is reserved`);\n }\n return {\n path: normalizeRoutePath(pathname),\n query: searchParams.toString(),\n hash,\n };\n};\nconst getHref = () =>\n process.env.EXPO_OS === 'web'\n ? window.location.href\n : // TODO: This is hardcoded on native to simplify the initial PR.\n 'http://localhost:8081/';\n\ntype ChangeRoute = (\n route: RouteProps,\n options?: {\n checkCache?: boolean;\n skipRefetch?: boolean;\n }\n) => void;\n\ntype PrefetchRoute = (route: RouteProps) => void;\n\nconst equalRouteProps = (a: RouteProps, b: RouteProps) => {\n if (a.path !== b.path) {\n return false;\n }\n if (a.query !== b.query) {\n return false;\n }\n return true;\n};\n\nconst RouterContext = createContext<{\n route: RouteProps;\n changeRoute: ChangeRoute;\n prefetchRoute: PrefetchRoute;\n} | null>(null);\n\nconst InnerRouter = ({ routerData }: { routerData: RouterData }) => {\n const refetch = useRefetch();\n\n const initialRouteRef = useRef<RouteProps>(null);\n if (!initialRouteRef.current) {\n initialRouteRef.current = parseRoute(new URL(getHref()));\n }\n const [route, setRoute] = useState(() => ({\n // This is the first initialization of the route, and it has\n // to ignore the hash, because on server side there is none.\n // Otherwise there will be a hydration error.\n // The client side route, including the hash, will be updated in the effect below.\n ...initialRouteRef.current!,\n hash: '',\n }));\n\n // Update the route post-load to include the current hash.\n useEffect(() => {\n const initialRoute = initialRouteRef.current!;\n setRoute((prev) => {\n if (\n prev.path === initialRoute.path &&\n prev.query === initialRoute.query &&\n prev.hash === initialRoute.hash\n ) {\n return prev;\n }\n return initialRoute;\n });\n }, []);\n\n const componentIds = getComponentIds(route.path);\n\n // const refetchRoute = () => {\n // const loc = parseRoute(new URL(getHref()));\n // const input = getInputString(loc.path);\n // refetch(input, loc.query);\n // refetch(input, JSON.stringify({ query: route.query }));\n // };\n // globalThis.__EXPO_REFETCH_ROUTE_NO_CACHE__ = refetchRoute;\n\n const [cached, setCached] = useState<Record<string, RouteProps>>(() => {\n return Object.fromEntries(componentIds.map((id) => [id, route]));\n });\n const cachedRef = useRef(cached);\n useEffect(() => {\n cachedRef.current = cached;\n }, [cached]);\n\n const changeRoute: ChangeRoute = useCallback(\n (route, options) => {\n const { checkCache, skipRefetch } = options || {};\n startTransition(() => {\n setRoute(route);\n });\n const componentIds = getComponentIds(route.path);\n if (\n checkCache &&\n componentIds.every((id) => {\n const cachedLoc = cachedRef.current[id];\n return cachedLoc && equalRouteProps(cachedLoc, route);\n })\n ) {\n return; // everything is cached\n }\n const shouldSkip = routerData[0];\n const skip = getSkipList(shouldSkip, componentIds, route, cachedRef.current);\n if (componentIds.every((id) => skip.includes(id))) {\n return; // everything is skipped\n }\n const input = getInputString(route.path);\n if (!skipRefetch) {\n refetch(input, JSON.stringify({ query: route.query, skip }));\n }\n startTransition(() => {\n setCached((prev) => ({\n ...prev,\n ...Object.fromEntries(\n componentIds.flatMap((id) => (skip.includes(id) ? [] : [[id, route]]))\n ),\n }));\n });\n },\n [refetch, routerData]\n );\n\n const prefetchRoute: PrefetchRoute = useCallback(\n (route) => {\n const componentIds = getComponentIds(route.path);\n const shouldSkip = routerData[0];\n const skip = getSkipList(shouldSkip, componentIds, route, cachedRef.current);\n if (componentIds.every((id) => skip.includes(id))) {\n return; // everything is cached\n }\n const input = getInputString(route.path);\n prefetchRSC(input, JSON.stringify({ query: route.query, skip }));\n (globalThis as any).__EXPO_ROUTER_PREFETCH__?.(route.path);\n },\n [routerData]\n );\n\n useEffect(() => {\n const callback = () => {\n const route = parseRoute(new URL(getHref()));\n changeRoute(route, { checkCache: true });\n };\n if (window.addEventListener) {\n window.addEventListener('popstate', callback);\n return () => {\n window.removeEventListener('popstate', callback);\n };\n }\n return () => {};\n }, [changeRoute]);\n\n useEffect(() => {\n const callback = (pathname: string, searchParamsString: string) => {\n const url = new URL(getHref());\n url.pathname = pathname;\n url.search = searchParamsString;\n url.hash = '';\n getHistory().pushState(\n {\n ...getHistory().state,\n expo_new_path: url.pathname !== window.location.pathname,\n },\n '',\n url\n );\n changeRoute(parseRoute(url), { skipRefetch: true });\n };\n // eslint-disable-next-line no-multi-assign\n const listeners = (routerData[1] ||= new Set());\n listeners.add(callback);\n return () => {\n listeners.delete(callback);\n };\n }, [changeRoute, routerData]);\n\n useEffect(() => {\n const { hash } = window.location;\n const { state } = getHistory();\n const element = hash && document.getElementById(hash.slice(1));\n if (window.scrollTo) {\n window.scrollTo({\n left: 0,\n top: element ? element.getBoundingClientRect().top + window.scrollY : 0,\n behavior: state?.expo_new_path ? 'instant' : 'auto',\n });\n } else {\n // TODO: Native\n // console.log('window.scrollTo is not available');\n }\n });\n\n const children = componentIds.reduceRight(\n (acc: ReactNode, id) =>\n createElement(RouterSlot, { route, routerData, cachedRef, id, fallback: acc }, acc),\n null\n );\n\n return createElement(\n RouterContext.Provider,\n { value: { route, changeRoute, prefetchRoute } },\n children\n );\n};\n\nfunction getHistory() {\n if (process.env.EXPO_OS === 'web') {\n return window.history;\n }\n // Native shim\n return {\n pushState: () => {},\n replaceState: () => {},\n back: () => {},\n forward: () => {},\n state: {},\n };\n}\n\nexport function useRouter_UNSTABLE(): ClassicExpoRouterType &\n RouteProps & {\n forward: () => void;\n prefetch: (href: Href) => void;\n } {\n const router = use(RouterContext);\n if (!router) {\n throw new Error('Missing Router');\n }\n const { route, changeRoute, prefetchRoute } = router;\n const push: ClassicExpoRouterType['push'] = useCallback(\n (href: Href, options?: NavigationOptions) => {\n if (options) {\n // TODO(Bacon): Implement options\n console.warn(\n 'options prop of router.push() is not supported in React Server Components yet'\n );\n }\n\n const url = new URL(resolveHref(href), getHref());\n getHistory().pushState(\n {\n ...getHistory().state,\n expo_new_path: url.pathname !== window.location.pathname,\n },\n '',\n url\n );\n changeRoute(parseRoute(url));\n },\n [changeRoute]\n );\n const replace: ClassicExpoRouterType['replace'] = useCallback(\n (href: Href, options?: NavigationOptions) => {\n if (options) {\n // TODO(Bacon): Implement options\n console.warn(\n 'options prop of router.replace() is not supported in React Server Components yet'\n );\n }\n\n const url = new URL(resolveHref(href), getHref());\n getHistory().replaceState(getHistory().state, '', url);\n changeRoute(parseRoute(url));\n },\n [changeRoute]\n );\n const reload = useCallback(() => {\n const url = new URL(getHref());\n changeRoute(parseRoute(url));\n }, [changeRoute]);\n const back = useCallback(() => {\n // FIXME is this correct?\n getHistory().back();\n }, []);\n const forward = useCallback(() => {\n // FIXME is this correct?\n getHistory().forward();\n }, []);\n const prefetch = useCallback(\n (href: Href) => {\n const url = new URL(resolveHref(href), getHref());\n prefetchRoute(parseRoute(url));\n },\n [prefetchRoute]\n );\n return {\n ...route,\n canDismiss() {\n throw new Error('router.canDismiss() is not supported in React Server Components yet');\n },\n canGoBack() {\n throw new Error('router.canGoBack() is not supported in React Server Components yet');\n },\n dismiss() {\n throw new Error('router.dismiss() is not supported in React Server Components yet');\n },\n dismissTo() {\n throw new Error('router.dismissTo() is not supported in React Server Components yet');\n },\n dismissAll() {\n throw new Error('router.dismissAll() is not supported in React Server Components yet');\n },\n setParams() {\n throw new Error('router.setParams() is not supported in React Server Components yet');\n },\n\n // TODO: The behavior here is not the same as before.\n navigate: push,\n push,\n replace,\n reload,\n back,\n forward,\n prefetch,\n };\n}\n\nconst RouterSlot = ({\n route,\n routerData,\n cachedRef,\n id,\n fallback,\n children,\n}: {\n route: RouteProps;\n routerData: RouterData;\n cachedRef: MutableRefObject<Record<string, RouteProps>>;\n id: string;\n fallback?: ReactNode;\n children?: ReactNode;\n}) => {\n // const unstable_shouldRenderPrev = (_err: unknown) => {\n // const shouldSkip = routerData[0];\n // const skip = getSkipList(shouldSkip, [id], route, cachedRef.current);\n // return skip.length > 0;\n // };\n return createElement(Slot, { id, fallback }, children);\n};\n\nconst getSkipList = (\n shouldSkip: ShouldSkip | undefined,\n componentIds: readonly string[],\n route: RouteProps,\n cached: Record<string, RouteProps>\n): string[] => {\n const shouldSkipObj = Object.fromEntries(shouldSkip || []);\n return componentIds.filter((id) => {\n const prevProps = cached[id];\n if (!prevProps) {\n return false;\n }\n const shouldCheck = shouldSkipObj[id];\n if (!shouldCheck) {\n return false;\n }\n if (shouldCheck[0] && route.path !== prevProps.path) {\n return false;\n }\n if (shouldCheck[0] && route.query !== prevProps.query) {\n return false;\n }\n return true;\n });\n};\n\n// TODO revisit shouldSkip API\ntype ShouldSkip = (readonly [\n string,\n readonly [\n boolean, // if we compare path\n string[], // searchParams keys to compare\n ],\n])[];\n\n// Note: The router data must be a stable mutable object (array).\ntype RouterData = [\n shouldSkip?: ShouldSkip,\n locationListeners?: Set<(path: string, query: string) => void>,\n];\n\nconst DEFAULT_ROUTER_DATA: RouterData = [];\n\nexport function Router({ routerData = DEFAULT_ROUTER_DATA }) {\n const route = parseRoute(new URL(getHref()));\n const initialInput = getInputString(route.path);\n const initialParams = JSON.stringify({ query: route.query });\n const unstable_onFetchData = () => {};\n return createElement(\n Root as FunctionComponent<Omit<ComponentProps<typeof Root>, 'children'>>,\n { initialInput, initialParams, unstable_onFetchData },\n createElement(InnerRouter, { routerData })\n );\n}\n\nconst notAvailableInServer = (name: string) => () => {\n throw new Error(`${name} is not in the server`);\n};\n/**\n * ServerRouter for SSR\n * This is not a public API.\n */\nexport function ServerRouter({ children, route }: { children: ReactNode; route: RouteProps }) {\n return createElement(\n Fragment,\n null,\n createElement(\n RouterContext.Provider,\n {\n value: {\n route,\n changeRoute: notAvailableInServer('changeRoute'),\n prefetchRoute: notAvailableInServer('prefetchRoute'),\n },\n },\n children\n )\n );\n}\n\nexport type LinkProps = ClassicLinkProps & {\n href: string;\n // pending?: ReactNode;\n // notPending?: ReactNode;\n\n // unstable_prefetchOnEnter?: boolean;\n // unstable_prefetchOnView?: boolean;\n} & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;\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 // pending,\n // notPending,\n // unstable_prefetchOnEnter,\n // unstable_prefetchOnView,\n children,\n ...props\n }: LinkProps,\n ref: ForwardedRef<Text>\n) {\n // Mutate the style prop to add the className on web.\n const style = useInteropClassName(props);\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 const router = use(RouterContext);\n const changeRoute = router\n ? router.changeRoute\n : () => {\n throw new Error('Missing Router');\n };\n const prefetchRoute = router\n ? router.prefetchRoute\n : () => {\n throw new Error('Missing Router');\n };\n // TODO: Implement support for pending states in the future.\n const [, startTransition] = useTransition();\n // const elementRef = useRef<HTMLAnchorElement>();\n\n // useEffect(() => {\n // if (unstable_prefetchOnView && process.env.EXPO_OS === 'web' && ref.current) {\n // const observer = new IntersectionObserver(\n // (entries) => {\n // entries.forEach((entry) => {\n // if (entry.isIntersecting) {\n // const url = new URL(resolvedHref, getHref());\n // if (router && url.href !== getHref()) {\n // const route = parseRoute(url);\n // router.prefetchRoute(route);\n // }\n // }\n // });\n // },\n // { threshold: 0.1 }\n // );\n\n // observer.observe(ref.current);\n\n // return () => {\n // observer.disconnect();\n // };\n // }\n // return () => {};\n // }, [unstable_prefetchOnView, router, resolvedHref]);\n\n const onClick = (event: MouseEvent<HTMLAnchorElement>) => {\n event.preventDefault();\n const url = new URL(resolvedHref, getHref());\n // TODO: Use in-memory route for native platforms.\n // if (url.href !== getHref()) {\n const route = parseRoute(url);\n prefetchRoute(route);\n startTransition(() => {\n getHistory().pushState(\n {\n ...getHistory().state,\n expo_new_path: url.pathname !== window.location.pathname,\n },\n '',\n url\n );\n changeRoute(route);\n });\n // }\n props.onClick?.(event);\n };\n // const onMouseEnter = unstable_prefetchOnEnter\n // ? (event: MouseEvent<HTMLAnchorElement>) => {\n // const url = new URL(to, getHref());\n // if (url.href !== getHref()) {\n // const route = parseRoute(url);\n // prefetchRoute(route);\n // }\n // props.onMouseEnter?.(event);\n // }\n // : props.onMouseEnter;\n\n const Element = asChild ? ReactSlot : Text;\n\n const ele = createElement(\n // @ts-expect-error\n Element,\n {\n ...hrefAttrs,\n ...props,\n style,\n href: resolvedHref,\n onPress: onClick,\n // onMouseEnter,\n ref,\n },\n children\n );\n // if (isPending && pending !== undefined) {\n // return createElement(Fragment, null, ele, pending);\n // }\n // if (!isPending && notPending !== undefined) {\n // return createElement(Fragment, null, ele, notPending);\n // }\n return ele;\n}\n"]}
@@ -16,17 +16,6 @@ type Result = ReturnType<typeof render> & {
16
16
  getSearchParams(): Record<string, string | string[]>;
17
17
  getRouterState(): ReactNavigationState | undefined;
18
18
  };
19
- declare global {
20
- namespace jest {
21
- interface Matchers<R> {
22
- toHavePathname(pathname: string): R;
23
- toHavePathnameWithParams(pathname: string): R;
24
- toHaveSegments(segments: string[]): R;
25
- toHaveSearchParams(params: Record<string, string | string[]>): R;
26
- getRouterState(): ReactNavigationState | undefined;
27
- }
28
- }
29
- }
30
19
  export { MockContextConfig, getMockConfig, getMockContext };
31
20
  export declare function renderRouter(context?: MockContextConfig, { initialUrl, linking, ...options }?: RenderRouterOptions): Result;
32
21
  export declare const testRouter: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing-library/index.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,CAAC;AAClB,OAAO,SAAS,CAAC;AAEjB,OAAO,EAAO,MAAM,EAAwB,MAAM,+BAA+B,CAAC;AAGlF,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEjF,OAAO,EAAE,kBAAkB,EAAE,MAA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AC,IAAI,EAAE,CAAC,CAAC;QACzB,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,CAAC,qBAAM,CAAC,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IACD,qEAAqE;IACrE,SAAS;QACP,OAAO,uBAAM,CAAC,SAAS,EAAE,CAAC;IAC5B,CAAC;IACD,wEAAwE;IACxE,SAAS,CAAC,MAA8B,EAAE,IAAa;QACrD,uBAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACzB,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,CAAC,qBAAM,CAAC,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IACD,qEAAqE;IACrE,UAAU;QACR,IAAA,kBAAG,EAAC,GAAG,EAAE,CAAC,uBAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IACjC,CAAC;CACF,CAAC","sourcesContent":["import './expect';\nimport './mocks';\n\nimport { act, render, RenderResult, screen } from '@testing-library/react-native';\nimport React from 'react';\n\nimport { MockContextConfig, getMockConfig, getMockContext } from './mock-config';\nimport { ExpoRoot } from '../ExpoRoot';\nimport { ExpoLinkingOptions } from '../getLinkingConfig';\nimport { ReactNavigationState, store } from '../global-state/router-store';\nimport { router } from '../imperative-api';\n\n// re-export everything\nexport * from '@testing-library/react-native';\n\nexport type RenderRouterOptions = Parameters<typeof render>[1] & {\n initialUrl?: any;\n linking?: Partial<ExpoLinkingOptions>;\n};\n\ntype Result = ReturnType<typeof render> & {\n getPathname(): string;\n getPathnameWithParams(): string;\n getSegments(): string[];\n getSearchParams(): Record<string, string | string[]>;\n getRouterState(): ReactNavigationState | undefined;\n};\n\ndeclare global {\n namespace jest {\n interface Matchers<R> {\n toHavePathname(pathname: string): R;\n toHavePathnameWithParams(pathname: string): R;\n toHaveSegments(segments: string[]): R;\n toHaveSearchParams(params: Record<string, string | string[]>): R;\n getRouterState(): ReactNavigationState | undefined;\n }\n }\n}\n\nexport { MockContextConfig, getMockConfig, getMockContext };\n\nexport function renderRouter(\n context: MockContextConfig = './app',\n { initialUrl = '/', linking, ...options }: RenderRouterOptions = {}\n): Result {\n jest.useFakeTimers();\n\n const mockContext = getMockContext(context);\n\n // Force the render to be synchronous\n process.env.EXPO_ROUTER_IMPORT_MODE = 'sync';\n\n const result = render(\n <ExpoRoot context={mockContext} location={initialUrl} linking={linking} />,\n options\n );\n\n /**\n * This is a hack to ensure that React Navigation's state updates are processed before we run assertions.\n * Some updates are async and we need to wait for them to complete, otherwise will we get a false positive.\n * (that the app will briefly be in the right state, but then update to an invalid state)\n */\n return Object.assign(result, {\n getPathname(this: RenderResult): string {\n return store.getRouteInfo().pathname;\n },\n getSegments(this: RenderResult): string[] {\n return store.getRouteInfo().segments;\n },\n getSearchParams(this: RenderResult): Record<string, string | string[]> {\n return store.getRouteInfo().params;\n },\n getPathnameWithParams(this: RenderResult): string {\n return store.getRouteInfo().pathnameWithParams;\n },\n getRouterState(this: RenderResult) {\n return store.state;\n },\n });\n}\n\nexport const testRouter = {\n /** Navigate to the provided pathname and the pathname */\n navigate(path: string) {\n act(() => router.navigate(path));\n expect(screen).toHavePathnameWithParams(path);\n },\n /** Push the provided pathname and assert the pathname */\n push(path: string) {\n act(() => router.push(path));\n expect(screen).toHavePathnameWithParams(path);\n },\n /** Replace with provided pathname and assert the pathname */\n replace(path: string) {\n act(() => router.replace(path));\n expect(screen).toHavePathnameWithParams(path);\n },\n /** Go back in history and asset the new pathname */\n back(path?: string) {\n expect(router.canGoBack()).toBe(true);\n act(() => router.back());\n if (path) {\n expect(screen).toHavePathnameWithParams(path);\n }\n },\n /** If there's history that supports invoking the `back` function. */\n canGoBack() {\n return router.canGoBack();\n },\n /** Update the current route query params and assert the new pathname */\n setParams(params: Record<string, string>, path?: string) {\n router.setParams(params);\n if (path) {\n expect(screen).toHavePathnameWithParams(path);\n }\n },\n /** If there's history that supports invoking the `back` function. */\n dismissAll() {\n act(() => router.dismissAll());\n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I,IAAI,EAAE,CAAC;YACT,MAAM,CAAC,qBAAM,CAAC,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IACD,qEAAqE;IACrE,UAAU;QACR,IAAA,kBAAG,EAAC,GAAG,EAAE,CAAC,uBAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IACjC,CAAC;CACF,CAAC","sourcesContent":["import './expect';\nimport './mocks';\n\nimport { act, render, RenderResult, screen } from '@testing-library/react-native';\nimport React from 'react';\n\nimport { MockContextConfig, getMockConfig, getMockContext } from './mock-config';\nimport { ExpoRoot } from '../ExpoRoot';\nimport { ExpoLinkingOptions } from '../getLinkingConfig';\nimport { ReactNavigationState, store } from '../global-state/router-store';\nimport { router } from '../imperative-api';\n\n// re-export everything\nexport * from '@testing-library/react-native';\n\nexport type RenderRouterOptions = Parameters<typeof render>[1] & {\n initialUrl?: any;\n linking?: Partial<ExpoLinkingOptions>;\n};\n\ntype Result = ReturnType<typeof render> & {\n getPathname(): string;\n getPathnameWithParams(): string;\n getSegments(): string[];\n getSearchParams(): Record<string, string | string[]>;\n getRouterState(): ReactNavigationState | undefined;\n};\n\nexport { MockContextConfig, getMockConfig, getMockContext };\n\nexport function renderRouter(\n context: MockContextConfig = './app',\n { initialUrl = '/', linking, ...options }: RenderRouterOptions = {}\n): Result {\n jest.useFakeTimers();\n\n const mockContext = getMockContext(context);\n\n // Force the render to be synchronous\n process.env.EXPO_ROUTER_IMPORT_MODE = 'sync';\n\n const result = render(\n <ExpoRoot context={mockContext} location={initialUrl} linking={linking} />,\n options\n );\n\n /**\n * This is a hack to ensure that React Navigation's state updates are processed before we run assertions.\n * Some updates are async and we need to wait for them to complete, otherwise will we get a false positive.\n * (that the app will briefly be in the right state, but then update to an invalid state)\n */\n return Object.assign(result, {\n getPathname(this: RenderResult): string {\n return store.getRouteInfo().pathname;\n },\n getSegments(this: RenderResult): string[] {\n return store.getRouteInfo().segments;\n },\n getSearchParams(this: RenderResult): Record<string, string | string[]> {\n return store.getRouteInfo().params;\n },\n getPathnameWithParams(this: RenderResult): string {\n return store.getRouteInfo().pathnameWithParams;\n },\n getRouterState(this: RenderResult) {\n return store.state;\n },\n });\n}\n\nexport const testRouter = {\n /** Navigate to the provided pathname and the pathname */\n navigate(path: string) {\n act(() => router.navigate(path));\n expect(screen).toHavePathnameWithParams(path);\n },\n /** Push the provided pathname and assert the pathname */\n push(path: string) {\n act(() => router.push(path));\n expect(screen).toHavePathnameWithParams(path);\n },\n /** Replace with provided pathname and assert the pathname */\n replace(path: string) {\n act(() => router.replace(path));\n expect(screen).toHavePathnameWithParams(path);\n },\n /** Go back in history and asset the new pathname */\n back(path?: string) {\n expect(router.canGoBack()).toBe(true);\n act(() => router.back());\n if (path) {\n expect(screen).toHavePathnameWithParams(path);\n }\n },\n /** If there's history that supports invoking the `back` function. */\n canGoBack() {\n return router.canGoBack();\n },\n /** Update the current route query params and assert the new pathname */\n setParams(params: Record<string, string>, path?: string) {\n router.setParams(params);\n if (path) {\n expect(screen).toHavePathnameWithParams(path);\n }\n },\n /** If there's history that supports invoking the `back` function. */\n dismissAll() {\n act(() => router.dismissAll());\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TabTrigger.d.ts","sourceRoot":"","sources":["../../src/ui/TabTrigger.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAc,YAAY,EAAE,cAAc,EAAe,MAAM,OAAO,CAAC;AACzF,OAAO,EAAE,IAAI,EAAyB,cAAc,EAAE,MAAM,cAAc,CAAC;AAG3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAK3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGrC,KAAK,qCAAqC,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,CA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CAAC;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,YAAY,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACnC,WAAW,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;CAC5C,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,mBAAmB,CAwG3E"}
@@ -62,7 +62,7 @@ function isTabTrigger(child) {
62
62
  function useTabTrigger(options) {
63
63
  const { state, navigation } = (0, Navigator_1.useNavigatorContext)();
64
64
  const { name, reset, onPress, onLongPress } = options;
65
- const triggerMap = (0, react_1.useContext)(TabContext_1.TabTriggerMapContext);
65
+ const triggerMap = (0, react_1.use)(TabContext_1.TabTriggerMapContext);
66
66
  const getTrigger = (0, react_1.useCallback)((name) => {
67
67
  const config = triggerMap[name];
68
68
  if (!config) {
@@ -1 +1 @@
1
- {"version":3,"file":"TabTrigger.js","sourceRoot":"","sources":["../../src/ui/TabTrigger.tsx"],"names":[],"mappings":";;AAqEA,gCA4BC;AAKD,oCAIC;AAkCD,sCAwGC;AApPD,qDAA4C;AAE5C,iCAAyF;AACzF,+CAA2E;AAE3E,6CAAoD;AAGpD,+DAAyD;AACzD,sDAA2C;AAC3C,mEAAoE;AACpE,0CAAyD;AAEzD,kDAAyD;AAqCzD,MAAM,cAAc,GAAG,iBAA4D,CAAC;AAEpF;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,GAAG,SAAS,EAAE,GAAG,KAAK,EAAmB;IAC9F,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,aAAa,CAAC;QAC9C,IAAI;QACJ,KAAK;QACL,GAAG,KAAK;KACT,CAAC,CAAC;IAEH,sFAAsF;IACtF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ACnB,SAAS,EAAE,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC;QACtC,OAAO,EAAE,aAAa;QACtB,WAAW,EAAE,iBAAiB;KAC/B,CAAC;IAEF,OAAO;QACL,SAAS;QACT,UAAU;QACV,OAAO;QACP,YAAY;KACb,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,UAAU,EAAE;QACV,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,eAAe;KAChC;CACF,CAAC,CAAC","sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport { TabNavigationState } from '@react-navigation/native';\nimport { ReactNode, useContext, ReactElement, ComponentProps, useCallback } from 'react';\nimport { View, StyleSheet, Pressable, PressableProps } from 'react-native';\n\nimport { TabTriggerMapContext } from './TabContext';\nimport { ExpoTabsResetValue } from './TabRouter';\nimport type { TriggerMap } from './common';\nimport { appendBaseUrl } from '../fork/getPathFromState';\nimport { router } from '../imperative-api';\nimport { shouldHandleMouseEvent } from '../link/useLinkToPathProps';\nimport { stripGroupSegmentsFromPath } from '../matchers';\nimport type { Href } from '../types';\nimport { useNavigatorContext } from '../views/Navigator';\n\ntype PressablePropsWithoutFunctionChildren = Omit<PressableProps, 'children'> & {\n children?: ReactNode | undefined;\n};\n\nexport type TabTriggerProps = PressablePropsWithoutFunctionChildren & {\n /**\n * Name of tab. When used within a `TabList` this sets the name of the tab.\n * Otherwise, this references the name.\n */\n name: string;\n /**\n * Name of tab. Required when used within a `TabList`.\n */\n href?: Href;\n /**\n * Forward props to child component. Useful for custom wrappers.\n */\n asChild?: boolean;\n /**\n * Resets the route when switching to a tab.\n */\n reset?: SwitchToOptions['reset'] | 'onLongPress';\n};\n\nexport type TabTriggerOptions = {\n name: string;\n href: Href;\n};\n\nexport type TabTriggerSlotProps = PressablePropsWithoutFunctionChildren &\n React.RefAttributes<View> & {\n isFocused?: boolean;\n href?: string;\n };\n\nconst TabTriggerSlot = Slot as React.ForwardRefExoticComponent<TabTriggerSlotProps>;\n\n/**\n * Creates a trigger to navigate to a tab. When used as child of `TabList`, its\n * functionality slightly changes since the `href` prop is required,\n * and the trigger also defines what routes are present in the `Tabs`.\n *\n * When used outside of `TabList`, this component no longer requires an `href`.\n *\n * @example\n * ```tsx\n * <Tabs>\n * <TabSlot />\n * <TabList>\n * <TabTrigger name=\"home\" href=\"/\" />\n * </TabList>\n * </Tabs>\n * ```\n */\nexport function TabTrigger({ asChild, name, href, reset = 'onFocus', ...props }: TabTriggerProps) {\n const { trigger, triggerProps } = useTabTrigger({\n name,\n reset,\n ...props,\n });\n\n // Pressable doesn't accept the extra props, so only pass them if we are using asChild\n if (asChild) {\n return (\n <TabTriggerSlot\n style={styles.tabTrigger}\n {...props}\n {...triggerProps}\n href={trigger?.resolvedHref}>\n {props.children}\n </TabTriggerSlot>\n );\n } else {\n // These props are not typed, but are allowed by React Native Web\n const reactNativeWebProps = { href: trigger?.resolvedHref };\n\n return (\n <Pressable style={styles.tabTrigger} {...reactNativeWebProps} {...props} {...triggerProps}>\n {props.children}\n </Pressable>\n );\n }\n}\n\n/**\n * @hidden\n */\nexport function isTabTrigger(\n child: ReactElement<any>\n): child is ReactElement<ComponentProps<typeof TabTrigger>> {\n return child.type === TabTrigger;\n}\n\n/**\n * Options for `switchTab` function.\n */\nexport type SwitchToOptions = {\n /**\n * Navigate and reset the history.\n */\n reset?: ExpoTabsResetValue;\n};\n\nexport type Trigger = TriggerMap[string] & {\n isFocused: boolean;\n resolvedHref: string;\n route: TabNavigationState<any>['routes'][number];\n};\n\nexport type UseTabTriggerResult = {\n switchTab: (name: string, options: SwitchToOptions) => void;\n getTrigger: (name: string) => Trigger | undefined;\n trigger?: Trigger;\n triggerProps: TriggerProps;\n};\n\nexport type TriggerProps = {\n isFocused: boolean;\n onPress: PressableProps['onPress'];\n onLongPress: PressableProps['onLongPress'];\n};\n\n/**\n * Utility hook creating custom `TabTrigger`.\n */\nexport function useTabTrigger(options: TabTriggerProps): UseTabTriggerResult {\n const { state, navigation } = useNavigatorContext();\n const { name, reset, onPress, onLongPress } = options;\n const triggerMap = useContext(TabTriggerMapContext);\n\n const getTrigger = useCallback(\n (name: string) => {\n const config = triggerMap[name];\n\n if (!config) {\n return;\n }\n\n return {\n isFocused: state.index === config.index,\n route: state.routes[config.index],\n resolvedHref: stripGroupSegmentsFromPath(appendBaseUrl(config.href)),\n ...config,\n };\n },\n [triggerMap]\n );\n\n const trigger = name !== undefined ? getTrigger(name) : undefined;\n\n const switchTab = useCallback(\n (name: string, options?: SwitchToOptions) => {\n const config = triggerMap[name];\n\n if (config) {\n if (config.type === 'external') {\n return router.navigate(config.href);\n } else {\n return navigation?.dispatch({\n type: 'JUMP_TO',\n payload: {\n name,\n ...options,\n },\n });\n }\n } else {\n return navigation?.dispatch({\n type: 'JUMP_TO',\n payload: {\n name,\n },\n });\n }\n },\n [navigation, triggerMap]\n );\n\n const handleOnPress = useCallback<NonNullable<PressableProps['onPress']>>(\n (event) => {\n onPress?.(event);\n if (!trigger) return;\n if (event?.isDefaultPrevented()) return;\n\n navigation?.emit({\n type: 'tabPress',\n target: trigger.type === 'internal' ? trigger.route.key : trigger?.href,\n canPreventDefault: true,\n });\n\n if (!shouldHandleMouseEvent(event)) return;\n\n switchTab(name, { reset: reset !== 'onLongPress' ? reset : undefined });\n },\n [onPress, name, reset, trigger]\n );\n\n const handleOnLongPress = useCallback<NonNullable<PressableProps['onPress']>>(\n (event) => {\n onPress?.(event);\n if (!trigger) return;\n if (event?.isDefaultPrevented()) return;\n\n navigation?.emit({\n type: 'tabLongPress',\n target: trigger.type === 'internal' ? trigger.route.key : trigger?.href,\n });\n\n if (!shouldHandleMouseEvent(event)) return;\n\n switchTab(name, {\n reset: reset === 'onLongPress' ? 'always' : reset,\n });\n },\n [onLongPress, name, reset, trigger]\n );\n\n const triggerProps = {\n isFocused: Boolean(trigger?.isFocused),\n onPress: handleOnPress,\n onLongPress: handleOnLongPress,\n };\n\n return {\n switchTab,\n getTrigger,\n trigger,\n triggerProps,\n };\n}\n\nconst styles = StyleSheet.create({\n tabTrigger: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n});\n"]}
1
+ {"version":3,"file":"TabTrigger.js","sourceRoot":"","sources":["../../src/ui/TabTrigger.tsx"],"names":[],"mappings":";;AAqEA,gCA4BC;AAKD,oCAIC;AAkCD,sCAwGC;AApPD,qDAA4C;AAE5C,iCAAkF;AAClF,+CAA2E;AAE3E,6CAAoD;AAGpD,+DAAyD;AACzD,sDAA2C;AAC3C,mEAAoE;AACpE,0CAAyD;AAEzD,kDAAyD;AAqCzD,MAAM,cAAc,GAAG,iBAA4D,CAAC;AAEpF;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,GAAG,SAAS,EAAE,GAAG,KAAK,EAAmB;IAC9F,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,aAAa,CAAC;QAC9C,IAAI;QACJ,KAAK;QACL,GAAG,KAAK;KACT,CAAC,CAAC;IAEH,sFAAsF;IACtF,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CACL,CAAC,cAAc,CACb,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CACzB,IAAI,KAAK,CAAC,CACV,IAAI,YAAY,CAAC,CACjB,IAAI,CAAC,CAAC,OAAO,EAAE,YAAY,CAAC,CAC5B;QAAA,CAAC,KAAK,CAAC,QAAQ,CACjB;MAAA,EAAE,cAAc,CAAC,CAClB,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,iEAAiE;QACjE,MAAM,mBAAmB,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;QAE5D,OAAO,CACL,CAAC,wBAAS,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,mBAAmB,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,YAAY,CAAC,C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iB,GAAG,IAAA,mBAAW,EACnC,CAAC,KAAK,EAAE,EAAE;QACR,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;QACjB,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,IAAI,KAAK,EAAE,kBAAkB,EAAE;YAAE,OAAO;QAExC,UAAU,EAAE,IAAI,CAAC;YACf,IAAI,EAAE,cAAc;YACpB,MAAM,EAAE,OAAO,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI;SACxE,CAAC,CAAC;QAEH,IAAI,CAAC,IAAA,2CAAsB,EAAC,KAAK,CAAC;YAAE,OAAO;QAE3C,SAAS,CAAC,IAAI,EAAE;YACd,KAAK,EAAE,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK;SAClD,CAAC,CAAC;IACL,CAAC,EACD,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CACpC,CAAC;IAEF,MAAM,YAAY,GAAG;QACnB,SAAS,EAAE,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC;QACtC,OAAO,EAAE,aAAa;QACtB,WAAW,EAAE,iBAAiB;KAC/B,CAAC;IAEF,OAAO;QACL,SAAS;QACT,UAAU;QACV,OAAO;QACP,YAAY;KACb,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,UAAU,EAAE;QACV,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,eAAe;KAChC;CACF,CAAC,CAAC","sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport { TabNavigationState } from '@react-navigation/native';\nimport { ReactNode, use, ReactElement, ComponentProps, useCallback } from 'react';\nimport { View, StyleSheet, Pressable, PressableProps } from 'react-native';\n\nimport { TabTriggerMapContext } from './TabContext';\nimport { ExpoTabsResetValue } from './TabRouter';\nimport type { TriggerMap } from './common';\nimport { appendBaseUrl } from '../fork/getPathFromState';\nimport { router } from '../imperative-api';\nimport { shouldHandleMouseEvent } from '../link/useLinkToPathProps';\nimport { stripGroupSegmentsFromPath } from '../matchers';\nimport type { Href } from '../types';\nimport { useNavigatorContext } from '../views/Navigator';\n\ntype PressablePropsWithoutFunctionChildren = Omit<PressableProps, 'children'> & {\n children?: ReactNode | undefined;\n};\n\nexport type TabTriggerProps = PressablePropsWithoutFunctionChildren & {\n /**\n * Name of tab. When used within a `TabList` this sets the name of the tab.\n * Otherwise, this references the name.\n */\n name: string;\n /**\n * Name of tab. Required when used within a `TabList`.\n */\n href?: Href;\n /**\n * Forward props to child component. Useful for custom wrappers.\n */\n asChild?: boolean;\n /**\n * Resets the route when switching to a tab.\n */\n reset?: SwitchToOptions['reset'] | 'onLongPress';\n};\n\nexport type TabTriggerOptions = {\n name: string;\n href: Href;\n};\n\nexport type TabTriggerSlotProps = PressablePropsWithoutFunctionChildren &\n React.RefAttributes<View> & {\n isFocused?: boolean;\n href?: string;\n };\n\nconst TabTriggerSlot = Slot as React.ForwardRefExoticComponent<TabTriggerSlotProps>;\n\n/**\n * Creates a trigger to navigate to a tab. When used as child of `TabList`, its\n * functionality slightly changes since the `href` prop is required,\n * and the trigger also defines what routes are present in the `Tabs`.\n *\n * When used outside of `TabList`, this component no longer requires an `href`.\n *\n * @example\n * ```tsx\n * <Tabs>\n * <TabSlot />\n * <TabList>\n * <TabTrigger name=\"home\" href=\"/\" />\n * </TabList>\n * </Tabs>\n * ```\n */\nexport function TabTrigger({ asChild, name, href, reset = 'onFocus', ...props }: TabTriggerProps) {\n const { trigger, triggerProps } = useTabTrigger({\n name,\n reset,\n ...props,\n });\n\n // Pressable doesn't accept the extra props, so only pass them if we are using asChild\n if (asChild) {\n return (\n <TabTriggerSlot\n style={styles.tabTrigger}\n {...props}\n {...triggerProps}\n href={trigger?.resolvedHref}>\n {props.children}\n </TabTriggerSlot>\n );\n } else {\n // These props are not typed, but are allowed by React Native Web\n const reactNativeWebProps = { href: trigger?.resolvedHref };\n\n return (\n <Pressable style={styles.tabTrigger} {...reactNativeWebProps} {...props} {...triggerProps}>\n {props.children}\n </Pressable>\n );\n }\n}\n\n/**\n * @hidden\n */\nexport function isTabTrigger(\n child: ReactElement<any>\n): child is ReactElement<ComponentProps<typeof TabTrigger>> {\n return child.type === TabTrigger;\n}\n\n/**\n * Options for `switchTab` function.\n */\nexport type SwitchToOptions = {\n /**\n * Navigate and reset the history.\n */\n reset?: ExpoTabsResetValue;\n};\n\nexport type Trigger = TriggerMap[string] & {\n isFocused: boolean;\n resolvedHref: string;\n route: TabNavigationState<any>['routes'][number];\n};\n\nexport type UseTabTriggerResult = {\n switchTab: (name: string, options: SwitchToOptions) => void;\n getTrigger: (name: string) => Trigger | undefined;\n trigger?: Trigger;\n triggerProps: TriggerProps;\n};\n\nexport type TriggerProps = {\n isFocused: boolean;\n onPress: PressableProps['onPress'];\n onLongPress: PressableProps['onLongPress'];\n};\n\n/**\n * Utility hook creating custom `TabTrigger`.\n */\nexport function useTabTrigger(options: TabTriggerProps): UseTabTriggerResult {\n const { state, navigation } = useNavigatorContext();\n const { name, reset, onPress, onLongPress } = options;\n const triggerMap = use(TabTriggerMapContext);\n\n const getTrigger = useCallback(\n (name: string) => {\n const config = triggerMap[name];\n\n if (!config) {\n return;\n }\n\n return {\n isFocused: state.index === config.index,\n route: state.routes[config.index],\n resolvedHref: stripGroupSegmentsFromPath(appendBaseUrl(config.href)),\n ...config,\n };\n },\n [triggerMap]\n );\n\n const trigger = name !== undefined ? getTrigger(name) : undefined;\n\n const switchTab = useCallback(\n (name: string, options?: SwitchToOptions) => {\n const config = triggerMap[name];\n\n if (config) {\n if (config.type === 'external') {\n return router.navigate(config.href);\n } else {\n return navigation?.dispatch({\n type: 'JUMP_TO',\n payload: {\n name,\n ...options,\n },\n });\n }\n } else {\n return navigation?.dispatch({\n type: 'JUMP_TO',\n payload: {\n name,\n },\n });\n }\n },\n [navigation, triggerMap]\n );\n\n const handleOnPress = useCallback<NonNullable<PressableProps['onPress']>>(\n (event) => {\n onPress?.(event);\n if (!trigger) return;\n if (event?.isDefaultPrevented()) return;\n\n navigation?.emit({\n type: 'tabPress',\n target: trigger.type === 'internal' ? trigger.route.key : trigger?.href,\n canPreventDefault: true,\n });\n\n if (!shouldHandleMouseEvent(event)) return;\n\n switchTab(name, { reset: reset !== 'onLongPress' ? reset : undefined });\n },\n [onPress, name, reset, trigger]\n );\n\n const handleOnLongPress = useCallback<NonNullable<PressableProps['onPress']>>(\n (event) => {\n onPress?.(event);\n if (!trigger) return;\n if (event?.isDefaultPrevented()) return;\n\n navigation?.emit({\n type: 'tabLongPress',\n target: trigger.type === 'internal' ? trigger.route.key : trigger?.href,\n });\n\n if (!shouldHandleMouseEvent(event)) return;\n\n switchTab(name, {\n reset: reset === 'onLongPress' ? 'always' : reset,\n });\n },\n [onLongPress, name, reset, trigger]\n );\n\n const triggerProps = {\n isFocused: Boolean(trigger?.isFocused),\n onPress: handleOnPress,\n onLongPress: handleOnLongPress,\n };\n\n return {\n switchTab,\n getTrigger,\n trigger,\n triggerProps,\n };\n}\n\nconst styles = StyleSheet.create({\n tabTrigger: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../src/ui/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EAEvB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAEjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EASL,iBAAiB,EAClB,MAAM,OAAO,CAAC;AACf,OAAO,EAAc,SAAS,EAAQ,MAAM,cAAc,CAAC;AAE3D,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EAErB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAKtB,OAAO,EAAoB,aAAa,EAAqB,MAAM,UAAU,CAAC;AAQ9E,cAAc,cA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;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,gBAAgB,CAiEzF"}
package/build/ui/Tabs.js CHANGED
@@ -106,10 +106,10 @@ function useTabsWithChildren(options) {
106
106
  function useTabsWithTriggers(options) {
107
107
  const { triggers, ...rest } = options;
108
108
  // Ensure we extend the parent triggers, so we can trigger them as well
109
- const parentTriggerMap = (0, react_1.useContext)(TabContext_1.TabTriggerMapContext);
109
+ const parentTriggerMap = (0, react_1.use)(TabContext_1.TabTriggerMapContext);
110
110
  const routeNode = (0, Route_1.useRouteNode)();
111
111
  const contextKey = (0, Route_1.useContextKey)();
112
- const linking = (0, react_1.useContext)(native_1.LinkingContext).options;
112
+ const linking = (0, react_1.use)(native_1.LinkingContext).options;
113
113
  const routeInfo = (0, hooks_1.useRouteInfo)();
114
114
  if (!routeNode || !linking) {
115
115
  throw new Error('No RouteNode. This is likely a bug in expo-router.');
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../src/ui/Tabs.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAmFA,oBAsBC;AA2BD,kDAGC;AAgBD,kDAiEC;AAxND,qDAQkC;AAClC,iCAUe;AACf,+CAA2D;AAE3D,6CAKsB;AACtB,uCAAsC;AACtC,2CAAkE;AAClE,uCAAsC;AACtC,6CAA4C;AAC5C,qCAA8E;AAC9E,iDAA8C;AAC9C,oCAAuD;AACvD,oCAAwC;AACxC,uCAA2C;AAC3C,sCAAoD;AACpD,kDAA6E;AAE7E,+CAA6B;AAC7B,4CAA0B;AAC1B,4CAA0B;AAC1B,+CAA6B;AA0B7B;;;;;;;;;;;;;GAaG;AACH,SAAgB,IAAI,CAAC,KAAgB;IACnC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACtD,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,yBAAgB,CAAC,CAAC,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ingContext,\n ParamListBase,\n TabActionHelpers,\n TabNavigationState,\n TabRouterOptions,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport {\n Children,\n ComponentProps,\n Fragment,\n ReactElement,\n ReactNode,\n isValidElement,\n useContext,\n useMemo,\n PropsWithChildren,\n} from 'react';\nimport { StyleSheet, ViewProps, View } from 'react-native';\n\nimport {\n ExpoTabsScreenOptions,\n TabNavigationEventMap,\n TabTriggerMapContext,\n TabsContextValue,\n} from './TabContext';\nimport { isTabList } from './TabList';\nimport { ExpoTabRouter, ExpoTabRouterOptions } from './TabRouter';\nimport { isTabSlot } from './TabSlot';\nimport { isTabTrigger } from './TabTrigger';\nimport { SafeAreaViewSlot, ScreenTrigger, triggersToScreens } from './common';\nimport { useComponent } from './useComponent';\nimport { useRouteNode, useContextKey } from '../Route';\nimport { useRouteInfo } from '../hooks';\nimport { resolveHref } from '../link/href';\nimport { shouldLinkExternally } from '../utils/url';\nimport { NavigatorContext, NavigatorContextValue } from '../views/Navigator';\n\nexport * from './TabContext';\nexport * from './TabList';\nexport * from './TabSlot';\nexport * from './TabTrigger';\nexport { ExpoTabsResetValue } from './TabRouter';\n\n/**\n * Options to provide to the Tab Router.\n */\nexport type UseTabsOptions = Omit<\n DefaultNavigatorOptions<\n ParamListBase,\n any,\n TabNavigationState<any>,\n ExpoTabsScreenOptions,\n TabNavigationEventMap,\n any\n >,\n 'children'\n> & {\n backBehavior?: TabRouterOptions['backBehavior'];\n};\n\nexport type TabsProps = ViewProps & {\n /** Forward props to child component and removes the extra `<View>`. Useful for custom wrappers. */\n asChild?: boolean;\n options?: UseTabsOptions;\n};\n\n/**\n * Root component for the headless tabs.\n *\n * @see [`useTabsWithChildren`](#usetabswithchildrenoptions) for a hook version of this component.\n * @example\n * ```tsx\n * <Tabs>\n * <TabSlot />\n * <TabList>\n * <TabTrigger name=\"home\" href=\"/\" />\n * </TabList>\n * </Tabs>\n * ```\n */\nexport function Tabs(props: TabsProps) {\n const { children, asChild, options, ...rest } = props;\n const Comp = asChild ? SafeAreaViewSlot : View;\n\n const { NavigationContent } = useTabsWithChildren({\n // asChild adds an extra layer, so we need to process the child's children\n children:\n asChild &&\n isValidElement(children) &&\n children.props &&\n typeof children.props === 'object' &&\n 'children' in children.props\n ? (children.props.children as ReactNode)\n : children,\n ...options,\n });\n\n return (\n <Comp style={styles.tabsRoot} {...rest}>\n <NavigationContent>{children}</NavigationContent>\n </Comp>\n );\n}\n\n// @docsMissing\nexport type UseTabsWithChildrenOptions = PropsWithChildren<UseTabsOptions>;\n\n// @docsMissing\nexport type UseTabsWithTriggersOptions = UseTabsOptions & {\n triggers: ScreenTrigger[];\n};\n\n/**\n * Hook version of `Tabs`. The returned NavigationContent component\n * should be rendered. Using the hook requires using the `<TabList />`\n * and `<TabTrigger />` components exported from Expo Router.\n *\n * The `useTabsWithTriggers()` hook can be used for custom components.\n *\n * @see [`Tabs`](#tabs) for the component version of this hook.\n * @example\n * ```tsx\n * export function MyTabs({ children }) {\n * const { NavigationContent } = useTabsWithChildren({ children })\n *\n * return <NavigationContent />\n * }\n * ```\n */\nexport function useTabsWithChildren(options: UseTabsWithChildrenOptions) {\n const { children, ...rest } = options;\n return useTabsWithTriggers({ triggers: parseTriggersFromChildren(children), ...rest });\n}\n\n/**\n * Alternative hook version of `Tabs` that uses explicit triggers\n * instead of `children`.\n *\n * @see [`Tabs`](#tabs) for the component version of this hook.\n * @example\n * ```tsx\n * export function MyTabs({ children }) {\n * const { NavigationContent } = useTabsWithChildren({ triggers: [] })\n *\n * return <NavigationContent />\n * }\n * ```\n */\nexport function useTabsWithTriggers(options: UseTabsWithTriggersOptions): TabsContextValue {\n const { triggers, ...rest } = options;\n // Ensure we extend the parent triggers, so we can trigger them as well\n const parentTriggerMap = useContext(TabTriggerMapContext);\n const routeNode = useRouteNode();\n const contextKey = useContextKey();\n const linking = useContext(LinkingContext).options;\n const routeInfo = useRouteInfo();\n\n if (!routeNode || !linking) {\n throw new Error('No RouteNode. This is likely a bug in expo-router.');\n }\n\n const initialRouteName = routeNode.initialRouteName;\n\n const { children, triggerMap } = triggersToScreens(\n triggers,\n routeNode,\n linking,\n initialRouteName,\n parentTriggerMap,\n routeInfo,\n contextKey\n );\n\n const navigatorContext = useNavigationBuilder<\n TabNavigationState<any>,\n ExpoTabRouterOptions,\n TabActionHelpers<ParamListBase>,\n ExpoTabsScreenOptions,\n TabNavigationEventMap\n >(ExpoTabRouter, {\n children,\n ...rest,\n triggerMap,\n id: contextKey,\n initialRouteName,\n });\n\n const {\n state,\n descriptors,\n navigation,\n describe,\n NavigationContent: RNNavigationContent,\n } = navigatorContext;\n\n const navigatorContextValue = useMemo<NavigatorContextValue>(\n () => ({\n ...(navigatorContext as unknown as ReturnType<typeof useNavigationBuilder>),\n contextKey,\n router: ExpoTabRouter,\n }),\n [navigatorContext, contextKey, ExpoTabRouter]\n );\n\n const NavigationContent = useComponent((children: React.ReactNode) => (\n <TabTriggerMapContext.Provider value={triggerMap}>\n <NavigatorContext.Provider value={navigatorContextValue}>\n <RNNavigationContent>{children}</RNNavigationContent>\n </NavigatorContext.Provider>\n </TabTriggerMapContext.Provider>\n )) as TabsContextValue['NavigationContent'];\n\n return { state, descriptors, navigation, NavigationContent, describe };\n}\n\nfunction parseTriggersFromChildren(\n children: ReactNode,\n screenTriggers: ScreenTrigger[] = [],\n isInTabList = false\n) {\n Children.forEach(children, (child) => {\n if (!child || !isValidElement(child) || isTabSlot(child)) {\n return;\n }\n\n if (isFragment(child) && typeof child.props.children !== 'function') {\n return parseTriggersFromChildren(\n child.props.children,\n screenTriggers,\n isInTabList || isTabList(child)\n );\n }\n\n if (isTabList(child) && typeof child.props.children !== 'function') {\n let children = child.props.children;\n\n // <TabList asChild /> adds an extra layer. We need to parse the child's children\n if (\n child.props.asChild &&\n isValidElement(children) &&\n children.props &&\n typeof children.props === 'object' &&\n 'children' in children.props\n ) {\n children = children.props.children as ReactNode;\n }\n\n return parseTriggersFromChildren(children, screenTriggers, isInTabList || isTabList(child));\n }\n\n // We should only process TabTriggers within the TabList. All other components will be ignored\n if (!isInTabList || !isTabTrigger(child)) {\n return;\n }\n\n const { href, name } = child.props;\n\n if (!href) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n `<TabTrigger name={${name}}> does not have a 'href' prop. TabTriggers within a <TabList /> are required to have an href.`\n );\n }\n return;\n }\n\n const resolvedHref = resolveHref(href);\n\n if (shouldLinkExternally(resolvedHref)) {\n return screenTriggers.push({\n type: 'external',\n name,\n href: resolvedHref,\n });\n }\n\n if (!name) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n `<TabTrigger> does not have a 'name' prop. TabTriggers within a <TabList /> are required to have a name.`\n );\n }\n return;\n }\n\n return screenTriggers.push({ type: 'internal', href: resolvedHref, name });\n });\n\n return screenTriggers;\n}\n\nfunction isFragment(\n child: ReactElement<any>\n): child is ReactElement<ComponentProps<typeof Fragment>> {\n return child.type === Fragment;\n}\n\nconst styles = StyleSheet.create({\n tabsRoot: {\n flex: 1,\n },\n});\n"]}
1
+ {"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../src/ui/Tabs.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAmFA,oBAsBC;AA2BD,kDAGC;AAgBD,kDAiEC;AAxND,qDAQkC;AAClC,iCAUe;AACf,+CAA2D;AAE3D,6CAKsB;AACtB,uCAAsC;AACtC,2CAAkE;AAClE,uCAAsC;AACtC,6CAA4C;AAC5C,qCAA8E;AAC9E,iDAA8C;AAC9C,oCAAuD;AACvD,oCAAwC;AACxC,uCAA2C;AAC3C,sCAAoD;AACpD,kDAA6E;AAE7E,+CAA6B;AAC7B,4CAA0B;AAC1B,4CAA0B;AAC1B,+CAA6B;AA0B7B;;;;;;;;;;;;;GAaG;AACH,SAAgB,IAAI,CAAC,KAAgB;IACnC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACtD,MAAM,IAAI,GAAG,OAAO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","sourcesContent":["import {\n DefaultNavigatorOptions,\n LinkingContext,\n ParamListBase,\n TabActionHelpers,\n TabNavigationState,\n TabRouterOptions,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport {\n Children,\n ComponentProps,\n Fragment,\n ReactElement,\n ReactNode,\n isValidElement,\n use,\n useMemo,\n PropsWithChildren,\n} from 'react';\nimport { StyleSheet, ViewProps, View } from 'react-native';\n\nimport {\n ExpoTabsScreenOptions,\n TabNavigationEventMap,\n TabTriggerMapContext,\n TabsContextValue,\n} from './TabContext';\nimport { isTabList } from './TabList';\nimport { ExpoTabRouter, ExpoTabRouterOptions } from './TabRouter';\nimport { isTabSlot } from './TabSlot';\nimport { isTabTrigger } from './TabTrigger';\nimport { SafeAreaViewSlot, ScreenTrigger, triggersToScreens } from './common';\nimport { useComponent } from './useComponent';\nimport { useRouteNode, useContextKey } from '../Route';\nimport { useRouteInfo } from '../hooks';\nimport { resolveHref } from '../link/href';\nimport { shouldLinkExternally } from '../utils/url';\nimport { NavigatorContext, NavigatorContextValue } from '../views/Navigator';\n\nexport * from './TabContext';\nexport * from './TabList';\nexport * from './TabSlot';\nexport * from './TabTrigger';\nexport { ExpoTabsResetValue } from './TabRouter';\n\n/**\n * Options to provide to the Tab Router.\n */\nexport type UseTabsOptions = Omit<\n DefaultNavigatorOptions<\n ParamListBase,\n any,\n TabNavigationState<any>,\n ExpoTabsScreenOptions,\n TabNavigationEventMap,\n any\n >,\n 'children'\n> & {\n backBehavior?: TabRouterOptions['backBehavior'];\n};\n\nexport type TabsProps = ViewProps & {\n /** Forward props to child component and removes the extra `<View>`. Useful for custom wrappers. */\n asChild?: boolean;\n options?: UseTabsOptions;\n};\n\n/**\n * Root component for the headless tabs.\n *\n * @see [`useTabsWithChildren`](#usetabswithchildrenoptions) for a hook version of this component.\n * @example\n * ```tsx\n * <Tabs>\n * <TabSlot />\n * <TabList>\n * <TabTrigger name=\"home\" href=\"/\" />\n * </TabList>\n * </Tabs>\n * ```\n */\nexport function Tabs(props: TabsProps) {\n const { children, asChild, options, ...rest } = props;\n const Comp = asChild ? SafeAreaViewSlot : View;\n\n const { NavigationContent } = useTabsWithChildren({\n // asChild adds an extra layer, so we need to process the child's children\n children:\n asChild &&\n isValidElement(children) &&\n children.props &&\n typeof children.props === 'object' &&\n 'children' in children.props\n ? (children.props.children as ReactNode)\n : children,\n ...options,\n });\n\n return (\n <Comp style={styles.tabsRoot} {...rest}>\n <NavigationContent>{children}</NavigationContent>\n </Comp>\n );\n}\n\n// @docsMissing\nexport type UseTabsWithChildrenOptions = PropsWithChildren<UseTabsOptions>;\n\n// @docsMissing\nexport type UseTabsWithTriggersOptions = UseTabsOptions & {\n triggers: ScreenTrigger[];\n};\n\n/**\n * Hook version of `Tabs`. The returned NavigationContent component\n * should be rendered. Using the hook requires using the `<TabList />`\n * and `<TabTrigger />` components exported from Expo Router.\n *\n * The `useTabsWithTriggers()` hook can be used for custom components.\n *\n * @see [`Tabs`](#tabs) for the component version of this hook.\n * @example\n * ```tsx\n * export function MyTabs({ children }) {\n * const { NavigationContent } = useTabsWithChildren({ children })\n *\n * return <NavigationContent />\n * }\n * ```\n */\nexport function useTabsWithChildren(options: UseTabsWithChildrenOptions) {\n const { children, ...rest } = options;\n return useTabsWithTriggers({ triggers: parseTriggersFromChildren(children), ...rest });\n}\n\n/**\n * Alternative hook version of `Tabs` that uses explicit triggers\n * instead of `children`.\n *\n * @see [`Tabs`](#tabs) for the component version of this hook.\n * @example\n * ```tsx\n * export function MyTabs({ children }) {\n * const { NavigationContent } = useTabsWithChildren({ triggers: [] })\n *\n * return <NavigationContent />\n * }\n * ```\n */\nexport function useTabsWithTriggers(options: UseTabsWithTriggersOptions): TabsContextValue {\n const { triggers, ...rest } = options;\n // Ensure we extend the parent triggers, so we can trigger them as well\n const parentTriggerMap = use(TabTriggerMapContext);\n const routeNode = useRouteNode();\n const contextKey = useContextKey();\n const linking = use(LinkingContext).options;\n const routeInfo = useRouteInfo();\n\n if (!routeNode || !linking) {\n throw new Error('No RouteNode. This is likely a bug in expo-router.');\n }\n\n const initialRouteName = routeNode.initialRouteName;\n\n const { children, triggerMap } = triggersToScreens(\n triggers,\n routeNode,\n linking,\n initialRouteName,\n parentTriggerMap,\n routeInfo,\n contextKey\n );\n\n const navigatorContext = useNavigationBuilder<\n TabNavigationState<any>,\n ExpoTabRouterOptions,\n TabActionHelpers<ParamListBase>,\n ExpoTabsScreenOptions,\n TabNavigationEventMap\n >(ExpoTabRouter, {\n children,\n ...rest,\n triggerMap,\n id: contextKey,\n initialRouteName,\n });\n\n const {\n state,\n descriptors,\n navigation,\n describe,\n NavigationContent: RNNavigationContent,\n } = navigatorContext;\n\n const navigatorContextValue = useMemo<NavigatorContextValue>(\n () => ({\n ...(navigatorContext as unknown as ReturnType<typeof useNavigationBuilder>),\n contextKey,\n router: ExpoTabRouter,\n }),\n [navigatorContext, contextKey, ExpoTabRouter]\n );\n\n const NavigationContent = useComponent((children: React.ReactNode) => (\n <TabTriggerMapContext.Provider value={triggerMap}>\n <NavigatorContext.Provider value={navigatorContextValue}>\n <RNNavigationContent>{children}</RNNavigationContent>\n </NavigatorContext.Provider>\n </TabTriggerMapContext.Provider>\n )) as TabsContextValue['NavigationContent'];\n\n return { state, descriptors, navigation, NavigationContent, describe };\n}\n\nfunction parseTriggersFromChildren(\n children: ReactNode,\n screenTriggers: ScreenTrigger[] = [],\n isInTabList = false\n) {\n Children.forEach(children, (child) => {\n if (!child || !isValidElement(child) || isTabSlot(child)) {\n return;\n }\n\n if (isFragment(child) && typeof child.props.children !== 'function') {\n return parseTriggersFromChildren(\n child.props.children,\n screenTriggers,\n isInTabList || isTabList(child)\n );\n }\n\n if (isTabList(child) && typeof child.props.children !== 'function') {\n let children = child.props.children;\n\n // <TabList asChild /> adds an extra layer. We need to parse the child's children\n if (\n child.props.asChild &&\n isValidElement(children) &&\n children.props &&\n typeof children.props === 'object' &&\n 'children' in children.props\n ) {\n children = children.props.children as ReactNode;\n }\n\n return parseTriggersFromChildren(children, screenTriggers, isInTabList || isTabList(child));\n }\n\n // We should only process TabTriggers within the TabList. All other components will be ignored\n if (!isInTabList || !isTabTrigger(child)) {\n return;\n }\n\n const { href, name } = child.props;\n\n if (!href) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n `<TabTrigger name={${name}}> does not have a 'href' prop. TabTriggers within a <TabList /> are required to have an href.`\n );\n }\n return;\n }\n\n const resolvedHref = resolveHref(href);\n\n if (shouldLinkExternally(resolvedHref)) {\n return screenTriggers.push({\n type: 'external',\n name,\n href: resolvedHref,\n });\n }\n\n if (!name) {\n if (process.env.NODE_ENV === 'development') {\n console.warn(\n `<TabTrigger> does not have a 'name' prop. TabTriggers within a <TabList /> are required to have a name.`\n );\n }\n return;\n }\n\n return screenTriggers.push({ type: 'internal', href: resolvedHref, name });\n });\n\n return screenTriggers;\n}\n\nfunction isFragment(\n child: ReactElement<any>\n): child is ReactElement<ComponentProps<typeof Fragment>> {\n return child.type === Fragment;\n}\n\nconst styles = StyleSheet.create({\n tabsRoot: {\n flex: 1,\n },\n});\n"]}
@@ -24,7 +24,7 @@ function StandardErrorView({ error }) {
24
24
  </react_native_1.View>);
25
25
  }
26
26
  function ErrorBoundary({ error, retry }) {
27
- const inTabBar = (0, react_1.useContext)(bottom_tabs_1.BottomTabBarHeightContext);
27
+ const inTabBar = (0, react_1.use)(bottom_tabs_1.BottomTabBarHeightContext);
28
28
  const Wrapper = inTabBar ? react_native_1.View : react_native_safe_area_context_1.SafeAreaView;
29
29
  const isServerError = error instanceof errors_1.ReactServerError;
30
30
  return (<react_native_1.View style={styles.container}>