expo-router 57.0.3 → 57.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/android/build.gradle +2 -2
  2. package/build/exports.d.ts +2 -1
  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/fork/useLinking.native.js +1 -1
  9. package/build/fork/useLinking.native.js.map +1 -1
  10. package/build/global-state/getRouteInfoFromState.d.ts.map +1 -1
  11. package/build/global-state/getRouteInfoFromState.js +3 -11
  12. package/build/global-state/getRouteInfoFromState.js.map +1 -1
  13. package/build/global-state/store.d.ts +3 -4
  14. package/build/global-state/store.d.ts.map +1 -1
  15. package/build/global-state/store.js.map +1 -1
  16. package/build/global-state/useStore.d.ts.map +1 -1
  17. package/build/global-state/useStore.js +0 -4
  18. package/build/global-state/useStore.js.map +1 -1
  19. package/build/native-tabs/NativeTabTrigger.d.ts +1 -1
  20. package/build/native-tabs/NativeTabTrigger.d.ts.map +1 -1
  21. package/build/native-tabs/NativeTabTrigger.js +9 -1
  22. package/build/native-tabs/NativeTabTrigger.js.map +1 -1
  23. package/build/native-tabs/types.d.ts +31 -0
  24. package/build/native-tabs/types.d.ts.map +1 -1
  25. package/build/native-tabs/types.js.map +1 -1
  26. package/build/react-navigation/native-stack/index.d.ts +1 -1
  27. package/build/react-navigation/native-stack/index.d.ts.map +1 -1
  28. package/build/react-navigation/native-stack/index.js.map +1 -1
  29. package/build/react-navigation/native-stack/types.d.ts +17 -0
  30. package/build/react-navigation/native-stack/types.d.ts.map +1 -1
  31. package/build/react-navigation/native-stack/types.js.map +1 -1
  32. package/build/react-navigation/native-stack/views/NativeStackView.native.d.ts.map +1 -1
  33. package/build/react-navigation/native-stack/views/NativeStackView.native.js +3 -2
  34. package/build/react-navigation/native-stack/views/NativeStackView.native.js.map +1 -1
  35. package/build/react-navigation/native-stack/views/useHeaderConfigProps.d.ts +1 -1
  36. package/build/react-navigation/native-stack/views/useHeaderConfigProps.d.ts.map +1 -1
  37. package/build/react-navigation/native-stack/views/useHeaderConfigProps.js +3 -1
  38. package/build/react-navigation/native-stack/views/useHeaderConfigProps.js.map +1 -1
  39. package/build/testing-library/context-stubs.d.ts +13 -0
  40. package/build/testing-library/context-stubs.d.ts.map +1 -1
  41. package/build/testing-library/context-stubs.js +38 -2
  42. package/build/testing-library/context-stubs.js.map +1 -1
  43. package/build/toolbar/native.android.d.ts.map +1 -1
  44. package/build/toolbar/native.android.js +6 -2
  45. package/build/toolbar/native.android.js.map +1 -1
  46. package/build/utils/url.d.ts +2 -0
  47. package/build/utils/url.d.ts.map +1 -1
  48. package/build/utils/url.js +21 -0
  49. package/build/utils/url.js.map +1 -1
  50. package/expo-module.config.json +1 -1
  51. package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.3/expo.modules.router-57.0.3.module → 57.0.5/expo.modules.router-57.0.5.module} +7 -7
  52. package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.5/expo.modules.router-57.0.5.module.md5 +1 -0
  53. package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.5/expo.modules.router-57.0.5.module.sha1 +1 -0
  54. package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.5/expo.modules.router-57.0.5.module.sha256 +1 -0
  55. package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.5/expo.modules.router-57.0.5.module.sha512 +1 -0
  56. package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.3/expo.modules.router-57.0.3.pom → 57.0.5/expo.modules.router-57.0.5.pom} +1 -1
  57. package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.5/expo.modules.router-57.0.5.pom.md5 +1 -0
  58. package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.5/expo.modules.router-57.0.5.pom.sha1 +1 -0
  59. package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.5/expo.modules.router-57.0.5.pom.sha256 +1 -0
  60. package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.5/expo.modules.router-57.0.5.pom.sha512 +1 -0
  61. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml +4 -4
  62. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.md5 +1 -1
  63. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha1 +1 -1
  64. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha256 +1 -1
  65. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha512 +1 -1
  66. package/package.json +8 -8
  67. package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.3/expo.modules.router-57.0.3.module.md5 +0 -1
  68. package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.3/expo.modules.router-57.0.3.module.sha1 +0 -1
  69. package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.3/expo.modules.router-57.0.3.module.sha256 +0 -1
  70. package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.3/expo.modules.router-57.0.3.module.sha512 +0 -1
  71. package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.3/expo.modules.router-57.0.3.pom.md5 +0 -1
  72. package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.3/expo.modules.router-57.0.3.pom.sha1 +0 -1
  73. package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.3/expo.modules.router-57.0.3.pom.sha256 +0 -1
  74. package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.3/expo.modules.router-57.0.3.pom.sha512 +0 -1
  75. /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.3/expo.modules.router-57.0.3-sources.jar → 57.0.5/expo.modules.router-57.0.5-sources.jar} +0 -0
  76. /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.3/expo.modules.router-57.0.3-sources.jar.md5 → 57.0.5/expo.modules.router-57.0.5-sources.jar.md5} +0 -0
  77. /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.3/expo.modules.router-57.0.3-sources.jar.sha1 → 57.0.5/expo.modules.router-57.0.5-sources.jar.sha1} +0 -0
  78. /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.3/expo.modules.router-57.0.3-sources.jar.sha256 → 57.0.5/expo.modules.router-57.0.5-sources.jar.sha256} +0 -0
  79. /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.3/expo.modules.router-57.0.3-sources.jar.sha512 → 57.0.5/expo.modules.router-57.0.5-sources.jar.sha512} +0 -0
  80. /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.3/expo.modules.router-57.0.3.aar → 57.0.5/expo.modules.router-57.0.5.aar} +0 -0
  81. /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.3/expo.modules.router-57.0.3.aar.md5 → 57.0.5/expo.modules.router-57.0.5.aar.md5} +0 -0
  82. /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.3/expo.modules.router-57.0.3.aar.sha1 → 57.0.5/expo.modules.router-57.0.5.aar.sha1} +0 -0
  83. /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.3/expo.modules.router-57.0.3.aar.sha256 → 57.0.5/expo.modules.router-57.0.5.aar.sha256} +0 -0
  84. /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.3/expo.modules.router-57.0.3.aar.sha512 → 57.0.5/expo.modules.router-57.0.5.aar.sha512} +0 -0
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'expo.modules.router'
7
- version = '57.0.3'
7
+ version = '57.0.5'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.router"
11
11
  defaultConfig {
12
12
  versionCode 1
13
- versionName "57.0.3"
13
+ versionName "57.0.5"
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';
@@ -42,5 +43,5 @@ export type { PagePreloadedEvent, PageFocusedEvent, PageBlurredEvent, PageRemove
42
43
  export { Tabs } from './layouts/Tabs';
43
44
  export { ExperimentalStack } from './layouts/experimental-stack';
44
45
  export type { ExperimentalStackNavigationOptions, ExperimentalStackNavigationEventMap, ExperimentalStackNavigationProp, ExperimentalStackScreenProps, } from './layouts/experimental-stack';
45
- export type { NativeStackHeaderBackProps, NativeStackHeaderItem, NativeStackHeaderItemButton, NativeStackHeaderItemCustom, NativeStackHeaderItemMenu, NativeStackHeaderItemMenuAction, NativeStackHeaderItemMenuSubmenu, NativeStackHeaderItemProps, NativeStackHeaderItemSpacing, NativeStackHeaderLeftProps, NativeStackHeaderProps, NativeStackHeaderRightProps, NativeStackNavigationEventMap, NativeStackNavigationOptions, NativeStackNavigationProp, NativeStackNavigatorProps, NativeStackOptionsArgs, NativeStackScreenProps, } from './react-navigation/native-stack';
46
+ export type { NativeStackHeaderBackProps, NativeStackHeaderItem, NativeStackHeaderItemButton, NativeStackHeaderItemCustom, NativeStackHeaderItemMenu, NativeStackHeaderItemMenuAction, NativeStackHeaderItemMenuSubmenu, NativeStackHeaderItemProps, NativeStackHeaderItemSpacing, NativeStackHeaderLeftProps, NativeStackHeaderProps, NativeStackHeaderRightProps, NativeStackHeaderNativeProps, NativeStackNativeProps, NativeStackNavigationEventMap, NativeStackNavigationOptions, NativeStackNavigationProp, NativeStackNavigatorProps, NativeStackOptionsArgs, NativeStackScreenNativeProps, NativeStackScreenProps, } from './react-navigation/native-stack';
46
47
  //# sourceMappingURL=exports.d.ts.map
@@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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 { 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 NativeStackNavigationEventMap,\n NativeStackNavigationOptions,\n NativeStackNavigationProp,\n NativeStackNavigatorProps,\n NativeStackOptionsArgs,\n NativeStackScreenProps,\n} from './react-nav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GAAA,YAAY,OAAA;AACrB,2EAA0E;AAAjE,gHAAA,cAAc,OAAA;AACvB,6DAA4D;AAAnD,oGAAA,QAAQ,OAAA;AAOjB,2CASsB;AARpB,mGAAA,KAAK,OAAA;AAEL,kGAAA,IAAI,OAAA;AAEJ,mGAAA,KAAK,OAAA;AAEL,wGAAA,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,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C,CAAC,wEAAwE;YACxE,CAAC,GAAG,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,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":"extractPathFromURL.js","sourceRoot":"","sources":["../../src/fork/extractPathFromURL.ts"],"names":[],"mappings":";;AAEA,4EAaC;AAED,0DAIC;AA6GD,wDAMC;AAxID,sCAAqE;AAErE,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,8BAA8B;AAC9B,SAAS,uBAAuB,CAAC,GAAW;IAC1C;IACE,2EAA2E;IAC3E,4CAA4C;IAC5C,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,EACzB,CAAC;QACD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAEhD,IAAI,QAAQ,KAAK,UAAU,IAAI,QAAQ,KAAK,YAAY,EAAE,CAAC;YACzD,wEAAwE;YACxE,kGAAkG;YAClG,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,IAAI,CAAC,OAA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} 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"]}
@@ -65,7 +65,7 @@ function useLinking(ref, { enabled = true, prefixes, filter, config, getInitialU
65
65
  if (independent) {
66
66
  return undefined;
67
67
  }
68
- if (enabled !== false && linkingHandlers.length && process.env.EXPO_OS !== 'android') {
68
+ if (enabled !== false && linkingHandlers.length) {
69
69
  // TODO(@ubax): This check should be removed
70
70
  if (linkingHandlers.length > 1) {
71
71
  console.error([
@@ -1 +1 @@
1
- {"version":3,"file":"useLinking.native.js","sourceRoot":"","sources":["../../src/fork/useLinking.native.ts"],"names":[],"mappings":";;;;;;;;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QACjC,mFAAmF;QACnF,OAAO,WAAW,CAAC,aAAa,EAAE,CAAC;IACrC,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC;QAClB,4DAA4D;QAC5D,sBAAO,CAAC,aAAa,EAAE;QACvB,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QAC5B,wDAAwD;QACxD,uEAAuE;QACvE,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CACrC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import * as ExpoLinking from 'expo-linking';\nimport { type RefObject, useEffect, useCallback, useRef } from 'react';\nimport { Linking, Platform } from 'react-native';\n\nimport { extractExpoPathFromURL } from './extractPathFromURL';\nimport {\n type LinkingOptions,\n getActionFromState as getActionFromStateDefault,\n getStateFromPath as getStateFromPathDefault,\n type NavigationContainerRef,\n type ParamListBase,\n useNavigationIndependentTree,\n} from '../react-navigation/native';\n\ntype ResultState = ReturnType<typeof getStateFromPathDefault>;\n\ntype Options = LinkingOptions<ParamListBase>;\n\nconst linkingHandlers: symbol[] = [];\n\nexport function useLinking(\n ref: RefObject<NavigationContainerRef<ParamListBase>>,\n {\n enabled = true,\n prefixes,\n filter,\n config,\n getInitialURL = () => getInitialURLWithTimeout(),\n subscribe = (listener) => {\n const callback = ({ url }: { url: string }) => listener(url);\n\n const subscription = Linking.addEventListener('url', callback) as\n | { remove(): void }\n | undefined;\n\n // Storing this in a local variable stops Jest from complaining about import after teardown\n // @ts-expect-error: removeEventListener is not present in newer RN versions\n const removeEventListener = Linking.removeEventListener?.bind(Linking);\n\n return () => {\n // https://github.com/facebook/react-native/commit/6d1aca806cee86ad76de771ed3a1cc62982ebcd7\n if (subscription?.remove) {\n subscription.remove();\n } else {\n removeEventListener?.('url', callback);\n }\n };\n },\n getStateFromPath = getStateFromPathDefault,\n getActionFromState = getActionFromStateDefault,\n }: Options,\n onUnhandledLinking: (lastUnhandledLining: string | undefined) => void\n) {\n const independent = useNavigationIndependentTree();\n\n useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return undefined;\n }\n\n if (independent) {\n return undefined;\n }\n\n if (enabled !== false && linkingHandlers.length && process.env.EXPO_OS !== 'android') {\n // TODO(@ubax): This check should be removed\n if (linkingHandlers.length > 1) {\n console.error(\n [\n 'Looks like you have configured linking in multiple places. This is likely an error since deep links should only be handled in one place to avoid conflicts. Make sure that:',\n \"- You don't have multiple NavigationContainers in the app each with 'linking' enabled\",\n '- Only a single instance of the root component is rendered',\n ]\n .join('\\n')\n .trim()\n );\n }\n }\n\n const handler = Symbol();\n\n if (enabled !== false) {\n linkingHandlers.push(handler);\n }\n\n return () => {\n const index = linkingHandlers.indexOf(handler);\n\n if (index > -1) {\n linkingHandlers.splice(index, 1);\n }\n };\n }, [enabled, independent]);\n\n // We store these options in ref to avoid re-creating getInitialState and re-subscribing listeners\n // This lets user avoid wrapping the items in `React.useCallback` or `React.useMemo`\n // Not re-creating `getInitialState` is important coz it makes it easier for the user to use in an effect\n const enabledRef = useRef(enabled);\n const prefixesRef = useRef(prefixes);\n const filterRef = useRef(filter);\n const configRef = useRef(config);\n const getInitialURLRef = useRef(getInitialURL);\n const getStateFromPathRef = useRef(getStateFromPath);\n const getActionFromStateRef = useRef(getActionFromState);\n\n useEffect(() => {\n enabledRef.current = enabled;\n prefixesRef.current = prefixes;\n filterRef.current = filter;\n configRef.current = config;\n getInitialURLRef.current = getInitialURL;\n getStateFromPathRef.current = getStateFromPath;\n getActionFromStateRef.current = getActionFromState;\n });\n\n const getStateFromURL = useCallback(\n (url: string | null | undefined) => {\n if (!url || (filterRef.current && !filterRef.current(url))) {\n return undefined;\n }\n\n const path = extractExpoPathFromURL(prefixesRef.current, url);\n\n return path !== undefined ? getStateFromPathRef.current(path, configRef.current) : undefined;\n },\n\n []\n );\n\n const getInitialState = useCallback(() => {\n let state: ResultState | undefined;\n\n if (enabledRef.current) {\n const url = getInitialURLRef.current();\n\n if (url != null) {\n if (typeof url !== 'string') {\n return url.then((url) => {\n const state = getStateFromURL(url);\n\n if (typeof url === 'string') {\n // If the link were handled, it gets cleared in NavigationContainer\n onUnhandledLinking(extractExpoPathFromURL(prefixes, url));\n }\n\n return state;\n });\n } else {\n onUnhandledLinking(extractExpoPathFromURL(prefixes, url));\n }\n }\n\n state = getStateFromURL(url);\n }\n\n const thenable = {\n then(onfulfilled?: (state: ResultState | undefined) => void) {\n return Promise.resolve(onfulfilled ? onfulfilled(state) : state);\n },\n catch() {\n return thenable;\n },\n };\n\n return thenable as PromiseLike<ResultState | undefined>;\n }, [getStateFromURL, onUnhandledLinking, prefixes]);\n\n useEffect(() => {\n const listener = (url: string) => {\n if (!enabled) {\n return;\n }\n\n const navigation = ref.current;\n const state = navigation ? getStateFromURL(url) : undefined;\n\n if (navigation && state) {\n // If the link were handled, it gets cleared in NavigationContainer\n onUnhandledLinking(extractExpoPathFromURL(prefixes, url));\n const rootState = navigation.getRootState();\n if (state.routes.some((r) => !rootState?.routeNames.includes(r.name))) {\n return;\n }\n\n const action = getActionFromStateRef.current(state, configRef.current);\n\n if (action !== undefined) {\n try {\n navigation.dispatch(action);\n } catch (e) {\n // Ignore any errors from deep linking.\n // This could happen in case of malformed links, navigation object not being initialized etc.\n console.warn(\n `An error occurred when trying to handle the link '${url}': ${\n typeof e === 'object' && e != null && 'message' in e ? e.message : e\n }`\n );\n }\n } else {\n navigation.resetRoot(state);\n }\n }\n };\n\n return subscribe(listener);\n }, [enabled, getStateFromURL, onUnhandledLinking, prefixes, ref, subscribe]);\n\n return {\n getInitialState,\n };\n}\n\nexport function getInitialURLWithTimeout(): string | null | Promise<string | null> {\n if (typeof window === 'undefined') {\n return '';\n } else if (Platform.OS === 'ios') {\n // Use the new Expo API for iOS. This has better support for App Clips and handoff.\n return ExpoLinking.getLinkingURL();\n }\n\n return Promise.race([\n // TODO: Phase this out in favor of expo-linking on Android.\n Linking.getInitialURL(),\n new Promise<null>((resolve) =>\n // Timeout in 150ms if `getInitialState` doesn't resolve\n // Workaround for https://github.com/facebook/react-native/issues/25675\n setTimeout(() => resolve(null), 150)\n ),\n ]);\n}\n"]}
1
+ {"version":3,"file":"useLinking.native.js","sourceRoot":"","sources":["../../src/fork/useLinking.native.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,gCA8LC;AAED,4DAiBC;AArOD,0DAA4C;AAC5C,iCAAuE;AACvE,+CAAiD;AAEjD,6DAA8D;AAC9D,uDAOoC;AAMpC,MAAM,eAAe,GAAa,EAAE,CAAC;AAErC,SAAgB,UAAU,CACxB,GAAqD,EACrD,EACE,OAAO,GAAG,IAAI,EACd,QAAQ,EACR,MAAM,EACN,MAAM,EACN,aAAa,GAAG,GAAG,EAAE,CAAC,wBAAwB,EAAE,EAChD,SAAS,GAAG,CAAC,QAAQ,EAAE,EAAE;IACvB,MAAM,QAAQ,GAAG,CAAC,EAAE,GAAG,EAAmB,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAE7D,MAAM,YAAY,GAAG,sBAAO,CAAC,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAEhD,CAAC;IAEd,2FAA2F;IAC3F,4EAA4E;IAC5E,MAAM,mBAAmB,GAAG,sBAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC,sBAAO,CAAC,CAAC;IAEvE,OAAO,GAAG,EAAE;QACV,2FAA2F;QAC3F,IAAI,YAAY,EAAE,MAAM,EAAE,CAAC;YACzB,YAAY,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,mBAAmB,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACzC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,EACD,gBAAgB,GAAG,yBAAuB,EAC1C,kBAAkB,GAAG,2BAAyB,GACtC,EACV,kBAAqE;IAErE,MAAM,WAAW,GAAG,IAAA,qCAA4B,GAAE,CAAC;IAEnD,IAAA,iBAAS,EAA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OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,EAAE,CAAC;IACZ,CAAC;SAAM,IAAI,uBAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QACjC,mFAAmF;QACnF,OAAO,WAAW,CAAC,aAAa,EAAE,CAAC;IACrC,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC;QAClB,4DAA4D;QAC5D,sBAAO,CAAC,aAAa,EAAE;QACvB,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QAC5B,wDAAwD;QACxD,uEAAuE;QACvE,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CACrC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import * as ExpoLinking from 'expo-linking';\nimport { type RefObject, useEffect, useCallback, useRef } from 'react';\nimport { Linking, Platform } from 'react-native';\n\nimport { extractExpoPathFromURL } from './extractPathFromURL';\nimport {\n type LinkingOptions,\n getActionFromState as getActionFromStateDefault,\n getStateFromPath as getStateFromPathDefault,\n type NavigationContainerRef,\n type ParamListBase,\n useNavigationIndependentTree,\n} from '../react-navigation/native';\n\ntype ResultState = ReturnType<typeof getStateFromPathDefault>;\n\ntype Options = LinkingOptions<ParamListBase>;\n\nconst linkingHandlers: symbol[] = [];\n\nexport function useLinking(\n ref: RefObject<NavigationContainerRef<ParamListBase>>,\n {\n enabled = true,\n prefixes,\n filter,\n config,\n getInitialURL = () => getInitialURLWithTimeout(),\n subscribe = (listener) => {\n const callback = ({ url }: { url: string }) => listener(url);\n\n const subscription = Linking.addEventListener('url', callback) as\n | { remove(): void }\n | undefined;\n\n // Storing this in a local variable stops Jest from complaining about import after teardown\n // @ts-expect-error: removeEventListener is not present in newer RN versions\n const removeEventListener = Linking.removeEventListener?.bind(Linking);\n\n return () => {\n // https://github.com/facebook/react-native/commit/6d1aca806cee86ad76de771ed3a1cc62982ebcd7\n if (subscription?.remove) {\n subscription.remove();\n } else {\n removeEventListener?.('url', callback);\n }\n };\n },\n getStateFromPath = getStateFromPathDefault,\n getActionFromState = getActionFromStateDefault,\n }: Options,\n onUnhandledLinking: (lastUnhandledLining: string | undefined) => void\n) {\n const independent = useNavigationIndependentTree();\n\n useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return undefined;\n }\n\n if (independent) {\n return undefined;\n }\n\n if (enabled !== false && linkingHandlers.length) {\n // TODO(@ubax): This check should be removed\n if (linkingHandlers.length > 1) {\n console.error(\n [\n 'Looks like you have configured linking in multiple places. This is likely an error since deep links should only be handled in one place to avoid conflicts. Make sure that:',\n \"- You don't have multiple NavigationContainers in the app each with 'linking' enabled\",\n '- Only a single instance of the root component is rendered',\n ]\n .join('\\n')\n .trim()\n );\n }\n }\n\n const handler = Symbol();\n\n if (enabled !== false) {\n linkingHandlers.push(handler);\n }\n\n return () => {\n const index = linkingHandlers.indexOf(handler);\n\n if (index > -1) {\n linkingHandlers.splice(index, 1);\n }\n };\n }, [enabled, independent]);\n\n // We store these options in ref to avoid re-creating getInitialState and re-subscribing listeners\n // This lets user avoid wrapping the items in `React.useCallback` or `React.useMemo`\n // Not re-creating `getInitialState` is important coz it makes it easier for the user to use in an effect\n const enabledRef = useRef(enabled);\n const prefixesRef = useRef(prefixes);\n const filterRef = useRef(filter);\n const configRef = useRef(config);\n const getInitialURLRef = useRef(getInitialURL);\n const getStateFromPathRef = useRef(getStateFromPath);\n const getActionFromStateRef = useRef(getActionFromState);\n\n useEffect(() => {\n enabledRef.current = enabled;\n prefixesRef.current = prefixes;\n filterRef.current = filter;\n configRef.current = config;\n getInitialURLRef.current = getInitialURL;\n getStateFromPathRef.current = getStateFromPath;\n getActionFromStateRef.current = getActionFromState;\n });\n\n const getStateFromURL = useCallback(\n (url: string | null | undefined) => {\n if (!url || (filterRef.current && !filterRef.current(url))) {\n return undefined;\n }\n\n const path = extractExpoPathFromURL(prefixesRef.current, url);\n\n return path !== undefined ? getStateFromPathRef.current(path, configRef.current) : undefined;\n },\n\n []\n );\n\n const getInitialState = useCallback(() => {\n let state: ResultState | undefined;\n\n if (enabledRef.current) {\n const url = getInitialURLRef.current();\n\n if (url != null) {\n if (typeof url !== 'string') {\n return url.then((url) => {\n const state = getStateFromURL(url);\n\n if (typeof url === 'string') {\n // If the link were handled, it gets cleared in NavigationContainer\n onUnhandledLinking(extractExpoPathFromURL(prefixes, url));\n }\n\n return state;\n });\n } else {\n onUnhandledLinking(extractExpoPathFromURL(prefixes, url));\n }\n }\n\n state = getStateFromURL(url);\n }\n\n const thenable = {\n then(onfulfilled?: (state: ResultState | undefined) => void) {\n return Promise.resolve(onfulfilled ? onfulfilled(state) : state);\n },\n catch() {\n return thenable;\n },\n };\n\n return thenable as PromiseLike<ResultState | undefined>;\n }, [getStateFromURL, onUnhandledLinking, prefixes]);\n\n useEffect(() => {\n const listener = (url: string) => {\n if (!enabled) {\n return;\n }\n\n const navigation = ref.current;\n const state = navigation ? getStateFromURL(url) : undefined;\n\n if (navigation && state) {\n // If the link were handled, it gets cleared in NavigationContainer\n onUnhandledLinking(extractExpoPathFromURL(prefixes, url));\n const rootState = navigation.getRootState();\n if (state.routes.some((r) => !rootState?.routeNames.includes(r.name))) {\n return;\n }\n\n const action = getActionFromStateRef.current(state, configRef.current);\n\n if (action !== undefined) {\n try {\n navigation.dispatch(action);\n } catch (e) {\n // Ignore any errors from deep linking.\n // This could happen in case of malformed links, navigation object not being initialized etc.\n console.warn(\n `An error occurred when trying to handle the link '${url}': ${\n typeof e === 'object' && e != null && 'message' in e ? e.message : e\n }`\n );\n }\n } else {\n navigation.resetRoot(state);\n }\n }\n };\n\n return subscribe(listener);\n }, [enabled, getStateFromURL, onUnhandledLinking, prefixes, ref, subscribe]);\n\n return {\n getInitialState,\n };\n}\n\nexport function getInitialURLWithTimeout(): string | null | Promise<string | null> {\n if (typeof window === 'undefined') {\n return '';\n } else if (Platform.OS === 'ios') {\n // Use the new Expo API for iOS. This has better support for App Clips and handoff.\n return ExpoLinking.getLinkingURL();\n }\n\n return Promise.race([\n // TODO: Phase this out in favor of expo-linking on Android.\n Linking.getInitialURL(),\n new Promise<null>((resolve) =>\n // Timeout in 150ms if `getInitialState` doesn't resolve\n // Workaround for https://github.com/facebook/react-native/issues/25675\n setTimeout(() => resolve(null), 150)\n ),\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,OAAO,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,SAS9B,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,CA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C,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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,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,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;AAED,SAAS,sBAAsB,CAAC,KAAU;IACxC,IAAI,CAAC;QACH,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACvE,CAAC;IAAC,MAAM,CAAC;QACP,6DAA6D;QAC7D,OAAO,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,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,G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":["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"]}
@@ -1,10 +1,10 @@
1
1
  import type { ComponentType } from 'react';
2
- import { type UrlObject } from './getRouteInfoFromState';
3
- import type { FocusedRouteState, LinkToOptions, ReactNavigationState, StoreRedirects } from './types';
4
2
  import type { RouteNode } from '../Route';
5
3
  import type { ExpoLinkingOptions } from '../getLinkingConfig';
4
+ import { type UrlObject } from './getRouteInfoFromState';
5
+ import type { FocusedRouteState, LinkToOptions, ReactNavigationState, StoreRedirects } from './types';
6
6
  import type { NavigationContainerRefWithCurrent } from '../react-navigation/native';
7
- import type { RequireContext, Href } from '../types';
7
+ import type { Href } from '../types';
8
8
  export type RouterStore = typeof store;
9
9
  type StoreRef = {
10
10
  navigationRef: NavigationContainerRefWithCurrent<ReactNavigation.RootParamList>;
@@ -15,7 +15,6 @@ type StoreRef = {
15
15
  config: any;
16
16
  redirects: StoreRedirects[];
17
17
  routeInfo?: UrlObject;
18
- context?: RequireContext;
19
18
  };
20
19
  export declare const storeRef: {
21
20
  current: StoreRef;
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/global-state/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,KAAK,EACV,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,cAAc,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGrD,MAAM,MAAM,WAAW,GAAG,OAAO,KAAK,CAAC;AAEvC,KAAK,QAAQ,GAAG;IACd,aAAa,EAAE,iCAAiC,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;IAChF,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,MAAM,EAAE,GAAG,CAAC;IACZ,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,QAAQ;aACJ,QAAQ;CACxB,CAAC;AAKF,wBAAgB,6BAA6B,uBAE5C;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,QAEtE;AAED,wBAAgB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wB,KAAK,CAAC;YACzC,IAAI,KAAK,GAAqC,QAAQ,CAAC;YAEvD,OAAO,CAAC,OAAO,IAAI,KAAK,EAAE,CAAC;gBACzB,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC;gBACtB,KAAK;oBACH,KAAK,CAAC,MAAM,EAAE,CACZ,OAAO,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;wBACjD,CAAC,CAAC,KAAK,CAAC,KAAK;wBACb,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAC5B,EAAE,KAAK,CAAC;YACb,CAAC;YACD,IAAI,OAAO,EAAE,CAAC;gBACZ,yIAAyI;gBACzI,OAAO,CAAC,KAAK,CACX,6EAA6E,CAC9E,CAAC;YACJ,CAAC;QACH,CAAC;QAED,gBAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC;QAElC,gBAAQ,CAAC,OAAO,CAAC,SAAS,GAAG,IAAA,mCAAkB,EAAC,QAAQ,CAAC,CAAC;QAE1D,KAAK,MAAM,QAAQ,IAAI,qCAAoB,EAAE,CAAC;YAC5C,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC;IACD,aAAa;QACX,IAAI,CAAC,gBAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CACb,gKAAgK,CACjK,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import type { ComponentType } from 'react';\n\nimport { defaultRouteInfo, type UrlObject } from './getRouteInfoFromState';\nimport { getCachedRouteInfo, routeInfoSubscribers } from './routeInfoCache';\nimport type {\n FocusedRouteState,\n LinkToOptions,\n ReactNavigationState,\n StoreRedirects,\n} from './types';\nimport type { RouteNode } from '../Route';\nimport type { ExpoLinkingOptions } from '../getLinkingConfig';\nimport { resolveHref, resolveHrefStringWithSegments } from '../link/href';\nimport type { NavigationContainerRefWithCurrent } from '../react-navigation/native';\nimport type { RequireContext, Href } from '../types';\nimport * as SplashScreen from '../views/Splash';\n\nexport type RouterStore = typeof store;\n\ntype StoreRef = {\n navigationRef: NavigationContainerRefWithCurrent<ReactNavigation.RootParamList>;\n routeNode: RouteNode | null;\n rootComponent: ComponentType<any>;\n state?: ReactNavigationState;\n linking?: ExpoLinkingOptions;\n config: any;\n redirects: StoreRedirects[];\n routeInfo?: UrlObject;\n context?: RequireContext;\n};\n\nexport const storeRef = {\n current: {} as StoreRef,\n};\n\nlet splashScreenAnimationFrame: number | undefined;\nlet hasAttemptedToHideSplash = false;\n\nexport function getSplashScreenAnimationFrame() {\n return splashScreenAnimationFrame;\n}\n\nexport function setSplashScreenAnimationFrame(value: number | undefined) {\n splashScreenAnimationFrame = value;\n}\n\nexport function setHasAttemptedToHideSplash(value: boolean) {\n hasAttemptedToHideSplash = value;\n}\n\nexport const store = {\n shouldShowTutorial() {\n return !storeRef.current.routeNode && process.env.NODE_ENV === 'development';\n },\n get state() {\n return storeRef.current.state;\n },\n get navigationRef() {\n return storeRef.current.navigationRef;\n },\n get routeNode() {\n return storeRef.current.routeNode;\n },\n getRouteInfo(): UrlObject {\n return storeRef.current.routeInfo || defaultRouteInfo;\n },\n get redirects() {\n return storeRef.current.redirects || [];\n },\n get rootComponent() {\n return storeRef.current.rootComponent;\n },\n getStateForHref(href: Href, options?: LinkToOptions) {\n href = resolveHref(href);\n\n href = resolveHrefStringWithSegments(href, store.getRouteInfo(), options);\n return this.linking?.getStateFromPath!(href, this.linking.config);\n },\n get linking() {\n return storeRef.current.linking;\n },\n setFocusedState(state: FocusedRouteState) {\n const routeInfo = getCachedRouteInfo(state);\n storeRef.current.routeInfo = routeInfo;\n },\n // TODO(@ubax): Refactor onReady logic as it probably should live somewhere else then store\n onReady() {\n if (!hasAttemptedToHideSplash) {\n setHasAttemptedToHideSplash(true);\n // NOTE(EvanBacon): `navigationRef.isReady` is sometimes not true when state is called initially.\n setSplashScreenAnimationFrame(\n requestAnimationFrame(() => {\n SplashScreen._internal_maybeHideAsync?.();\n })\n );\n }\n },\n onStateChange(newState: ReactNavigationState | undefined) {\n if (!newState) {\n return;\n }\n if (process.env.NODE_ENV === 'development') {\n let isStale: boolean | undefined = false;\n let state: ReactNavigationState | undefined = newState;\n\n while (!isStale && state) {\n isStale = state.stale;\n state =\n state.routes?.[\n 'index' in state && typeof state.index === 'number'\n ? state.index\n : state.routes.length - 1\n ]?.state;\n }\n if (isStale) {\n // This should never happen, as onStateChange should provide a full state. However, adding this check to catch any undocumented behavior.\n console.error(\n 'Detected stale state in onStateChange. This is likely a bug in Expo Router.'\n );\n }\n }\n\n storeRef.current.state = newState;\n\n storeRef.current.routeInfo = getCachedRouteInfo(newState);\n\n for (const callback of routeInfoSubscribers) {\n callback();\n }\n },\n assertIsReady() {\n if (!storeRef.current.navigationRef.isReady()) {\n throw new Error(\n 'Attempted to navigate before mounting the Root Layout component. Ensure the Root Layout component is rendering a Slot, or other navigator on the first render.'\n );\n }\n },\n};\n"]}
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/global-state/store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,sEAEC;AAED,sEAEC;AAED,kEAEC;AA3CD,mEAA2E;AAC3E,qDAA4E;AAO5E,uCAA0E;AAG1E,8DAAgD;AAenC,QAAA,QAAQ,GAAG;IACtB,OAAO,EAAE,EAAc;CACxB,CAAC;AAEF,IAAI,0BAA8C,CAAC;AACnD,IAAI,wBAAwB,GAAG,KAAK,CAAC;AAErC,SAAgB,6BAA6B;IAC3C,OAAO,0BAA0B,CAAC;AACpC,CAAC;AAED,SAAgB,6BAA6B,CAAC,KAAyB;IACrE,0BAA0B,GAAG,KAAK,CAAC;AACrC,CAAC;AAED,SAAgB,2BAA2B,CAAC,KAAc;IACxD,wBAAwB,GAAG,KAAK,CAAC;AACnC,CAAC;AAEY,QAAA,KAAK,GAAG;IACnB,kBAAkB;QAChB,OAA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jK,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC","sourcesContent":["import type { ComponentType } from 'react';\n\nimport type { RouteNode } from '../Route';\nimport type { ExpoLinkingOptions } from '../getLinkingConfig';\nimport { defaultRouteInfo, type UrlObject } from './getRouteInfoFromState';\nimport { getCachedRouteInfo, routeInfoSubscribers } from './routeInfoCache';\nimport type {\n FocusedRouteState,\n LinkToOptions,\n ReactNavigationState,\n StoreRedirects,\n} from './types';\nimport { resolveHref, resolveHrefStringWithSegments } from '../link/href';\nimport type { NavigationContainerRefWithCurrent } from '../react-navigation/native';\nimport type { Href } from '../types';\nimport * as SplashScreen from '../views/Splash';\n\nexport type RouterStore = typeof store;\n\ntype StoreRef = {\n navigationRef: NavigationContainerRefWithCurrent<ReactNavigation.RootParamList>;\n routeNode: RouteNode | null;\n rootComponent: ComponentType<any>;\n state?: ReactNavigationState;\n linking?: ExpoLinkingOptions;\n config: any;\n redirects: StoreRedirects[];\n routeInfo?: UrlObject;\n};\n\nexport const storeRef = {\n current: {} as StoreRef,\n};\n\nlet splashScreenAnimationFrame: number | undefined;\nlet hasAttemptedToHideSplash = false;\n\nexport function getSplashScreenAnimationFrame() {\n return splashScreenAnimationFrame;\n}\n\nexport function setSplashScreenAnimationFrame(value: number | undefined) {\n splashScreenAnimationFrame = value;\n}\n\nexport function setHasAttemptedToHideSplash(value: boolean) {\n hasAttemptedToHideSplash = value;\n}\n\nexport const store = {\n shouldShowTutorial() {\n return !storeRef.current.routeNode && process.env.NODE_ENV === 'development';\n },\n get state() {\n return storeRef.current.state;\n },\n get navigationRef() {\n return storeRef.current.navigationRef;\n },\n get routeNode() {\n return storeRef.current.routeNode;\n },\n getRouteInfo(): UrlObject {\n return storeRef.current.routeInfo || defaultRouteInfo;\n },\n get redirects() {\n return storeRef.current.redirects || [];\n },\n get rootComponent() {\n return storeRef.current.rootComponent;\n },\n getStateForHref(href: Href, options?: LinkToOptions) {\n href = resolveHref(href);\n\n href = resolveHrefStringWithSegments(href, store.getRouteInfo(), options);\n return this.linking?.getStateFromPath!(href, this.linking.config);\n },\n get linking() {\n return storeRef.current.linking;\n },\n setFocusedState(state: FocusedRouteState) {\n const routeInfo = getCachedRouteInfo(state);\n storeRef.current.routeInfo = routeInfo;\n },\n // TODO(@ubax): Refactor onReady logic as it probably should live somewhere else then store\n onReady() {\n if (!hasAttemptedToHideSplash) {\n setHasAttemptedToHideSplash(true);\n // NOTE(EvanBacon): `navigationRef.isReady` is sometimes not true when state is called initially.\n setSplashScreenAnimationFrame(\n requestAnimationFrame(() => {\n SplashScreen._internal_maybeHideAsync?.();\n })\n );\n }\n },\n onStateChange(newState: ReactNavigationState | undefined) {\n if (!newState) {\n return;\n }\n if (process.env.NODE_ENV === 'development') {\n let isStale: boolean | undefined = false;\n let state: ReactNavigationState | undefined = newState;\n\n while (!isStale && state) {\n isStale = state.stale;\n state =\n state.routes?.[\n 'index' in state && typeof state.index === 'number'\n ? state.index\n : state.routes.length - 1\n ]?.state;\n }\n if (isStale) {\n // This should never happen, as onStateChange should provide a full state. However, adding this check to catch any undocumented behavior.\n console.error(\n 'Detected stale state in onStateChange. This is likely a bug in Expo Router.'\n );\n }\n }\n\n storeRef.current.state = newState;\n\n storeRef.current.routeInfo = getCachedRouteInfo(newState);\n\n for (const callback of routeInfoSubscribers) {\n callback();\n }\n },\n assertIsReady() {\n if (!storeRef.current.navigationRef.isReady()) {\n throw new Error(\n 'Attempted to navigate before mounting the Root Layout component. Ensure the Root Layout component is rendering a Slot, or other navigator on the first render.'\n );\n }\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useStore.d.ts","sourceRoot":"","sources":["../../src/global-state/useStore.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAY3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAKpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI/C,wBAAgB,QAAQ,CACtB,OAAO,EAAE,cAAc,EACvB,oBAAoB,EAAE,oBAAoB,EAC1C,SAAS,CAAC,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgGnB"}
1
+ {"version":3,"file":"useStore.d.ts","sourceRoot":"","sources":["../../src/global-state/useStore.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAY3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAKpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI/C,wBAAgB,QAAQ,CACtB,OAAO,EAAE,cAAc,EACvB,oBAAoB,EAAE,oBAAoB,EAC1C,SAAS,CAAC,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2FnB"}
@@ -75,9 +75,6 @@ function useStore(context, linkingConfigOptions, serverUrl) {
75
75
  // In development, we will show the onboarding screen
76
76
  rootComponent = react_1.Fragment;
77
77
  }
78
- if (react_native_1.Platform.OS === 'android' && store_1.storeRef.current.state && store_1.storeRef.current.context === context) {
79
- initialState = store_1.storeRef.current.state;
80
- }
81
78
  store_1.storeRef.current = {
82
79
  navigationRef,
83
80
  routeNode,
@@ -86,7 +83,6 @@ function useStore(context, linkingConfigOptions, serverUrl) {
86
83
  linking,
87
84
  redirects,
88
85
  state: initialState,
89
- context,
90
86
  };
91
87
  if (initialState) {
92
88
  store_1.storeRef.current.routeInfo = (0, routeInfoCache_1.getCachedRouteInfo)(initialState);
@@ -1 +1 @@
1
- {"version":3,"file":"useStore.js","sourceRoot":"","sources":["../../src/global-state/useStore.ts"],"names":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OAAO,KAAK,OAAO,EAAE,CAAC;QAChG,YAAY,GAAG,gBAAQ,CAAC,OAAO,CAAC,KAAK,CAAC;IACxC,CAAC;IAED,gBAAQ,CAAC,OAAO,GAAG;QACjB,aAAa;QACb,SAAS;QACT,MAAM;QACN,aAAa;QACb,OAAO;QACP,SAAS;QACT,KAAK,EAAE,YAAY;QACnB,OAAO;KACR,CAAC;IAEF,IAAI,YAAY,EAAE,CAAC;QACjB,gBAAQ,CAAC,OAAO,CAAC,SAAS,GAAG,IAAA,mCAAkB,EAAC,YAAY,CAAC,CAAC;IAChE,CAAC;IAED,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,OAAO,GAAG,EAAE;YACV,cAAc;YAEd,MAAM,cAAc,GAAG,IAAA,qCAA6B,GAAE,CAAC;YACvD,IAAI,cAAc,EAAE,CAAC;gBACnB,oBAAoB,CAAC,cAAc,CAAC,CAAC;gBACrC,IAAA,qCAA6B,EAAC,SAAS,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,aAAK,CAAC;AACf,CAAC","sourcesContent":["'use client';\n\nimport Constants from 'expo-constants';\nimport type { ComponentType } from 'react';\nimport { Fragment, useEffect } from 'react';\nimport { Platform } from 'react-native';\n\nimport { getRouteInfoFromState } from './getRouteInfoFromState';\nimport { getCachedRouteInfo, setCachedRouteInfo } from './routeInfoCache';\nimport {\n store,\n storeRef,\n getSplashScreenAnimationFrame,\n setSplashScreenAnimationFrame,\n} from './store';\nimport type { ReactNavigationState, StoreRedirects } from './types';\nimport { extractExpoPathFromURL } from '../fork/extractPathFromURL';\nimport { routePatternToRegex } from '../fork/getStateFromPath-forks';\nimport type { ExpoLinkingOptions, LinkingConfigOptions } from '../getLinkingConfig';\nimport { getLinkingConfig } from '../getLinkingConfig';\nimport { parseRouteSegments } from '../getReactNavigationConfig';\nimport { getRoutes } from '../getRoutes';\nimport { useNavigationContainerRef } from '../react-navigation/native';\nimport type { RequireContext } from '../types';\nimport { getQualifiedRouteComponent } from '../useScreens';\nimport { shouldLinkExternally } from '../utils/url';\n\nexport function useStore(\n context: RequireContext,\n linkingConfigOptions: LinkingConfigOptions,\n serverUrl?: string\n) {\n const navigationRef = useNavigationContainerRef();\n const config = Constants.expoConfig?.extra?.router;\n\n let linking: ExpoLinkingOptions | undefined;\n let rootComponent: ComponentType<any> = Fragment;\n let initialState: ReactNavigationState | undefined;\n\n const routeNode = getRoutes(context, {\n ...config,\n skipGenerated: true,\n ignoreEntryPoints: true,\n platform: Platform.OS,\n preserveRedirectAndRewrites: true,\n });\n\n const redirects: StoreRedirects[] = [config?.redirects, config?.rewrites]\n .filter(Boolean)\n .flat()\n .map((route) => {\n return [\n routePatternToRegex(parseRouteSegments(route.source)),\n route,\n shouldLinkExternally(route.destination),\n ];\n });\n\n if (routeNode) {\n // We have routes, so get the linking config and the root component\n linking = getLinkingConfig(routeNode, context, () => store.getRouteInfo(), {\n metaOnly: linkingConfigOptions.metaOnly,\n serverUrl,\n redirects,\n skipGenerated: config?.skipGenerated ?? false,\n sitemap: config?.sitemap ?? true,\n notFound: config?.notFound ?? true,\n });\n rootComponent = getQualifiedRouteComponent(routeNode);\n\n // By default React Navigation is async and does not render anything in the first pass as it waits for `getInitialURL`\n // This will cause static rendering to fail, which once performs a single pass.\n // If the initialURL is a string, we can prefetch the state and routeInfo, skipping React Navigation's async behavior.\n const initialURL = linking?.getInitialURL?.();\n if (typeof initialURL === 'string') {\n let initialPath = extractExpoPathFromURL(linking.prefixes, initialURL);\n\n // It does not matter if the path starts with a `/` or not, but this keeps the behavior consistent\n if (!initialPath.startsWith('/')) initialPath = '/' + initialPath;\n\n initialState = linking.getStateFromPath(initialPath, linking.config);\n const initialRouteInfo = getRouteInfoFromState(initialState);\n setCachedRouteInfo(initialState as any, initialRouteInfo);\n }\n } else {\n // Only error in production, in development we will show the onboarding screen\n if (process.env.NODE_ENV === 'production') {\n throw new Error('No routes found');\n }\n\n // In development, we will show the onboarding screen\n rootComponent = Fragment;\n }\n\n if (Platform.OS === 'android' && storeRef.current.state && storeRef.current.context === context) {\n initialState = storeRef.current.state;\n }\n\n storeRef.current = {\n navigationRef,\n routeNode,\n config,\n rootComponent,\n linking,\n redirects,\n state: initialState,\n context,\n };\n\n if (initialState) {\n storeRef.current.routeInfo = getCachedRouteInfo(initialState);\n }\n\n useEffect(() => {\n return () => {\n // listener();\n\n const animationFrame = getSplashScreenAnimationFrame();\n if (animationFrame) {\n cancelAnimationFrame(animationFrame);\n setSplashScreenAnimationFrame(undefined);\n }\n };\n });\n\n return store;\n}\n"]}
1
+ {"version":3,"file":"useStore.js","sourceRoot":"","sources":["../../src/global-state/useStore.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;AA2Bb,4BA8FC;AAvHD,oEAAuC;AAEvC,iCAA4C;AAC5C,+CAAwC;AAExC,mEAAgE;AAChE,qDAA0E;AAC1E,mCAKiB;AAEjB,mEAAoE;AACpE,2EAAqE;AAErE,0DAAuD;AACvD,0EAAiE;AACjE,4CAAyC;AACzC,uDAAuE;AAEvE,8CAA2D;AAC3D,sCAAoD;AAEpD,SAAgB,QAAQ,CACtB,OAAuB,EACvB,oBAA0C,EAC1C,SAAkB;IAElB,MAAM,aAAa,GAAG,IAAA,kCAAyB,GAAE,CAAC;IAClD,MAAM,MAAM,GAAG,wBAAS,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC;IAEnD,IAAI,OAAuC,CAAC;IAC5C,IAAI,aAAa,GAAuB,gBAAQ,CAAC;IACjD,IAAI,YAA8C,CAAC;IAEnD,MAAM,SAAS,GAAG,IAAA,qBAAS,EAAC,OAAO,EAAE;QACnC,GAAG,MAAM;QACT,aAAa,EAAE,IAAI;QACnB,iBAAiB,EAAE,IAAI;QACvB,QAAQ,EAAE,uBAAQ,CAAC,EAAE;QACrB,2BAA2B,EAAE,IAAI;KAClC,CAAC,CAAC;IAEH,MAAM,SAAS,GAAqB,CAAC,MAAM,EAAE,SAA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C,YAAY,CAAC,CAAC;YAC7D,IAAA,mCAAkB,EAAC,YAAmB,EAAE,gBAAgB,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;SAAM,CAAC;QACN,8EAA8E;QAC9E,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACrC,CAAC;QAED,qDAAqD;QACrD,aAAa,GAAG,gBAAQ,CAAC;IAC3B,CAAC;IAED,gBAAQ,CAAC,OAAO,GAAG;QACjB,aAAa;QACb,SAAS;QACT,MAAM;QACN,aAAa;QACb,OAAO;QACP,SAAS;QACT,KAAK,EAAE,YAAY;KACpB,CAAC;IAEF,IAAI,YAAY,EAAE,CAAC;QACjB,gBAAQ,CAAC,OAAO,CAAC,SAAS,GAAG,IAAA,mCAAkB,EAAC,YAAY,CAAC,CAAC;IAChE,CAAC;IAED,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,OAAO,GAAG,EAAE;YACV,cAAc;YAEd,MAAM,cAAc,GAAG,IAAA,qCAA6B,GAAE,CAAC;YACvD,IAAI,cAAc,EAAE,CAAC;gBACnB,oBAAoB,CAAC,cAAc,CAAC,CAAC;gBACrC,IAAA,qCAA6B,EAAC,SAAS,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,aAAK,CAAC;AACf,CAAC","sourcesContent":["'use client';\n\nimport Constants from 'expo-constants';\nimport type { ComponentType } from 'react';\nimport { Fragment, useEffect } from 'react';\nimport { Platform } from 'react-native';\n\nimport { getRouteInfoFromState } from './getRouteInfoFromState';\nimport { getCachedRouteInfo, setCachedRouteInfo } from './routeInfoCache';\nimport {\n store,\n storeRef,\n getSplashScreenAnimationFrame,\n setSplashScreenAnimationFrame,\n} from './store';\nimport type { ReactNavigationState, StoreRedirects } from './types';\nimport { extractExpoPathFromURL } from '../fork/extractPathFromURL';\nimport { routePatternToRegex } from '../fork/getStateFromPath-forks';\nimport type { ExpoLinkingOptions, LinkingConfigOptions } from '../getLinkingConfig';\nimport { getLinkingConfig } from '../getLinkingConfig';\nimport { parseRouteSegments } from '../getReactNavigationConfig';\nimport { getRoutes } from '../getRoutes';\nimport { useNavigationContainerRef } from '../react-navigation/native';\nimport type { RequireContext } from '../types';\nimport { getQualifiedRouteComponent } from '../useScreens';\nimport { shouldLinkExternally } from '../utils/url';\n\nexport function useStore(\n context: RequireContext,\n linkingConfigOptions: LinkingConfigOptions,\n serverUrl?: string\n) {\n const navigationRef = useNavigationContainerRef();\n const config = Constants.expoConfig?.extra?.router;\n\n let linking: ExpoLinkingOptions | undefined;\n let rootComponent: ComponentType<any> = Fragment;\n let initialState: ReactNavigationState | undefined;\n\n const routeNode = getRoutes(context, {\n ...config,\n skipGenerated: true,\n ignoreEntryPoints: true,\n platform: Platform.OS,\n preserveRedirectAndRewrites: true,\n });\n\n const redirects: StoreRedirects[] = [config?.redirects, config?.rewrites]\n .filter(Boolean)\n .flat()\n .map((route) => {\n return [\n routePatternToRegex(parseRouteSegments(route.source)),\n route,\n shouldLinkExternally(route.destination),\n ];\n });\n\n if (routeNode) {\n // We have routes, so get the linking config and the root component\n linking = getLinkingConfig(routeNode, context, () => store.getRouteInfo(), {\n metaOnly: linkingConfigOptions.metaOnly,\n serverUrl,\n redirects,\n skipGenerated: config?.skipGenerated ?? false,\n sitemap: config?.sitemap ?? true,\n notFound: config?.notFound ?? true,\n });\n rootComponent = getQualifiedRouteComponent(routeNode);\n\n // By default React Navigation is async and does not render anything in the first pass as it waits for `getInitialURL`\n // This will cause static rendering to fail, which once performs a single pass.\n // If the initialURL is a string, we can prefetch the state and routeInfo, skipping React Navigation's async behavior.\n const initialURL = linking?.getInitialURL?.();\n if (typeof initialURL === 'string') {\n let initialPath = extractExpoPathFromURL(linking.prefixes, initialURL);\n\n // It does not matter if the path starts with a `/` or not, but this keeps the behavior consistent\n if (!initialPath.startsWith('/')) initialPath = '/' + initialPath;\n\n initialState = linking.getStateFromPath(initialPath, linking.config);\n const initialRouteInfo = getRouteInfoFromState(initialState);\n setCachedRouteInfo(initialState as any, initialRouteInfo);\n }\n } else {\n // Only error in production, in development we will show the onboarding screen\n if (process.env.NODE_ENV === 'production') {\n throw new Error('No routes found');\n }\n\n // In development, we will show the onboarding screen\n rootComponent = Fragment;\n }\n\n storeRef.current = {\n navigationRef,\n routeNode,\n config,\n rootComponent,\n linking,\n redirects,\n state: initialState,\n };\n\n if (initialState) {\n storeRef.current.routeInfo = getCachedRouteInfo(initialState);\n }\n\n useEffect(() => {\n return () => {\n // listener();\n\n const animationFrame = getSplashScreenAnimationFrame();\n if (animationFrame) {\n cancelAnimationFrame(animationFrame);\n setSplashScreenAnimationFrame(undefined);\n }\n };\n });\n\n return store;\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.t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AC,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,QAAQ,EACR,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,MAAM,EACN,kBAAkB,GACnB,EAAE,qBAAqB,EACxB,SAAS,GAAE,OAAe,oBAyD3B;AAyBD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,KAAK,IAAI,YAAY,CAAC,qBAAqB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAoBjE"}
@@ -72,7 +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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AAE,CAAC;QACjB,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC;IACrB,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;YACxB,OAAO,CAAC,kBAAkB,GAAG,yBAAU,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAgB,kBAAkB,CAChC,KAAgB,EAChB,UAAmB;IAEnB,IAAI,IAAA,wBAAa,EAAC,KAAK,EAAE,wBAAgB,CAAC,EAAE,CAAC;QAC3C,IAAI,MAAM,IAAI,KAAK,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CACb,uDAAuD,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmC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AI,MAAM,IAAI,KAAK,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CACb,uDAAuD,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 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"]}