expo-router 7.0.0-canary-20260121-a63c0dd → 55.0.0-beta.0

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 (70) hide show
  1. package/android/build.gradle +2 -2
  2. package/build/Route.d.ts +1 -1
  3. package/build/Route.d.ts.map +1 -1
  4. package/build/Route.js.map +1 -1
  5. package/build/hooks.d.ts +2 -1
  6. package/build/hooks.d.ts.map +1 -1
  7. package/build/hooks.js +11 -4
  8. package/build/hooks.js.map +1 -1
  9. package/build/layouts/TabsClient.d.ts +23 -17
  10. package/build/layouts/TabsClient.d.ts.map +1 -1
  11. package/build/layouts/stack-utils/toolbar/StackToolbarButton.d.ts +3 -1
  12. package/build/layouts/stack-utils/toolbar/StackToolbarButton.d.ts.map +1 -1
  13. package/build/layouts/stack-utils/toolbar/StackToolbarButton.js.map +1 -1
  14. package/build/layouts/stack-utils/toolbar/StackToolbarMenu.d.ts +3 -1
  15. package/build/layouts/stack-utils/toolbar/StackToolbarMenu.d.ts.map +1 -1
  16. package/build/layouts/stack-utils/toolbar/StackToolbarMenu.js +4 -4
  17. package/build/layouts/stack-utils/toolbar/StackToolbarMenu.js.map +1 -1
  18. package/build/layouts/stack-utils/toolbar/StackToolbarSpacer.d.ts +0 -8
  19. package/build/layouts/stack-utils/toolbar/StackToolbarSpacer.d.ts.map +1 -1
  20. package/build/layouts/stack-utils/toolbar/StackToolbarSpacer.js +1 -1
  21. package/build/layouts/stack-utils/toolbar/StackToolbarSpacer.js.map +1 -1
  22. package/build/native-tabs/NativeBottomTabsNavigator.d.ts.map +1 -1
  23. package/build/native-tabs/NativeBottomTabsNavigator.js +2 -1
  24. package/build/native-tabs/NativeBottomTabsNavigator.js.map +1 -1
  25. package/build/native-tabs/types.d.ts +2 -0
  26. package/build/native-tabs/types.d.ts.map +1 -1
  27. package/build/native-tabs/types.js.map +1 -1
  28. package/build/testing-library/context-stubs.d.ts +2 -1
  29. package/build/testing-library/context-stubs.d.ts.map +1 -1
  30. package/build/testing-library/context-stubs.js.map +1 -1
  31. package/build/types.d.ts +0 -8
  32. package/build/types.d.ts.map +1 -1
  33. package/build/types.js.map +1 -1
  34. package/expo-module.config.json +1 -1
  35. package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd.module → 55.0.0-beta.0/expo.modules.router-55.0.0-beta.0.module} +7 -7
  36. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0-beta.0/expo.modules.router-55.0.0-beta.0.module.md5 +1 -0
  37. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0-beta.0/expo.modules.router-55.0.0-beta.0.module.sha1 +1 -0
  38. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0-beta.0/expo.modules.router-55.0.0-beta.0.module.sha256 +1 -0
  39. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0-beta.0/expo.modules.router-55.0.0-beta.0.module.sha512 +1 -0
  40. package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd.pom → 55.0.0-beta.0/expo.modules.router-55.0.0-beta.0.pom} +1 -1
  41. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0-beta.0/expo.modules.router-55.0.0-beta.0.pom.md5 +1 -0
  42. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0-beta.0/expo.modules.router-55.0.0-beta.0.pom.sha1 +1 -0
  43. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0-beta.0/expo.modules.router-55.0.0-beta.0.pom.sha256 +1 -0
  44. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0-beta.0/expo.modules.router-55.0.0-beta.0.pom.sha512 +1 -0
  45. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml +4 -4
  46. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.md5 +1 -1
  47. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha1 +1 -1
  48. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha256 +1 -1
  49. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha512 +1 -1
  50. package/package.json +16 -15
  51. package/plugin/tsconfig.tsbuildinfo +1 -0
  52. package/server.d.ts +1 -15
  53. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd.module.md5 +0 -1
  54. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd.module.sha1 +0 -1
  55. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd.module.sha256 +0 -1
  56. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd.module.sha512 +0 -1
  57. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd.pom.md5 +0 -1
  58. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd.pom.sha1 +0 -1
  59. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd.pom.sha256 +0 -1
  60. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd.pom.sha512 +0 -1
  61. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd-sources.jar → 55.0.0-beta.0/expo.modules.router-55.0.0-beta.0-sources.jar} +0 -0
  62. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd-sources.jar.md5 → 55.0.0-beta.0/expo.modules.router-55.0.0-beta.0-sources.jar.md5} +0 -0
  63. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd-sources.jar.sha1 → 55.0.0-beta.0/expo.modules.router-55.0.0-beta.0-sources.jar.sha1} +0 -0
  64. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd-sources.jar.sha256 → 55.0.0-beta.0/expo.modules.router-55.0.0-beta.0-sources.jar.sha256} +0 -0
  65. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd-sources.jar.sha512 → 55.0.0-beta.0/expo.modules.router-55.0.0-beta.0-sources.jar.sha512} +0 -0
  66. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd.aar → 55.0.0-beta.0/expo.modules.router-55.0.0-beta.0.aar} +0 -0
  67. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd.aar.md5 → 55.0.0-beta.0/expo.modules.router-55.0.0-beta.0.aar.md5} +0 -0
  68. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd.aar.sha1 → 55.0.0-beta.0/expo.modules.router-55.0.0-beta.0.aar.sha1} +0 -0
  69. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd.aar.sha256 → 55.0.0-beta.0/expo.modules.router-55.0.0-beta.0.aar.sha256} +0 -0
  70. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20260121-a63c0dd/expo.modules.router-7.0.0-canary-20260121-a63c0dd.aar.sha512 → 55.0.0-beta.0/expo.modules.router-55.0.0-beta.0.aar.sha512} +0 -0
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'expo.modules.router'
7
- version = '7.0.0-canary-20260121-a63c0dd'
7
+ version = '55.0.0-beta.0'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.router"
11
11
  defaultConfig {
12
12
  versionCode 1
13
- versionName "7.0.0-canary-20260121-a63c0dd"
13
+ versionName "55.0.0-beta.0"
14
14
  }
15
15
  lintOptions {
16
16
  abortOnError false
package/build/Route.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ import type { LoaderFunction } from 'expo-server';
1
2
  import { type ComponentType, type PropsWithChildren } from 'react';
2
3
  import { sortRoutesWithInitial, sortRoutes } from './sortRoutes';
3
- import { LoaderFunction } from './types';
4
4
  import { type ErrorBoundaryProps } from './views/Try';
5
5
  export type DynamicConvention = {
6
6
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpF,KAAK,MAAM,GA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,IAAA,qBAAa,EAAmB,IAAI,CAAC,CAAC;AACrD,QAAA,uBAAuB,GAAG,IAAA,qBAAa,EAAqB,EAAE,CAAC,CAAC;AAE7E,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;IAC1C,mBAAmB,CAAC,WAAW,GAAG,WAAW,CAAC;AAChD,CAAC;AAED,+DAA+D;AAC/D,SAAgB,YAAY;IAC1B,OAAO,IAAA,WAAG,EAAC,mBAAmB,CAAC,CAAC;AAClC,CAAC;AAED,SAAgB,aAAa;IAC3B,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC;IAC5B,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAA,wBAAa,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC;AAOD,iEAAiE;AACjE,SAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAc;IAC1D,OAAO,CACL,CAAC,+BAAuB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAC9C;MAAA,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CACrF;IAAA,EAAE,+BAAuB,CAAC,QAAQ,CAAC,CACpC,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { createContext, use, type ComponentType, type PropsWithChildren } from 'react';\n\nimport { getContextKey } from './matchers';\nimport { sortRoutesWithInitial, sortRoutes } from './sortRoutes';\nimport { LoaderFunction } from './types';\nimport { type ErrorBoundaryProps } from './views/Try';\n\nexport type DynamicConvention = { name: string; deep: boolean; notFound?: boolean };\n\ntype Params = Record<string, string | string[]>;\n\nexport type LoadedRoute = {\n ErrorBoundary?: ComponentType<ErrorBoundaryProps>;\n default?: ComponentType<any>;\n unstable_settings?: Record<string, any>;\n getNavOptions?: (args: any) => any;\n generateStaticParams?: (props: { params?: Params }) => Params[];\n loader?: LoaderFunction;\n};\n\nexport type LoadedMiddleware = Pick<LoadedRoute, 'default' | 'unstable_settings'>;\n\nexport type MiddlewareNode = {\n /** Context Module ID. Used to resolve the middleware module */\n contextKey: string;\n /** Loads middleware into memory. Returns the exports from +middleware.ts */\n loadRoute: () => Partial<LoadedMiddleware>;\n};\n\nexport type RouteNode = {\n /** The type of RouteNode */\n type: 'route' | 'api' | 'layout' | 'redirect' | 'rewrite';\n /** Load a route into memory. Returns the exports from a route. */\n loadRoute: () => Partial<LoadedRoute>;\n /** Loaded initial route name. */\n initialRouteName?: string;\n /** Nested routes */\n children: RouteNode[];\n /** Is the route a dynamic path */\n dynamic: null | DynamicConvention[];\n /** `index`, `error-boundary`, etc. */\n route: string;\n /** Context Module ID, used for matching children. */\n contextKey: string;\n /** Redirect Context Module ID, used for matching children. */\n destinationContextKey?: string;\n /** Parent Context Module ID, used for matching static routes to their parent dynamic route. */\n parentContextKey?: string;\n /** Is the redirect permanent. */\n permanent?: boolean;\n /** Added in-memory */\n generated?: boolean;\n /** Internal screens like the directory or the auto 404 should be marked as internal. */\n internal?: boolean;\n /** File paths for async entry modules that should be included in the initial chunk request to ensure the runtime JavaScript matches the statically rendered HTML representation. */\n entryPoints?: string[];\n /** HTTP methods for this route. If undefined, assumed to be ['GET'] */\n methods?: string[];\n /** Middleware function for server-side request processing. Only present on the root route node. */\n middleware?: MiddlewareNode;\n};\n\nconst CurrentRouteContext = createContext<RouteNode | null>(null);\nexport const LocalRouteParamsContext = createContext<object | undefined>({});\n\nif (process.env.NODE_ENV !== 'production') {\n CurrentRouteContext.displayName = 'RouteNode';\n}\n\n/** Return the RouteNode at the current contextual boundary. */\nexport function useRouteNode(): RouteNode | null {\n return use(CurrentRouteContext);\n}\n\nexport function useContextKey(): string {\n const node = useRouteNode();\n if (node == null) {\n throw new Error('No filename found. This is likely a bug in expo-router.');\n }\n return getContextKey(node.contextKey);\n}\n\nexport type RouteProps = PropsWithChildren<{\n node: RouteNode;\n params: object | undefined;\n}>;\n\n/** Provides the matching routes and filename to the children. */\nexport function Route({ children, node, params }: RouteProps) {\n return (\n <LocalRouteParamsContext.Provider value={params}>\n <CurrentRouteContext.Provider value={node}>{children}</CurrentRouteContext.Provider>\n </LocalRouteParamsContext.Provider>\n );\n}\n\nexport { sortRoutesWithInitial, sortRoutes };\n"]}
1
+ {"version":3,"file":"Route.js","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAwEb,oCAEC;AAED,sCAMC;AAQD,sBAMC;AA7FD,iCAAuF;AAEvF,yCAA2C;AAC3C,6CAAiE;AA4FxD,sGA5FA,kCAAqB,OA4FA;AAAE,2FA5FA,uBAAU,OA4FA;AAlC1C,MAAM,mBAAmB,GAAG,IAAA,qBAAa,EAAmB,IAAI,CAAC,CAAC;AACrD,QAAA,uBAAuB,GAAG,IAAA,qBAAa,EAAqB,EAAE,CAAC,CAAC;AAE7E,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;IAC1C,mBAAmB,CAAC,WAAW,GAAG,WAAW,CAAC;AAChD,CAAC;AAED,+DAA+D;AAC/D,SAAgB,YAAY;IAC1B,OAAO,IAAA,WAAG,EAAC,mBAAmB,CAAC,CAAC;AAClC,CAAC;AAED,SAAgB,aAAa;IAC3B,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC;IAC5B,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAA,wBAAa,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC;AAOD,iEAAiE;AACjE,SAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAc;IAC1D,OAAO,CACL,CAAC,+BAAuB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAC9C;MAAA,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CACrF;IAAA,EAAE,+BAAuB,CAAC,QAAQ,CAAC,CACpC,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport type { LoaderFunction } from 'expo-server';\nimport { createContext, use, type ComponentType, type PropsWithChildren } from 'react';\n\nimport { getContextKey } from './matchers';\nimport { sortRoutesWithInitial, sortRoutes } from './sortRoutes';\nimport { type ErrorBoundaryProps } from './views/Try';\n\nexport type DynamicConvention = { name: string; deep: boolean; notFound?: boolean };\n\ntype Params = Record<string, string | string[]>;\n\nexport type LoadedRoute = {\n ErrorBoundary?: ComponentType<ErrorBoundaryProps>;\n default?: ComponentType<any>;\n unstable_settings?: Record<string, any>;\n getNavOptions?: (args: any) => any;\n generateStaticParams?: (props: { params?: Params }) => Params[];\n loader?: LoaderFunction;\n};\n\nexport type LoadedMiddleware = Pick<LoadedRoute, 'default' | 'unstable_settings'>;\n\nexport type MiddlewareNode = {\n /** Context Module ID. Used to resolve the middleware module */\n contextKey: string;\n /** Loads middleware into memory. Returns the exports from +middleware.ts */\n loadRoute: () => Partial<LoadedMiddleware>;\n};\n\nexport type RouteNode = {\n /** The type of RouteNode */\n type: 'route' | 'api' | 'layout' | 'redirect' | 'rewrite';\n /** Load a route into memory. Returns the exports from a route. */\n loadRoute: () => Partial<LoadedRoute>;\n /** Loaded initial route name. */\n initialRouteName?: string;\n /** Nested routes */\n children: RouteNode[];\n /** Is the route a dynamic path */\n dynamic: null | DynamicConvention[];\n /** `index`, `error-boundary`, etc. */\n route: string;\n /** Context Module ID, used for matching children. */\n contextKey: string;\n /** Redirect Context Module ID, used for matching children. */\n destinationContextKey?: string;\n /** Parent Context Module ID, used for matching static routes to their parent dynamic route. */\n parentContextKey?: string;\n /** Is the redirect permanent. */\n permanent?: boolean;\n /** Added in-memory */\n generated?: boolean;\n /** Internal screens like the directory or the auto 404 should be marked as internal. */\n internal?: boolean;\n /** File paths for async entry modules that should be included in the initial chunk request to ensure the runtime JavaScript matches the statically rendered HTML representation. */\n entryPoints?: string[];\n /** HTTP methods for this route. If undefined, assumed to be ['GET'] */\n methods?: string[];\n /** Middleware function for server-side request processing. Only present on the root route node. */\n middleware?: MiddlewareNode;\n};\n\nconst CurrentRouteContext = createContext<RouteNode | null>(null);\nexport const LocalRouteParamsContext = createContext<object | undefined>({});\n\nif (process.env.NODE_ENV !== 'production') {\n CurrentRouteContext.displayName = 'RouteNode';\n}\n\n/** Return the RouteNode at the current contextual boundary. */\nexport function useRouteNode(): RouteNode | null {\n return use(CurrentRouteContext);\n}\n\nexport function useContextKey(): string {\n const node = useRouteNode();\n if (node == null) {\n throw new Error('No filename found. This is likely a bug in expo-router.');\n }\n return getContextKey(node.contextKey);\n}\n\nexport type RouteProps = PropsWithChildren<{\n node: RouteNode;\n params: object | undefined;\n}>;\n\n/** Provides the matching routes and filename to the children. */\nexport function Route({ children, node, params }: RouteProps) {\n return (\n <LocalRouteParamsContext.Provider value={params}>\n <CurrentRouteContext.Provider value={node}>{children}</CurrentRouteContext.Provider>\n </LocalRouteParamsContext.Provider>\n );\n}\n\nexport { sortRoutesWithInitial, sortRoutes };\n"]}
package/build/hooks.d.ts CHANGED
@@ -1,6 +1,7 @@
1
+ import type { LoaderFunction } from 'expo-server';
1
2
  import { useRouteInfo } from './global-state/router-store';
2
3
  import { Router } from './imperative-api';
3
- import { RouteParams, RouteSegments, UnknownOutputParams, Route, LoaderFunction } from './types';
4
+ import { RouteParams, RouteSegments, UnknownOutputParams, Route } from './types';
4
5
  export { useRouteInfo };
5
6
  /**
6
7
  * Returns the [navigation state](https://reactnavigation.org/docs/navigation-state/)
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.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AoB,CAAC,CAAC,SAAS,cAAc,CAAC,GAAG,CAAC,IACrD,CAAC,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;AAElD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,cAAc,CAAC,GAAG,CAAC,GAAG,GAAG,KAAK,oBAAoB,CAAC,CAAC,CAAC,CAyD5F"}
package/build/hooks.js CHANGED
@@ -246,6 +246,7 @@ class ReadOnlyURLSearchParams extends URLSearchParams {
246
246
  }
247
247
  const loaderDataCache = new Map();
248
248
  const loaderPromiseCache = new Map();
249
+ const loaderErrorCache = new Map();
249
250
  /**
250
251
  * Returns the result of the `loader` function for the calling route.
251
252
  *
@@ -284,6 +285,11 @@ function useLoaderData() {
284
285
  return globalThis.__EXPO_ROUTER_LOADER_DATA__[resolvedPath];
285
286
  }
286
287
  }
288
+ // Check error cache first to prevent infinite retry loops when a loader fails.
289
+ // We throw the cached error instead of starting a new fetch.
290
+ if (loaderErrorCache.has(resolvedPath)) {
291
+ throw loaderErrorCache.get(resolvedPath);
292
+ }
287
293
  // Check cache for route data
288
294
  if (loaderDataCache.has(resolvedPath)) {
289
295
  return loaderDataCache.get(resolvedPath);
@@ -293,16 +299,17 @@ function useLoaderData() {
293
299
  const promise = (0, utils_1.fetchLoaderModule)(resolvedPath)
294
300
  .then((data) => {
295
301
  loaderDataCache.set(resolvedPath, data);
302
+ loaderErrorCache.delete(resolvedPath);
303
+ loaderPromiseCache.delete(resolvedPath);
296
304
  return data;
297
305
  })
298
306
  .catch((error) => {
299
- console.error(`Failed to load loader data for route: ${resolvedPath}:`, error);
300
- throw new Error(`Failed to load loader data for route: ${resolvedPath}`, {
307
+ const wrappedError = new Error(`Failed to load loader data for route: ${resolvedPath}`, {
301
308
  cause: error,
302
309
  });
303
- })
304
- .finally(() => {
310
+ loaderErrorCache.set(resolvedPath, wrappedError);
305
311
  loaderPromiseCache.delete(resolvedPath);
312
+ throw wrappedError;
306
313
  });
307
314
  loaderPromiseCache.set(resolvedPath, promise);
308
315
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCb,wDAWC;AAMD,8CAEC;AAMD,8DAEC;AAmDD,8BAMC;AAOD,sDAEC;AA2CD,kCAEC;AAmBD,kCAEC;AA4CD,sDAEC;AAyCD,oDA+BC;AAED,0CAsBC;AAuCD,sCAkDC;AApaD,qDAAyE;AACzE,+CAAmC;AAEnC,mCAAgE;AAChE,2CAAiD;AACjD,8DAAkE;AAQzD,6FARO,2BAAY,OAQP;AAPrB,qDAAkD;AAClD,sCAA0C;AAC1C,4EAAoE;AACpE,+EAA4E;AAC5E,2CAAoD;AAKpD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,sBAAsB;IACpC,MAAM,MAAM;IACV,sDAAsD;IACtD,wFAAwF;IACxF,IAAA,sBAAa,GAAyC,CAAC,SAAS,CAAC,8BAAkB,CAAC,CAAC;IACvF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,gGAAgG,CACjG,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC3B,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,MAAM,qBAAqB,GAAG,CAAC,IAAY,EAAE,EAAE;IAC7C,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;QAC1C,OAAO,CAAC,IAAI,CACV,UAAU,IAAI,qHAAqH,CACpI,CAAC;IACJ,CAAC;AACH,C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b,eAAe,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;YACxC,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,OAAO,CAAC,KAAK,CAAC,yCAAyC,YAAY,GAAG,EAAE,KAAK,CAAC,CAAC;YAC/E,MAAM,IAAI,KAAK,CAAC,yCAAyC,YAAY,EAAE,EAAE;gBACvE,KAAK,EAAE,KAAK;aACb,CAAC,CAAC;QACL,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACZ,kBAAkB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;QAEL,kBAAkB,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,IAAA,WAAG,EAAC,kBAAkB,CAAC,GAAG,CAAC,YAAY,CAAE,CAAC,CAAC;AACpD,CAAC","sourcesContent":["'use client';\n\nimport { NavigationProp, useNavigation } from '@react-navigation/native';\nimport React, { use } from 'react';\n\nimport { LocalRouteParamsContext, useRouteNode } from './Route';\nimport { INTERNAL_SLOT_NAME } from './constants';\nimport { store, useRouteInfo } from './global-state/router-store';\nimport { router, Router } from './imperative-api';\nimport { resolveHref } from './link/href';\nimport { usePreviewInfo } from './link/preview/PreviewRouteContext';\nimport { ServerDataLoaderContext } from './loaders/ServerDataLoaderContext';\nimport { fetchLoaderModule } from './loaders/utils';\nimport { RouteParams, RouteSegments, UnknownOutputParams, Route, LoaderFunction } 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 const parent =\n // We assume that this is called from routes in __root\n // Users cannot customize the generated Sitemap or NotFound routes, so we should be safe\n useNavigation<NavigationProp<object, never, string>>().getParent(INTERNAL_SLOT_NAME);\n if (!parent) {\n throw new Error(\n 'useRootNavigationState was called from a generated route. This is likely a bug in Expo Router.'\n );\n }\n return parent.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\nconst displayWarningForProp = (prop: string) => {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `router.${prop} should not be used in a previewed screen. To fix this issue, wrap navigation calls with 'if (!isPreview) { ... }'.`\n );\n }\n};\n\nconst createNOOPWithWarning = (prop: string) => () => displayWarningForProp(prop);\n\nconst routerWithWarnings: Router = {\n back: createNOOPWithWarning('back'),\n canGoBack: () => {\n displayWarningForProp('canGoBack');\n return false;\n },\n push: createNOOPWithWarning('push'),\n navigate: createNOOPWithWarning('navigate'),\n replace: createNOOPWithWarning('replace'),\n dismiss: createNOOPWithWarning('dismiss'),\n dismissTo: createNOOPWithWarning('dismissTo'),\n dismissAll: createNOOPWithWarning('dismissAll'),\n canDismiss: () => {\n displayWarningForProp('canDismiss');\n return false;\n },\n setParams: createNOOPWithWarning('setParams'),\n reload: createNOOPWithWarning('reload'),\n prefetch: createNOOPWithWarning('prefetch'),\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 const { isPreview } = usePreviewInfo();\n if (isPreview) {\n return routerWithWarnings;\n }\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>Pathname: {pathname}</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 const { params: previewParams } = usePreviewInfo();\n return Object.fromEntries(\n Object.entries(previewParams ?? params).map(([key, value]) => {\n // React Navigation doesn't remove \"undefined\" values from the params object, and you cannot remove them via\n // navigation.setParams as it shallow merges. Hence, we hide them here\n if (value === undefined) {\n return [key, undefined];\n }\n\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\nconst loaderDataCache = new Map<string, any>();\nconst loaderPromiseCache = new Map<string, Promise<any>>();\n\ntype LoaderFunctionResult<T extends LoaderFunction<any>> =\n T extends LoaderFunction<infer R> ? R : unknown;\n\n/**\n * Returns the result of the `loader` function for the calling route.\n *\n * @example\n * ```tsx app/profile/[user].tsx\n * import { Text } from 'react-native';\n * import { useLoaderData } from 'expo-router';\n *\n * export function loader() {\n * return Promise.resolve({ foo: 'bar' }}\n * }\n *\n * export default function Route() {\n * // { foo: 'bar' }\n * const data = useLoaderData<typeof loader>();\n *\n * return <Text>Data: {JSON.stringify(data)}</Text>;\n * }\n */\nexport function useLoaderData<T extends LoaderFunction<any> = any>(): LoaderFunctionResult<T> {\n const routeNode = useRouteNode();\n const params = useLocalSearchParams();\n const serverDataLoaderContext = use(ServerDataLoaderContext);\n\n if (!routeNode) {\n throw new Error('No route node found. This is likely a bug in expo-router.');\n }\n\n const resolvedPath = `/${resolveHref({ pathname: routeNode?.route, params })}`;\n\n // First invocation of this hook will happen server-side, so we look up the loaded data from context\n if (serverDataLoaderContext) {\n return serverDataLoaderContext[resolvedPath];\n }\n\n // The second invocation happens after the client has hydrated on initial load, so we look up the data injected\n // by `<PreloadedDataScript />` using `globalThis.__EXPO_ROUTER_LOADER_DATA__`\n if (typeof window !== 'undefined' && globalThis.__EXPO_ROUTER_LOADER_DATA__) {\n if (globalThis.__EXPO_ROUTER_LOADER_DATA__[resolvedPath]) {\n return globalThis.__EXPO_ROUTER_LOADER_DATA__[resolvedPath];\n }\n }\n\n // Check cache for route data\n if (loaderDataCache.has(resolvedPath)) {\n return loaderDataCache.get(resolvedPath);\n }\n\n // Fetch data if not cached\n if (!loaderPromiseCache.has(resolvedPath)) {\n const promise = fetchLoaderModule(resolvedPath)\n .then((data) => {\n loaderDataCache.set(resolvedPath, data);\n return data;\n })\n .catch((error) => {\n console.error(`Failed to load loader data for route: ${resolvedPath}:`, error);\n throw new Error(`Failed to load loader data for route: ${resolvedPath}`, {\n cause: error,\n });\n })\n .finally(() => {\n loaderPromiseCache.delete(resolvedPath);\n });\n\n loaderPromiseCache.set(resolvedPath, promise);\n }\n\n return use(loaderPromiseCache.get(resolvedPath)!);\n}\n"]}
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiC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E;YACb,eAAe,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;YACxC,gBAAgB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACtC,kBAAkB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACxC,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,MAAM,YAAY,GAAG,IAAI,KAAK,CAAC,yCAAyC,YAAY,EAAE,EAAE;gBACtF,KAAK,EAAE,KAAK;aACb,CAAC,CAAC;YACH,gBAAgB,CAAC,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;YACjD,kBAAkB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACxC,MAAM,YAAY,CAAC;QACrB,CAAC,CAAC,CAAC;QAEL,kBAAkB,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,IAAA,WAAG,EAAC,kBAAkB,CAAC,GAAG,CAAC,YAAY,CAAE,CAAC,CAAC;AACpD,CAAC","sourcesContent":["'use client';\n\nimport { NavigationProp, useNavigation } from '@react-navigation/native';\nimport type { LoaderFunction } from 'expo-server';\nimport React, { use } from 'react';\n\nimport { LocalRouteParamsContext, useRouteNode } from './Route';\nimport { INTERNAL_SLOT_NAME } from './constants';\nimport { store, useRouteInfo } from './global-state/router-store';\nimport { router, Router } from './imperative-api';\nimport { resolveHref } from './link/href';\nimport { usePreviewInfo } from './link/preview/PreviewRouteContext';\nimport { ServerDataLoaderContext } from './loaders/ServerDataLoaderContext';\nimport { fetchLoaderModule } from './loaders/utils';\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 const parent =\n // We assume that this is called from routes in __root\n // Users cannot customize the generated Sitemap or NotFound routes, so we should be safe\n useNavigation<NavigationProp<object, never, string>>().getParent(INTERNAL_SLOT_NAME);\n if (!parent) {\n throw new Error(\n 'useRootNavigationState was called from a generated route. This is likely a bug in Expo Router.'\n );\n }\n return parent.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\nconst displayWarningForProp = (prop: string) => {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `router.${prop} should not be used in a previewed screen. To fix this issue, wrap navigation calls with 'if (!isPreview) { ... }'.`\n );\n }\n};\n\nconst createNOOPWithWarning = (prop: string) => () => displayWarningForProp(prop);\n\nconst routerWithWarnings: Router = {\n back: createNOOPWithWarning('back'),\n canGoBack: () => {\n displayWarningForProp('canGoBack');\n return false;\n },\n push: createNOOPWithWarning('push'),\n navigate: createNOOPWithWarning('navigate'),\n replace: createNOOPWithWarning('replace'),\n dismiss: createNOOPWithWarning('dismiss'),\n dismissTo: createNOOPWithWarning('dismissTo'),\n dismissAll: createNOOPWithWarning('dismissAll'),\n canDismiss: () => {\n displayWarningForProp('canDismiss');\n return false;\n },\n setParams: createNOOPWithWarning('setParams'),\n reload: createNOOPWithWarning('reload'),\n prefetch: createNOOPWithWarning('prefetch'),\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 const { isPreview } = usePreviewInfo();\n if (isPreview) {\n return routerWithWarnings;\n }\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>Pathname: {pathname}</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 const { params: previewParams } = usePreviewInfo();\n return Object.fromEntries(\n Object.entries(previewParams ?? params).map(([key, value]) => {\n // React Navigation doesn't remove \"undefined\" values from the params object, and you cannot remove them via\n // navigation.setParams as it shallow merges. Hence, we hide them here\n if (value === undefined) {\n return [key, undefined];\n }\n\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\nconst loaderDataCache = new Map<string, any>();\nconst loaderPromiseCache = new Map<string, Promise<any>>();\nconst loaderErrorCache = new Map<string, unknown>();\n\ntype LoaderFunctionResult<T extends LoaderFunction<any>> =\n T extends LoaderFunction<infer R> ? R : unknown;\n\n/**\n * Returns the result of the `loader` function for the calling route.\n *\n * @example\n * ```tsx app/profile/[user].tsx\n * import { Text } from 'react-native';\n * import { useLoaderData } from 'expo-router';\n *\n * export function loader() {\n * return Promise.resolve({ foo: 'bar' }}\n * }\n *\n * export default function Route() {\n * // { foo: 'bar' }\n * const data = useLoaderData<typeof loader>();\n *\n * return <Text>Data: {JSON.stringify(data)}</Text>;\n * }\n */\nexport function useLoaderData<T extends LoaderFunction<any> = any>(): LoaderFunctionResult<T> {\n const routeNode = useRouteNode();\n const params = useLocalSearchParams();\n const serverDataLoaderContext = use(ServerDataLoaderContext);\n\n if (!routeNode) {\n throw new Error('No route node found. This is likely a bug in expo-router.');\n }\n\n const resolvedPath = `/${resolveHref({ pathname: routeNode?.route, params })}`;\n\n // First invocation of this hook will happen server-side, so we look up the loaded data from context\n if (serverDataLoaderContext) {\n return serverDataLoaderContext[resolvedPath];\n }\n\n // The second invocation happens after the client has hydrated on initial load, so we look up the data injected\n // by `<PreloadedDataScript />` using `globalThis.__EXPO_ROUTER_LOADER_DATA__`\n if (typeof window !== 'undefined' && globalThis.__EXPO_ROUTER_LOADER_DATA__) {\n if (globalThis.__EXPO_ROUTER_LOADER_DATA__[resolvedPath]) {\n return globalThis.__EXPO_ROUTER_LOADER_DATA__[resolvedPath];\n }\n }\n\n // Check error cache first to prevent infinite retry loops when a loader fails.\n // We throw the cached error instead of starting a new fetch.\n if (loaderErrorCache.has(resolvedPath)) {\n throw loaderErrorCache.get(resolvedPath);\n }\n\n // Check cache for route data\n if (loaderDataCache.has(resolvedPath)) {\n return loaderDataCache.get(resolvedPath);\n }\n\n // Fetch data if not cached\n if (!loaderPromiseCache.has(resolvedPath)) {\n const promise = fetchLoaderModule(resolvedPath)\n .then((data) => {\n loaderDataCache.set(resolvedPath, data);\n loaderErrorCache.delete(resolvedPath);\n loaderPromiseCache.delete(resolvedPath);\n return data;\n })\n .catch((error) => {\n const wrappedError = new Error(`Failed to load loader data for route: ${resolvedPath}`, {\n cause: error,\n });\n loaderErrorCache.set(resolvedPath, wrappedError);\n loaderPromiseCache.delete(resolvedPath);\n throw wrappedError;\n });\n\n loaderPromiseCache.set(resolvedPath, promise);\n }\n\n return use(loaderPromiseCache.get(resolvedPath)!);\n}\n"]}
@@ -3,7 +3,7 @@ import { ParamListBase, TabNavigationState } from '@react-navigation/native';
3
3
  import React, { ComponentProps } from 'react';
4
4
  import { Href } from '../types';
5
5
  import { Protected } from '../views/Protected';
6
- declare const BottomTabNavigator: React.ComponentType<Omit<import("@react-navigation/bottom-tabs").BottomTabNavigatorProps, "children" | "layout" | "initialRouteName" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/native").DefaultRouterOptions<string> & {
6
+ declare const BottomTabNavigator: React.ComponentType<Omit<import("@react-navigation/bottom-tabs").BottomTabNavigatorProps, "children" | "layout" | "initialRouteName" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/native").DefaultRouterOptions<string> & ({
7
7
  children: React.ReactNode;
8
8
  layout?: ((props: {
9
9
  state: TabNavigationState<ParamListBase>;
@@ -22,7 +22,7 @@ declare const BottomTabNavigator: React.ComponentType<Omit<import("@react-naviga
22
22
  beforeRemove: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "beforeRemove", true>;
23
23
  }> | ((props: {
24
24
  route: import("@react-navigation/native").RouteProp<ParamListBase, string>;
25
- navigation: import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, undefined>;
25
+ navigation: import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, string | undefined>;
26
26
  }) => Partial<{
27
27
  tabPress: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "tabPress", true>;
28
28
  tabLongPress: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "tabLongPress", unknown>;
@@ -35,10 +35,10 @@ declare const BottomTabNavigator: React.ComponentType<Omit<import("@react-naviga
35
35
  }>) | undefined;
36
36
  screenOptions?: BottomTabNavigationOptions | ((props: {
37
37
  route: import("@react-navigation/native").RouteProp<ParamListBase, string>;
38
- navigation: import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, undefined>;
38
+ navigation: import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, string | undefined>;
39
39
  theme: ReactNavigation.Theme;
40
40
  }) => BottomTabNavigationOptions) | undefined;
41
- screenLayout?: ((props: import("@react-navigation/native").ScreenLayoutArgs<ParamListBase, string, BottomTabNavigationOptions, import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, undefined>>) => React.ReactElement) | undefined;
41
+ screenLayout?: ((props: import("@react-navigation/native").ScreenLayoutArgs<ParamListBase, string, BottomTabNavigationOptions, import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, string | undefined>>) => React.ReactElement) | undefined;
42
42
  UNSTABLE_router?: (<Action extends Readonly<{
43
43
  type: string;
44
44
  payload?: object;
@@ -46,14 +46,16 @@ declare const BottomTabNavigator: React.ComponentType<Omit<import("@react-naviga
46
46
  target?: string;
47
47
  }>>(original: import("@react-navigation/native").Router<TabNavigationState<ParamListBase>, Action>) => Partial<import("@react-navigation/native").Router<TabNavigationState<ParamListBase>, Action>>) | undefined;
48
48
  UNSTABLE_routeNamesChangeBehavior?: "firstMatch" | "lastUnhandled";
49
- } & {
49
+ } & ({
50
50
  id?: undefined;
51
- }>;
51
+ } | {
52
+ id: string;
53
+ }))>;
52
54
  export type BottomTabNavigator = typeof BottomTabNavigator;
53
55
  type TabsProps = BottomTabNavigationOptions & {
54
56
  href?: Href | null;
55
57
  };
56
- declare const ExpoTabs: React.ForwardRefExoticComponent<Omit<Omit<import("@react-navigation/bottom-tabs").BottomTabNavigatorProps, "children" | "layout" | "initialRouteName" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/native").DefaultRouterOptions<string> & {
58
+ declare const ExpoTabs: React.ForwardRefExoticComponent<Omit<Omit<import("@react-navigation/bottom-tabs").BottomTabNavigatorProps, "children" | "layout" | "initialRouteName" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/native").DefaultRouterOptions<string> & ({
57
59
  children: React.ReactNode;
58
60
  layout?: ((props: {
59
61
  state: TabNavigationState<ParamListBase>;
@@ -72,7 +74,7 @@ declare const ExpoTabs: React.ForwardRefExoticComponent<Omit<Omit<import("@react
72
74
  beforeRemove: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "beforeRemove", true>;
73
75
  }> | ((props: {
74
76
  route: import("@react-navigation/native").RouteProp<ParamListBase, string>;
75
- navigation: import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, undefined>;
77
+ navigation: import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, string | undefined>;
76
78
  }) => Partial<{
77
79
  tabPress: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "tabPress", true>;
78
80
  tabLongPress: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "tabLongPress", unknown>;
@@ -85,10 +87,10 @@ declare const ExpoTabs: React.ForwardRefExoticComponent<Omit<Omit<import("@react
85
87
  }>) | undefined;
86
88
  screenOptions?: BottomTabNavigationOptions | ((props: {
87
89
  route: import("@react-navigation/native").RouteProp<ParamListBase, string>;
88
- navigation: import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, undefined>;
90
+ navigation: import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, string | undefined>;
89
91
  theme: ReactNavigation.Theme;
90
92
  }) => BottomTabNavigationOptions) | undefined;
91
- screenLayout?: ((props: import("@react-navigation/native").ScreenLayoutArgs<ParamListBase, string, BottomTabNavigationOptions, import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, undefined>>) => React.ReactElement) | undefined;
93
+ screenLayout?: ((props: import("@react-navigation/native").ScreenLayoutArgs<ParamListBase, string, BottomTabNavigationOptions, import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, string | undefined>>) => React.ReactElement) | undefined;
92
94
  UNSTABLE_router?: (<Action extends Readonly<{
93
95
  type: string;
94
96
  payload?: object;
@@ -96,9 +98,11 @@ declare const ExpoTabs: React.ForwardRefExoticComponent<Omit<Omit<import("@react
96
98
  target?: string;
97
99
  }>>(original: import("@react-navigation/native").Router<TabNavigationState<ParamListBase>, Action>) => Partial<import("@react-navigation/native").Router<TabNavigationState<ParamListBase>, Action>>) | undefined;
98
100
  UNSTABLE_routeNamesChangeBehavior?: "firstMatch" | "lastUnhandled";
99
- } & {
101
+ } & ({
100
102
  id?: undefined;
101
- }, "children"> & Partial<Pick<Omit<import("@react-navigation/bottom-tabs").BottomTabNavigatorProps, "children" | "layout" | "initialRouteName" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/native").DefaultRouterOptions<string> & {
103
+ } | {
104
+ id: string;
105
+ })), "children"> & Partial<Pick<Omit<import("@react-navigation/bottom-tabs").BottomTabNavigatorProps, "children" | "layout" | "initialRouteName" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/native").DefaultRouterOptions<string> & ({
102
106
  children: React.ReactNode;
103
107
  layout?: ((props: {
104
108
  state: TabNavigationState<ParamListBase>;
@@ -117,7 +121,7 @@ declare const ExpoTabs: React.ForwardRefExoticComponent<Omit<Omit<import("@react
117
121
  beforeRemove: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "beforeRemove", true>;
118
122
  }> | ((props: {
119
123
  route: import("@react-navigation/native").RouteProp<ParamListBase, string>;
120
- navigation: import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, undefined>;
124
+ navigation: import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, string | undefined>;
121
125
  }) => Partial<{
122
126
  tabPress: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "tabPress", true>;
123
127
  tabLongPress: import("@react-navigation/native").EventListenerCallback<BottomTabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<ParamListBase>>, "tabLongPress", unknown>;
@@ -130,10 +134,10 @@ declare const ExpoTabs: React.ForwardRefExoticComponent<Omit<Omit<import("@react
130
134
  }>) | undefined;
131
135
  screenOptions?: BottomTabNavigationOptions | ((props: {
132
136
  route: import("@react-navigation/native").RouteProp<ParamListBase, string>;
133
- navigation: import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, undefined>;
137
+ navigation: import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, string | undefined>;
134
138
  theme: ReactNavigation.Theme;
135
139
  }) => BottomTabNavigationOptions) | undefined;
136
- screenLayout?: ((props: import("@react-navigation/native").ScreenLayoutArgs<ParamListBase, string, BottomTabNavigationOptions, import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, undefined>>) => React.ReactElement) | undefined;
140
+ screenLayout?: ((props: import("@react-navigation/native").ScreenLayoutArgs<ParamListBase, string, BottomTabNavigationOptions, import("@react-navigation/bottom-tabs").BottomTabNavigationProp<ParamListBase, string, string | undefined>>) => React.ReactElement) | undefined;
137
141
  UNSTABLE_router?: (<Action extends Readonly<{
138
142
  type: string;
139
143
  payload?: object;
@@ -141,9 +145,11 @@ declare const ExpoTabs: React.ForwardRefExoticComponent<Omit<Omit<import("@react
141
145
  target?: string;
142
146
  }>>(original: import("@react-navigation/native").Router<TabNavigationState<ParamListBase>, Action>) => Partial<import("@react-navigation/native").Router<TabNavigationState<ParamListBase>, Action>>) | undefined;
143
147
  UNSTABLE_routeNamesChangeBehavior?: "firstMatch" | "lastUnhandled";
144
- } & {
148
+ } & ({
145
149
  id?: undefined;
146
- }, "children">> & React.RefAttributes<unknown>> & {
150
+ } | {
151
+ id: string;
152
+ })), "children">> & React.RefAttributes<unknown>> & {
147
153
  Screen: (props: import("..").ScreenProps<TabsProps, TabNavigationState<ParamListBase>, BottomTabNavigationEventMap>) => null;
148
154
  Protected: typeof Protected;
149
155
  };
@@ -1 +1 @@
1
- {"version":3,"file":"TabsClient.d.ts","sourceRoot":"","sources":["../../src/layouts/TabsClient.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAE3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAK9C,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAuC,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC;AAE3D,KAAK,SAAS,GAAG,0BAA0B,GAAG;IAAE,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CAAE,CAAC;AAErE,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CZ,CAAC;AAEH,QAAA,MAAM,IAAI,WACA,cAAc,CAAC,OAAO,QAAQ,CAAC;;;CAOxC,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"TabsClient.d.ts","sourceRoot":"","sources":["../../src/layouts/TabsClient.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAE3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,EAAE,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAK9C,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAuC,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC;AAE3D,KAAK,SAAS,GAAG,0BAA0B,GAAG;IAAE,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CAAE,CAAC;AAErE,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CZ,CAAC;AAEH,QAAA,MAAM,IAAI,WACA,cAAc,CAAC,OAAO,QAAQ,CAAC;;;CAOxC,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -65,12 +65,14 @@ export interface StackToolbarButtonProps {
65
65
  * Icon to display in the button.
66
66
  *
67
67
  * Can be a string representing an SFSymbol or an image source.
68
+ *
69
+ * > **Note**: When used in `placement="bottom"`, only string SFSymbols are supported. Use the `image` prop to provide custom images.
68
70
  */
69
71
  icon?: StackHeaderItemSharedProps['icon'];
70
72
  /**
71
73
  * Image to display in the button.
72
74
  *
73
- * > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.
75
+ * > **Note**: This prop is only supported in toolbar with `placement="bottom"`.
74
76
  */
75
77
  image?: ImageRef;
76
78
  onPress?: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"StackToolbarButton.d.ts","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbarButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzD,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,uBAAuB;IACtC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;OAIG;IACH,IAAI,CAAC,EAAE,0BAA0B,CAAC,MAAM,CAAC,CAAC;IAE1C;;;;OAIG;IACH,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;;OAIG;IACH,kB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CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QACrE,OAAO,CAAC,oDAAmB,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAG,CAAC;IAC5E,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAVW,QAAA,kBAAkB,sBAU7B;AAEF,SAAgB,4CAA4C,CAC1D,KAA8B;IAE9B,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,GAAG,IAAA,0DAAiD,EAAC,KAAK,CAAC;QAC3D,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;QACpC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport type { NativeStackHeaderItemButton } from '@react-navigation/native-stack';\nimport type { ImageRef } from 'expo-image';\nimport type { ReactNode } from 'react';\nimport type { StyleProp, TextStyle } from 'react-native';\n\nimport { NativeToolbarButton } from './bottom-toolbar-native-elements';\nimport { useToolbarPlacement } from './context';\nimport {\n convertStackHeaderSharedPropsToRNSharedHeaderItem,\n type StackHeaderItemSharedProps,\n} from '../shared';\n\nexport interface StackToolbarButtonProps {\n accessibilityLabel?: string;\n accessibilityHint?: string;\n /**\n * There are two ways to specify the content of the button:\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"left\">\n * <Stack.Toolbar.Button icon=\"star.fill\">As text passed as children</Stack.Toolbar.Button>\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"left\">\n * <Stack.Toolbar.Button>\n * <Stack.Toolbar.Icon sf=\"star.fill\" />\n * <Stack.Toolbar.Label>As components</Stack.Toolbar.Label>\n * <Stack.Toolbar.Badge>3</Stack.Toolbar.Badge>\n * </Stack.Toolbar.Button>\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * > **Note**: When icon is used, the label will not be shown and will be used for accessibility purposes only. Badge is only supported in left/right placements, not in bottom (iOS toolbar limitation).\n */\n children?: ReactNode;\n disabled?: boolean;\n /**\n * Whether the button should be hidden.\n *\n * @default false\n */\n hidden?: boolean;\n /**\n * Whether to hide the shared background.\n *\n * @platform iOS 26+\n */\n hidesSharedBackground?: boolean;\n /**\n * Icon to display in the button.\n *\n * Can be a string representing an SFSymbol or an image source.\n */\n icon?: StackHeaderItemSharedProps['icon'];\n // TODO(@ubax): Add useImage support in a follow-up PR.\n /**\n * Image to display in the button.\n *\n * > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.\n */\n image?: ImageRef;\n onPress?: () => void;\n /**\n * Whether to separate the background of this item from other header items.\n *\n * @default false\n */\n separateBackground?: boolean;\n /**\n * Whether the button is in a selected state\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/isselected) for more information\n */\n selected?: boolean;\n /**\n * Style for the label of the header item.\n */\n style?: StyleProp<TextStyle>;\n /**\n * The tint color to apply to the button item\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/tintcolor) for more information.\n */\n tintColor?: StackHeaderItemSharedProps['tintColor'];\n /**\n * @default 'plain'\n */\n variant?: StackHeaderItemSharedProps['variant'];\n}\n\n/**\n * A button used inside `Stack.Toolbar`.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Layout() {\n * return (\n * <Stack>\n * <Stack.Screen name=\"index\">\n * <Stack.Toolbar placement=\"left\">\n * <Stack.Toolbar.Button icon=\"arrow.left.circle\" onPress={() => alert('Left pressed')} />\n * </Stack.Toolbar>\n * </Stack.Screen>\n * </Stack>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"left\">\n * <Stack.Toolbar.Button icon=\"arrow.left.circle\" onPress={() => alert('Left pressed')} />\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @platform ios\n */\nexport const StackToolbarButton: React.FC<StackToolbarButtonProps> = (props) => {\n const placement = useToolbarPlacement();\n\n if (placement === 'bottom') {\n // TODO(@ubax): Handle image loading using useImage in a follow-up PR.\n const icon = typeof props.icon === 'string' ? props.icon : undefined;\n return <NativeToolbarButton {...props} icon={icon} image={props.image} />;\n }\n\n return null;\n};\n\nexport function convertStackToolbarButtonPropsToRNHeaderItem(\n props: StackToolbarButtonProps\n): NativeStackHeaderItemButton | undefined {\n if (props.hidden) {\n return undefined;\n }\n\n return {\n ...convertStackHeaderSharedPropsToRNSharedHeaderItem(props),\n type: 'button',\n onPress: props.onPress ?? (() => {}),\n selected: !!props.selected,\n };\n}\n"]}
1
+ {"version":3,"file":"StackToolbarButton.js","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbarButton.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAqKb,oGAaC;AA5KD,qFAAuE;AACvE,uCAAgD;AAChD,sCAGmB;AAwGnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACI,MAAM,kBAAkB,GAAsC,CAAC,KAAK,EAAE,EAAE;IAC7E,MAAM,SAAS,GAAG,IAAA,6BAAmB,GAAE,CAAC;IAExC,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC3B,sEAAsE;QACtE,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QACrE,OAAO,CAAC,oDAAmB,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAG,CAAC;IAC5E,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAVW,QAAA,kBAAkB,sBAU7B;AAEF,SAAgB,4CAA4C,CAC1D,KAA8B;IAE9B,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,GAAG,IAAA,0DAAiD,EAAC,KAAK,CAAC;QAC3D,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;QACpC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["'use client';\nimport type { NativeStackHeaderItemButton } from '@react-navigation/native-stack';\nimport type { ImageRef } from 'expo-image';\nimport type { ReactNode } from 'react';\nimport type { StyleProp, TextStyle } from 'react-native';\n\nimport { NativeToolbarButton } from './bottom-toolbar-native-elements';\nimport { useToolbarPlacement } from './context';\nimport {\n convertStackHeaderSharedPropsToRNSharedHeaderItem,\n type StackHeaderItemSharedProps,\n} from '../shared';\n\nexport interface StackToolbarButtonProps {\n accessibilityLabel?: string;\n accessibilityHint?: string;\n /**\n * There are two ways to specify the content of the button:\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"left\">\n * <Stack.Toolbar.Button icon=\"star.fill\">As text passed as children</Stack.Toolbar.Button>\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"left\">\n * <Stack.Toolbar.Button>\n * <Stack.Toolbar.Icon sf=\"star.fill\" />\n * <Stack.Toolbar.Label>As components</Stack.Toolbar.Label>\n * <Stack.Toolbar.Badge>3</Stack.Toolbar.Badge>\n * </Stack.Toolbar.Button>\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * > **Note**: When icon is used, the label will not be shown and will be used for accessibility purposes only. Badge is only supported in left/right placements, not in bottom (iOS toolbar limitation).\n */\n children?: ReactNode;\n disabled?: boolean;\n /**\n * Whether the button should be hidden.\n *\n * @default false\n */\n hidden?: boolean;\n /**\n * Whether to hide the shared background.\n *\n * @platform iOS 26+\n */\n hidesSharedBackground?: boolean;\n /**\n * Icon to display in the button.\n *\n * Can be a string representing an SFSymbol or an image source.\n *\n * > **Note**: When used in `placement=\"bottom\"`, only string SFSymbols are supported. Use the `image` prop to provide custom images.\n */\n icon?: StackHeaderItemSharedProps['icon'];\n // TODO(@ubax): Add useImage support in a follow-up PR.\n /**\n * Image to display in the button.\n *\n * > **Note**: This prop is only supported in toolbar with `placement=\"bottom\"`.\n */\n image?: ImageRef;\n onPress?: () => void;\n /**\n * Whether to separate the background of this item from other header items.\n *\n * @default false\n */\n separateBackground?: boolean;\n /**\n * Whether the button is in a selected state\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/isselected) for more information\n */\n selected?: boolean;\n /**\n * Style for the label of the header item.\n */\n style?: StyleProp<TextStyle>;\n /**\n * The tint color to apply to the button item\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/tintcolor) for more information.\n */\n tintColor?: StackHeaderItemSharedProps['tintColor'];\n /**\n * @default 'plain'\n */\n variant?: StackHeaderItemSharedProps['variant'];\n}\n\n/**\n * A button used inside `Stack.Toolbar`.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Layout() {\n * return (\n * <Stack>\n * <Stack.Screen name=\"index\">\n * <Stack.Toolbar placement=\"left\">\n * <Stack.Toolbar.Button icon=\"arrow.left.circle\" onPress={() => alert('Left pressed')} />\n * </Stack.Toolbar>\n * </Stack.Screen>\n * </Stack>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"left\">\n * <Stack.Toolbar.Button icon=\"arrow.left.circle\" onPress={() => alert('Left pressed')} />\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @platform ios\n */\nexport const StackToolbarButton: React.FC<StackToolbarButtonProps> = (props) => {\n const placement = useToolbarPlacement();\n\n if (placement === 'bottom') {\n // TODO(@ubax): Handle image loading using useImage in a follow-up PR.\n const icon = typeof props.icon === 'string' ? props.icon : undefined;\n return <NativeToolbarButton {...props} icon={icon} image={props.image} />;\n }\n\n return null;\n};\n\nexport function convertStackToolbarButtonPropsToRNHeaderItem(\n props: StackToolbarButtonProps\n): NativeStackHeaderItemButton | undefined {\n if (props.hidden) {\n return undefined;\n }\n\n return {\n ...convertStackHeaderSharedPropsToRNSharedHeaderItem(props),\n type: 'button',\n onPress: props.onPress ?? (() => {}),\n selected: !!props.selected,\n };\n}\n"]}
@@ -30,7 +30,7 @@ export interface StackToolbarMenuProps {
30
30
  /**
31
31
  * Image to display for the menu item.
32
32
  *
33
- * > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.
33
+ * > **Note**: This prop is only supported in toolbar with `placement="bottom"`.
34
34
  */
35
35
  image?: ImageRef;
36
36
  /**
@@ -51,6 +51,8 @@ export interface StackToolbarMenuProps {
51
51
  * Icon for the menu item.
52
52
  *
53
53
  * Can be an SF Symbol name or an image source.
54
+ *
55
+ * > **Note**: When used in `placement="bottom"`, only string SFSymbols are supported. Use the `image` prop to provide custom images.
54
56
  */
55
57
  icon?: StackHeaderItemSharedProps['icon'];
56
58
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"StackToolbarMenu.d.ts","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0, shared_1.convertStackHeaderSharedPropsToRNSharedHeaderItem)(rest),
71
71
  type: 'menu',
72
72
  menu: {
73
+ multiselectable: true,
73
74
  items: actions
74
75
  .map((action) => {
75
76
  if ((0, children_1.isChildOfType)(action, exports.StackToolbarMenu)) {
@@ -91,8 +92,6 @@ function convertStackToolbarSubmenuMenuPropsToRNHeaderItem(props) {
91
92
  }
92
93
  const sharedProps = (0, shared_1.convertStackHeaderSharedPropsToRNSharedHeaderItem)(props);
93
94
  const actions = react_1.Children.toArray(props.children).filter((child) => (0, children_1.isChildOfType)(child, exports.StackToolbarMenuAction) || (0, children_1.isChildOfType)(child, exports.StackToolbarMenu));
94
- // TODO: Remove Pick<HeaderBarButtonItemSubmenu> when this PR is merged and released in react-navigation:
95
- // https://github.com/react-navigation/react-navigation/pull/12895
96
95
  const item = {
97
96
  type: 'submenu',
98
97
  items: actions
@@ -104,12 +103,13 @@ function convertStackToolbarSubmenuMenuPropsToRNHeaderItem(props) {
104
103
  })
105
104
  .filter((i) => !!i),
106
105
  label: sharedProps.label || props.title || '',
106
+ multiselectable: true,
107
107
  };
108
108
  if (props.inline !== undefined) {
109
- item.displayInline = props.inline;
109
+ item.inline = props.inline;
110
110
  }
111
111
  if (props.palette !== undefined) {
112
- item.displayAsPalette = props.palette;
112
+ item.layout = props.palette ? 'palette' : 'default';
113
113
  }
114
114
  if (props.destructive !== undefined) {
115
115
  item.destructive = props.destructive;
@@ -1 +1 @@
1
- {"version":3,"file":"StackToolbarMenu.js","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbarMenu.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AA8Lb,gGA8BC;AAiJD,4GA2BC;AAjYD,iCAA0D;AAK1D,qFAA8F;AAC9F,uCAAgD;AAChD,oDAAuD;AACvD,sDAAuF;AACvF,sCAGmB;AA2GnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACI,MAAM,gBAAgB,GAAoC,CAAC,EAAE,Q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AG,sBAAsB,CAAC;IACnD,CAAC;IACD,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC;QACrB,iDAAiD;QACjD,oEAAoE;QACpE,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACzC,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;QAC/B,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CACV,qIAAqI,CACtI,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["'use client';\nimport type {\n NativeStackHeaderItemMenu,\n NativeStackHeaderItemMenuAction,\n NativeStackHeaderItemMenuSubmenu,\n} from '@react-navigation/native-stack';\nimport type { ImageRef } from 'expo-image';\nimport { Children, useMemo, type ReactNode } from 'react';\nimport type { ImageSourcePropType } from 'react-native';\nimport type { HeaderBarButtonItemSubmenu } from 'react-native-screens';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport { NativeToolbarMenu, NativeToolbarMenuAction } from './bottom-toolbar-native-elements';\nimport { useToolbarPlacement } from './context';\nimport { Menu, MenuAction } from '../../../primitives';\nimport { filterAllowedChildrenElements, isChildOfType } from '../../../utils/children';\nimport {\n convertStackHeaderSharedPropsToRNSharedHeaderItem,\n type StackHeaderItemSharedProps,\n} from '../shared';\n\nexport interface StackToolbarMenuProps {\n accessibilityLabel?: string;\n accessibilityHint?: string;\n /**\n * Menu content - can include icons, labels, badges and menu actions.\n *\n * @example\n * ```tsx\n * <Stack.Toolbar.Menu>\n * <Stack.Toolbar.Icon sfSymbol=\"ellipsis.circle\" />\n * <Stack.Toolbar.Label>Options</Stack.Toolbar.Label>\n * <Stack.Toolbar.MenuAction onPress={() => {}}>Action 1</Stack.Toolbar.MenuAction>\n * </Stack.Toolbar.Menu>\n * ```\n */\n children?: ReactNode;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive) for more information.\n */\n destructive?: boolean;\n disabled?: boolean;\n // TODO(@ubax): Add useImage support in a follow-up PR.\n /**\n * Image to display for the menu item.\n *\n * > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.\n */\n image?: ImageRef;\n /**\n * Whether to hide the shared background.\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/hidessharedbackground) for more information.\n *\n * @platform iOS 26+\n */\n hidesSharedBackground?: boolean;\n /**\n * Whether the menu should be hidden.\n *\n * @default false\n */\n hidden?: boolean;\n /**\n * Icon for the menu item.\n *\n * Can be an SF Symbol name or an image source.\n */\n icon?: StackHeaderItemSharedProps['icon'];\n /**\n * If `true`, the menu will be displayed inline.\n * This means that the menu will not be collapsed\n *\n * > **Note**: Inline menus are only supported in submenus.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayinline) for more information.\n */\n inline?: boolean;\n /**\n * If `true`, the menu will be displayed as a palette.\n * This means that the menu will be displayed as one row\n *\n * > **Note**: Palette menus are only supported in submenus.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayaspalette) for more information.\n */\n palette?: boolean;\n /**\n * Whether to separate the background of this item from other header items.\n *\n * @default false\n */\n separateBackground?: boolean;\n /**\n * Style for the label of the header item.\n */\n style?: StackHeaderItemSharedProps['style'];\n /**\n * The tint color to apply to the button item\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/tintcolor) for more information.\n */\n tintColor?: StackHeaderItemSharedProps['tintColor'];\n /**\n * Optional title to show on top of the menu.\n */\n title?: string;\n /**\n * @default 'plain'\n */\n variant?: StackHeaderItemSharedProps['variant'];\n // TODO(@ubax): Add elementSize support in react-native-screens for header menus.\n /**\n * The preferred size of the menu elements.\n *\n * > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/preferredelementsize) for more information.\n *\n * @platform iOS 16.0+\n */\n elementSize?: 'auto' | 'small' | 'medium' | 'large';\n}\n\n/**\n * Use as `Stack.Toolbar.Menu` to provide menus in iOS toolbar.\n * It accepts `Stack.Toolbar.MenuAction` and nested `Stack.Toolbar.Menu`\n * elements. Menu can be configured using both component props and child\n * elements.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n * import { Alert } from 'react-native';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"right\">\n * <Stack.Toolbar.Menu icon=\"ellipsis.circle\">\n * <Stack.Toolbar.MenuAction onPress={() => Alert.alert('Action pressed!')}>\n * Action 1\n * </Stack.Toolbar.MenuAction>\n * </Stack.Toolbar.Menu>\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @see [Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/menus) for more information about menus on iOS.\n *\n * @platform ios\n */\nexport const StackToolbarMenu: React.FC<StackToolbarMenuProps> = ({ children, ...props }) => {\n const placement = useToolbarPlacement();\n\n const allowedChildren = useMemo(\n () =>\n placement === 'bottom'\n ? [StackToolbarMenu, StackToolbarMenuAction, NativeToolbarMenu, NativeToolbarMenuAction]\n : [StackToolbarMenu, StackToolbarMenuAction],\n [placement]\n );\n\n const validChildren = useMemo(\n () => filterAllowedChildrenElements(children, allowedChildren),\n [children, allowedChildren]\n );\n\n if (process.env.NODE_ENV !== 'production') {\n const allChildren = Children.toArray(children);\n if (allChildren.length !== validChildren.length) {\n throw new Error(\n `Stack.Toolbar.Menu only accepts Stack.Toolbar.Menu and Stack.Toolbar.MenuAction as its children.`\n );\n }\n }\n\n if (placement === 'bottom') {\n // TODO(@ubax): Handle image loading using useImage in a follow-up PR.\n return <NativeToolbarMenu {...props} image={props.image} children={validChildren} />;\n }\n\n return <Menu {...props} children={validChildren} />;\n};\n\nexport function convertStackToolbarMenuPropsToRNHeaderItem(\n props: StackToolbarMenuProps\n): NativeStackHeaderItemMenu | undefined {\n if (props.hidden) {\n return undefined;\n }\n const { title, ...rest } = props;\n const actions = Children.toArray(props.children).filter(\n (child) =>\n isChildOfType(child, StackToolbarMenuAction) || isChildOfType(child, StackToolbarMenu)\n );\n const item: NativeStackHeaderItemMenu = {\n ...convertStackHeaderSharedPropsToRNSharedHeaderItem(rest),\n type: 'menu',\n menu: {\n items: actions\n .map((action) => {\n if (isChildOfType(action, StackToolbarMenu)) {\n return convertStackToolbarSubmenuMenuPropsToRNHeaderItem(action.props);\n }\n return convertStackToolbarMenuActionPropsToRNHeaderItem(action.props);\n })\n .filter((i) => !!i),\n },\n };\n if (title) {\n item.menu.title = title;\n }\n\n return item;\n}\n\nfunction convertStackToolbarSubmenuMenuPropsToRNHeaderItem(\n props: StackToolbarMenuProps\n): NativeStackHeaderItemMenuSubmenu | undefined {\n if (props.hidden) {\n return undefined;\n }\n const sharedProps = convertStackHeaderSharedPropsToRNSharedHeaderItem(props);\n const actions = Children.toArray(props.children).filter(\n (child) =>\n isChildOfType(child, StackToolbarMenuAction) || isChildOfType(child, StackToolbarMenu)\n );\n\n // TODO: Remove Pick<HeaderBarButtonItemSubmenu> when this PR is merged and released in react-navigation:\n // https://github.com/react-navigation/react-navigation/pull/12895\n const item: NativeStackHeaderItemMenuSubmenu &\n Pick<HeaderBarButtonItemSubmenu, 'displayAsPalette' | 'displayInline' | 'destructive'> = {\n type: 'submenu',\n items: actions\n .map((action) => {\n if (isChildOfType(action, StackToolbarMenu)) {\n return convertStackToolbarSubmenuMenuPropsToRNHeaderItem(action.props);\n }\n return convertStackToolbarMenuActionPropsToRNHeaderItem(action.props);\n })\n .filter((i) => !!i),\n label: sharedProps.label || props.title || '',\n };\n\n if (props.inline !== undefined) {\n item.displayInline = props.inline;\n }\n if (props.palette !== undefined) {\n item.displayAsPalette = props.palette;\n }\n if (props.destructive !== undefined) {\n item.destructive = props.destructive;\n }\n // TODO: Add elementSize to react-native-screens\n\n if (sharedProps.icon) {\n // Only SF Symbols are supported in submenu icons\n // TODO(@ubax): Add support for other images in react-native-screens\n if (sharedProps.icon.type === 'sfSymbol') {\n item.icon = sharedProps.icon;\n } else {\n console.warn(\n 'When Icon is used inside Stack.Toolbar.Menu used as a submenu, only sfSymbol icons are supported. This is a limitation of React Native Screens.'\n );\n }\n }\n\n return item;\n}\n\nexport interface StackToolbarMenuActionProps {\n /**\n * Can be an Icon, Label or string title.\n */\n children?: ReactNode;\n /**\n * If `true`, the menu item will be disabled and not selectable.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/disabled) for more information.\n */\n disabled?: boolean;\n icon?: SFSymbol | ImageSourcePropType;\n // TODO(@ubax): Add useImage support in a follow-up PR.\n /**\n * Image to display for the menu action.\n *\n * > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.\n */\n image?: ImageRef;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive) for more information.\n */\n destructive?: boolean;\n /**\n * If `true`, the menu will be kept presented after the action is selected.\n *\n * This is marked as unstable, because when action is selected it will recreate the menu,\n * which will close all opened submenus and reset the scroll position.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/keepsmenupresented) for more information.\n */\n unstable_keepPresented?: boolean;\n /**\n * If `true`, the menu item will be displayed as selected.\n */\n isOn?: boolean;\n onPress?: () => void;\n /**\n * An elaborated title that explains the purpose of the action.\n */\n discoverabilityLabel?: string;\n /**\n * An optional subtitle for the menu item.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/subtitle) for more information.\n */\n subtitle?: string;\n hidden?: boolean;\n}\n\n/**\n * An action item for a `Stack.Toolbar.Menu`.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"right\">\n * <Stack.Toolbar.Menu icon=\"ellipsis.circle\">\n * <Stack.Toolbar.MenuAction onPress={() => alert('Action pressed!')}>\n * Action 1\n * </Stack.Toolbar.MenuAction>\n * </Stack.Toolbar.Menu>\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @platform ios\n */\nexport const StackToolbarMenuAction: React.FC<StackToolbarMenuActionProps> = (props) => {\n const placement = useToolbarPlacement();\n\n if (placement === 'bottom') {\n // TODO(@ubax): Handle image loading using useImage in a follow-up PR.\n const icon = typeof props.icon === 'string' ? props.icon : undefined;\n return <NativeToolbarMenuAction {...props} icon={icon} image={props.image} />;\n }\n\n return <MenuAction {...props} />;\n};\n\nexport function convertStackToolbarMenuActionPropsToRNHeaderItem(\n props: StackToolbarMenuActionProps\n): NativeStackHeaderItemMenuAction {\n const { children, isOn, unstable_keepPresented, icon, ...rest } = props;\n const sharedProps = convertStackHeaderSharedPropsToRNSharedHeaderItem(props);\n const item: NativeStackHeaderItemMenuAction = {\n ...rest,\n type: 'action',\n label: sharedProps.label,\n state: isOn ? 'on' : 'off',\n onPress: props.onPress ?? (() => {}),\n };\n if (unstable_keepPresented !== undefined) {\n item.keepsMenuPresented = unstable_keepPresented;\n }\n if (sharedProps.icon) {\n // Only SF Symbols are supported in submenu icons\n // TODO(@ubax): Add support for other images in react-native-screens\n if (sharedProps.icon.type === 'sfSymbol') {\n item.icon = sharedProps.icon;\n } else {\n console.warn(\n 'When Icon is used inside Stack.Toolbar.MenuAction, only sfSymbol icons are supported. This is a limitation of React Native Screens.'\n );\n }\n }\n return item;\n}\n"]}
1
+ {"version":3,"file":"StackToolbarMenu.js","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/toolbar/StackToolbarMenu.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AA+Lb,gGA+BC;AA+ID,4GA2BC;AAjYD,iCAA0D;AAI1D,qFAA8F;AAC9F,uCAAgD;AAChD,oDAAuD;AACvD,sDAAuF;AACvF,sCAGmB;AA6GnB;;;;;;;;;;;;;;;;;;;;;;;;;;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AAC,GAAG,EAAE,GAAE,CAAC,CAAC;KACrC,CAAC;IACF,IAAI,sBAAsB,KAAK,SAAS,EAAE,CAAC;QACzC,IAAI,CAAC,kBAAkB,GAAG,sBAAsB,CAAC;IACnD,CAAC;IACD,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC;QACrB,iDAAiD;QACjD,oEAAoE;QACpE,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACzC,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;QAC/B,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CACV,qIAAqI,CACtI,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["'use client';\nimport type {\n NativeStackHeaderItemMenu,\n NativeStackHeaderItemMenuAction,\n NativeStackHeaderItemMenuSubmenu,\n} from '@react-navigation/native-stack';\nimport type { ImageRef } from 'expo-image';\nimport { Children, useMemo, type ReactNode } from 'react';\nimport type { ImageSourcePropType } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport { NativeToolbarMenu, NativeToolbarMenuAction } from './bottom-toolbar-native-elements';\nimport { useToolbarPlacement } from './context';\nimport { Menu, MenuAction } from '../../../primitives';\nimport { filterAllowedChildrenElements, isChildOfType } from '../../../utils/children';\nimport {\n convertStackHeaderSharedPropsToRNSharedHeaderItem,\n type StackHeaderItemSharedProps,\n} from '../shared';\n\nexport interface StackToolbarMenuProps {\n accessibilityLabel?: string;\n accessibilityHint?: string;\n /**\n * Menu content - can include icons, labels, badges and menu actions.\n *\n * @example\n * ```tsx\n * <Stack.Toolbar.Menu>\n * <Stack.Toolbar.Icon sfSymbol=\"ellipsis.circle\" />\n * <Stack.Toolbar.Label>Options</Stack.Toolbar.Label>\n * <Stack.Toolbar.MenuAction onPress={() => {}}>Action 1</Stack.Toolbar.MenuAction>\n * </Stack.Toolbar.Menu>\n * ```\n */\n children?: ReactNode;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive) for more information.\n */\n destructive?: boolean;\n disabled?: boolean;\n // TODO(@ubax): Add useImage support in a follow-up PR.\n /**\n * Image to display for the menu item.\n *\n * > **Note**: This prop is only supported in toolbar with `placement=\"bottom\"`.\n */\n image?: ImageRef;\n /**\n * Whether to hide the shared background.\n *\n * @see [Official Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/hidessharedbackground) for more information.\n *\n * @platform iOS 26+\n */\n hidesSharedBackground?: boolean;\n /**\n * Whether the menu should be hidden.\n *\n * @default false\n */\n hidden?: boolean;\n /**\n * Icon for the menu item.\n *\n * Can be an SF Symbol name or an image source.\n *\n * > **Note**: When used in `placement=\"bottom\"`, only string SFSymbols are supported. Use the `image` prop to provide custom images.\n */\n icon?: StackHeaderItemSharedProps['icon'];\n /**\n * If `true`, the menu will be displayed inline.\n * This means that the menu will not be collapsed\n *\n * > **Note**: Inline menus are only supported in submenus.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayinline) for more information.\n */\n inline?: boolean;\n /**\n * If `true`, the menu will be displayed as a palette.\n * This means that the menu will be displayed as one row\n *\n * > **Note**: Palette menus are only supported in submenus.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayaspalette) for more information.\n */\n palette?: boolean;\n /**\n * Whether to separate the background of this item from other header items.\n *\n * @default false\n */\n separateBackground?: boolean;\n /**\n * Style for the label of the header item.\n */\n style?: StackHeaderItemSharedProps['style'];\n /**\n * The tint color to apply to the button item\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarbuttonitem/tintcolor) for more information.\n */\n tintColor?: StackHeaderItemSharedProps['tintColor'];\n /**\n * Optional title to show on top of the menu.\n */\n title?: string;\n /**\n * @default 'plain'\n */\n variant?: StackHeaderItemSharedProps['variant'];\n // TODO(@ubax): Add elementSize support in react-native-screens for header menus.\n /**\n * The preferred size of the menu elements.\n *\n * > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/preferredelementsize) for more information.\n *\n * @platform iOS 16.0+\n */\n elementSize?: 'auto' | 'small' | 'medium' | 'large';\n}\n\n/**\n * Use as `Stack.Toolbar.Menu` to provide menus in iOS toolbar.\n * It accepts `Stack.Toolbar.MenuAction` and nested `Stack.Toolbar.Menu`\n * elements. Menu can be configured using both component props and child\n * elements.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n * import { Alert } from 'react-native';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"right\">\n * <Stack.Toolbar.Menu icon=\"ellipsis.circle\">\n * <Stack.Toolbar.MenuAction onPress={() => Alert.alert('Action pressed!')}>\n * Action 1\n * </Stack.Toolbar.MenuAction>\n * </Stack.Toolbar.Menu>\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @see [Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/menus) for more information about menus on iOS.\n *\n * @platform ios\n */\nexport const StackToolbarMenu: React.FC<StackToolbarMenuProps> = ({ children, ...props }) => {\n const placement = useToolbarPlacement();\n\n const allowedChildren = useMemo(\n () =>\n placement === 'bottom'\n ? [StackToolbarMenu, StackToolbarMenuAction, NativeToolbarMenu, NativeToolbarMenuAction]\n : [StackToolbarMenu, StackToolbarMenuAction],\n [placement]\n );\n\n const validChildren = useMemo(\n () => filterAllowedChildrenElements(children, allowedChildren),\n [children, allowedChildren]\n );\n\n if (process.env.NODE_ENV !== 'production') {\n const allChildren = Children.toArray(children);\n if (allChildren.length !== validChildren.length) {\n throw new Error(\n `Stack.Toolbar.Menu only accepts Stack.Toolbar.Menu and Stack.Toolbar.MenuAction as its children.`\n );\n }\n }\n\n if (placement === 'bottom') {\n // TODO(@ubax): Handle image loading using useImage in a follow-up PR.\n return <NativeToolbarMenu {...props} image={props.image} children={validChildren} />;\n }\n\n return <Menu {...props} children={validChildren} />;\n};\n\nexport function convertStackToolbarMenuPropsToRNHeaderItem(\n props: StackToolbarMenuProps\n): NativeStackHeaderItemMenu | undefined {\n if (props.hidden) {\n return undefined;\n }\n const { title, ...rest } = props;\n const actions = Children.toArray(props.children).filter(\n (child) =>\n isChildOfType(child, StackToolbarMenuAction) || isChildOfType(child, StackToolbarMenu)\n );\n const item: NativeStackHeaderItemMenu = {\n ...convertStackHeaderSharedPropsToRNSharedHeaderItem(rest),\n type: 'menu',\n menu: {\n multiselectable: true,\n items: actions\n .map((action) => {\n if (isChildOfType(action, StackToolbarMenu)) {\n return convertStackToolbarSubmenuMenuPropsToRNHeaderItem(action.props);\n }\n return convertStackToolbarMenuActionPropsToRNHeaderItem(action.props);\n })\n .filter((i) => !!i),\n },\n };\n if (title) {\n item.menu.title = title;\n }\n\n return item;\n}\n\nfunction convertStackToolbarSubmenuMenuPropsToRNHeaderItem(\n props: StackToolbarMenuProps\n): NativeStackHeaderItemMenuSubmenu | undefined {\n if (props.hidden) {\n return undefined;\n }\n const sharedProps = convertStackHeaderSharedPropsToRNSharedHeaderItem(props);\n const actions = Children.toArray(props.children).filter(\n (child) =>\n isChildOfType(child, StackToolbarMenuAction) || isChildOfType(child, StackToolbarMenu)\n );\n\n const item: NativeStackHeaderItemMenuSubmenu = {\n type: 'submenu',\n items: actions\n .map((action) => {\n if (isChildOfType(action, StackToolbarMenu)) {\n return convertStackToolbarSubmenuMenuPropsToRNHeaderItem(action.props);\n }\n return convertStackToolbarMenuActionPropsToRNHeaderItem(action.props);\n })\n .filter((i) => !!i),\n label: sharedProps.label || props.title || '',\n multiselectable: true,\n };\n\n if (props.inline !== undefined) {\n item.inline = props.inline;\n }\n if (props.palette !== undefined) {\n item.layout = props.palette ? 'palette' : 'default';\n }\n if (props.destructive !== undefined) {\n item.destructive = props.destructive;\n }\n // TODO: Add elementSize to react-native-screens\n\n if (sharedProps.icon) {\n // Only SF Symbols are supported in submenu icons\n // TODO(@ubax): Add support for other images in react-native-screens\n if (sharedProps.icon.type === 'sfSymbol') {\n item.icon = sharedProps.icon;\n } else {\n console.warn(\n 'When Icon is used inside Stack.Toolbar.Menu used as a submenu, only sfSymbol icons are supported. This is a limitation of React Native Screens.'\n );\n }\n }\n\n return item;\n}\n\nexport interface StackToolbarMenuActionProps {\n /**\n * Can be an Icon, Label or string title.\n */\n children?: ReactNode;\n /**\n * If `true`, the menu item will be disabled and not selectable.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/disabled) for more information.\n */\n disabled?: boolean;\n icon?: SFSymbol | ImageSourcePropType;\n // TODO(@ubax): Add useImage support in a follow-up PR.\n /**\n * Image to display for the menu action.\n *\n * > **Note**: This prop is only supported in `Stack.Toolbar.Bottom`.\n */\n image?: ImageRef;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive) for more information.\n */\n destructive?: boolean;\n /**\n * If `true`, the menu will be kept presented after the action is selected.\n *\n * This is marked as unstable, because when action is selected it will recreate the menu,\n * which will close all opened submenus and reset the scroll position.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/keepsmenupresented) for more information.\n */\n unstable_keepPresented?: boolean;\n /**\n * If `true`, the menu item will be displayed as selected.\n */\n isOn?: boolean;\n onPress?: () => void;\n /**\n * An elaborated title that explains the purpose of the action.\n */\n discoverabilityLabel?: string;\n /**\n * An optional subtitle for the menu item.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/subtitle) for more information.\n */\n subtitle?: string;\n hidden?: boolean;\n}\n\n/**\n * An action item for a `Stack.Toolbar.Menu`.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Toolbar placement=\"right\">\n * <Stack.Toolbar.Menu icon=\"ellipsis.circle\">\n * <Stack.Toolbar.MenuAction onPress={() => alert('Action pressed!')}>\n * Action 1\n * </Stack.Toolbar.MenuAction>\n * </Stack.Toolbar.Menu>\n * </Stack.Toolbar>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * @platform ios\n */\nexport const StackToolbarMenuAction: React.FC<StackToolbarMenuActionProps> = (props) => {\n const placement = useToolbarPlacement();\n\n if (placement === 'bottom') {\n // TODO(@ubax): Handle image loading using useImage in a follow-up PR.\n const icon = typeof props.icon === 'string' ? props.icon : undefined;\n return <NativeToolbarMenuAction {...props} icon={icon} image={props.image} />;\n }\n\n return <MenuAction {...props} />;\n};\n\nexport function convertStackToolbarMenuActionPropsToRNHeaderItem(\n props: StackToolbarMenuActionProps\n): NativeStackHeaderItemMenuAction {\n const { children, isOn, unstable_keepPresented, icon, ...rest } = props;\n const sharedProps = convertStackHeaderSharedPropsToRNSharedHeaderItem(props);\n const item: NativeStackHeaderItemMenuAction = {\n ...rest,\n type: 'action',\n label: sharedProps.label,\n state: isOn ? 'on' : 'off',\n onPress: props.onPress ?? (() => {}),\n };\n if (unstable_keepPresented !== undefined) {\n item.keepsMenuPresented = unstable_keepPresented;\n }\n if (sharedProps.icon) {\n // Only SF Symbols are supported in submenu icons\n // TODO(@ubax): Add support for other images in react-native-screens\n if (sharedProps.icon.type === 'sfSymbol') {\n item.icon = sharedProps.icon;\n } else {\n console.warn(\n 'When Icon is used inside Stack.Toolbar.MenuAction, only sfSymbol icons are supported. This is a limitation of React Native Screens.'\n );\n }\n }\n return item;\n}\n"]}