expo-router 56.2.14 → 56.2.16

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 (69) hide show
  1. package/android/build.gradle +2 -2
  2. package/build/exports.d.ts +1 -0
  3. package/build/exports.d.ts.map +1 -1
  4. package/build/exports.js.map +1 -1
  5. package/build/fork/extractPathFromURL.d.ts.map +1 -1
  6. package/build/fork/extractPathFromURL.js +5 -2
  7. package/build/fork/extractPathFromURL.js.map +1 -1
  8. package/build/global-state/getRouteInfoFromState.d.ts.map +1 -1
  9. package/build/global-state/getRouteInfoFromState.js +3 -11
  10. package/build/global-state/getRouteInfoFromState.js.map +1 -1
  11. package/build/native-tabs/NativeTabTrigger.d.ts +1 -1
  12. package/build/native-tabs/NativeTabTrigger.d.ts.map +1 -1
  13. package/build/native-tabs/NativeTabTrigger.js +9 -1
  14. package/build/native-tabs/NativeTabTrigger.js.map +1 -1
  15. package/build/native-tabs/types.d.ts +31 -0
  16. package/build/native-tabs/types.d.ts.map +1 -1
  17. package/build/native-tabs/types.js.map +1 -1
  18. package/build/react-navigation/routers/StackRouter.d.ts.map +1 -1
  19. package/build/react-navigation/routers/StackRouter.js +2 -0
  20. package/build/react-navigation/routers/StackRouter.js.map +1 -1
  21. package/build/react-navigation/routers/TabRouter.d.ts.map +1 -1
  22. package/build/react-navigation/routers/TabRouter.js +2 -0
  23. package/build/react-navigation/routers/TabRouter.js.map +1 -1
  24. package/build/testing-library/context-stubs.d.ts +13 -0
  25. package/build/testing-library/context-stubs.d.ts.map +1 -1
  26. package/build/testing-library/context-stubs.js +38 -2
  27. package/build/testing-library/context-stubs.js.map +1 -1
  28. package/build/toolbar/native.android.d.ts.map +1 -1
  29. package/build/toolbar/native.android.js +6 -2
  30. package/build/toolbar/native.android.js.map +1 -1
  31. package/build/utils/url.d.ts +2 -0
  32. package/build/utils/url.d.ts.map +1 -1
  33. package/build/utils/url.js +21 -0
  34. package/build/utils/url.js.map +1 -1
  35. package/expo-module.config.json +1 -1
  36. package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.14/expo.modules.router-56.2.14.module → 56.2.16/expo.modules.router-56.2.16.module} +7 -7
  37. package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.16/expo.modules.router-56.2.16.module.md5 +1 -0
  38. package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.16/expo.modules.router-56.2.16.module.sha1 +1 -0
  39. package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.16/expo.modules.router-56.2.16.module.sha256 +1 -0
  40. package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.16/expo.modules.router-56.2.16.module.sha512 +1 -0
  41. package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.14/expo.modules.router-56.2.14.pom → 56.2.16/expo.modules.router-56.2.16.pom} +1 -1
  42. package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.16/expo.modules.router-56.2.16.pom.md5 +1 -0
  43. package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.16/expo.modules.router-56.2.16.pom.sha1 +1 -0
  44. package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.16/expo.modules.router-56.2.16.pom.sha256 +1 -0
  45. package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.16/expo.modules.router-56.2.16.pom.sha512 +1 -0
  46. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml +4 -4
  47. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.md5 +1 -1
  48. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha1 +1 -1
  49. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha256 +1 -1
  50. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha512 +1 -1
  51. package/package.json +11 -11
  52. package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.14/expo.modules.router-56.2.14.module.md5 +0 -1
  53. package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.14/expo.modules.router-56.2.14.module.sha1 +0 -1
  54. package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.14/expo.modules.router-56.2.14.module.sha256 +0 -1
  55. package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.14/expo.modules.router-56.2.14.module.sha512 +0 -1
  56. package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.14/expo.modules.router-56.2.14.pom.md5 +0 -1
  57. package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.14/expo.modules.router-56.2.14.pom.sha1 +0 -1
  58. package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.14/expo.modules.router-56.2.14.pom.sha256 +0 -1
  59. package/local-maven-repo/expo/modules/router/expo.modules.router/56.2.14/expo.modules.router-56.2.14.pom.sha512 +0 -1
  60. /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.14/expo.modules.router-56.2.14-sources.jar → 56.2.16/expo.modules.router-56.2.16-sources.jar} +0 -0
  61. /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.14/expo.modules.router-56.2.14-sources.jar.md5 → 56.2.16/expo.modules.router-56.2.16-sources.jar.md5} +0 -0
  62. /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.14/expo.modules.router-56.2.14-sources.jar.sha1 → 56.2.16/expo.modules.router-56.2.16-sources.jar.sha1} +0 -0
  63. /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.14/expo.modules.router-56.2.14-sources.jar.sha256 → 56.2.16/expo.modules.router-56.2.16-sources.jar.sha256} +0 -0
  64. /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.14/expo.modules.router-56.2.14-sources.jar.sha512 → 56.2.16/expo.modules.router-56.2.16-sources.jar.sha512} +0 -0
  65. /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.14/expo.modules.router-56.2.14.aar → 56.2.16/expo.modules.router-56.2.16.aar} +0 -0
  66. /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.14/expo.modules.router-56.2.14.aar.md5 → 56.2.16/expo.modules.router-56.2.16.aar.md5} +0 -0
  67. /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.14/expo.modules.router-56.2.14.aar.sha1 → 56.2.16/expo.modules.router-56.2.16.aar.sha1} +0 -0
  68. /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.14/expo.modules.router-56.2.14.aar.sha256 → 56.2.16/expo.modules.router-56.2.16.aar.sha256} +0 -0
  69. /package/local-maven-repo/expo/modules/router/expo.modules.router/{56.2.14/expo.modules.router-56.2.14.aar.sha512 → 56.2.16/expo.modules.router-56.2.16.aar.sha512} +0 -0
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'expo.modules.router'
7
- version = '56.2.14'
7
+ version = '56.2.16'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.router"
11
11
  defaultConfig {
12
12
  versionCode 1
13
- versionName "56.2.14"
13
+ versionName "56.2.16"
14
14
  }
15
15
  lintOptions {
16
16
  abortOnError false
@@ -23,6 +23,7 @@ export { DarkTheme } from './react-navigation/native/theming/DarkTheme';
23
23
  export { DefaultTheme } from './react-navigation/native/theming/DefaultTheme';
24
24
  export { ThemeProvider } from './react-navigation/core/theming/ThemeProvider';
25
25
  export { useTheme } from './react-navigation/core/theming/useTheme';
26
+ export type { Theme } from './react-navigation/native/types';
26
27
  export { useRoutePath } from './react-navigation/native/useRoutePath';
27
28
  export { useScrollToTop } from './react-navigation/native/useScrollToTop';
28
29
  export { useRoute } from './react-navigation/core/useRoute';
@@ -1 +1 @@
1
- {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,WAAW,EACX,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,sBAAsB,EACtB,aAAa,EACb,mBAAmB,GACpB,M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\n useRouter,\n useUnstableGlobalHref,\n usePathname,\n useNavigationContainerRef,\n useGlobalSearchParams,\n useLocalSearchParams,\n useSegments,\n useRootNavigation,\n useRootNavigationState,\n useLoaderData,\n useCurrentRouteInfo,\n} from './hooks';\n\nexport { router, type ImperativeRouter } from './imperative-api';\n\nexport { withLayoutContext } from './layouts/withLayoutContext';\nexport { Navigator, Slot };\n\n// Expo Router Views\nexport { ExpoRoot } from './ExpoRoot';\nexport { Unmatched } from './views/Unmatched';\nexport { Sitemap } from './views/Sitemap';\nexport { useSitemap, type SitemapType } from './views/useSitemap';\nexport type { ErrorBoundaryProps } from './views/Try';\nexport { ErrorBoundary } from './views/ErrorBoundary';\nexport { SuspenseFallback, type SuspenseFallbackProps } from './views/SuspenseFallback';\nexport type { ScreenProps } from './useScreens';\n\n// Platform\n/**\n * @hidden\n */\nexport * as SplashScreen from './views/Splash';\n\n// React Navigation\nexport { useNavigation } from './useNavigation';\nexport { useFocusEffect, type EffectCallback } from './useFocusEffect';\nexport { useIsFocused } from './useIsFocused';\nexport type { ResultState } from './fork/getStateFromPath';\n\nexport { DarkTheme } from './react-navigation/native/theming/DarkTheme';\nexport { DefaultTheme } from './react-navigation/native/theming/DefaultTheme';\nexport { ThemeProvider } from './react-navigation/core/theming/ThemeProvider';\nexport { useTheme } from './react-navigation/core/theming/useTheme';\nexport { useRoutePath } from './react-navigation/native/useRoutePath';\nexport { useScrollToTop } from './react-navigation/native/useScrollToTop';\nexport { useRoute } from './react-navigation/core/useRoute';\n\nexport type { RedirectConfig } from './getRoutesCore';\nexport type { SingularOptions } from './useScreens';\n\nexport type * from './types';\n\nexport {\n Badge,\n type BadgeProps,\n Icon,\n type IconProps,\n Label,\n type LabelProps,\n VectorIcon,\n type VectorIconProps,\n} from './primitives';\n\nexport {\n unstable_createStandardRouterNavigator,\n unstable_integrateWithRouter,\n} from './standard-navigation';\nexport type {\n IntegrateWithRouterOptions,\n NavigatorContentProps,\n StandardNavigatorEventMapBase,\n StandardUseNavigationBuilderOptions,\n} from './standard-navigation';\n\n// Router factories for use with `unstable_createStandardRouterNavigator` / `unstable_integrateWithRouter`.\nexport { StackRouter, TabRouter } from './react-navigation/routers';\nexport type {\n StackNavigationState,\n StackRouterOptions,\n TabNavigationState,\n TabRouterOptions,\n} from './react-navigation/routers';\n\nexport { unstable_navigationEvents } from './navigationEvents';\nexport type {\n PagePreloadedEvent,\n PageFocusedEvent,\n PageBlurredEvent,\n PageRemoved,\n ActionDispatchedEvent,\n AnalyticsEvent,\n} from './navigationEvents';\n\n/**\n * @deprecated Use `import { Tabs } from 'expo-router/js-tabs'` instead.\n */\nexport { Tabs } from './layouts/Tabs';\n\nexport { ExperimentalStack } from './layouts/experimental-stack';\nexport type {\n ExperimentalStackNavigationOptions,\n ExperimentalStackNavigationEventMap,\n ExperimentalStackNavigationProp,\n ExperimentalStackScreenProps,\n} from './layouts/experimental-stack';\n\n// Copied from packages/expo-router/src/react-navigation/native-stack/index.tsx\n// Keep in sync\nexport type {\n NativeStackHeaderBackProps,\n NativeStackHeaderItem,\n NativeStackHeaderItemButton,\n NativeStackHeaderItemCustom,\n NativeStackHeaderItemMenu,\n NativeStackHeaderItemMenuAction,\n NativeStackHeaderItemMenuSubmenu,\n NativeStackHeaderItemProps,\n NativeStackHeaderItemSpacing,\n NativeStackHeaderLeftProps,\n NativeStackHeaderProps,\n NativeStackHeaderRightProps,\n NativeStackHeaderNativeProps,\n NativeStackNativeProps,\n NativeStackNavigationEventMap,\n NativeStackNavigationOptions,\n NativeStackNavigationProp,\n NativeStackNavigatorProps,\n NativeStackOptionsArgs,\n NativeStackScreenNativeProps,\n NativeStackScreenProps,\n} from './react-navigation/native-stack';\n"]}
1
+ {"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAkB;AAClB,iDAAoD;AAmB3C,0FAnBA,qBAAS,OAmBA;AAAE,qFAnBA,gBAA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AA,UAAU,OAAA;AAIZ,6DAG+B;AAF7B,6IAAA,sCAAsC,OAAA;AACtC,mIAAA,4BAA4B,OAAA;AAS9B,2GAA2G;AAC3G,sDAAoE;AAA3D,sGAAA,WAAW,OAAA;AAAE,oGAAA,SAAS,OAAA;AAQ/B,uDAA+D;AAAtD,6HAAA,yBAAyB,OAAA;AAUlC;;GAEG;AACH,uCAAsC;AAA7B,4FAAA,IAAI,OAAA;AAEb,mEAAiE;AAAxD,uHAAA,iBAAiB,OAAA","sourcesContent":["// Expo Router API\nimport { Navigator, Slot } from './views/Navigator';\n\nexport {\n useRouter,\n useUnstableGlobalHref,\n usePathname,\n useNavigationContainerRef,\n useGlobalSearchParams,\n useLocalSearchParams,\n useSegments,\n useRootNavigation,\n useRootNavigationState,\n useLoaderData,\n useCurrentRouteInfo,\n} from './hooks';\n\nexport { router, type ImperativeRouter } from './imperative-api';\n\nexport { withLayoutContext } from './layouts/withLayoutContext';\nexport { Navigator, Slot };\n\n// Expo Router Views\nexport { ExpoRoot } from './ExpoRoot';\nexport { Unmatched } from './views/Unmatched';\nexport { Sitemap } from './views/Sitemap';\nexport { useSitemap, type SitemapType } from './views/useSitemap';\nexport type { ErrorBoundaryProps } from './views/Try';\nexport { ErrorBoundary } from './views/ErrorBoundary';\nexport { SuspenseFallback, type SuspenseFallbackProps } from './views/SuspenseFallback';\nexport type { ScreenProps } from './useScreens';\n\n// Platform\n/**\n * @hidden\n */\nexport * as SplashScreen from './views/Splash';\n\n// React Navigation\nexport { useNavigation } from './useNavigation';\nexport { useFocusEffect, type EffectCallback } from './useFocusEffect';\nexport { useIsFocused } from './useIsFocused';\nexport type { ResultState } from './fork/getStateFromPath';\n\nexport { DarkTheme } from './react-navigation/native/theming/DarkTheme';\nexport { DefaultTheme } from './react-navigation/native/theming/DefaultTheme';\nexport { ThemeProvider } from './react-navigation/core/theming/ThemeProvider';\nexport { useTheme } from './react-navigation/core/theming/useTheme';\nexport type { Theme } from './react-navigation/native/types';\nexport { useRoutePath } from './react-navigation/native/useRoutePath';\nexport { useScrollToTop } from './react-navigation/native/useScrollToTop';\nexport { useRoute } from './react-navigation/core/useRoute';\n\nexport type { RedirectConfig } from './getRoutesCore';\nexport type { SingularOptions } from './useScreens';\n\nexport type * from './types';\n\nexport {\n Badge,\n type BadgeProps,\n Icon,\n type IconProps,\n Label,\n type LabelProps,\n VectorIcon,\n type VectorIconProps,\n} from './primitives';\n\nexport {\n unstable_createStandardRouterNavigator,\n unstable_integrateWithRouter,\n} from './standard-navigation';\nexport type {\n IntegrateWithRouterOptions,\n NavigatorContentProps,\n StandardNavigatorEventMapBase,\n StandardUseNavigationBuilderOptions,\n} from './standard-navigation';\n\n// Router factories for use with `unstable_createStandardRouterNavigator` / `unstable_integrateWithRouter`.\nexport { StackRouter, TabRouter } from './react-navigation/routers';\nexport type {\n StackNavigationState,\n StackRouterOptions,\n TabNavigationState,\n TabRouterOptions,\n} from './react-navigation/routers';\n\nexport { unstable_navigationEvents } from './navigationEvents';\nexport type {\n PagePreloadedEvent,\n PageFocusedEvent,\n PageBlurredEvent,\n PageRemoved,\n ActionDispatchedEvent,\n AnalyticsEvent,\n} from './navigationEvents';\n\n/**\n * @deprecated Use `import { Tabs } from 'expo-router/js-tabs'` instead.\n */\nexport { Tabs } from './layouts/Tabs';\n\nexport { ExperimentalStack } from './layouts/experimental-stack';\nexport type {\n ExperimentalStackNavigationOptions,\n ExperimentalStackNavigationEventMap,\n ExperimentalStackNavigationProp,\n ExperimentalStackScreenProps,\n} from './layouts/experimental-stack';\n\n// Copied from packages/expo-router/src/react-navigation/native-stack/index.tsx\n// Keep in sync\nexport type {\n NativeStackHeaderBackProps,\n NativeStackHeaderItem,\n NativeStackHeaderItemButton,\n NativeStackHeaderItemCustom,\n NativeStackHeaderItemMenu,\n NativeStackHeaderItemMenuAction,\n NativeStackHeaderItemMenuSubmenu,\n NativeStackHeaderItemProps,\n NativeStackHeaderItemSpacing,\n NativeStackHeaderLeftProps,\n NativeStackHeaderProps,\n NativeStackHeaderRightProps,\n NativeStackHeaderNativeProps,\n NativeStackNativeProps,\n NativeStackNavigationEventMap,\n NativeStackNavigationOptions,\n NativeStackNavigationProp,\n NativeStackNavigatorProps,\n NativeStackOptionsArgs,\n NativeStackScreenNativeProps,\n NativeStackScreenProps,\n} from './react-navigation/native-stack';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"extractPathFromURL.d.ts","sourceRoot":"","sources":["../../src/fork/extractPathFromURL.ts"],"names":[],"mappings":"AAAA,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,MAAM,GAAG;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAUA;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI3D;AA2GD,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,MAAW,UAM3E"}
1
+ {"version":3,"file":"extractPathFromURL.d.ts","sourceRoot":"","sources":["../../src/fork/extractPathFromURL.ts"],"names":[],"mappings":"AAEA,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,MAAM,GAAG;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAUA;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI3D;AA6GD,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,MAAW,UAM3E"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parsePathAndParamsFromExpoGoLink = parsePathAndParamsFromExpoGoLink;
4
4
  exports.parsePathFromExpoGoLink = parsePathFromExpoGoLink;
5
5
  exports.extractExpoPathFromURL = extractExpoPathFromURL;
6
+ const url_1 = require("../utils/url");
6
7
  function parsePathAndParamsFromExpoGoLink(url) {
7
8
  // If the URL is defined (default in Expo Go dev apps) and the URL has no path:
8
9
  // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`
@@ -84,7 +85,7 @@ function fromDeepLink(url) {
84
85
  return '';
85
86
  }
86
87
  const incomingUrl = res.searchParams.get('url');
87
- return extractExactPathFromURL(decodeURI(incomingUrl));
88
+ return extractExactPathFromURL((0, url_1.safeDecodeURI)(incomingUrl));
88
89
  }
89
90
  let results = '';
90
91
  if (res.host) {
@@ -96,7 +97,9 @@ function fromDeepLink(url) {
96
97
  const qs = !res.search
97
98
  ? ''
98
99
  : // @ts-ignore: `entries` is not on `URLSearchParams` in some typechecks.
99
- [...res.searchParams.entries()].map(([k, v]) => `${k}=${decodeURIComponent(v)}`).join('&');
100
+ [...res.searchParams.entries()]
101
+ .map(([k, v]) => `${k}=${(0, url_1.safeDecodeURIComponent)(v)}`)
102
+ .join('&');
100
103
  if (qs) {
101
104
  results += '?' + qs;
102
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"extractPathFromURL.js","sourceRoot":"","sources":["../../src/fork/extractPathFromURL.ts"],"names":[],"mappings":";;AAAA,4EAaC;AAED,0DAIC;AA2GD,wDAMC;AApID,SAAgB,gCAAgC,CAAC,GAAW;IAI1D,+EAA+E;IAC/E,oFAAoF;IAEpF,MAAM,IAAI,GAAG,uBAAuB,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC7C,OAAO;QACL,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE;QAC5B,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE;KAChC,CAAC;AACJ,CAAC;AAED,SAAgB,uBAAuB,CAAC,GAAW;IACjD,+EAA+E;IAC/E,oFAAoF;IACpF,OAAO,GAAG,CAAC,KAAK,CAAC,yBAAyB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACzD,CAAC;AAED,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AC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE/F,IAAI,EAAE,EAAE,CAAC;QACP,OAAO,IAAI,GAAG,GAAG,EAAE,CAAC;IACtB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAgB,sBAAsB,CAAC,SAAmB,EAAE,MAAc,EAAE;IAC1E,OAAO,CACL,uBAAuB,CAAC,GAAG,CAAC;QAC1B,sEAAsE;SACrE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CACtB,CAAC;AACJ,CAAC","sourcesContent":["export function parsePathAndParamsFromExpoGoLink(url: string): {\n pathname: string;\n queryString: string;\n} {\n // If the URL is defined (default in Expo Go dev apps) and the URL has no path:\n // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`\n\n const href = parsePathFromExpoGoLink(url);\n const results = href.match(/([^?]*)(\\?.*)?/);\n return {\n pathname: results?.[1] ?? '',\n queryString: results?.[2] ?? '',\n };\n}\n\nexport function parsePathFromExpoGoLink(url: string): string {\n // If the URL is defined (default in Expo Go dev apps) and the URL has no path:\n // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`\n return url.match(/exps?:\\/\\/.*?\\/--\\/(.*)/)?.[1] ?? '';\n}\n\n// This is only run on native.\nfunction extractExactPathFromURL(url: string): string {\n if (\n // If a universal link / app link / web URL is used, we should use the path\n // from the URL, while stripping the origin.\n url.match(/^https?:\\/\\//)\n ) {\n const { origin, href, hostname } = new URL(url);\n\n if (hostname === 'exp.host' || hostname === 'u.expo.dev') {\n // These are QR code generate deep-link that always like to the '/' path\n // TODO: In the future, QR code may link to a specific path and this logic will need to be udpated\n return '';\n }\n\n return href.replace(origin, '');\n }\n\n const isExpoGo = typeof expo !== 'undefined' && globalThis.expo?.modules?.ExpoGo;\n\n // Handle special URLs used in Expo Go: `/--/pathname` -> `pathname`\n if (\n isExpoGo &&\n // while not exhaustive, `exp` and `exps` are the only two schemes which\n // are passed through to other apps in Expo Go.\n url.match(/^exp(s)?:\\/\\//)\n ) {\n const pathname = parsePathFromExpoGoLink(url);\n if (pathname) {\n return fromDeepLink('a://' + pathname);\n }\n // Match the `?.*` segment of the URL.\n const queryParams = url.match(/exps?:\\/\\/.*\\?(.*)/)?.[1];\n if (queryParams) {\n return fromDeepLink('a://?' + queryParams);\n }\n\n return '';\n }\n\n // TODO: Support dev client URLs\n\n return fromDeepLink(url);\n}\n\n/** Major hack to support the makeshift expo-development-client system. */\nfunction isExpoDevelopmentClient(url: URL): boolean {\n return url.hostname === 'expo-development-client';\n}\n\nfunction fromDeepLink(url: string): string {\n let res: URL | null;\n try {\n // This is for all standard deep links, e.g. `foobar://` where everything\n // after the `://` is the path.\n res = new URL(url);\n } catch {\n /**\n * We failed to parse the URL. This can occur for a variety of reasons, including:\n * - Its a partial URL (e.g. `/route?query=param`).\n * - It has a valid App scheme, but the scheme isn't a valid URL scheme (e.g. `my_app://`)\n */\n\n // If `url` is already a path (starts with `/`), return it as-is\n if (url.startsWith('/')) {\n return url;\n }\n\n /**\n * App schemes are not valid URL schemes, so they will fail to parse.\n * We need to strip the scheme from these URLs\n */\n return url.replace(/^[^:]+:\\/\\//, '');\n }\n\n if (isExpoDevelopmentClient(res)) {\n if (!res.searchParams.get('url')) {\n return '';\n }\n const incomingUrl = res.searchParams.get('url')!;\n return extractExactPathFromURL(decodeURI(incomingUrl));\n }\n\n let results = '';\n\n if (res.host) {\n results += res.host;\n }\n\n if (res.pathname) {\n results += res.pathname;\n }\n\n const qs = !res.search\n ? ''\n : // @ts-ignore: `entries` is not on `URLSearchParams` in some typechecks.\n [...res.searchParams.entries()].map(([k, v]) => `${k}=${decodeURIComponent(v)}`).join('&');\n\n if (qs) {\n results += '?' + qs;\n }\n\n return results;\n}\n\nexport function extractExpoPathFromURL(_prefixes: string[], url: string = '') {\n return (\n extractExactPathFromURL(url)\n // TODO: We should get rid of this, dropping specificities is not good\n .replace(/^\\//, '')\n );\n}\n"]}
1
+ {"version":3,"file":"extractPathF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AG,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;QACjD,OAAO,uBAAuB,CAAC,IAAA,mBAAa,EAAC,WAAW,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,IAAI,OAAO,GAAG,EAAE,CAAC;IAEjB,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QACb,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC;IACtB,CAAC;IAED,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;QACjB,OAAO,IAAI,GAAG,CAAC,QAAQ,CAAC;IAC1B,CAAC;IAED,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM;QACpB,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,wEAAwE;YACxE,CAAC,GAAG,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;iBAC5B,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,IAAA,4BAAsB,EAAC,CAAC,CAAC,EAAE,CAAC;iBACpD,IAAI,CAAC,GAAG,CAAC,CAAC;IAEjB,IAAI,EAAE,EAAE,CAAC;QACP,OAAO,IAAI,GAAG,GAAG,EAAE,CAAC;IACtB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAgB,sBAAsB,CAAC,SAAmB,EAAE,MAAc,EAAE;IAC1E,OAAO,CACL,uBAAuB,CAAC,GAAG,CAAC;QAC1B,sEAAsE;SACrE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CACtB,CAAC;AACJ,CAAC","sourcesContent":["import { safeDecodeURI, safeDecodeURIComponent } from '../utils/url';\n\nexport function parsePathAndParamsFromExpoGoLink(url: string): {\n pathname: string;\n queryString: string;\n} {\n // If the URL is defined (default in Expo Go dev apps) and the URL has no path:\n // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`\n\n const href = parsePathFromExpoGoLink(url);\n const results = href.match(/([^?]*)(\\?.*)?/);\n return {\n pathname: results?.[1] ?? '',\n queryString: results?.[2] ?? '',\n };\n}\n\nexport function parsePathFromExpoGoLink(url: string): string {\n // If the URL is defined (default in Expo Go dev apps) and the URL has no path:\n // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`\n return url.match(/exps?:\\/\\/.*?\\/--\\/(.*)/)?.[1] ?? '';\n}\n\n// This is only run on native.\nfunction extractExactPathFromURL(url: string): string {\n if (\n // If a universal link / app link / web URL is used, we should use the path\n // from the URL, while stripping the origin.\n url.match(/^https?:\\/\\//)\n ) {\n const { origin, href, hostname } = new URL(url);\n\n if (hostname === 'exp.host' || hostname === 'u.expo.dev') {\n // These are QR code generate deep-link that always like to the '/' path\n // TODO: In the future, QR code may link to a specific path and this logic will need to be udpated\n return '';\n }\n\n return href.replace(origin, '');\n }\n\n const isExpoGo = typeof expo !== 'undefined' && globalThis.expo?.modules?.ExpoGo;\n\n // Handle special URLs used in Expo Go: `/--/pathname` -> `pathname`\n if (\n isExpoGo &&\n // while not exhaustive, `exp` and `exps` are the only two schemes which\n // are passed through to other apps in Expo Go.\n url.match(/^exp(s)?:\\/\\//)\n ) {\n const pathname = parsePathFromExpoGoLink(url);\n if (pathname) {\n return fromDeepLink('a://' + pathname);\n }\n // Match the `?.*` segment of the URL.\n const queryParams = url.match(/exps?:\\/\\/.*\\?(.*)/)?.[1];\n if (queryParams) {\n return fromDeepLink('a://?' + queryParams);\n }\n\n return '';\n }\n\n // TODO: Support dev client URLs\n\n return fromDeepLink(url);\n}\n\n/** Major hack to support the makeshift expo-development-client system. */\nfunction isExpoDevelopmentClient(url: URL): boolean {\n return url.hostname === 'expo-development-client';\n}\n\nfunction fromDeepLink(url: string): string {\n let res: URL | null;\n try {\n // This is for all standard deep links, e.g. `foobar://` where everything\n // after the `://` is the path.\n res = new URL(url);\n } catch {\n /**\n * We failed to parse the URL. This can occur for a variety of reasons, including:\n * - Its a partial URL (e.g. `/route?query=param`).\n * - It has a valid App scheme, but the scheme isn't a valid URL scheme (e.g. `my_app://`)\n */\n\n // If `url` is already a path (starts with `/`), return it as-is\n if (url.startsWith('/')) {\n return url;\n }\n\n /**\n * App schemes are not valid URL schemes, so they will fail to parse.\n * We need to strip the scheme from these URLs\n */\n return url.replace(/^[^:]+:\\/\\//, '');\n }\n\n if (isExpoDevelopmentClient(res)) {\n if (!res.searchParams.get('url')) {\n return '';\n }\n const incomingUrl = res.searchParams.get('url')!;\n return extractExactPathFromURL(safeDecodeURI(incomingUrl));\n }\n\n let results = '';\n\n if (res.host) {\n results += res.host;\n }\n\n if (res.pathname) {\n results += res.pathname;\n }\n\n const qs = !res.search\n ? ''\n : // @ts-ignore: `entries` is not on `URLSearchParams` in some typechecks.\n [...res.searchParams.entries()]\n .map(([k, v]) => `${k}=${safeDecodeURIComponent(v)}`)\n .join('&');\n\n if (qs) {\n results += '?' + qs;\n }\n\n return results;\n}\n\nexport function extractExpoPathFromURL(_prefixes: string[], url: string = '') {\n return (\n extractExactPathFromURL(url)\n // TODO: We should get rid of this, dropping specificities is not good\n .replace(/^\\//, '')\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getRouteInfoFromState.d.ts","sourceRoot":"","sources":["../../src/global-state/getRouteInfoFromState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGjD,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAEhF,MAAM,MAAM,SAAS,GAAG;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IACnD,YAAY,EAAE,eAAe,CAAC;IAC9B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,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CAAC;AAEF;;GAEG;AACH,KAAK,WAAW,GAAG,CAAC,iBAAiB,GAAG,eAAe,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC,GAAG;IACzF,MAAM,EAAE;QACN,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,wBAAwB,CAAC;QAClC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,WAAW,CAAC;KACrB,EAAE,CAAC;CACL,CAAC;AAEF,KAAK,wBAAwB,GACzB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,GACjC;IACE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,wBAAwB,CAAC;CACnC,CAAC;AAEN,wBAAgB,qBAAqB,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,SAAS,CAwKpE"}
@@ -4,6 +4,7 @@ exports.defaultRouteInfo = void 0;
4
4
  exports.getRouteInfoFromState = getRouteInfoFromState;
5
5
  const constants_1 = require("../constants");
6
6
  const getPathFromState_forks_1 = require("../fork/getPathFromState-forks");
7
+ const url_1 = require("../utils/url");
7
8
  exports.defaultRouteInfo = {
8
9
  unstable_globalHref: '',
9
10
  searchParams: new URLSearchParams(),
@@ -48,10 +49,10 @@ function getRouteInfoFromState(state) {
48
49
  }
49
50
  params = Object.fromEntries(Object.entries(params).map(([key, value]) => {
50
51
  if (typeof value === 'string') {
51
- return [key, safeDecodeURIComponent(value)];
52
+ return [key, (0, url_1.safeDecodeURIComponent)(value)];
52
53
  }
53
54
  else if (Array.isArray(value)) {
54
- return [key, value.map((v) => safeDecodeURIComponent(v))];
55
+ return [key, value.map((v) => (0, url_1.safeDecodeURIComponent)(v))];
55
56
  }
56
57
  else {
57
58
  return [key, value];
@@ -161,13 +162,4 @@ function getRouteInfoFromState(state) {
161
162
  isIndex: false,
162
163
  };
163
164
  }
164
- function safeDecodeURIComponent(value) {
165
- try {
166
- return typeof value === 'string' ? decodeURIComponent(value) : value;
167
- }
168
- catch {
169
- // If the value is not a valid URI component, return it as is
170
- return value;
171
- }
172
- }
173
165
  //# sourceMappingURL=getRouteInfoFromState.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getRouteInfoFromState.js","sourceRoot":"","sources":["../../src/global-state/getRouteInfoFromState.ts"],"names":[],"mappings":";;;AA8CA,sDAwKC;AArND,4CAA4F;AAC5F,2EAA+D;AAalD,QAAA,gBAAgB,GAAc;IACzC,mBAAmB,EAAE,EAAE;IACvB,YAAY,EAAE,IAAI,eAAe,EAAE;IACnC,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,EAAE;IACZ,kBAAkB,EAAE,GAAG;IACvB,6CAA6C;IAC7C,OAAO,EAAE,KAAK;CACf,CAAC;AAsBF,SAAgB,qBAAqB,CAAC,KAAmB;IACvD,IAAI,CAAC,KAAK;QAAE,OAAO,wBAAgB,CAAC;IAEpC,8CAA8C;IAC9C,MAAM,KAAK,GAAG,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAE,CAAC;IAEjC,IAAI,KAAK,CAAC,IAAI,KAAK,gCAAoB,IAAI,KAAK,CAAC,IAAI,KAAK,8BAAkB,EAAE,CAAC;QAC7E,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,gCAAoB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAC1F,OAAO;YACL,GAAG,wBAAgB;YACnB,mBAAmB,EAAE,IAAA,sCAAa,EAAC,IAAI,CAAC;YACxC,QAAQ,EAAE,IAAI;YACd,kBAAkB,EAAE,IA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,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["import type { FocusedRouteState } from './types';\nimport { INTERNAL_SLOT_NAME, NOT_FOUND_ROUTE_NAME, SITEMAP_ROUTE_NAME } from '../constants';\nimport { appendBaseUrl } from '../fork/getPathFromState-forks';\nimport type { NavigationState, PartialState } from '../react-navigation/native';\n\nexport type UrlObject = {\n unstable_globalHref: string;\n pathname: string;\n readonly params: Record<string, string | string[]>;\n searchParams: URLSearchParams;\n segments: string[];\n pathnameWithParams: string;\n isIndex: boolean;\n};\n\nexport const defaultRouteInfo: UrlObject = {\n unstable_globalHref: '',\n searchParams: new URLSearchParams(),\n pathname: '/',\n params: {},\n segments: [],\n pathnameWithParams: '/',\n // TODO: Remove this, it is not used anywhere\n isIndex: false,\n};\n\n/**\n * A better typed version of `FocusedRouteState` that is easier to parse\n */\ntype StrictState = (FocusedRouteState | NavigationState | PartialState<NavigationState>) & {\n routes: {\n key?: string;\n name: string;\n params?: StrictFocusedRouteParams;\n path?: string;\n state?: StrictState;\n }[];\n};\n\ntype StrictFocusedRouteParams =\n | Record<string, string | string[]>\n | {\n screen?: string;\n params?: StrictFocusedRouteParams;\n };\n\nexport function getRouteInfoFromState(state?: StrictState): UrlObject {\n if (!state) return defaultRouteInfo;\n\n // TODO(@kitten): Review edge-case type safety\n const index = 'index' in state ? (state.index ?? 0) : 0;\n let route = state.routes[index]!;\n\n if (route.name === NOT_FOUND_ROUTE_NAME || route.name === SITEMAP_ROUTE_NAME) {\n const path = route.path || (route.name === NOT_FOUND_ROUTE_NAME ? '/' : `/${route.name}`);\n return {\n ...defaultRouteInfo,\n unstable_globalHref: appendBaseUrl(path),\n pathname: path,\n pathnameWithParams: path,\n segments: [route.name],\n };\n }\n\n if (route.name !== INTERNAL_SLOT_NAME) {\n throw new Error(`Expected the first route to be ${INTERNAL_SLOT_NAME}, but got ${route.name}`);\n }\n\n state = route.state;\n\n const segments: string[] = [];\n let params: UrlObject['params'] = Object.create(null);\n\n while (state) {\n route = state.routes['index' in state && state.index ? state.index : 0]!;\n\n Object.assign(params, route.params);\n\n let routeName = route.name;\n if (routeName.startsWith('/')) {\n routeName = routeName.slice(1);\n }\n\n segments.push(...routeName.split('/'));\n state = route.state;\n }\n\n params = Object.fromEntries(\n Object.entries(params).map(([key, value]) => {\n if (typeof value === 'string') {\n return [key, safeDecodeURIComponent(value)];\n } else if (Array.isArray(value)) {\n return [key, value.map((v) => safeDecodeURIComponent(v))];\n } else {\n return [key, value];\n }\n })\n );\n\n /**\n * If React Navigation didn't render the entire tree (e.g it was interrupted in a layout)\n * then the state maybe incomplete. The reset of the path is in the params, instead of being a route\n */\n let routeParams: StrictFocusedRouteParams | undefined = route.params;\n while (routeParams && 'screen' in routeParams) {\n if (typeof routeParams.screen === 'string') {\n const screen = routeParams.screen.startsWith('/')\n ? routeParams.screen.slice(1)\n : routeParams.screen;\n segments.push(...screen.split('/'));\n }\n\n if (typeof routeParams.params === 'object' && !Array.isArray(routeParams.params)) {\n routeParams = routeParams.params;\n } else {\n routeParams = undefined;\n }\n }\n\n if (route.params && 'screen' in route.params && route.params.screen === 'string') {\n const screen = route.params.screen.startsWith('/')\n ? route.params.screen.slice(1)\n : route.params.screen;\n segments.push(...screen.split('/'));\n }\n\n if (segments[segments.length - 1] === 'index') {\n segments.pop();\n }\n\n delete params['screen'];\n delete params['params'];\n\n const pathParams = new Set<string>();\n\n const pathname =\n '/' +\n segments\n .filter((segment) => {\n return !(segment.startsWith('(') && segment.endsWith(')'));\n })\n .flatMap((segment) => {\n if (segment === '+not-found') {\n const notFoundPath = params['not-found'];\n\n pathParams.add('not-found');\n\n if (typeof notFoundPath === 'undefined') {\n // Not founds are optional, do nothing if its not present\n return [];\n } else if (Array.isArray(notFoundPath)) {\n return notFoundPath;\n } else {\n return [notFoundPath];\n }\n } else if (segment.startsWith('[...') && segment.endsWith(']')) {\n let paramName = segment.slice(4, -1);\n\n // Legacy for React Navigation optional params\n if (paramName.endsWith('?')) {\n paramName = paramName.slice(0, -1);\n }\n\n const values = params[paramName];\n pathParams.add(paramName);\n\n // Catchall params are optional\n return values || [];\n } else if (segment.startsWith('[') && segment.endsWith(']')) {\n const paramName = segment.slice(1, -1);\n const value = params[paramName];\n pathParams.add(paramName);\n\n // Optional params are optional\n return value ? [value] : [];\n } else {\n return [segment];\n }\n })\n .join('/');\n\n const searchParams = new URLSearchParams(\n Object.entries(params).flatMap(([key, value]) => {\n // Search params should not include path params\n if (pathParams.has(key)) {\n return [];\n } else if (Array.isArray(value)) {\n return value.map((v) => [key, v]);\n }\n return [[key, value]];\n })\n );\n\n let hash: string | undefined;\n if (searchParams.has('#')) {\n hash = searchParams.get('#') || undefined;\n searchParams.delete('#');\n }\n\n // We cannot use searchParams.size because it is not included in the React Native polyfill\n const searchParamString = searchParams.toString();\n let pathnameWithParams = searchParamString ? pathname + '?' + searchParamString : pathname;\n pathnameWithParams = hash ? pathnameWithParams + '#' + hash : pathnameWithParams;\n\n return {\n segments,\n pathname,\n params,\n unstable_globalHref: appendBaseUrl(pathnameWithParams),\n searchParams,\n pathnameWithParams,\n // TODO: Remove this, it is not used anywhere\n isIndex: false,\n };\n}\n\nfunction safeDecodeURIComponent(value: any) {\n try {\n return typeof value === 'string' ? decodeURIComponent(value) : value;\n } catch {\n // If the value is not a valid URI component, return it as is\n return value;\n }\n}\n"]}
1
+ {"version":3,"file":"getRouteInfoFromState.js","sourceRoot":"","sources":["../../src/global-state/getRouteInfoFromState.ts"],"names":[],"mappings":";;;AA+CA,sDAwKC;AAtND,4CAA4F;AAC5F,2EAA+D;AAE/D,sCAAsD;AAYzC,QAAA,gBAAgB,GAAc;IACzC,mBAAmB,EAAE,EAAE;IACvB,YAAY,EAAE,IAAI,eAAe,EAAE;IACnC,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,EAAE;IACZ,kBAAkB,EAAE,GAAG;IACvB,6CAA6C;IAC7C,OAAO,EAAE,KAAK;CACf,CAAC;AAsBF,SAAg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0FAA0F;IAC1F,MAAM,iBAAiB,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;IAClD,IAAI,kBAAkB,GAAG,iBAAiB,CAAC,CAAC,CAAC,QAAQ,GAAG,GAAG,GAAG,iBAAiB,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC3F,kBAAkB,GAAG,IAAI,CAAC,CAAC,CAAC,kBAAkB,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC;IAEjF,OAAO;QACL,QAAQ;QACR,QAAQ;QACR,MAAM;QACN,mBAAmB,EAAE,IAAA,sCAAa,EAAC,kBAAkB,CAAC;QACtD,YAAY;QACZ,kBAAkB;QAClB,6CAA6C;QAC7C,OAAO,EAAE,KAAK;KACf,CAAC;AACJ,CAAC","sourcesContent":["import type { FocusedRouteState } from './types';\nimport { INTERNAL_SLOT_NAME, NOT_FOUND_ROUTE_NAME, SITEMAP_ROUTE_NAME } from '../constants';\nimport { appendBaseUrl } from '../fork/getPathFromState-forks';\nimport type { NavigationState, PartialState } from '../react-navigation/native';\nimport { safeDecodeURIComponent } from '../utils/url';\n\nexport type UrlObject = {\n unstable_globalHref: string;\n pathname: string;\n readonly params: Record<string, string | string[]>;\n searchParams: URLSearchParams;\n segments: string[];\n pathnameWithParams: string;\n isIndex: boolean;\n};\n\nexport const defaultRouteInfo: UrlObject = {\n unstable_globalHref: '',\n searchParams: new URLSearchParams(),\n pathname: '/',\n params: {},\n segments: [],\n pathnameWithParams: '/',\n // TODO: Remove this, it is not used anywhere\n isIndex: false,\n};\n\n/**\n * A better typed version of `FocusedRouteState` that is easier to parse\n */\ntype StrictState = (FocusedRouteState | NavigationState | PartialState<NavigationState>) & {\n routes: {\n key?: string;\n name: string;\n params?: StrictFocusedRouteParams;\n path?: string;\n state?: StrictState;\n }[];\n};\n\ntype StrictFocusedRouteParams =\n | Record<string, string | string[]>\n | {\n screen?: string;\n params?: StrictFocusedRouteParams;\n };\n\nexport function getRouteInfoFromState(state?: StrictState): UrlObject {\n if (!state) return defaultRouteInfo;\n\n // TODO(@kitten): Review edge-case type safety\n const index = 'index' in state ? (state.index ?? 0) : 0;\n let route = state.routes[index]!;\n\n if (route.name === NOT_FOUND_ROUTE_NAME || route.name === SITEMAP_ROUTE_NAME) {\n const path = route.path || (route.name === NOT_FOUND_ROUTE_NAME ? '/' : `/${route.name}`);\n return {\n ...defaultRouteInfo,\n unstable_globalHref: appendBaseUrl(path),\n pathname: path,\n pathnameWithParams: path,\n segments: [route.name],\n };\n }\n\n if (route.name !== INTERNAL_SLOT_NAME) {\n throw new Error(`Expected the first route to be ${INTERNAL_SLOT_NAME}, but got ${route.name}`);\n }\n\n state = route.state;\n\n const segments: string[] = [];\n let params: UrlObject['params'] = Object.create(null);\n\n while (state) {\n route = state.routes['index' in state && state.index ? state.index : 0]!;\n\n Object.assign(params, route.params);\n\n let routeName = route.name;\n if (routeName.startsWith('/')) {\n routeName = routeName.slice(1);\n }\n\n segments.push(...routeName.split('/'));\n state = route.state;\n }\n\n params = Object.fromEntries(\n Object.entries(params).map(([key, value]) => {\n if (typeof value === 'string') {\n return [key, safeDecodeURIComponent(value)];\n } else if (Array.isArray(value)) {\n return [key, value.map((v) => safeDecodeURIComponent(v))];\n } else {\n return [key, value];\n }\n })\n );\n\n /**\n * If React Navigation didn't render the entire tree (e.g it was interrupted in a layout)\n * then the state maybe incomplete. The reset of the path is in the params, instead of being a route\n */\n let routeParams: StrictFocusedRouteParams | undefined = route.params;\n while (routeParams && 'screen' in routeParams) {\n if (typeof routeParams.screen === 'string') {\n const screen = routeParams.screen.startsWith('/')\n ? routeParams.screen.slice(1)\n : routeParams.screen;\n segments.push(...screen.split('/'));\n }\n\n if (typeof routeParams.params === 'object' && !Array.isArray(routeParams.params)) {\n routeParams = routeParams.params;\n } else {\n routeParams = undefined;\n }\n }\n\n if (route.params && 'screen' in route.params && route.params.screen === 'string') {\n const screen = route.params.screen.startsWith('/')\n ? route.params.screen.slice(1)\n : route.params.screen;\n segments.push(...screen.split('/'));\n }\n\n if (segments[segments.length - 1] === 'index') {\n segments.pop();\n }\n\n delete params['screen'];\n delete params['params'];\n\n const pathParams = new Set<string>();\n\n const pathname =\n '/' +\n segments\n .filter((segment) => {\n return !(segment.startsWith('(') && segment.endsWith(')'));\n })\n .flatMap((segment) => {\n if (segment === '+not-found') {\n const notFoundPath = params['not-found'];\n\n pathParams.add('not-found');\n\n if (typeof notFoundPath === 'undefined') {\n // Not founds are optional, do nothing if its not present\n return [];\n } else if (Array.isArray(notFoundPath)) {\n return notFoundPath;\n } else {\n return [notFoundPath];\n }\n } else if (segment.startsWith('[...') && segment.endsWith(']')) {\n let paramName = segment.slice(4, -1);\n\n // Legacy for React Navigation optional params\n if (paramName.endsWith('?')) {\n paramName = paramName.slice(0, -1);\n }\n\n const values = params[paramName];\n pathParams.add(paramName);\n\n // Catchall params are optional\n return values || [];\n } else if (segment.startsWith('[') && segment.endsWith(']')) {\n const paramName = segment.slice(1, -1);\n const value = params[paramName];\n pathParams.add(paramName);\n\n // Optional params are optional\n return value ? [value] : [];\n } else {\n return [segment];\n }\n })\n .join('/');\n\n const searchParams = new URLSearchParams(\n Object.entries(params).flatMap(([key, value]) => {\n // Search params should not include path params\n if (pathParams.has(key)) {\n return [];\n } else if (Array.isArray(value)) {\n return value.map((v) => [key, v]);\n }\n return [[key, value]];\n })\n );\n\n let hash: string | undefined;\n if (searchParams.has('#')) {\n hash = searchParams.get('#') || undefined;\n searchParams.delete('#');\n }\n\n // We cannot use searchParams.size because it is not included in the React Native polyfill\n const searchParamString = searchParams.toString();\n let pathnameWithParams = searchParamString ? pathname + '?' + searchParamString : pathname;\n pathnameWithParams = hash ? pathnameWithParams + '#' + hash : pathnameWithParams;\n\n return {\n segments,\n pathname,\n params,\n unstable_globalHref: appendBaseUrl(pathnameWithParams),\n searchParams,\n pathnameWithParams,\n // TODO: Remove this, it is not used anywhere\n isIndex: false,\n };\n}\n"]}
@@ -44,7 +44,7 @@ export declare const NativeTabTrigger: typeof NativeTabTriggerImpl & {
44
44
  Badge: import("react").FC<NativeTabsTriggerBadgeProps>;
45
45
  VectorIcon: typeof import("..").VectorIcon;
46
46
  };
47
- export declare function convertTabPropsToOptions({ hidden, children, role, disablePopToTop, disableScrollToTop, unstable_nativeProps, disableAutomaticContentInsets, contentStyle, disableTransparentOnScrollEdge, disabled, rippleColor, indicatorColor, disableIndicator, labelVisibilityMode, }: NativeTabTriggerProps, isDynamic?: boolean): NativeTabOptions;
47
+ export declare function convertTabPropsToOptions({ hidden, children, role, disablePopToTop, disableScrollToTop, unstable_nativeProps, disableAutomaticContentInsets, contentStyle, disableTransparentOnScrollEdge, disabled, rippleColor, indicatorColor, disableIndicator, labelVisibilityMode, testID, accessibilityLabel, }: NativeTabTriggerProps, isDynamic?: boolean): NativeTabOptions;
48
48
  export declare function isNativeTabTrigger(child: ReactNode, contextKey?: string): child is ReactElement<NativeTabTriggerProps & {
49
49
  name: string;
50
50
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"NativeTabTrigger.d.ts","sourceRoot":"","sources":["../../src/native-tabs/NativeTabTrigger.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvE,OAAO,EAKL,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EACjC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAMvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,iBAAS,oBAAoB,CAAC,KAAK,EAAE,qBAAqB,QAuBzD;AAED,eAAO,MAAM,gBAAgB;;;;;CAK3B,CAAC;AAEH,wBAAgB,wBAAwB,CACtC,EACE,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,6BAA6B,EAC7B,YAAY,EACZ,8BAA8B,EAC9B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 +72,7 @@ exports.NativeTabTrigger = Object.assign(NativeTabTriggerImpl, {
72
72
  Badge: elements_1.NativeTabsTriggerBadge,
73
73
  VectorIcon: elements_1.NativeTabsTriggerVectorIcon,
74
74
  });
75
- function convertTabPropsToOptions({ hidden, children, role, disablePopToTop, disableScrollToTop, unstable_nativeProps, disableAutomaticContentInsets, contentStyle, disableTransparentOnScrollEdge, disabled, rippleColor, indicatorColor, disableIndicator, labelVisibilityMode, }, isDynamic = false) {
75
+ function convertTabPropsToOptions({ hidden, children, role, disablePopToTop, disableScrollToTop, unstable_nativeProps, disableAutomaticContentInsets, contentStyle, disableTransparentOnScrollEdge, disabled, rippleColor, indicatorColor, disableIndicator, labelVisibilityMode, testID, accessibilityLabel, }, isDynamic = false) {
76
76
  const initialOptions = isDynamic
77
77
  ? {
78
78
  ...(unstable_nativeProps ? { nativeProps: unstable_nativeProps } : {}),
@@ -82,6 +82,10 @@ function convertTabPropsToOptions({ hidden, children, role, disablePopToTop, dis
82
82
  ...(indicatorColor !== undefined ? { indicatorColor } : {}),
83
83
  ...(disableIndicator !== undefined ? { disableIndicator } : {}),
84
84
  ...(labelVisibilityMode !== undefined ? { labelVisibilityMode } : {}),
85
+ ...(testID !== undefined ? { tabBarItemTestID: testID } : {}),
86
+ ...(accessibilityLabel !== undefined
87
+ ? { tabBarItemAccessibilityLabel: accessibilityLabel }
88
+ : {}),
85
89
  }
86
90
  : {
87
91
  hidden: !!hidden,
@@ -101,6 +105,10 @@ function convertTabPropsToOptions({ hidden, children, role, disablePopToTop, dis
101
105
  ...(indicatorColor !== undefined ? { indicatorColor } : {}),
102
106
  ...(disableIndicator !== undefined ? { disableIndicator } : {}),
103
107
  ...(labelVisibilityMode !== undefined ? { labelVisibilityMode } : {}),
108
+ ...(testID !== undefined ? { tabBarItemTestID: testID } : {}),
109
+ ...(accessibilityLabel !== undefined
110
+ ? { tabBarItemAccessibilityLabel: accessibilityLabel }
111
+ : {}),
104
112
  };
105
113
  const allowedChildren = (0, children_1.filterAllowedChildrenElements)(children, [
106
114
  elements_1.NativeTabsTriggerBadge,
@@ -1 +1 @@
1
- {"version":3,"file":"NativeTabTrigger.js","sourceRoot":"","sources":["../../src/native-tabs/NativeTabTrigger.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAwFb,4DAkEC;AAyBD,gDAuBC;AAxMD,iCAAuE;AACvE,+CAA0C;AAE1C,uDAAqE;AACrE,gDAO2B;AAE3B,uEAAiE;AACjE,6EAAmE;AACnE,sDAAmD;AACnD,gDAAiF;AAEjF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,SAAS,oBAAoB,CAAC,KAA4B;IACxD,MAAM,KAAK,GAAG,IAAA,iBAAQ,GAAE,CAAC;IACzB,MAAM,UAAU,GAAG,IAAA,sBAAa,GAAE,CAAC;IACnC,MAAM,WAAW,GAAG,IAAA,kCAAY,GAAE,CAAC;IAEnC,IAAA,+BAAc,EACZ,IAAA,mBAAW,EAAC,GAAG,EAAE;QACf,6DAA6D;QAC7D,yEAAyE;QACzE,iDAAiD;QACjD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,IAAI,UAAU,CAAC,QAAQ,EAAE,EAAE,IAAI,KAAK,KAAK,EAAE,CAAC;gBAC1C,MAAM,IAAI,KAAK,CACb,wEAAwE,KAAK,CAAC,IAAI,EAAE,CACrF,CAAC;YACJ,CAAC;YACD,MAAM,OAAO,GAAG,wBAAwB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACtD,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CACzB,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AAEY,QAAA,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,oBAAoB,EAAE;IAClE,KAAK,EAAE,iCAAsB;IAC7B,IAAI,EAAE,gCAAqB;IAC3B,KAAK,EAAE,i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D,UAAU,8EAA8E,CAChJ,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;YAC1C,IAAK,CAAC,WAAW,EAAE,cAAc,CAAW,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC/E,MAAM,IAAI,KAAK,CACb,uDAAuD,UAAU,0GAA0G,CAC5K,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["'use client';\n\nimport { useCallback, type ReactElement, type ReactNode } from 'react';\nimport { StyleSheet } from 'react-native';\n\nimport { useNavigation, useRoute } from '../react-navigation/native';\nimport {\n NativeTabsTriggerIcon,\n NativeTabsTriggerBadge,\n NativeTabsTriggerLabel,\n NativeTabsTriggerVectorIcon,\n type NativeTabsTriggerBadgeProps,\n type NativeTabsTriggerLabelProps,\n} from './common/elements';\nimport type { NativeTabOptions, NativeTabTriggerProps } from './types';\nimport { appendIconOptions } from './utils/optionsIconConverter';\nimport { useIsPreview } from '../link/preview/PreviewRouteContext';\nimport { useFocusEffect } from '../useFocusEffect';\nimport { filterAllowedChildrenElements, isChildOfType } from '../utils/children';\n\n/**\n * The component used to customize the native tab options both in the _layout file and from the tab screen.\n *\n * When used in the _layout file, you need to provide a `name` prop.\n * When used in the tab screen, the `name` prop takes no effect.\n *\n * @example\n * ```tsx app/_layout.tsx\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default function Layout() {\n * return (\n * <NativeTabs>\n * <NativeTabs.Trigger name=\"home\" />\n * <NativeTabs.Trigger name=\"settings\" />\n * </NativeTabs>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx app/home.tsx\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default function HomeScreen() {\n * return (\n * <View>\n * <NativeTabs.Trigger>\n * <NativeTabs.Trigger.Label>Home</NativeTabs.Trigger.Label>\n * </NativeTabs.Trigger>\n * <Text>This is home screen!</Text>\n * </View>\n * );\n * }\n * ```\n */\nfunction NativeTabTriggerImpl(props: NativeTabTriggerProps) {\n const route = useRoute();\n const navigation = useNavigation();\n const isInPreview = useIsPreview();\n\n useFocusEffect(\n useCallback(() => {\n // This will cause the tab to update only when it is focused.\n // As long as all tabs are loaded at the start, we don't need this check.\n // It is here to ensure similar behavior to stack\n if (!isInPreview) {\n if (navigation.getState()?.type !== 'tab') {\n throw new Error(\n `Trigger component can only be used in the tab screen. Current route: ${route.name}`\n );\n }\n const options = convertTabPropsToOptions(props, true);\n navigation.setOptions(options);\n }\n }, [props, isInPreview])\n );\n\n return null;\n}\n\nexport const NativeTabTrigger = Object.assign(NativeTabTriggerImpl, {\n Label: NativeTabsTriggerLabel,\n Icon: NativeTabsTriggerIcon,\n Badge: NativeTabsTriggerBadge,\n VectorIcon: NativeTabsTriggerVectorIcon,\n});\n\nexport function convertTabPropsToOptions(\n {\n hidden,\n children,\n role,\n disablePopToTop,\n disableScrollToTop,\n unstable_nativeProps,\n disableAutomaticContentInsets,\n contentStyle,\n disableTransparentOnScrollEdge,\n disabled,\n rippleColor,\n indicatorColor,\n disableIndicator,\n labelVisibilityMode,\n }: NativeTabTriggerProps,\n isDynamic: boolean = false\n) {\n const initialOptions: NativeTabOptions = isDynamic\n ? {\n ...(unstable_nativeProps ? { nativeProps: unstable_nativeProps } : {}),\n ...(disableTransparentOnScrollEdge !== undefined ? { disableTransparentOnScrollEdge } : {}),\n ...(disabled !== undefined ? { disabled } : {}),\n ...(rippleColor !== undefined ? { rippleColor } : {}),\n ...(indicatorColor !== undefined ? { indicatorColor } : {}),\n ...(disableIndicator !== undefined ? { disableIndicator } : {}),\n ...(labelVisibilityMode !== undefined ? { labelVisibilityMode } : {}),\n }\n : {\n hidden: !!hidden,\n specialEffects: {\n repeatedTabSelection: {\n popToRoot: !disablePopToTop,\n scrollToTop: !disableScrollToTop,\n },\n },\n contentStyle,\n role,\n nativeProps: unstable_nativeProps,\n disableAutomaticContentInsets,\n ...(disableTransparentOnScrollEdge !== undefined ? { disableTransparentOnScrollEdge } : {}),\n ...(disabled !== undefined ? { disabled } : {}),\n ...(rippleColor !== undefined ? { rippleColor } : {}),\n ...(indicatorColor !== undefined ? { indicatorColor } : {}),\n ...(disableIndicator !== undefined ? { disableIndicator } : {}),\n ...(labelVisibilityMode !== undefined ? { labelVisibilityMode } : {}),\n };\n const allowedChildren = filterAllowedChildrenElements(children, [\n NativeTabsTriggerBadge,\n NativeTabsTriggerLabel,\n NativeTabsTriggerIcon,\n ]);\n return allowedChildren.reduce<NativeTabOptions>(\n (acc, child) => {\n if (isChildOfType(child, NativeTabsTriggerBadge)) {\n appendBadgeOptions(acc, child.props);\n } else if (isChildOfType(child, NativeTabsTriggerLabel)) {\n appendLabelOptions(acc, child.props);\n } else if (isChildOfType(child, NativeTabsTriggerIcon)) {\n appendIconOptions(acc, child.props);\n }\n return acc;\n },\n { ...initialOptions }\n );\n}\n\nfunction appendBadgeOptions(options: NativeTabOptions, props: NativeTabsTriggerBadgeProps) {\n if (props.children) {\n options.badgeValue = String(props.children);\n options.selectedBadgeBackgroundColor = props.selectedBackgroundColor;\n } else if (!props.hidden) {\n // If no value is provided, we set it to a space to show the badge\n // Otherwise, the `react-native-screens` will interpret it as a hidden badge\n // https://github.com/software-mansion/react-native-screens/blob/b4358fd95dd0736fc54df6bb97f210dc89edf24c/ios/bottom-tabs/RNSBottomTabsScreenComponentView.mm#L172\n options.badgeValue = ' ';\n }\n}\n\nfunction appendLabelOptions(options: NativeTabOptions, props: NativeTabsTriggerLabelProps) {\n if (props.hidden) {\n options.title = '';\n } else {\n options.title = props.children;\n if (props.selectedStyle) {\n options.selectedLabelStyle = StyleSheet.flatten(props.selectedStyle);\n }\n }\n}\n\nexport function isNativeTabTrigger(\n child: ReactNode,\n contextKey?: string\n): child is ReactElement<NativeTabTriggerProps & { name: string }> {\n if (isChildOfType(child, NativeTabTrigger)) {\n if ('name' in child.props && !child.props.name) {\n throw new Error(\n `<Trigger /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must have a \\`name\\` prop when used as a child of a Layout Route.`\n );\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if ((['component', 'getComponent'] as const).some((key) => key in child.props)) {\n throw new Error(\n `<Trigger /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must not have a \\`component\\` or \\`getComponent\\` prop when used as a child of a Layout Route`\n );\n }\n }\n\n return true;\n }\n\n return false;\n}\n"]}
1
+ {"version":3,"file":"NativeTabTrigger.js","sourceRoot":"","sources":["../../src/native-tabs/NativeTabTrigger.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAwFb,4DA4EC;AAyBD,gDAuBC;AAlND,iCAAuE;AACvE,+CAA0C;AAE1C,uDAAqE;AACrE,gDAO2B;AAE3B,uEAAiE;AACjE,6EAAmE;AACnE,sDAAmD;AACnD,gDAAiF;AAEjF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,SAAS,oBAAoB,CAAC,KAA4B;IACxD,MAAM,KAAK,GAAG,IAAA,iBAAQ,GAAE,CAAC;IACzB,MAAM,UAAU,GAAG,IAAA,sBAAa,GAAE,CAAC;IACnC,MAAM,WAAW,GAAG,IAAA,kCAAY,GAAE,CAAC;IAEnC,IAAA,+BAAc,EACZ,IAAA,mBAAW,EAAC,GAAG,EAAE;QACf,6DAA6D;QAC7D,yEAAyE;QACzE,iDAAiD;QACjD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,IAAI,UAAU,CAAC,QAAQ,EAAE,EAAE,IAAI,KAAK,KAAK,EAAE,CAAC;gBAC1C,MAAM,IAAI,KAAK,CACb,wEAAwE,KAAK,CAAC,IAAI,EAAE,CACrF,CAAC;YACJ,CAAC;YACD,MAAM,OAAO,GAAG,wBAAwB,CAAC,KAAK,EAAE,IAAI,CAAC,CAA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nimport { useCallback, type ReactElement, type ReactNode } from 'react';\nimport { StyleSheet } from 'react-native';\n\nimport { useNavigation, useRoute } from '../react-navigation/native';\nimport {\n NativeTabsTriggerIcon,\n NativeTabsTriggerBadge,\n NativeTabsTriggerLabel,\n NativeTabsTriggerVectorIcon,\n type NativeTabsTriggerBadgeProps,\n type NativeTabsTriggerLabelProps,\n} from './common/elements';\nimport type { NativeTabOptions, NativeTabTriggerProps } from './types';\nimport { appendIconOptions } from './utils/optionsIconConverter';\nimport { useIsPreview } from '../link/preview/PreviewRouteContext';\nimport { useFocusEffect } from '../useFocusEffect';\nimport { filterAllowedChildrenElements, isChildOfType } from '../utils/children';\n\n/**\n * The component used to customize the native tab options both in the _layout file and from the tab screen.\n *\n * When used in the _layout file, you need to provide a `name` prop.\n * When used in the tab screen, the `name` prop takes no effect.\n *\n * @example\n * ```tsx app/_layout.tsx\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default function Layout() {\n * return (\n * <NativeTabs>\n * <NativeTabs.Trigger name=\"home\" />\n * <NativeTabs.Trigger name=\"settings\" />\n * </NativeTabs>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx app/home.tsx\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default function HomeScreen() {\n * return (\n * <View>\n * <NativeTabs.Trigger>\n * <NativeTabs.Trigger.Label>Home</NativeTabs.Trigger.Label>\n * </NativeTabs.Trigger>\n * <Text>This is home screen!</Text>\n * </View>\n * );\n * }\n * ```\n */\nfunction NativeTabTriggerImpl(props: NativeTabTriggerProps) {\n const route = useRoute();\n const navigation = useNavigation();\n const isInPreview = useIsPreview();\n\n useFocusEffect(\n useCallback(() => {\n // This will cause the tab to update only when it is focused.\n // As long as all tabs are loaded at the start, we don't need this check.\n // It is here to ensure similar behavior to stack\n if (!isInPreview) {\n if (navigation.getState()?.type !== 'tab') {\n throw new Error(\n `Trigger component can only be used in the tab screen. Current route: ${route.name}`\n );\n }\n const options = convertTabPropsToOptions(props, true);\n navigation.setOptions(options);\n }\n }, [props, isInPreview])\n );\n\n return null;\n}\n\nexport const NativeTabTrigger = Object.assign(NativeTabTriggerImpl, {\n Label: NativeTabsTriggerLabel,\n Icon: NativeTabsTriggerIcon,\n Badge: NativeTabsTriggerBadge,\n VectorIcon: NativeTabsTriggerVectorIcon,\n});\n\nexport function convertTabPropsToOptions(\n {\n hidden,\n children,\n role,\n disablePopToTop,\n disableScrollToTop,\n unstable_nativeProps,\n disableAutomaticContentInsets,\n contentStyle,\n disableTransparentOnScrollEdge,\n disabled,\n rippleColor,\n indicatorColor,\n disableIndicator,\n labelVisibilityMode,\n testID,\n accessibilityLabel,\n }: NativeTabTriggerProps,\n isDynamic: boolean = false\n) {\n const initialOptions: NativeTabOptions = isDynamic\n ? {\n ...(unstable_nativeProps ? { nativeProps: unstable_nativeProps } : {}),\n ...(disableTransparentOnScrollEdge !== undefined ? { disableTransparentOnScrollEdge } : {}),\n ...(disabled !== undefined ? { disabled } : {}),\n ...(rippleColor !== undefined ? { rippleColor } : {}),\n ...(indicatorColor !== undefined ? { indicatorColor } : {}),\n ...(disableIndicator !== undefined ? { disableIndicator } : {}),\n ...(labelVisibilityMode !== undefined ? { labelVisibilityMode } : {}),\n ...(testID !== undefined ? { tabBarItemTestID: testID } : {}),\n ...(accessibilityLabel !== undefined\n ? { tabBarItemAccessibilityLabel: accessibilityLabel }\n : {}),\n }\n : {\n hidden: !!hidden,\n specialEffects: {\n repeatedTabSelection: {\n popToRoot: !disablePopToTop,\n scrollToTop: !disableScrollToTop,\n },\n },\n contentStyle,\n role,\n nativeProps: unstable_nativeProps,\n disableAutomaticContentInsets,\n ...(disableTransparentOnScrollEdge !== undefined ? { disableTransparentOnScrollEdge } : {}),\n ...(disabled !== undefined ? { disabled } : {}),\n ...(rippleColor !== undefined ? { rippleColor } : {}),\n ...(indicatorColor !== undefined ? { indicatorColor } : {}),\n ...(disableIndicator !== undefined ? { disableIndicator } : {}),\n ...(labelVisibilityMode !== undefined ? { labelVisibilityMode } : {}),\n ...(testID !== undefined ? { tabBarItemTestID: testID } : {}),\n ...(accessibilityLabel !== undefined\n ? { tabBarItemAccessibilityLabel: accessibilityLabel }\n : {}),\n };\n const allowedChildren = filterAllowedChildrenElements(children, [\n NativeTabsTriggerBadge,\n NativeTabsTriggerLabel,\n NativeTabsTriggerIcon,\n ]);\n return allowedChildren.reduce<NativeTabOptions>(\n (acc, child) => {\n if (isChildOfType(child, NativeTabsTriggerBadge)) {\n appendBadgeOptions(acc, child.props);\n } else if (isChildOfType(child, NativeTabsTriggerLabel)) {\n appendLabelOptions(acc, child.props);\n } else if (isChildOfType(child, NativeTabsTriggerIcon)) {\n appendIconOptions(acc, child.props);\n }\n return acc;\n },\n { ...initialOptions }\n );\n}\n\nfunction appendBadgeOptions(options: NativeTabOptions, props: NativeTabsTriggerBadgeProps) {\n if (props.children) {\n options.badgeValue = String(props.children);\n options.selectedBadgeBackgroundColor = props.selectedBackgroundColor;\n } else if (!props.hidden) {\n // If no value is provided, we set it to a space to show the badge\n // Otherwise, the `react-native-screens` will interpret it as a hidden badge\n // https://github.com/software-mansion/react-native-screens/blob/b4358fd95dd0736fc54df6bb97f210dc89edf24c/ios/bottom-tabs/RNSBottomTabsScreenComponentView.mm#L172\n options.badgeValue = ' ';\n }\n}\n\nfunction appendLabelOptions(options: NativeTabOptions, props: NativeTabsTriggerLabelProps) {\n if (props.hidden) {\n options.title = '';\n } else {\n options.title = props.children;\n if (props.selectedStyle) {\n options.selectedLabelStyle = StyleSheet.flatten(props.selectedStyle);\n }\n }\n}\n\nexport function isNativeTabTrigger(\n child: ReactNode,\n contextKey?: string\n): child is ReactElement<NativeTabTriggerProps & { name: string }> {\n if (isChildOfType(child, NativeTabTrigger)) {\n if ('name' in child.props && !child.props.name) {\n throw new Error(\n `<Trigger /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must have a \\`name\\` prop when used as a child of a Layout Route.`\n );\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if ((['component', 'getComponent'] as const).some((key) => key in child.props)) {\n throw new Error(\n `<Trigger /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must not have a \\`component\\` or \\`getComponent\\` prop when used as a child of a Layout Route`\n );\n }\n }\n\n return true;\n }\n\n return false;\n}\n"]}
@@ -155,6 +155,16 @@ export interface NativeTabOptions extends DefaultRouterOptions {
155
155
  * @platform iOS
156
156
  */
157
157
  disabled?: boolean;
158
+ /**
159
+ * @platform android
160
+ * @platform iOS
161
+ */
162
+ tabBarItemTestID?: string;
163
+ /**
164
+ * @platform android
165
+ * @platform iOS
166
+ */
167
+ tabBarItemAccessibilityLabel?: string;
158
168
  /**
159
169
  * @platform iOS
160
170
  */
@@ -499,6 +509,27 @@ export interface NativeTabTriggerProps {
499
509
  * @platform ios
500
510
  */
501
511
  disabled?: boolean;
512
+ /**
513
+ * A test identifier for the tab bar item.
514
+ *
515
+ * On iOS it maps to the item's accessibility identifier, which XCUITest and Maestro match.
516
+ * On Android it maps to the item's view tag, which Espresso-based drivers like Detox read
517
+ * but Maestro and Appium do not. Use `accessibilityLabel` to match the tab by id there.
518
+ *
519
+ * @platform android
520
+ * @platform iOS
521
+ */
522
+ testID?: string;
523
+ /**
524
+ * The accessibility label of the tab bar item, announced by screen readers.
525
+ * Defaults to the visible tab label.
526
+ *
527
+ * On Android, maps to the item's `contentDescription` and requires API 26 or above.
528
+ *
529
+ * @platform android
530
+ * @platform iOS
531
+ */
532
+ accessibilityLabel?: string;
502
533
  /**
503
534
  * The children of the trigger.
504
535
  *
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/native-tabs/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EACnB,SAAS,EACT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,aAAa,EAAE,eAA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AMG;IACH,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;;;OAQG;IACH,mBAAmB,CAAC,EAAE,uCAAuC,CAAC;IAC9D;;;;;;;;;;;;;;;;;;;OAmBG;IACH,SAAS,CAAC,EAAE,WAAW,CACrB,GAAG,EACH,kBAAkB,CAAC,aAAa,CAAC,EACjC,2BAA2B,CAC5B,CAAC,WAAW,CAAC,CAAC;CAChB;AAED,QAAA,MAAM,4BAA4B,0JAaxB,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/native-tabs/types.ts"],"names":[],"mappings":";;;AAiQa,QAAA,sBAAsB,GAAG;IACpC,MAAM;IACN,eAAe;IACf,YAAY;IACZ,OAAO;IACP,MAAM;IACN,SAAS;IACT,WAAW;IACX,yBAAyB;IACzB,oBAAoB;IACpB,gBAAgB;IAChB,qBAAqB;IACrB,sBAAsB;IACtB,8BAA8B;IAC9B,yBAAyB;IACzB,qBAAqB;IACrB,0BAA0B;IAC1B,2BAA2B;IAC3B,6BAA6B;IAC7B,wBAAwB;IACxB,oBAAoB;IACpB,yBAAyB;IACzB,0BAA0B;CAClB,CAAC;AAuPE,QAAA,6CAA6C,GAAG;IAC3D,MAAM;IACN,UAAU;IACV,SAAS;IACT,WAAW;CACH,CAAC;AAUE,QAAA,oCAAoC,GAAG;IAClD,WAAW;IACX,OAAO;IACP,cAAc;IACd,YAAY;CACJ,CAAC;AAsLX,MAAM,4BAA4B,GAAG;IACnC,WAAW;IACX,UAAU;IACV,WAAW;IACX,WAAW;IACX,UAAU;IACV,SAAS;IACT,MAAM;IACN,YAAY;IACZ,YAAY;IACZ,SAAS;IACT,QAAQ;IACR,UAAU;CACF,CAAC","sourcesContent":["import type { PropsWithChildren } from 'react';\nimport type {\n ColorValue,\n ImageSourcePropType,\n StyleProp,\n TextStyle,\n ViewStyle,\n} from 'react-native';\nimport type { TabsHostProps, TabsScreenProps } from 'react-native-screens';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport type {\n DefaultRouterOptions,\n ParamListBase,\n RouteProp,\n ScreenListeners,\n TabNavigationState,\n} from '../react-navigation/native';\nimport type { ScreenProps } from '../useScreens';\n\n/**\n * Event map for `NativeTabs` navigation events.\n * Only `tabPress` is currently supported.\n */\nexport type NativeTabNavigationEventMap = {\n tabPress: {\n data: {\n __internalTabsType: 'native';\n /**\n * `true` when the native side prevented the selection because the target\n * tab is `disabled`. The event is still emitted so listeners are notified,\n * but no navigation occurs.\n */\n isPrevented: boolean;\n };\n canPreventDefault: false;\n };\n};\n\nexport type NativeScreenProps = Partial<Omit<TabsScreenProps, 'screenKey'>>;\n\n/**\n * Props passed to the underlying tab host implementation in `react-native-screens`.\n */\nexport type NativeTabsHostNativeProps = Partial<\n Omit<TabsHostProps, 'navStateRequest' | 'onTabSelected' | 'children'>\n>;\n\nexport interface NativeTabOptions extends DefaultRouterOptions {\n /**\n * @platform android\n * @platform iOS\n */\n icon?: SymbolOrImageSource;\n /**\n * @platform android\n * @platform iOS\n */\n selectedIcon?: SymbolOrImageSource;\n /**\n * @platform android\n * @platform iOS\n * @platform web\n */\n title?: string;\n /**\n * @platform android\n * @platform iOS\n * @platform web\n */\n badgeValue?: string;\n /**\n * @platform android\n * @platform iOS\n * @platform web\n */\n selectedLabelStyle?: NativeTabsLabelStyle;\n /**\n * @platform android\n * @platform iOS\n * @platform web\n */\n labelStyle?: NativeTabsLabelStyle;\n /**\n * @platform iOS\n */\n role?: NativeTabsTabBarItemRole;\n /**\n * @platform android\n * @platform iOS\n */\n selectedIconColor?: ColorValue;\n /**\n * @platform iOS\n */\n selectedBadgeBackgroundColor?: ColorValue;\n /**\n * @platform android\n * @platform iOS\n * @platform web\n */\n badgeBackgroundColor?: ColorValue;\n /**\n * @platform android\n * @platform web\n */\n badgeTextColor?: ColorValue;\n /**\n * @platform android\n * @platform iOS\n * @platform web\n */\n backgroundColor?: ColorValue;\n /**\n * @platform iOS\n */\n blurEffect?: NativeTabsBlurEffect;\n /**\n * @platform iOS\n */\n shadowColor?: ColorValue;\n /**\n * @platform android\n * @platform iOS\n */\n iconColor?: ColorValue;\n /**\n * @platform android\n */\n tintColor?: ColorValue;\n /**\n * @platform iOS\n */\n disableTransparentOnScrollEdge?: boolean;\n /**\n * @platform iOS\n */\n titlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n /**\n * @platform iOS\n */\n selectedTitlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n /**\n * @platform android\n * @platform web\n */\n indicatorColor?: ColorValue;\n /**\n * @platform android\n */\n rippleColor?: ColorValue;\n /**\n * @platform android\n */\n disableIndicator?: boolean;\n /**\n * @platform android\n */\n labelVisibilityMode?: NativeTabsTabBarItemLabelVisibilityMode;\n /**\n * @platform android\n * @platform iOS\n * @platform web\n */\n hidden?: boolean;\n /**\n * @platform android\n * @platform iOS\n */\n disabled?: boolean;\n /**\n * @platform iOS\n */\n specialEffects?: TabsScreenProps['specialEffects'];\n /**\n * @platform android\n * @platform iOS\n */\n nativeProps?: NativeScreenProps;\n /**\n * @platform android\n * @platform iOS\n */\n disableAutomaticContentInsets?: boolean;\n /**\n * @platform android\n * @platform iOS\n */\n contentStyle?: Pick<\n ViewStyle,\n | 'backgroundColor'\n | 'experimental_backgroundImage'\n | 'padding'\n | 'paddingTop'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'paddingRight'\n | 'paddingBlock'\n | 'paddingBlockEnd'\n | 'paddingBlockStart'\n | 'paddingInline'\n | 'paddingInlineEnd'\n | 'paddingInlineStart'\n | 'paddingEnd'\n | 'paddingHorizontal'\n | 'paddingVertical'\n | 'paddingStart'\n | 'alignContent'\n | 'alignItems'\n | 'justifyContent'\n | 'flexDirection'\n | 'gap'\n >;\n}\n\nexport type SymbolOrImageSource =\n | {\n /**\n * The name of the SF Symbol to use as an icon.\n * @platform iOS\n */\n sf?: SFSymbol;\n /**\n * The name of the iOS asset catalog image to use as an icon.\n * @platform iOS\n */\n xcasset?: string;\n /**\n * The name of the drawable resource to use as an icon.\n * @platform android\n */\n drawable?: string;\n }\n | {\n /**\n * The image source to use as an icon.\n */\n src?: ImageSourcePropType | Promise<ImageSourcePropType | null>;\n /**\n * Controls how the icon is rendered on iOS.\n * @platform ios\n * @default 'template'\n */\n renderingMode?: 'template' | 'original';\n };\n\nexport type NativeTabsLabelStyle = Pick<\n TextStyle,\n 'fontFamily' | 'fontSize' | 'fontStyle' | 'fontWeight' | 'color'\n>;\n\nexport const SUPPORTED_BLUR_EFFECTS = [\n 'none',\n 'systemDefault',\n 'extraLight',\n 'light',\n 'dark',\n 'regular',\n 'prominent',\n 'systemUltraThinMaterial',\n 'systemThinMaterial',\n 'systemMaterial',\n 'systemThickMaterial',\n 'systemChromeMaterial',\n 'systemUltraThinMaterialLight',\n 'systemThinMaterialLight',\n 'systemMaterialLight',\n 'systemThickMaterialLight',\n 'systemChromeMaterialLight',\n 'systemUltraThinMaterialDark',\n 'systemThinMaterialDark',\n 'systemMaterialDark',\n 'systemThickMaterialDark',\n 'systemChromeMaterialDark',\n] as const;\n\n/**\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uiblureffect/style)\n */\nexport type NativeTabsBlurEffect = (typeof SUPPORTED_BLUR_EFFECTS)[number];\n\nexport interface NativeTabsProps extends PropsWithChildren {\n // #region common props\n /**\n * The style of the every tab label in the tab bar.\n */\n labelStyle?:\n | StyleProp<NativeTabsLabelStyle>\n | {\n default?: StyleProp<NativeTabsLabelStyle>;\n selected?: StyleProp<NativeTabsLabelStyle>;\n };\n /**\n * The color of every tab icon in the tab bar.\n */\n iconColor?: ColorValue | { default?: ColorValue; selected?: ColorValue };\n /**\n * The tint color of the tab icon.\n *\n * Can be overridden by icon color and label color for each tab individually.\n */\n tintColor?: ColorValue;\n /**\n * The background color of the tab bar.\n */\n backgroundColor?: ColorValue;\n /**\n * The background color of every badge in the tab bar.\n */\n badgeBackgroundColor?: ColorValue;\n /**\n * When set to `true`, hides the tab bar.\n *\n * @default false\n */\n hidden?: boolean;\n // #endregion common props\n // #region iOS props\n /**\n * Specifies the minimize behavior for the tab bar.\n *\n * Available starting from iOS 26.\n *\n * The following values are currently supported:\n *\n * - `automatic` - resolves to the system default minimize behavior\n * - `never` - the tab bar does not minimize\n * - `onScrollDown` - the tab bar minimizes when scrolling down and\n * expands when scrolling back up\n * - `onScrollUp` - the tab bar minimizes when scrolling up and expands\n * when scrolling back down\n *\n * @see The supported values correspond to the official [Apple documentation](https://developer.apple.com/documentation/uikit/uitabbarcontroller/minimizebehavior).\n *\n * @default automatic\n *\n * @platform iOS 26+\n */\n minimizeBehavior?: NativeTabsTabBarMinimizeBehavior;\n /**\n * The blur effect applied to the tab bar.\n *\n * @platform iOS\n */\n blurEffect?: NativeTabsBlurEffect;\n /**\n * The color of the shadow.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarappearance/shadowcolor)\n *\n * @platform iOS\n */\n shadowColor?: ColorValue;\n /**\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uitabbaritem/titlepositionadjustment)\n *\n * @platform iOS\n */\n titlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n /**\n * When set to `true`, the tab bar will not become transparent when scrolled to the edge.\n *\n * @platform iOS\n */\n disableTransparentOnScrollEdge?: boolean;\n /**\n * When set to `true`, enables the sidebarAdaptable tab bar style on iPadOS and macOS. This prop has no effect on iPhone.\n *\n * @platform iOS 18+\n */\n sidebarAdaptable?: boolean;\n // #endregion iOS props\n // #region android props\n /**\n * Disables the active indicator for the tab bar.\n *\n * @platform android\n */\n disableIndicator?: boolean;\n /**\n * The behavior when navigating back with the back button.\n *\n * @platform android\n */\n backBehavior?: 'none' | 'initialRoute' | 'history';\n /**\n * The visibility mode of the tab item label.\n *\n * @see [Material Components documentation](https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md#making-navigation-bar-accessible)\n *\n * @platform android\n */\n labelVisibilityMode?: NativeTabsTabBarItemLabelVisibilityMode;\n /**\n * The color of the ripple effect when the tab is pressed.\n *\n * @platform android\n */\n rippleColor?: ColorValue;\n /**\n * The color of the tab indicator.\n *\n * @platform android\n * @platform web\n */\n indicatorColor?: ColorValue;\n /**\n * The color of the badge text.\n *\n * @platform android\n * @platform web\n */\n badgeTextColor?: ColorValue;\n /**\n * When `true`, the tab bar lifts above the keyboard (input method editor, or IME) instead of being overlaid by it. By default, the keyboard overlays the tab bar.\n *\n * Requires `windowSoftInputMode=\"adjustResize\"`. Has no effect on Android API levels earlier than 30 (Android 11).\n *\n * @default false\n * @platform android\n */\n tabBarRespectsIMEInsets?: boolean;\n // #endregion android props\n /**\n * Listeners for navigation events on all tabs.\n *\n * Supported events:\n * - `tabPress` - called when a tab is pressed\n * - `focus` - called when the screen comes into focus\n * - `blur` - called when the screen loses focus\n *\n * @example\n * ```tsx\n * <NativeTabs\n * screenListeners={{\n * tabPress: (e) => {\n * console.log('Any tab pressed');\n * },\n * }}\n * >\n * ...\n * </NativeTabs>\n * ```\n */\n screenListeners?:\n | ScreenListeners<TabNavigationState<ParamListBase>, NativeTabNavigationEventMap>\n | ((prop: {\n route: RouteProp<ParamListBase, string>;\n }) => ScreenListeners<TabNavigationState<ParamListBase>, NativeTabNavigationEventMap>);\n /**\n * Props passed to the underlying native tab host implementation in `react-native-screens`.\n * Use this to configure props that are not directly exposed by Expo Router.\n *\n * > **Note**: This is an unstable API and may change or be removed in minor versions.\n *\n * @platform android\n * @platform ios\n */\n unstable_nativeProps?: NativeTabsHostNativeProps;\n}\n\nexport interface InternalNativeTabsProps extends NativeTabsProps {\n nonTriggerChildren?: React.ReactNode;\n}\nexport interface OnTabChangeEventPayload {\n /**\n * The route key of the tab the native side has just selected.\n */\n selectedKey: string;\n /**\n * The provenance value reported by the native side for this selection.\n *\n * The navigator echoes this back via `navStateRequest.baseProvenance` on\n * subsequent JS-driven updates so the native side can distinguish stale\n * updates from fresh ones. See `TabsHostNavStateRequest` in\n * `react-native-screens` for the full contract.\n */\n provenance: number;\n // TODO(@ubax): consider renaming this field\n isNativeAction: boolean;\n /**\n * Whether the native side prevented this selection because the target tab is\n * `disabled`. When `true`, the navigator emits `tabPress` but skips navigation.\n *\n * @default false\n */\n isPrevented?: boolean;\n}\n\nexport interface NativeTabsViewProps extends Omit<\n InternalNativeTabsProps,\n | 'labelStyle'\n | 'iconColor'\n | 'backgroundColor'\n | 'badgeBackgroundColor'\n | 'blurEffect'\n | 'indicatorColor'\n | 'badgeTextColor'\n | 'rippleColor'\n | 'disableIndicator'\n | 'labelVisibilityMode'\n> {\n focusedIndex: number;\n /**\n * Provenance counter associated with the currently rendered `focusedIndex`.\n */\n provenance: number;\n tabs: NativeTabsViewTabItem[];\n onTabChange: (event: OnTabChangeEventPayload) => void;\n}\n\nexport interface NativeTabsViewTabItem {\n options: NativeTabOptions;\n routeKey: string;\n name: string;\n contentRenderer: () => React.ReactNode;\n}\n\nexport const SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES = [\n 'auto',\n 'selected',\n 'labeled',\n 'unlabeled',\n] as const;\n\n/**\n * @see [Material Components documentation](https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md#making-navigation-bar-accessible)\n *\n * @platform android\n */\nexport type NativeTabsTabBarItemLabelVisibilityMode =\n (typeof SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES)[number];\n\nexport const SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS = [\n 'automatic',\n 'never',\n 'onScrollDown',\n 'onScrollUp',\n] as const;\n\n/**\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uitabbarcontroller/minimizebehavior)\n *\n * @platform iOS 26\n */\nexport type NativeTabsTabBarMinimizeBehavior =\n (typeof SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS)[number];\n\nexport interface NativeTabTriggerProps {\n /**\n * The name of the route.\n *\n * This is required when used inside a Layout component.\n *\n * When used in a route it has no effect.\n */\n name?: string;\n /**\n * If true, the tab will be hidden from the tab bar.\n *\n * > **Note**: Marking a tab as `hidden` means it cannot be navigated to in any way.\n *\n * > **Note**: Dynamically hiding tabs will remount the navigator and the state will be reset.\n */\n hidden?: boolean;\n /**\n * Props passed to the underlying native tab screen implementation.\n * Use this to configure props not directly exposed by Expo Router, but available in `react-native-screens`.\n *\n * > **Note**: This will override any other props set by Expo Router and may lead to unexpected behavior.\n *\n * > **Note**: This is an unstable API and may change or be removed in minor versions.\n *\n * @platform android\n * @platform iOS\n */\n unstable_nativeProps?: NativeScreenProps;\n /**\n * If true, the tab will not pop stack to the root when selected again.\n *\n * @default false\n * @platform iOS\n */\n disablePopToTop?: boolean;\n /**\n * If true, the tab will not scroll to the top when selected again.\n * @default false\n *\n * @platform iOS\n */\n disableScrollToTop?: boolean;\n /**\n * If `true`, the tab is shown but cannot be selected by tapping it in the\n * tab bar.\n *\n * > **Note:** This only suppresses the native tap interaction. JavaScript\n * > navigation such as `router.push()` or `<Link />` still navigates to\n * > the tab. Use this for tabs that should appear visible but be temporarily inert,\n * > and gate navigation in your own code if you need to fully prevent access.\n *\n * Unlike `hidden`, the tab remains visible in the tab bar.\n *\n * @default false\n *\n * @platform android\n * @platform ios\n */\n disabled?: boolean;\n /**\n * The children of the trigger.\n *\n * Use `Icon`, `Label`, and `Badge` components to customize the tab.\n */\n children?: React.ReactNode;\n /**\n * System-provided tab bar item with predefined icon and title\n *\n * Uses Apple's built-in tab bar items (e.g., bookmarks, contacts, downloads) with\n * standard iOS styling and localized titles. Custom `icon` or `selectedIcon`\n * properties will override the system icon, but the system-defined title cannot\n * be customized.\n *\n * @see The supported values correspond to the official [Apple documentation](https://developer.apple.com/documentation/uikit/uitabbaritem/systemitem).\n * @platform ios\n */\n role?: NativeTabsTabBarItemRole;\n /**\n * The default behavior differs between iOS and Android.\n *\n * On **Android**, the content of a native tabs screen is automatically wrapped in a `SafeAreaView`,\n * and the **bottom** inset is applied. Other insets must be handled manually.\n *\n * On **iOS**, the first scroll view nested inside a native tabs screen has\n * [automatic content inset adjustment](https://reactnative.dev/docs/scrollview#contentinsetadjustmentbehavior-ios) enabled\n *\n * When this property is set to `true`, automatic content inset adjustment is disabled for the screen\n * and must be managed manually. You can use `SafeAreaView` from `react-native-screens/experimental`\n * to handle safe area insets.\n *\n * @platform android\n * @platform ios\n */\n disableAutomaticContentInsets?: boolean;\n /**\n * The style applied to the content of the tab\n *\n * Note: Only certain style properties are supported.\n */\n contentStyle?: NativeTabOptions['contentStyle'];\n /**\n * When set to `true`, the tab bar will not become transparent when scrolled to the edge.\n *\n * When set on a trigger, it takes precedence over the value set on `NativeTabs`.\n *\n * @platform iOS\n */\n disableTransparentOnScrollEdge?: boolean;\n /**\n * The color of the ripple effect when this tab is selected - will be visible when other tabs are pressed.\n *\n * When set on a trigger, it takes precedence over the value set on `NativeTabs`.\n *\n * @platform android\n */\n rippleColor?: ColorValue;\n /**\n * The color of the active indicator for this tab.\n *\n * When set on a trigger, it takes precedence over the value set on `NativeTabs`.\n *\n * @platform android\n */\n indicatorColor?: ColorValue;\n /**\n * When set to `true`, disables the active indicator for this tab.\n *\n * When set on a trigger, it takes precedence over the value set on `NativeTabs`.\n *\n * @default false\n *\n * @platform android\n */\n disableIndicator?: boolean;\n /**\n * The visibility mode of the tab item label for this tab.\n *\n * When set on a trigger, it takes precedence over the value set on `NativeTabs`.\n *\n * @see [Material Components documentation](https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md#making-navigation-bar-accessible)\n *\n * @platform android\n */\n labelVisibilityMode?: NativeTabsTabBarItemLabelVisibilityMode;\n /**\n * Listeners for navigation events on this tab.\n *\n * Supported events:\n * - `tabPress` - called when this tab is pressed\n * - `focus` - called when this screen comes into focus\n * - `blur` - called when this screen loses focus\n *\n * @example\n * ```tsx\n * <NativeTabs.Trigger\n * name=\"home\"\n * listeners={{\n * tabPress: (e) => {\n * console.log('Home tab pressed');\n * },\n * }}\n * />\n * ```\n */\n listeners?: ScreenProps<\n any,\n TabNavigationState<ParamListBase>,\n NativeTabNavigationEventMap\n >['listeners'];\n}\n\nconst SUPPORTED_TAB_BAR_ITEM_ROLES = [\n 'bookmarks',\n 'contacts',\n 'downloads',\n 'favorites',\n 'featured',\n 'history',\n 'more',\n 'mostRecent',\n 'mostViewed',\n 'recents',\n 'search',\n 'topRated',\n] as const;\n\nexport type NativeTabsTabBarItemRole = (typeof SUPPORTED_TAB_BAR_ITEM_ROLES)[number];\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/native-tabs/types.ts"],"names":[],"mappings":";;;AA2Qa,QAAA,sBAAsB,GAAG;IACpC,MAAM;IACN,eAAe;IACf,YAAY;IACZ,OAAO;IACP,MAAM;IACN,SAAS;IACT,WAAW;IACX,yBAAyB;IACzB,oBAAoB;IACpB,gBAAgB;IAChB,qBAAqB;IACrB,sBAAsB;IACtB,8BAA8B;IAC9B,yBAAyB;IACzB,qBAAqB;IACrB,0BAA0B;IAC1B,2BAA2B;IAC3B,6BAA6B;IAC7B,wBAAwB;IACxB,oBAAoB;IACpB,yBAAyB;IACzB,0BAA0B;CAClB,CAAC;AAuPE,QAAA,6CAA6C,GAAG;IAC3D,MAAM;IACN,UAAU;IACV,SAAS;IACT,WAAW;CACH,CAAC;AAUE,QAAA,oCAAoC,GAAG;IAClD,WAAW;IACX,OAAO;IACP,cAAc;IACd,YAAY;CACJ,CAAC;AA2MX,MAAM,4BAA4B,GAAG;IACnC,WAAW;IACX,UAAU;IACV,WAAW;IACX,WAAW;IACX,UAAU;IACV,SAAS;IACT,MAAM;IACN,YAAY;IACZ,YAAY;IACZ,SAAS;IACT,QAAQ;IACR,UAAU;CACF,CAAC","sourcesContent":["import type { PropsWithChildren } from 'react';\nimport type {\n ColorValue,\n ImageSourcePropType,\n StyleProp,\n TextStyle,\n ViewStyle,\n} from 'react-native';\nimport type { TabsHostProps, TabsScreenProps } from 'react-native-screens';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport type {\n DefaultRouterOptions,\n ParamListBase,\n RouteProp,\n ScreenListeners,\n TabNavigationState,\n} from '../react-navigation/native';\nimport type { ScreenProps } from '../useScreens';\n\n/**\n * Event map for `NativeTabs` navigation events.\n * Only `tabPress` is currently supported.\n */\nexport type NativeTabNavigationEventMap = {\n tabPress: {\n data: {\n __internalTabsType: 'native';\n /**\n * `true` when the native side prevented the selection because the target\n * tab is `disabled`. The event is still emitted so listeners are notified,\n * but no navigation occurs.\n */\n isPrevented: boolean;\n };\n canPreventDefault: false;\n };\n};\n\nexport type NativeScreenProps = Partial<Omit<TabsScreenProps, 'screenKey'>>;\n\n/**\n * Props passed to the underlying tab host implementation in `react-native-screens`.\n */\nexport type NativeTabsHostNativeProps = Partial<\n Omit<TabsHostProps, 'navStateRequest' | 'onTabSelected' | 'children'>\n>;\n\nexport interface NativeTabOptions extends DefaultRouterOptions {\n /**\n * @platform android\n * @platform iOS\n */\n icon?: SymbolOrImageSource;\n /**\n * @platform android\n * @platform iOS\n */\n selectedIcon?: SymbolOrImageSource;\n /**\n * @platform android\n * @platform iOS\n * @platform web\n */\n title?: string;\n /**\n * @platform android\n * @platform iOS\n * @platform web\n */\n badgeValue?: string;\n /**\n * @platform android\n * @platform iOS\n * @platform web\n */\n selectedLabelStyle?: NativeTabsLabelStyle;\n /**\n * @platform android\n * @platform iOS\n * @platform web\n */\n labelStyle?: NativeTabsLabelStyle;\n /**\n * @platform iOS\n */\n role?: NativeTabsTabBarItemRole;\n /**\n * @platform android\n * @platform iOS\n */\n selectedIconColor?: ColorValue;\n /**\n * @platform iOS\n */\n selectedBadgeBackgroundColor?: ColorValue;\n /**\n * @platform android\n * @platform iOS\n * @platform web\n */\n badgeBackgroundColor?: ColorValue;\n /**\n * @platform android\n * @platform web\n */\n badgeTextColor?: ColorValue;\n /**\n * @platform android\n * @platform iOS\n * @platform web\n */\n backgroundColor?: ColorValue;\n /**\n * @platform iOS\n */\n blurEffect?: NativeTabsBlurEffect;\n /**\n * @platform iOS\n */\n shadowColor?: ColorValue;\n /**\n * @platform android\n * @platform iOS\n */\n iconColor?: ColorValue;\n /**\n * @platform android\n */\n tintColor?: ColorValue;\n /**\n * @platform iOS\n */\n disableTransparentOnScrollEdge?: boolean;\n /**\n * @platform iOS\n */\n titlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n /**\n * @platform iOS\n */\n selectedTitlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n /**\n * @platform android\n * @platform web\n */\n indicatorColor?: ColorValue;\n /**\n * @platform android\n */\n rippleColor?: ColorValue;\n /**\n * @platform android\n */\n disableIndicator?: boolean;\n /**\n * @platform android\n */\n labelVisibilityMode?: NativeTabsTabBarItemLabelVisibilityMode;\n /**\n * @platform android\n * @platform iOS\n * @platform web\n */\n hidden?: boolean;\n /**\n * @platform android\n * @platform iOS\n */\n disabled?: boolean;\n /**\n * @platform android\n * @platform iOS\n */\n tabBarItemTestID?: string;\n /**\n * @platform android\n * @platform iOS\n */\n tabBarItemAccessibilityLabel?: string;\n /**\n * @platform iOS\n */\n specialEffects?: TabsScreenProps['specialEffects'];\n /**\n * @platform android\n * @platform iOS\n */\n nativeProps?: NativeScreenProps;\n /**\n * @platform android\n * @platform iOS\n */\n disableAutomaticContentInsets?: boolean;\n /**\n * @platform android\n * @platform iOS\n */\n contentStyle?: Pick<\n ViewStyle,\n | 'backgroundColor'\n | 'experimental_backgroundImage'\n | 'padding'\n | 'paddingTop'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'paddingRight'\n | 'paddingBlock'\n | 'paddingBlockEnd'\n | 'paddingBlockStart'\n | 'paddingInline'\n | 'paddingInlineEnd'\n | 'paddingInlineStart'\n | 'paddingEnd'\n | 'paddingHorizontal'\n | 'paddingVertical'\n | 'paddingStart'\n | 'alignContent'\n | 'alignItems'\n | 'justifyContent'\n | 'flexDirection'\n | 'gap'\n >;\n}\n\nexport type SymbolOrImageSource =\n | {\n /**\n * The name of the SF Symbol to use as an icon.\n * @platform iOS\n */\n sf?: SFSymbol;\n /**\n * The name of the iOS asset catalog image to use as an icon.\n * @platform iOS\n */\n xcasset?: string;\n /**\n * The name of the drawable resource to use as an icon.\n * @platform android\n */\n drawable?: string;\n }\n | {\n /**\n * The image source to use as an icon.\n */\n src?: ImageSourcePropType | Promise<ImageSourcePropType | null>;\n /**\n * Controls how the icon is rendered on iOS.\n * @platform ios\n * @default 'template'\n */\n renderingMode?: 'template' | 'original';\n };\n\nexport type NativeTabsLabelStyle = Pick<\n TextStyle,\n 'fontFamily' | 'fontSize' | 'fontStyle' | 'fontWeight' | 'color'\n>;\n\nexport const SUPPORTED_BLUR_EFFECTS = [\n 'none',\n 'systemDefault',\n 'extraLight',\n 'light',\n 'dark',\n 'regular',\n 'prominent',\n 'systemUltraThinMaterial',\n 'systemThinMaterial',\n 'systemMaterial',\n 'systemThickMaterial',\n 'systemChromeMaterial',\n 'systemUltraThinMaterialLight',\n 'systemThinMaterialLight',\n 'systemMaterialLight',\n 'systemThickMaterialLight',\n 'systemChromeMaterialLight',\n 'systemUltraThinMaterialDark',\n 'systemThinMaterialDark',\n 'systemMaterialDark',\n 'systemThickMaterialDark',\n 'systemChromeMaterialDark',\n] as const;\n\n/**\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uiblureffect/style)\n */\nexport type NativeTabsBlurEffect = (typeof SUPPORTED_BLUR_EFFECTS)[number];\n\nexport interface NativeTabsProps extends PropsWithChildren {\n // #region common props\n /**\n * The style of the every tab label in the tab bar.\n */\n labelStyle?:\n | StyleProp<NativeTabsLabelStyle>\n | {\n default?: StyleProp<NativeTabsLabelStyle>;\n selected?: StyleProp<NativeTabsLabelStyle>;\n };\n /**\n * The color of every tab icon in the tab bar.\n */\n iconColor?: ColorValue | { default?: ColorValue; selected?: ColorValue };\n /**\n * The tint color of the tab icon.\n *\n * Can be overridden by icon color and label color for each tab individually.\n */\n tintColor?: ColorValue;\n /**\n * The background color of the tab bar.\n */\n backgroundColor?: ColorValue;\n /**\n * The background color of every badge in the tab bar.\n */\n badgeBackgroundColor?: ColorValue;\n /**\n * When set to `true`, hides the tab bar.\n *\n * @default false\n */\n hidden?: boolean;\n // #endregion common props\n // #region iOS props\n /**\n * Specifies the minimize behavior for the tab bar.\n *\n * Available starting from iOS 26.\n *\n * The following values are currently supported:\n *\n * - `automatic` - resolves to the system default minimize behavior\n * - `never` - the tab bar does not minimize\n * - `onScrollDown` - the tab bar minimizes when scrolling down and\n * expands when scrolling back up\n * - `onScrollUp` - the tab bar minimizes when scrolling up and expands\n * when scrolling back down\n *\n * @see The supported values correspond to the official [Apple documentation](https://developer.apple.com/documentation/uikit/uitabbarcontroller/minimizebehavior).\n *\n * @default automatic\n *\n * @platform iOS 26+\n */\n minimizeBehavior?: NativeTabsTabBarMinimizeBehavior;\n /**\n * The blur effect applied to the tab bar.\n *\n * @platform iOS\n */\n blurEffect?: NativeTabsBlurEffect;\n /**\n * The color of the shadow.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarappearance/shadowcolor)\n *\n * @platform iOS\n */\n shadowColor?: ColorValue;\n /**\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uitabbaritem/titlepositionadjustment)\n *\n * @platform iOS\n */\n titlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n /**\n * When set to `true`, the tab bar will not become transparent when scrolled to the edge.\n *\n * @platform iOS\n */\n disableTransparentOnScrollEdge?: boolean;\n /**\n * When set to `true`, enables the sidebarAdaptable tab bar style on iPadOS and macOS. This prop has no effect on iPhone.\n *\n * @platform iOS 18+\n */\n sidebarAdaptable?: boolean;\n // #endregion iOS props\n // #region android props\n /**\n * Disables the active indicator for the tab bar.\n *\n * @platform android\n */\n disableIndicator?: boolean;\n /**\n * The behavior when navigating back with the back button.\n *\n * @platform android\n */\n backBehavior?: 'none' | 'initialRoute' | 'history';\n /**\n * The visibility mode of the tab item label.\n *\n * @see [Material Components documentation](https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md#making-navigation-bar-accessible)\n *\n * @platform android\n */\n labelVisibilityMode?: NativeTabsTabBarItemLabelVisibilityMode;\n /**\n * The color of the ripple effect when the tab is pressed.\n *\n * @platform android\n */\n rippleColor?: ColorValue;\n /**\n * The color of the tab indicator.\n *\n * @platform android\n * @platform web\n */\n indicatorColor?: ColorValue;\n /**\n * The color of the badge text.\n *\n * @platform android\n * @platform web\n */\n badgeTextColor?: ColorValue;\n /**\n * When `true`, the tab bar lifts above the keyboard (input method editor, or IME) instead of being overlaid by it. By default, the keyboard overlays the tab bar.\n *\n * Requires `windowSoftInputMode=\"adjustResize\"`. Has no effect on Android API levels earlier than 30 (Android 11).\n *\n * @default false\n * @platform android\n */\n tabBarRespectsIMEInsets?: boolean;\n // #endregion android props\n /**\n * Listeners for navigation events on all tabs.\n *\n * Supported events:\n * - `tabPress` - called when a tab is pressed\n * - `focus` - called when the screen comes into focus\n * - `blur` - called when the screen loses focus\n *\n * @example\n * ```tsx\n * <NativeTabs\n * screenListeners={{\n * tabPress: (e) => {\n * console.log('Any tab pressed');\n * },\n * }}\n * >\n * ...\n * </NativeTabs>\n * ```\n */\n screenListeners?:\n | ScreenListeners<TabNavigationState<ParamListBase>, NativeTabNavigationEventMap>\n | ((prop: {\n route: RouteProp<ParamListBase, string>;\n }) => ScreenListeners<TabNavigationState<ParamListBase>, NativeTabNavigationEventMap>);\n /**\n * Props passed to the underlying native tab host implementation in `react-native-screens`.\n * Use this to configure props that are not directly exposed by Expo Router.\n *\n * > **Note**: This is an unstable API and may change or be removed in minor versions.\n *\n * @platform android\n * @platform ios\n */\n unstable_nativeProps?: NativeTabsHostNativeProps;\n}\n\nexport interface InternalNativeTabsProps extends NativeTabsProps {\n nonTriggerChildren?: React.ReactNode;\n}\nexport interface OnTabChangeEventPayload {\n /**\n * The route key of the tab the native side has just selected.\n */\n selectedKey: string;\n /**\n * The provenance value reported by the native side for this selection.\n *\n * The navigator echoes this back via `navStateRequest.baseProvenance` on\n * subsequent JS-driven updates so the native side can distinguish stale\n * updates from fresh ones. See `TabsHostNavStateRequest` in\n * `react-native-screens` for the full contract.\n */\n provenance: number;\n // TODO(@ubax): consider renaming this field\n isNativeAction: boolean;\n /**\n * Whether the native side prevented this selection because the target tab is\n * `disabled`. When `true`, the navigator emits `tabPress` but skips navigation.\n *\n * @default false\n */\n isPrevented?: boolean;\n}\n\nexport interface NativeTabsViewProps extends Omit<\n InternalNativeTabsProps,\n | 'labelStyle'\n | 'iconColor'\n | 'backgroundColor'\n | 'badgeBackgroundColor'\n | 'blurEffect'\n | 'indicatorColor'\n | 'badgeTextColor'\n | 'rippleColor'\n | 'disableIndicator'\n | 'labelVisibilityMode'\n> {\n focusedIndex: number;\n /**\n * Provenance counter associated with the currently rendered `focusedIndex`.\n */\n provenance: number;\n tabs: NativeTabsViewTabItem[];\n onTabChange: (event: OnTabChangeEventPayload) => void;\n}\n\nexport interface NativeTabsViewTabItem {\n options: NativeTabOptions;\n routeKey: string;\n name: string;\n contentRenderer: () => React.ReactNode;\n}\n\nexport const SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES = [\n 'auto',\n 'selected',\n 'labeled',\n 'unlabeled',\n] as const;\n\n/**\n * @see [Material Components documentation](https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md#making-navigation-bar-accessible)\n *\n * @platform android\n */\nexport type NativeTabsTabBarItemLabelVisibilityMode =\n (typeof SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES)[number];\n\nexport const SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS = [\n 'automatic',\n 'never',\n 'onScrollDown',\n 'onScrollUp',\n] as const;\n\n/**\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uitabbarcontroller/minimizebehavior)\n *\n * @platform iOS 26\n */\nexport type NativeTabsTabBarMinimizeBehavior =\n (typeof SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS)[number];\n\nexport interface NativeTabTriggerProps {\n /**\n * The name of the route.\n *\n * This is required when used inside a Layout component.\n *\n * When used in a route it has no effect.\n */\n name?: string;\n /**\n * If true, the tab will be hidden from the tab bar.\n *\n * > **Note**: Marking a tab as `hidden` means it cannot be navigated to in any way.\n *\n * > **Note**: Dynamically hiding tabs will remount the navigator and the state will be reset.\n */\n hidden?: boolean;\n /**\n * Props passed to the underlying native tab screen implementation.\n * Use this to configure props not directly exposed by Expo Router, but available in `react-native-screens`.\n *\n * > **Note**: This will override any other props set by Expo Router and may lead to unexpected behavior.\n *\n * > **Note**: This is an unstable API and may change or be removed in minor versions.\n *\n * @platform android\n * @platform iOS\n */\n unstable_nativeProps?: NativeScreenProps;\n /**\n * If true, the tab will not pop stack to the root when selected again.\n *\n * @default false\n * @platform iOS\n */\n disablePopToTop?: boolean;\n /**\n * If true, the tab will not scroll to the top when selected again.\n * @default false\n *\n * @platform iOS\n */\n disableScrollToTop?: boolean;\n /**\n * If `true`, the tab is shown but cannot be selected by tapping it in the\n * tab bar.\n *\n * > **Note:** This only suppresses the native tap interaction. JavaScript\n * > navigation such as `router.push()` or `<Link />` still navigates to\n * > the tab. Use this for tabs that should appear visible but be temporarily inert,\n * > and gate navigation in your own code if you need to fully prevent access.\n *\n * Unlike `hidden`, the tab remains visible in the tab bar.\n *\n * @default false\n *\n * @platform android\n * @platform ios\n */\n disabled?: boolean;\n /**\n * A test identifier for the tab bar item.\n *\n * On iOS it maps to the item's accessibility identifier, which XCUITest and Maestro match.\n * On Android it maps to the item's view tag, which Espresso-based drivers like Detox read\n * but Maestro and Appium do not. Use `accessibilityLabel` to match the tab by id there.\n *\n * @platform android\n * @platform iOS\n */\n testID?: string;\n /**\n * The accessibility label of the tab bar item, announced by screen readers.\n * Defaults to the visible tab label.\n *\n * On Android, maps to the item's `contentDescription` and requires API 26 or above.\n *\n * @platform android\n * @platform iOS\n */\n accessibilityLabel?: string;\n /**\n * The children of the trigger.\n *\n * Use `Icon`, `Label`, and `Badge` components to customize the tab.\n */\n children?: React.ReactNode;\n /**\n * System-provided tab bar item with predefined icon and title\n *\n * Uses Apple's built-in tab bar items (e.g., bookmarks, contacts, downloads) with\n * standard iOS styling and localized titles. Custom `icon` or `selectedIcon`\n * properties will override the system icon, but the system-defined title cannot\n * be customized.\n *\n * @see The supported values correspond to the official [Apple documentation](https://developer.apple.com/documentation/uikit/uitabbaritem/systemitem).\n * @platform ios\n */\n role?: NativeTabsTabBarItemRole;\n /**\n * The default behavior differs between iOS and Android.\n *\n * On **Android**, the content of a native tabs screen is automatically wrapped in a `SafeAreaView`,\n * and the **bottom** inset is applied. Other insets must be handled manually.\n *\n * On **iOS**, the first scroll view nested inside a native tabs screen has\n * [automatic content inset adjustment](https://reactnative.dev/docs/scrollview#contentinsetadjustmentbehavior-ios) enabled\n *\n * When this property is set to `true`, automatic content inset adjustment is disabled for the screen\n * and must be managed manually. You can use `SafeAreaView` from `react-native-screens/experimental`\n * to handle safe area insets.\n *\n * @platform android\n * @platform ios\n */\n disableAutomaticContentInsets?: boolean;\n /**\n * The style applied to the content of the tab\n *\n * Note: Only certain style properties are supported.\n */\n contentStyle?: NativeTabOptions['contentStyle'];\n /**\n * When set to `true`, the tab bar will not become transparent when scrolled to the edge.\n *\n * When set on a trigger, it takes precedence over the value set on `NativeTabs`.\n *\n * @platform iOS\n */\n disableTransparentOnScrollEdge?: boolean;\n /**\n * The color of the ripple effect when this tab is selected - will be visible when other tabs are pressed.\n *\n * When set on a trigger, it takes precedence over the value set on `NativeTabs`.\n *\n * @platform android\n */\n rippleColor?: ColorValue;\n /**\n * The color of the active indicator for this tab.\n *\n * When set on a trigger, it takes precedence over the value set on `NativeTabs`.\n *\n * @platform android\n */\n indicatorColor?: ColorValue;\n /**\n * When set to `true`, disables the active indicator for this tab.\n *\n * When set on a trigger, it takes precedence over the value set on `NativeTabs`.\n *\n * @default false\n *\n * @platform android\n */\n disableIndicator?: boolean;\n /**\n * The visibility mode of the tab item label for this tab.\n *\n * When set on a trigger, it takes precedence over the value set on `NativeTabs`.\n *\n * @see [Material Components documentation](https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md#making-navigation-bar-accessible)\n *\n * @platform android\n */\n labelVisibilityMode?: NativeTabsTabBarItemLabelVisibilityMode;\n /**\n * Listeners for navigation events on this tab.\n *\n * Supported events:\n * - `tabPress` - called when this tab is pressed\n * - `focus` - called when this screen comes into focus\n * - `blur` - called when this screen loses focus\n *\n * @example\n * ```tsx\n * <NativeTabs.Trigger\n * name=\"home\"\n * listeners={{\n * tabPress: (e) => {\n * console.log('Home tab pressed');\n * },\n * }}\n * />\n * ```\n */\n listeners?: ScreenProps<\n any,\n TabNavigationState<ParamListBase>,\n NativeTabNavigationEventMap\n >['listeners'];\n}\n\nconst SUPPORTED_TAB_BAR_ITEM_ROLES = [\n 'bookmarks',\n 'contacts',\n 'downloads',\n 'favorites',\n 'featured',\n 'history',\n 'more',\n 'mostRecent',\n 'mostViewed',\n 'recents',\n 'search',\n 'topRated',\n] as const;\n\nexport type NativeTabsTabBarItemRole = (typeof SUPPORTED_TAB_BAR_ITEM_ROLES)[number];\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"StackRouter.d.ts","sourceRoot":"","sources":["../../../src/react-navigation/routers/StackRouter.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,aAAa,EAEb,MAAM,EACP,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,eAAe,GACvB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,E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A;KAAE;;;;;;;;CAgBnE,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,mGAygBtD"}
1
+ {"version":3,"file":"StackRouter.d.ts","sourceRoot":"","sources":["../../../src/react-navigation/routers/StackRouter.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,aAAa,EAEb,MAAM,EACP,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,eAAe,GACvB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD;IACE,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,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E,SAAS,SAAS,OAAO,GAC9B,SAAS,SAAS,SAAS,CAAC,SAAS,CAAC,GACpC,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,GACjF,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,GAClF,KAAK,GACR,IAAI,CAAC;CACT,CAAC;AAEF,eAAO,MAAM,YAAY;kBACT,MAAM,WAAW,MAAM;;;;;;;eAM1B,MAAM,WAAW,MAAM;;;;;;;gBAMvB,MAAM;;;;;;;;;gBASL,MAAM,WAAW,MAAM,YAAY;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;;;;;;;;CAgBnE,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,mGA8gBtD"}
@@ -118,6 +118,7 @@ function StackRouter(options) {
118
118
  },
119
119
  getStateForRouteNamesChange(state, { routeNames, routeParamList, routeKeyChanges }) {
120
120
  const routes = state.routes.filter((route) => routeNames.includes(route.name) && !routeKeyChanges.includes(route.name));
121
+ const preloadedRoutes = state.preloadedRoutes.filter((route) => routeNames.includes(route.name) && !routeKeyChanges.includes(route.name));
121
122
  if (routes.length === 0) {
122
123
  const initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName)
123
124
  ? options.initialRouteName
@@ -132,6 +133,7 @@ function StackRouter(options) {
132
133
  ...state,
133
134
  routeNames,
134
135
  routes,
136
+ preloadedRoutes,
135
137
  index: Math.min(state.index, routes.length - 1),
136
138
  };
137
139
  },