expo-router 55.0.0-preview.9 → 55.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/android/build.gradle +2 -2
  2. package/build/fork/native-stack/composition-options/CompositionOptionsContext.d.ts +38 -0
  3. package/build/fork/native-stack/composition-options/CompositionOptionsContext.d.ts.map +1 -0
  4. package/build/fork/native-stack/composition-options/CompositionOptionsContext.js +75 -0
  5. package/build/fork/native-stack/composition-options/CompositionOptionsContext.js.map +1 -0
  6. package/build/fork/native-stack/composition-options/index.d.ts +4 -0
  7. package/build/fork/native-stack/composition-options/index.d.ts.map +1 -0
  8. package/build/fork/native-stack/composition-options/index.js +10 -0
  9. package/build/fork/native-stack/composition-options/index.js.map +1 -0
  10. package/build/fork/native-stack/composition-options/mergeOptions.d.ts +13 -0
  11. package/build/fork/native-stack/composition-options/mergeOptions.d.ts.map +1 -0
  12. package/build/fork/native-stack/composition-options/mergeOptions.js +39 -0
  13. package/build/fork/native-stack/composition-options/mergeOptions.js.map +1 -0
  14. package/build/fork/native-stack/composition-options/types.d.ts +25 -0
  15. package/build/fork/native-stack/composition-options/types.d.ts.map +1 -0
  16. package/build/fork/native-stack/composition-options/types.js +3 -0
  17. package/build/fork/native-stack/composition-options/types.js.map +1 -0
  18. package/build/fork/native-stack/createNativeStackNavigator.d.ts.map +1 -1
  19. package/build/fork/native-stack/createNativeStackNavigator.js +7 -2
  20. package/build/fork/native-stack/createNativeStackNavigator.js.map +1 -1
  21. package/build/layouts/ExperimentalModalStack.d.ts +2 -2
  22. package/build/layouts/ExperimentalModalStack.d.ts.map +1 -1
  23. package/build/layouts/ExperimentalModalStack.js +6 -4
  24. package/build/layouts/ExperimentalModalStack.js.map +1 -1
  25. package/build/layouts/StackClient.d.ts +2 -2
  26. package/build/layouts/StackClient.d.ts.map +1 -1
  27. package/build/layouts/StackClient.js +1 -35
  28. package/build/layouts/StackClient.js.map +1 -1
  29. package/build/layouts/stack-utils/StackHeaderComponent.d.ts +4 -1
  30. package/build/layouts/stack-utils/StackHeaderComponent.d.ts.map +1 -1
  31. package/build/layouts/stack-utils/StackHeaderComponent.js +10 -6
  32. package/build/layouts/stack-utils/StackHeaderComponent.js.map +1 -1
  33. package/build/layouts/stack-utils/StackScreen.d.ts.map +1 -1
  34. package/build/layouts/stack-utils/StackScreen.js +3 -10
  35. package/build/layouts/stack-utils/StackScreen.js.map +1 -1
  36. package/build/layouts/stack-utils/StackSearchBar.d.ts +1 -1
  37. package/build/layouts/stack-utils/StackSearchBar.d.ts.map +1 -1
  38. package/build/layouts/stack-utils/StackSearchBar.js +59 -4
  39. package/build/layouts/stack-utils/StackSearchBar.js.map +1 -1
  40. package/build/layouts/stack-utils/index.d.ts +1 -0
  41. package/build/layouts/stack-utils/index.d.ts.map +1 -1
  42. package/build/layouts/stack-utils/index.js +3 -1
  43. package/build/layouts/stack-utils/index.js.map +1 -1
  44. package/build/layouts/stack-utils/mapProtectedScreen.d.ts +3 -0
  45. package/build/layouts/stack-utils/mapProtectedScreen.d.ts.map +1 -0
  46. package/build/layouts/stack-utils/mapProtectedScreen.js +76 -0
  47. package/build/layouts/stack-utils/mapProtectedScreen.js.map +1 -0
  48. package/build/layouts/stack-utils/screen/StackScreenBackButton.d.ts +4 -1
  49. package/build/layouts/stack-utils/screen/StackScreenBackButton.d.ts.map +1 -1
  50. package/build/layouts/stack-utils/screen/StackScreenBackButton.js +10 -4
  51. package/build/layouts/stack-utils/screen/StackScreenBackButton.js.map +1 -1
  52. package/build/layouts/stack-utils/screen/StackScreenTitle.d.ts +4 -1
  53. package/build/layouts/stack-utils/screen/StackScreenTitle.d.ts.map +1 -1
  54. package/build/layouts/stack-utils/screen/StackScreenTitle.js +10 -4
  55. package/build/layouts/stack-utils/screen/StackScreenTitle.js.map +1 -1
  56. package/build/layouts/stack-utils/toolbar/StackToolbarClient.d.ts +4 -1
  57. package/build/layouts/stack-utils/toolbar/StackToolbarClient.d.ts.map +1 -1
  58. package/build/layouts/stack-utils/toolbar/StackToolbarClient.js +10 -17
  59. package/build/layouts/stack-utils/toolbar/StackToolbarClient.js.map +1 -1
  60. package/build/link/preview/HrefPreview.d.ts.map +1 -1
  61. package/build/link/preview/HrefPreview.js +7 -4
  62. package/build/link/preview/HrefPreview.js.map +1 -1
  63. package/expo-module.config.json +1 -1
  64. package/ios/LinkPreview/LinkPreviewNativeNavigation.swift +5 -5
  65. package/local-maven-repo/expo/modules/router/expo.modules.router/{55.0.0-preview.9/expo.modules.router-55.0.0-preview.9.module → 55.0.0/expo.modules.router-55.0.0.module} +7 -7
  66. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0/expo.modules.router-55.0.0.module.md5 +1 -0
  67. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0/expo.modules.router-55.0.0.module.sha1 +1 -0
  68. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0/expo.modules.router-55.0.0.module.sha256 +1 -0
  69. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0/expo.modules.router-55.0.0.module.sha512 +1 -0
  70. package/local-maven-repo/expo/modules/router/expo.modules.router/{55.0.0-preview.9/expo.modules.router-55.0.0-preview.9.pom → 55.0.0/expo.modules.router-55.0.0.pom} +1 -1
  71. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0/expo.modules.router-55.0.0.pom.md5 +1 -0
  72. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0/expo.modules.router-55.0.0.pom.sha1 +1 -0
  73. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0/expo.modules.router-55.0.0.pom.sha256 +1 -0
  74. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0/expo.modules.router-55.0.0.pom.sha512 +1 -0
  75. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml +4 -4
  76. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.md5 +1 -1
  77. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha1 +1 -1
  78. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha256 +1 -1
  79. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha512 +1 -1
  80. package/package.json +10 -9
  81. package/plugin/tsconfig.tsbuildinfo +1 -0
  82. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0-preview.9/expo.modules.router-55.0.0-preview.9.module.md5 +0 -1
  83. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0-preview.9/expo.modules.router-55.0.0-preview.9.module.sha1 +0 -1
  84. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0-preview.9/expo.modules.router-55.0.0-preview.9.module.sha256 +0 -1
  85. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0-preview.9/expo.modules.router-55.0.0-preview.9.module.sha512 +0 -1
  86. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0-preview.9/expo.modules.router-55.0.0-preview.9.pom.md5 +0 -1
  87. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0-preview.9/expo.modules.router-55.0.0-preview.9.pom.sha1 +0 -1
  88. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0-preview.9/expo.modules.router-55.0.0-preview.9.pom.sha256 +0 -1
  89. package/local-maven-repo/expo/modules/router/expo.modules.router/55.0.0-preview.9/expo.modules.router-55.0.0-preview.9.pom.sha512 +0 -1
  90. /package/local-maven-repo/expo/modules/router/expo.modules.router/{55.0.0-preview.9/expo.modules.router-55.0.0-preview.9-sources.jar → 55.0.0/expo.modules.router-55.0.0-sources.jar} +0 -0
  91. /package/local-maven-repo/expo/modules/router/expo.modules.router/{55.0.0-preview.9/expo.modules.router-55.0.0-preview.9-sources.jar.md5 → 55.0.0/expo.modules.router-55.0.0-sources.jar.md5} +0 -0
  92. /package/local-maven-repo/expo/modules/router/expo.modules.router/{55.0.0-preview.9/expo.modules.router-55.0.0-preview.9-sources.jar.sha1 → 55.0.0/expo.modules.router-55.0.0-sources.jar.sha1} +0 -0
  93. /package/local-maven-repo/expo/modules/router/expo.modules.router/{55.0.0-preview.9/expo.modules.router-55.0.0-preview.9-sources.jar.sha256 → 55.0.0/expo.modules.router-55.0.0-sources.jar.sha256} +0 -0
  94. /package/local-maven-repo/expo/modules/router/expo.modules.router/{55.0.0-preview.9/expo.modules.router-55.0.0-preview.9-sources.jar.sha512 → 55.0.0/expo.modules.router-55.0.0-sources.jar.sha512} +0 -0
  95. /package/local-maven-repo/expo/modules/router/expo.modules.router/{55.0.0-preview.9/expo.modules.router-55.0.0-preview.9.aar → 55.0.0/expo.modules.router-55.0.0.aar} +0 -0
  96. /package/local-maven-repo/expo/modules/router/expo.modules.router/{55.0.0-preview.9/expo.modules.router-55.0.0-preview.9.aar.md5 → 55.0.0/expo.modules.router-55.0.0.aar.md5} +0 -0
  97. /package/local-maven-repo/expo/modules/router/expo.modules.router/{55.0.0-preview.9/expo.modules.router-55.0.0-preview.9.aar.sha1 → 55.0.0/expo.modules.router-55.0.0.aar.sha1} +0 -0
  98. /package/local-maven-repo/expo/modules/router/expo.modules.router/{55.0.0-preview.9/expo.modules.router-55.0.0-preview.9.aar.sha256 → 55.0.0/expo.modules.router-55.0.0.aar.sha256} +0 -0
  99. /package/local-maven-repo/expo/modules/router/expo.modules.router/{55.0.0-preview.9/expo.modules.router-55.0.0-preview.9.aar.sha512 → 55.0.0/expo.modules.router-55.0.0.aar.sha512} +0 -0
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'expo.modules.router'
7
- version = '55.0.0-preview.9'
7
+ version = '55.0.0'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.router"
11
11
  defaultConfig {
12
12
  versionCode 1
13
- versionName "55.0.0-preview.9"
13
+ versionName "55.0.0"
14
14
  }
15
15
  lintOptions {
16
16
  abortOnError false
@@ -0,0 +1,38 @@
1
+ import type { NativeStackNavigationOptions } from '@react-navigation/native-stack';
2
+ import type { CompositionContextValue, CompositionRegistry } from './types';
3
+ /** @internal */
4
+ export declare const CompositionContext: import("react").Context<CompositionContextValue | null>;
5
+ type RegistryAction = {
6
+ type: 'set';
7
+ routeKey: string;
8
+ options: Partial<NativeStackNavigationOptions>;
9
+ } | {
10
+ type: 'unset';
11
+ routeKey: string;
12
+ options: Partial<NativeStackNavigationOptions>;
13
+ };
14
+ /** @internal */
15
+ export declare function registryReducer(state: CompositionRegistry, action: RegistryAction): CompositionRegistry;
16
+ /**
17
+ * Provides the composition registry to descendant composition components.
18
+ *
19
+ * Uses useReducer with immutable object updates for React Compiler compatibility.
20
+ * Each set/unset call produces a new object reference, which the compiler can
21
+ * track as a reactive dependency.
22
+ */
23
+ export declare function useCompositionRegistry(): {
24
+ registry: CompositionRegistry;
25
+ contextValue: {
26
+ set: (routeKey: string, options: Partial<NativeStackNavigationOptions>) => void;
27
+ unset: (routeKey: string, options: Partial<NativeStackNavigationOptions>) => void;
28
+ };
29
+ };
30
+ /**
31
+ * Hook used by composition components to register their options in the composition registry.
32
+ *
33
+ * Registers options on mount/update via useSafeLayoutEffect, and unregisters on unmount.
34
+ * Callers should memoize the options object to avoid unnecessary re-registrations.
35
+ */
36
+ export declare function useCompositionOption(options: Partial<NativeStackNavigationOptions>): void;
37
+ export {};
38
+ //# sourceMappingURL=CompositionOptionsContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompositionOptionsContext.d.ts","sourceRoot":"","sources":["../../../../src/fork/native-stack/composition-options/CompositionOptionsContext.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAGnF,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAG5E,gBAAgB;AAChB,eAAO,MAAM,kBAAkB,yDAAsD,CAAC;AAEtF,KAAK,cAAc,GACf;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC,4BAA4B,CAAC,CAAC;CAChD,GACD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC,4BAA4B,CAAC,CAAA;CAAE,CAAC;AAExF,gBAAgB;AAChB,wBAAgB,eAAe,CAC7B,KAAK,EAAE,mBAAmB,EAC1B,MAAM,EAAE,cAAc,GACrB,mBAAmB,CAuBrB;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB;;;wBAGD,MAAM,WAAW,OAAO,CAAC,4BAA4B,CAAC;0BAIpD,MAAM,WAAW,OAAO,CAAC,4BAA4B,CAAC;;EAS5F;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,4BAA4B,CAAC,QAiBlF"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CompositionContext = void 0;
5
+ exports.registryReducer = registryReducer;
6
+ exports.useCompositionRegistry = useCompositionRegistry;
7
+ exports.useCompositionOption = useCompositionOption;
8
+ const native_1 = require("@react-navigation/native");
9
+ const react_1 = require("react");
10
+ const useSafeLayoutEffect_1 = require("../../../views/useSafeLayoutEffect");
11
+ /** @internal */
12
+ exports.CompositionContext = (0, react_1.createContext)(null);
13
+ /** @internal */
14
+ function registryReducer(state, action) {
15
+ if (action.type === 'set') {
16
+ const { routeKey, options } = action;
17
+ if (state[routeKey]?.includes(options)) {
18
+ return state;
19
+ }
20
+ return { ...state, [routeKey]: [...(state[routeKey] ?? []), options] };
21
+ }
22
+ if (action.type === 'unset') {
23
+ const { routeKey, options } = action;
24
+ const existing = state[routeKey];
25
+ const filtered = existing?.filter((o) => o !== options);
26
+ if (!existing || filtered?.length === existing.length) {
27
+ return state;
28
+ }
29
+ if (filtered.length === 0) {
30
+ const { [routeKey]: _, ...newState } = state;
31
+ return newState;
32
+ }
33
+ return { ...state, [routeKey]: filtered };
34
+ }
35
+ return state;
36
+ }
37
+ /**
38
+ * Provides the composition registry to descendant composition components.
39
+ *
40
+ * Uses useReducer with immutable object updates for React Compiler compatibility.
41
+ * Each set/unset call produces a new object reference, which the compiler can
42
+ * track as a reactive dependency.
43
+ */
44
+ function useCompositionRegistry() {
45
+ const [registry, dispatch] = (0, react_1.useReducer)(registryReducer, {});
46
+ const set = (0, react_1.useCallback)((routeKey, options) => {
47
+ dispatch({ type: 'set', routeKey, options });
48
+ }, []);
49
+ const unset = (0, react_1.useCallback)((routeKey, options) => {
50
+ dispatch({ type: 'unset', routeKey, options });
51
+ }, []);
52
+ const contextValue = (0, react_1.useMemo)(() => ({ set, unset }), [set, unset]);
53
+ return { registry, contextValue };
54
+ }
55
+ /**
56
+ * Hook used by composition components to register their options in the composition registry.
57
+ *
58
+ * Registers options on mount/update via useSafeLayoutEffect, and unregisters on unmount.
59
+ * Callers should memoize the options object to avoid unnecessary re-registrations.
60
+ */
61
+ function useCompositionOption(options) {
62
+ const context = (0, react_1.use)(exports.CompositionContext);
63
+ if (!context) {
64
+ throw new Error('useCompositionOption must be used within a RouterCompositionOptionsProvider. This is likely a bug in Expo Router.');
65
+ }
66
+ const route = (0, native_1.useRoute)();
67
+ const { set, unset } = context;
68
+ (0, useSafeLayoutEffect_1.useSafeLayoutEffect)(() => {
69
+ set(route.key, options);
70
+ return () => {
71
+ unset(route.key, options);
72
+ };
73
+ }, [route.key, set, unset, options]);
74
+ }
75
+ //# sourceMappingURL=CompositionOptionsContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompositionOptionsContext.js","sourceRoot":"","sources":["../../../../src/fork/native-stack/composition-options/CompositionOptionsContext.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAqBb,0CA0BC;AASD,wDAgBC;AAQD,oDAiBC;AA/FD,qDAAoD;AAEpD,iCAA6E;AAG7E,4EAAyE;AAEzE,gBAAgB;AACH,QAAA,kBAAkB,GAAG,IAAA,qBAAa,EAAiC,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C5B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AACvC,CAAC","sourcesContent":["'use client';\n\nimport { useRoute } from '@react-navigation/native';\nimport type { NativeStackNavigationOptions } from '@react-navigation/native-stack';\nimport { createContext, use, useCallback, useMemo, useReducer } from 'react';\n\nimport type { CompositionContextValue, CompositionRegistry } from './types';\nimport { useSafeLayoutEffect } from '../../../views/useSafeLayoutEffect';\n\n/** @internal */\nexport const CompositionContext = createContext<CompositionContextValue | null>(null);\n\ntype RegistryAction =\n | {\n type: 'set';\n routeKey: string;\n options: Partial<NativeStackNavigationOptions>;\n }\n | { type: 'unset'; routeKey: string; options: Partial<NativeStackNavigationOptions> };\n\n/** @internal */\nexport function registryReducer(\n state: CompositionRegistry,\n action: RegistryAction\n): CompositionRegistry {\n if (action.type === 'set') {\n const { routeKey, options } = action;\n if (state[routeKey]?.includes(options)) {\n return state;\n }\n return { ...state, [routeKey]: [...(state[routeKey] ?? []), options] };\n }\n\n if (action.type === 'unset') {\n const { routeKey, options } = action;\n const existing = state[routeKey];\n const filtered = existing?.filter((o) => o !== options);\n if (!existing || filtered?.length === existing.length) {\n return state;\n }\n if (filtered.length === 0) {\n const { [routeKey]: _, ...newState } = state;\n return newState;\n }\n return { ...state, [routeKey]: filtered };\n }\n return state;\n}\n\n/**\n * Provides the composition registry to descendant composition components.\n *\n * Uses useReducer with immutable object updates for React Compiler compatibility.\n * Each set/unset call produces a new object reference, which the compiler can\n * track as a reactive dependency.\n */\nexport function useCompositionRegistry() {\n const [registry, dispatch] = useReducer(registryReducer, {} as CompositionRegistry);\n\n const set = useCallback((routeKey: string, options: Partial<NativeStackNavigationOptions>) => {\n dispatch({ type: 'set', routeKey, options });\n }, []);\n\n const unset = useCallback((routeKey: string, options: Partial<NativeStackNavigationOptions>) => {\n dispatch({ type: 'unset', routeKey, options });\n }, []);\n\n const contextValue = useMemo(\n () => ({ set, unset }) satisfies CompositionContextValue,\n [set, unset]\n );\n return { registry, contextValue };\n}\n\n/**\n * Hook used by composition components to register their options in the composition registry.\n *\n * Registers options on mount/update via useSafeLayoutEffect, and unregisters on unmount.\n * Callers should memoize the options object to avoid unnecessary re-registrations.\n */\nexport function useCompositionOption(options: Partial<NativeStackNavigationOptions>) {\n const context = use(CompositionContext);\n if (!context) {\n throw new Error(\n 'useCompositionOption must be used within a RouterCompositionOptionsProvider. This is likely a bug in Expo Router.'\n );\n }\n\n const route = useRoute();\n const { set, unset } = context;\n\n useSafeLayoutEffect(() => {\n set(route.key, options);\n return () => {\n unset(route.key, options);\n };\n }, [route.key, set, unset, options]);\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export { mergeOptions } from './mergeOptions';
2
+ export { CompositionContext, useCompositionRegistry, useCompositionOption, } from './CompositionOptionsContext';
3
+ export type { CompositionRegistry, CompositionContextValue } from './types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fork/native-stack/composition-options/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCompositionOption = exports.useCompositionRegistry = exports.CompositionContext = exports.mergeOptions = void 0;
4
+ var mergeOptions_1 = require("./mergeOptions");
5
+ Object.defineProperty(exports, "mergeOptions", { enumerable: true, get: function () { return mergeOptions_1.mergeOptions; } });
6
+ var CompositionOptionsContext_1 = require("./CompositionOptionsContext");
7
+ Object.defineProperty(exports, "CompositionContext", { enumerable: true, get: function () { return CompositionOptionsContext_1.CompositionContext; } });
8
+ Object.defineProperty(exports, "useCompositionRegistry", { enumerable: true, get: function () { return CompositionOptionsContext_1.useCompositionRegistry; } });
9
+ Object.defineProperty(exports, "useCompositionOption", { enumerable: true, get: function () { return CompositionOptionsContext_1.useCompositionOption; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/fork/native-stack/composition-options/index.ts"],"names":[],"mappings":";;;AAAA,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,yEAIqC;AAHnC,+HAAA,kBAAkB,OAAA;AAClB,mIAAA,sBAAsB,OAAA;AACtB,iIAAA,oBAAoB,OAAA","sourcesContent":["export { mergeOptions } from './mergeOptions';\nexport {\n CompositionContext,\n useCompositionRegistry,\n useCompositionOption,\n} from './CompositionOptionsContext';\nexport type { CompositionRegistry, CompositionContextValue } from './types';\n"]}
@@ -0,0 +1,13 @@
1
+ import type { ParamListBase, StackNavigationState } from '@react-navigation/native';
2
+ import type { NativeStackDescriptorMap } from '../descriptors-context';
3
+ import type { CompositionRegistry } from './types';
4
+ /**
5
+ * Merges composition component options into navigation descriptors.
6
+ *
7
+ * For each descriptor:
8
+ * 1. If no composition options registered → pass through unchanged
9
+ * 2. If route is preloaded AND not focused → skip composition (pass through)
10
+ * 3. Otherwise → merge descriptor.options with composition options (composition wins)
11
+ */
12
+ export declare function mergeOptions(descriptors: NativeStackDescriptorMap, registry: CompositionRegistry, state: StackNavigationState<ParamListBase>): NativeStackDescriptorMap;
13
+ //# sourceMappingURL=mergeOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeOptions.d.ts","sourceRoot":"","sources":["../../../../src/fork/native-stack/composition-options/mergeOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEpF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,WAAW,EAAE,wBAAwB,EACrC,QAAQ,EAAE,mBAAmB,EAC7B,KAAK,EAAE,oBAAoB,CAAC,aAAa,CAAC,GACzC,wBAAwB,CAiC1B"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mergeOptions = mergeOptions;
4
+ /**
5
+ * Merges composition component options into navigation descriptors.
6
+ *
7
+ * For each descriptor:
8
+ * 1. If no composition options registered → pass through unchanged
9
+ * 2. If route is preloaded AND not focused → skip composition (pass through)
10
+ * 3. Otherwise → merge descriptor.options with composition options (composition wins)
11
+ */
12
+ function mergeOptions(descriptors, registry, state) {
13
+ const result = {};
14
+ const focusedKey = state.routes[state.index]?.key;
15
+ for (const key in descriptors) {
16
+ const descriptor = descriptors[key];
17
+ const routeOptions = registry[key];
18
+ // No composition options or empty array → pass through
19
+ if (!routeOptions || routeOptions.length === 0) {
20
+ result[key] = descriptor;
21
+ continue;
22
+ }
23
+ // Check if route is preloaded and not focused → skip composition
24
+ const isPreloaded = state.preloadedRoutes?.some((r) => r.key === key) ?? false;
25
+ if (isPreloaded && key !== focusedKey) {
26
+ result[key] = descriptor;
27
+ continue;
28
+ }
29
+ // Merge: descriptor options as base, composition options override
30
+ const mergedOptions = Object.assign({}, descriptor.options, ...routeOptions);
31
+ const merged = {
32
+ ...descriptor,
33
+ options: mergedOptions,
34
+ };
35
+ result[key] = merged;
36
+ }
37
+ return result;
38
+ }
39
+ //# sourceMappingURL=mergeOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeOptions.js","sourceRoot":"","sources":["../../../../src/fork/native-stack/composition-options/mergeOptions.ts"],"names":[],"mappings":";;AAaA,oCAqCC;AA7CD;;;;;;;GAOG;AACH,SAAgB,YAAY,CAC1B,WAAqC,EACrC,QAA6B,EAC7B,KAA0C;IAE1C,MAAM,MAAM,GAA6B,EAAE,CAAC;IAC5C,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC;IAElD,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QAC9B,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QAEnC,uDAAuD;QACvD,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/C,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;YACzB,SAAS;QACX,CAAC;QAED,iEAAiE;QACjE,MAAM,WAAW,GAAG,KAAK,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,KAAK,CAAC;QAC/E,IAAI,WAAW,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;YACtC,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;YACzB,SAAS;QACX,CAAC;QAED,kEAAkE;QAClE,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,CAAC;QAE7E,MAAM,MAAM,GAAG;YACb,GAAG,UAAU;YACb,OAAO,EAAE,aAAa;SACvB,CAAC;QAEF,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { ParamListBase, StackNavigationState } from '@react-navigation/native';\n\nimport type { NativeStackDescriptorMap } from '../descriptors-context';\nimport type { CompositionRegistry } from './types';\n\n/**\n * Merges composition component options into navigation descriptors.\n *\n * For each descriptor:\n * 1. If no composition options registered → pass through unchanged\n * 2. If route is preloaded AND not focused → skip composition (pass through)\n * 3. Otherwise → merge descriptor.options with composition options (composition wins)\n */\nexport function mergeOptions(\n descriptors: NativeStackDescriptorMap,\n registry: CompositionRegistry,\n state: StackNavigationState<ParamListBase>\n): NativeStackDescriptorMap {\n const result: NativeStackDescriptorMap = {};\n const focusedKey = state.routes[state.index]?.key;\n\n for (const key in descriptors) {\n const descriptor = descriptors[key];\n const routeOptions = registry[key];\n\n // No composition options or empty array → pass through\n if (!routeOptions || routeOptions.length === 0) {\n result[key] = descriptor;\n continue;\n }\n\n // Check if route is preloaded and not focused → skip composition\n const isPreloaded = state.preloadedRoutes?.some((r) => r.key === key) ?? false;\n if (isPreloaded && key !== focusedKey) {\n result[key] = descriptor;\n continue;\n }\n\n // Merge: descriptor options as base, composition options override\n const mergedOptions = Object.assign({}, descriptor.options, ...routeOptions);\n\n const merged = {\n ...descriptor,\n options: mergedOptions,\n };\n\n result[key] = merged;\n }\n\n return result;\n}\n"]}
@@ -0,0 +1,25 @@
1
+ import type { NativeStackNavigationOptions } from '@react-navigation/native-stack';
2
+ /**
3
+ * Registry mapping route keys to composition component options.
4
+ *
5
+ * Structure: Record<routeKey, options[]>
6
+ *
7
+ * Each composition component (Title, BackButton, Header, Toolbar) registers
8
+ * its memoized options object. Array order reflects registration order,
9
+ * so later registrations override earlier ones during merge.
10
+ *
11
+ * @internal
12
+ */
13
+ export type CompositionRegistry = Record<string, Partial<NativeStackNavigationOptions>[]>;
14
+ /** @internal */
15
+ export interface CompositionContextValue {
16
+ /**
17
+ * Register or update options for a composition component.
18
+ */
19
+ set(routeKey: string, options: Partial<NativeStackNavigationOptions>): void;
20
+ /**
21
+ * Remove a composition component's options by reference (should be called on unmount).
22
+ */
23
+ unset(routeKey: string, options: Partial<NativeStackNavigationOptions>): void;
24
+ }
25
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/fork/native-stack/composition-options/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAEnF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,4BAA4B,CAAC,EAAE,CAAC,CAAC;AAE1F,gBAAgB;AAChB,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,4BAA4B,CAAC,GAAG,IAAI,CAAC;IAE5E;;OAEG;IACH,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,4BAA4B,CAAC,GAAG,IAAI,CAAC;CAC/E"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/fork/native-stack/composition-options/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { NativeStackNavigationOptions } from '@react-navigation/native-stack';\n\n/**\n * Registry mapping route keys to composition component options.\n *\n * Structure: Record<routeKey, options[]>\n *\n * Each composition component (Title, BackButton, Header, Toolbar) registers\n * its memoized options object. Array order reflects registration order,\n * so later registrations override earlier ones during merge.\n *\n * @internal\n */\nexport type CompositionRegistry = Record<string, Partial<NativeStackNavigationOptions>[]>;\n\n/** @internal */\nexport interface CompositionContextValue {\n /**\n * Register or update options for a composition component.\n */\n set(routeKey: string, options: Partial<NativeStackNavigationOptions>): void;\n\n /**\n * Remove a composition component's options by reference (should be called on unmount).\n */\n unset(routeKey: string, options: Partial<NativeStackNavigationOptions>): void;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"createNativeStackNavigator.d.ts","sourceRoot":"","sources":["../../../src/fork/native-stack/createNativeStackNavigator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAGlB,KAAK,oBAAoB,EAGzB,KAAK,YAAY,EACjB,KAAK,cAAc,EAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAE9B,KAAK,yBAAyB,EAC/B,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,iBAAS,oBAAoB,CAAC,EAC5B,EAAE,EACF,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,GAAG,IAAI,EACR,EAAE,yBAAyB,qBAgH3B;AAED,wBAAgB,0BAA0B,CACxC,KAAK,CAAC,SAAS,SAAS,aAAa,EACrC,KAAK,CAAC,WAAW,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,EACxD,KAAK,CAAC,OAAO,SAAS,oBAAoB,GAAG;IAC3C,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IACvC,aAAa,EAAE,4BAA4B,CAAC;IAC5C,QAAQ,EAAE,6BAA6B,CAAC;IACxC,cAAc,EAAE;SACb,SAAS,IAAI,MAAM,SAAS,GAAG,yBAAyB,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC;KAC7F,CAAC;IACF,SAAS,EAAE,OAAO,oBAAoB,CAAC;CACxC,EACD,KAAK,CAAC,MAAM,SAAS,YAAY,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,EAClE,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAElD"}
1
+ {"version":3,"file":"createNativeStackNavigator.d.ts","sourceRoot":"","sources":["../../../src/fork/native-stack/createNativeStackNavigator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAGlB,KAAK,oBAAoB,EAGzB,KAAK,YAAY,EACjB,KAAK,cAAc,EAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAE9B,KAAK,yBAAyB,EAC/B,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,iBAAS,oBAAoB,CAAC,EAC5B,EAAE,EACF,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,GAAG,IAAI,EACR,EAAE,yBAAyB,qBAwH3B;AAED,wBAAgB,0BAA0B,CACxC,KAAK,CAAC,SAAS,SAAS,aAAa,EACrC,KAAK,CAAC,WAAW,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,EACxD,KAAK,CAAC,OAAO,SAAS,oBAAoB,GAAG;IAC3C,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IACvC,aAAa,EAAE,4BAA4B,CAAC;IAC5C,QAAQ,EAAE,6BAA6B,CAAC;IACxC,cAAc,EAAE;SACb,SAAS,IAAI,MAAM,SAAS,GAAG,yBAAyB,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC;KAC7F,CAAC;IACF,SAAS,EAAE,OAAO,oBAAoB,CAAC;CACxC,EACD,KAAK,CAAC,MAAM,SAAS,YAAY,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,EAClE,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAElD"}
@@ -38,6 +38,7 @@ const native_1 = require("@react-navigation/native");
38
38
  const native_stack_1 = require("@react-navigation/native-stack");
39
39
  const expo_glass_effect_1 = require("expo-glass-effect");
40
40
  const React = __importStar(require("react"));
41
+ const composition_options_1 = require("./composition-options");
41
42
  const descriptors_context_1 = require("./descriptors-context");
42
43
  const usePreviewTransition_1 = require("./usePreviewTransition");
43
44
  const navigationParams_1 = require("../../navigationParams");
@@ -112,20 +113,24 @@ function NativeStackNavigator({ id, initialRouteName, children, layout, screenLi
112
113
  }
113
114
  return needsNewMap ? result : computedDescriptors;
114
115
  }, [computedDescriptors]);
116
+ const { registry, contextValue } = (0, composition_options_1.useCompositionRegistry)();
117
+ const mergedDescriptors = React.useMemo(() => (0, composition_options_1.mergeOptions)(finalDescriptors, registry, computedState), [finalDescriptors, computedState, registry]);
115
118
  // END FORK
116
119
  return (
117
120
  // START FORK
118
121
  <descriptors_context_1.DescriptorsContext value={descriptors}>
119
122
  {/* END FORK */}
120
123
  <NavigationContent>
121
- <native_stack_1.NativeStackView {...rest}
124
+ <composition_options_1.CompositionContext value={contextValue}>
125
+ <native_stack_1.NativeStackView {...rest}
122
126
  // START FORK
123
- state={computedState} navigation={navigationWrapper} descriptors={finalDescriptors}
127
+ state={computedState} navigation={navigationWrapper} descriptors={mergedDescriptors}
124
128
  // state={state}
125
129
  // navigation={navigation}
126
130
  // descriptors={descriptors}
127
131
  // END FORK
128
132
  describe={describe}/>
133
+ </composition_options_1.CompositionContext>
129
134
  </NavigationContent>
130
135
  {/* START FORK */}
131
136
  </descriptors_context_1.DescriptorsContext>
@@ -1 +1 @@
1
- {"version":3,"file":"createNativeStackNavigator.js","sourceRoot":"","sources":["../../../src/fork/native-stack/createNativeStackNavigator.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgKA,gEAiBC;AAjLD,qDAakC;AAClC,iEAMwC;AACxC,yDAA2D;AAC3D,6CAA+B;AAE/B,+DAA2D;AAC3D,iEAA8D;AAC9D,6DAGgC;AAEhC,MAAM,KAAK,GAAG,IAAA,0CAAsB,GAAE,CAAC;AAKvC,SAAS,oBAAoB,CAAC,EAC5B,EAAE,EACF,gB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,GAAG,UAAU,CAAC;YAC3B,CAAC;QACH,CAAC;QACD,OAAO,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,mBAAmB,CAAC;IACpD,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1B,WAAW;IAEX,OAAO;IACL,aAAa;IACb,CAAC,wCAAkB,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CACrC;MAAA,CAAC,cAAc,CACf;MAAA,CAAC,iBAAiB,CAChB;QAAA,CAAC,8BAAe,CACd,IAAI,IAAI,CAAC;IACT,aAAa;IACb,KAAK,CAAC,CAAC,aAAa,CAAC,CACrB,UAAU,CAAC,CAAC,iBAAiB,CAAC,CAC9B,WAAW,CAAC,CAAC,gBAAgB,CAAC;IAC9B,gBAAgB;IAChB,0BAA0B;IAC1B,4BAA4B;IAC5B,WAAW;IACX,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAEvB;MAAA,EAAE,iBAAiB,CACnB;MAAA,CAAC,gBAAgB,CACnB;IAAA,EAAE,wCAAkB,CAAC;IACrB,WAAW;KACZ,CAAC;AACJ,CAAC;AAED,SAAgB,0BAA0B,CAexC,MAAe;IACf,OAAO,IAAA,+BAAsB,EAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["import {\n createNavigatorFactory,\n type EventArg,\n type NavigatorTypeBagBase,\n type ParamListBase,\n type StackActionHelpers,\n StackActions,\n type StackNavigationState,\n StackRouter,\n type StackRouterOptions,\n type StaticConfig,\n type TypedNavigator,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport {\n type NativeStackNavigationEventMap,\n type NativeStackNavigationOptions,\n type NativeStackNavigationProp,\n NativeStackView,\n type NativeStackNavigatorProps,\n} from '@react-navigation/native-stack';\nimport { isLiquidGlassAvailable } from 'expo-glass-effect';\nimport * as React from 'react';\n\nimport { DescriptorsContext } from './descriptors-context';\nimport { usePreviewTransition } from './usePreviewTransition';\nimport {\n INTERNAL_EXPO_ROUTER_GESTURE_ENABLED_OPTION_NAME,\n type InternalNavigationOptions,\n} from '../../navigationParams';\n\nconst GLASS = isLiquidGlassAvailable();\n\ntype NativeStackNavigationOptionsWithInternal = NativeStackNavigationOptions &\n InternalNavigationOptions;\n\nfunction NativeStackNavigator({\n id,\n initialRouteName,\n children,\n layout,\n screenListeners,\n screenOptions,\n screenLayout,\n UNSTABLE_router,\n ...rest\n}: NativeStackNavigatorProps) {\n const { state, describe, descriptors, navigation, NavigationContent } = useNavigationBuilder<\n StackNavigationState<ParamListBase>,\n StackRouterOptions,\n StackActionHelpers<ParamListBase>,\n NativeStackNavigationOptionsWithInternal,\n NativeStackNavigationEventMap\n >(StackRouter, {\n id,\n initialRouteName,\n children,\n layout,\n screenListeners,\n screenOptions,\n screenLayout,\n UNSTABLE_router,\n });\n\n React.useEffect(\n () =>\n // @ts-expect-error: there may not be a tab navigator in parent\n navigation?.addListener?.('tabPress', (e: any) => {\n const isFocused = navigation.isFocused();\n\n // Run the operation in the next frame so we're sure all listeners have been run\n // This is necessary to know if preventDefault() has been called\n requestAnimationFrame(() => {\n if (state.index > 0 && isFocused && !(e as EventArg<'tabPress', true>).defaultPrevented) {\n // When user taps on already focused tab and we're inside the tab,\n // reset the stack to replicate native behaviour\n // START FORK\n // navigation.dispatch({\n // ...StackActions.popToTop(),\n // target: state.key,\n // });\n // The popToTop will be automatically triggered on native side for native tabs\n if (e.data?.__internalTabsType !== 'native') {\n navigation.dispatch({\n ...StackActions.popToTop(),\n target: state.key,\n });\n }\n // END FORK\n }\n });\n }),\n [navigation, state.index, state.key]\n );\n\n // START FORK\n const { computedState, computedDescriptors, navigationWrapper } = usePreviewTransition(\n state,\n navigation,\n descriptors,\n describe\n );\n\n // Map internal gesture option to React Navigation's gestureEnabled option\n // This allows Expo Router to override gesture behavior without affecting user settings\n const finalDescriptors = React.useMemo(() => {\n let needsNewMap = false;\n const result: typeof computedDescriptors = {};\n for (const key of Object.keys(computedDescriptors)) {\n const descriptor = computedDescriptors[key];\n const options = descriptor.options as NativeStackNavigationOptionsWithInternal;\n const internalGestureEnabled = options?.[INTERNAL_EXPO_ROUTER_GESTURE_ENABLED_OPTION_NAME];\n const needsGestureFix = internalGestureEnabled !== undefined;\n const needsGlassFix = GLASS && options?.presentation === 'formSheet';\n\n if (needsGestureFix || needsGlassFix) {\n needsNewMap = true;\n const newOptions = { ...options };\n if (needsGestureFix) {\n newOptions.gestureEnabled = internalGestureEnabled;\n }\n if (needsGlassFix) {\n newOptions.headerTransparent ??= true;\n newOptions.contentStyle ??= { backgroundColor: 'transparent' };\n newOptions.headerShadowVisible ??= false;\n newOptions.headerLargeTitleShadowVisible ??= false;\n }\n result[key] = { ...descriptor, options: newOptions };\n } else {\n result[key] = descriptor;\n }\n }\n return needsNewMap ? result : computedDescriptors;\n }, [computedDescriptors]);\n // END FORK\n\n return (\n // START FORK\n <DescriptorsContext value={descriptors}>\n {/* END FORK */}\n <NavigationContent>\n <NativeStackView\n {...rest}\n // START FORK\n state={computedState}\n navigation={navigationWrapper}\n descriptors={finalDescriptors}\n // state={state}\n // navigation={navigation}\n // descriptors={descriptors}\n // END FORK\n describe={describe}\n />\n </NavigationContent>\n {/* START FORK */}\n </DescriptorsContext>\n // END FORK\n );\n}\n\nexport function createNativeStackNavigator<\n const ParamList extends ParamListBase,\n const NavigatorID extends string | undefined = undefined,\n const TypeBag extends NavigatorTypeBagBase = {\n ParamList: ParamList;\n NavigatorID: NavigatorID;\n State: StackNavigationState<ParamList>;\n ScreenOptions: NativeStackNavigationOptions;\n EventMap: NativeStackNavigationEventMap;\n NavigationList: {\n [RouteName in keyof ParamList]: NativeStackNavigationProp<ParamList, RouteName, NavigatorID>;\n };\n Navigator: typeof NativeStackNavigator;\n },\n const Config extends StaticConfig<TypeBag> = StaticConfig<TypeBag>,\n>(config?: Config): TypedNavigator<TypeBag, Config> {\n return createNavigatorFactory(NativeStackNavigator)(config);\n}\n"]}
1
+ {"version":3,"file":"createNativeStack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CAAC,CAAC,QAAQ,CAAC,EAEvB;QAAA,EAAE,wCAAkB,CACtB;MAAA,EAAE,iBAAiB,CACnB;MAAA,CAAC,gBAAgB,CACnB;IAAA,EAAE,wCAAkB,CAAC;IACrB,WAAW;KACZ,CAAC;AACJ,CAAC;AAED,SAAgB,0BAA0B,CAexC,MAAe;IACf,OAAO,IAAA,+BAAsB,EAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["import {\n createNavigatorFactory,\n type EventArg,\n type NavigatorTypeBagBase,\n type ParamListBase,\n type StackActionHelpers,\n StackActions,\n type StackNavigationState,\n StackRouter,\n type StackRouterOptions,\n type StaticConfig,\n type TypedNavigator,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport {\n type NativeStackNavigationEventMap,\n type NativeStackNavigationOptions,\n type NativeStackNavigationProp,\n NativeStackView,\n type NativeStackNavigatorProps,\n} from '@react-navigation/native-stack';\nimport { isLiquidGlassAvailable } from 'expo-glass-effect';\nimport * as React from 'react';\n\nimport { CompositionContext, mergeOptions, useCompositionRegistry } from './composition-options';\nimport { DescriptorsContext } from './descriptors-context';\nimport { usePreviewTransition } from './usePreviewTransition';\nimport {\n INTERNAL_EXPO_ROUTER_GESTURE_ENABLED_OPTION_NAME,\n type InternalNavigationOptions,\n} from '../../navigationParams';\n\nconst GLASS = isLiquidGlassAvailable();\n\ntype NativeStackNavigationOptionsWithInternal = NativeStackNavigationOptions &\n InternalNavigationOptions;\n\nfunction NativeStackNavigator({\n id,\n initialRouteName,\n children,\n layout,\n screenListeners,\n screenOptions,\n screenLayout,\n UNSTABLE_router,\n ...rest\n}: NativeStackNavigatorProps) {\n const { state, describe, descriptors, navigation, NavigationContent } = useNavigationBuilder<\n StackNavigationState<ParamListBase>,\n StackRouterOptions,\n StackActionHelpers<ParamListBase>,\n NativeStackNavigationOptionsWithInternal,\n NativeStackNavigationEventMap\n >(StackRouter, {\n id,\n initialRouteName,\n children,\n layout,\n screenListeners,\n screenOptions,\n screenLayout,\n UNSTABLE_router,\n });\n\n React.useEffect(\n () =>\n // @ts-expect-error: there may not be a tab navigator in parent\n navigation?.addListener?.('tabPress', (e: any) => {\n const isFocused = navigation.isFocused();\n\n // Run the operation in the next frame so we're sure all listeners have been run\n // This is necessary to know if preventDefault() has been called\n requestAnimationFrame(() => {\n if (state.index > 0 && isFocused && !(e as EventArg<'tabPress', true>).defaultPrevented) {\n // When user taps on already focused tab and we're inside the tab,\n // reset the stack to replicate native behaviour\n // START FORK\n // navigation.dispatch({\n // ...StackActions.popToTop(),\n // target: state.key,\n // });\n // The popToTop will be automatically triggered on native side for native tabs\n if (e.data?.__internalTabsType !== 'native') {\n navigation.dispatch({\n ...StackActions.popToTop(),\n target: state.key,\n });\n }\n // END FORK\n }\n });\n }),\n [navigation, state.index, state.key]\n );\n\n // START FORK\n const { computedState, computedDescriptors, navigationWrapper } = usePreviewTransition(\n state,\n navigation,\n descriptors,\n describe\n );\n\n // Map internal gesture option to React Navigation's gestureEnabled option\n // This allows Expo Router to override gesture behavior without affecting user settings\n const finalDescriptors = React.useMemo(() => {\n let needsNewMap = false;\n const result: typeof computedDescriptors = {};\n for (const key of Object.keys(computedDescriptors)) {\n const descriptor = computedDescriptors[key];\n const options = descriptor.options as NativeStackNavigationOptionsWithInternal;\n const internalGestureEnabled = options?.[INTERNAL_EXPO_ROUTER_GESTURE_ENABLED_OPTION_NAME];\n const needsGestureFix = internalGestureEnabled !== undefined;\n const needsGlassFix = GLASS && options?.presentation === 'formSheet';\n\n if (needsGestureFix || needsGlassFix) {\n needsNewMap = true;\n const newOptions = { ...options };\n if (needsGestureFix) {\n newOptions.gestureEnabled = internalGestureEnabled;\n }\n if (needsGlassFix) {\n newOptions.headerTransparent ??= true;\n newOptions.contentStyle ??= { backgroundColor: 'transparent' };\n newOptions.headerShadowVisible ??= false;\n newOptions.headerLargeTitleShadowVisible ??= false;\n }\n result[key] = { ...descriptor, options: newOptions };\n } else {\n result[key] = descriptor;\n }\n }\n return needsNewMap ? result : computedDescriptors;\n }, [computedDescriptors]);\n const { registry, contextValue } = useCompositionRegistry();\n\n const mergedDescriptors = React.useMemo(\n () => mergeOptions(finalDescriptors, registry, computedState),\n [finalDescriptors, computedState, registry]\n );\n // END FORK\n\n return (\n // START FORK\n <DescriptorsContext value={descriptors}>\n {/* END FORK */}\n <NavigationContent>\n <CompositionContext value={contextValue}>\n <NativeStackView\n {...rest}\n // START FORK\n state={computedState}\n navigation={navigationWrapper}\n descriptors={mergedDescriptors}\n // state={state}\n // navigation={navigation}\n // descriptors={descriptors}\n // END FORK\n describe={describe}\n />\n </CompositionContext>\n </NavigationContent>\n {/* START FORK */}\n </DescriptorsContext>\n // END FORK\n );\n}\n\nexport function createNativeStackNavigator<\n const ParamList extends ParamListBase,\n const NavigatorID extends string | undefined = undefined,\n const TypeBag extends NavigatorTypeBagBase = {\n ParamList: ParamList;\n NavigatorID: NavigatorID;\n State: StackNavigationState<ParamList>;\n ScreenOptions: NativeStackNavigationOptions;\n EventMap: NativeStackNavigationEventMap;\n NavigationList: {\n [RouteName in keyof ParamList]: NativeStackNavigationProp<ParamList, RouteName, NavigatorID>;\n };\n Navigator: typeof NativeStackNavigator;\n },\n const Config extends StaticConfig<TypeBag> = StaticConfig<TypeBag>,\n>(config?: Config): TypedNavigator<TypeBag, Config> {\n return createNavigatorFactory(NativeStackNavigator)(config);\n}\n"]}
@@ -1,7 +1,7 @@
1
- import type { ComponentProps } from 'react';
1
+ import { type ComponentProps } from 'react';
2
2
  import { RouterModal } from '../modal/web/ModalStack';
3
3
  import { Screen } from '../views/Screen';
4
- declare const _default: ((props: ComponentProps<typeof RouterModal>) => import("react").JSX.Element) & {
4
+ declare const _default: (({ children, ...props }: ComponentProps<typeof RouterModal>) => import("react").JSX.Element) & {
5
5
  Screen: typeof Screen;
6
6
  Protected: import("react").FunctionComponent<import("../views/Protected").ProtectedProps>;
7
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ExperimentalModalStack.d.ts","sourceRoot":"","sources":["../../src/layouts/ExperimentalModalStack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;iCAK/B,cAAc,CAAC,OAAO,WAAW,CAAC;;;;AAD5C,wBAQE"}
1
+ {"version":3,"file":"ExperimentalModalStack.d.ts","sourceRoot":"","sources":["../../src/layouts/ExperimentalModalStack.tsx"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAIrD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;kDAGd,cAAc,CAAC,OAAO,WAAW,CAAC;;;;AAD7D,wBAYE"}
@@ -1,13 +1,15 @@
1
1
  "use strict";
2
+ 'use client';
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ const react_1 = require("react");
3
5
  const StackClient_1 = require("./StackClient");
6
+ const stack_utils_1 = require("./stack-utils");
4
7
  const ModalStack_1 = require("../modal/web/ModalStack");
5
8
  const Protected_1 = require("../views/Protected");
6
9
  const Screen_1 = require("../views/Screen");
7
- // The RouterModal already includes Screen and Protected via withLayoutContext
8
- // but we need to ensure we forward the stackRouterOverride for singular routes etc.
9
- exports.default = Object.assign((props) => {
10
- return <ModalStack_1.RouterModal {...props} UNSTABLE_router={StackClient_1.stackRouterOverride}/>;
10
+ exports.default = Object.assign(({ children, ...props }) => {
11
+ const rnChildren = (0, react_1.useMemo)(() => (0, stack_utils_1.mapProtectedScreen)({ guard: true, children }).children, [children]);
12
+ return <ModalStack_1.RouterModal {...props} UNSTABLE_router={StackClient_1.stackRouterOverride} children={rnChildren}/>;
11
13
  }, {
12
14
  Screen: Screen_1.Screen,
13
15
  Protected: Protected_1.Protected,
@@ -1 +1 @@
1
- {"version":3,"file":"ExperimentalModalStack.js","sourceRoot":"","sources":["../../src/layouts/ExperimentalModalStack.tsx"],"names":[],"mappings":";;AAEA,+CAAoD;AACpD,wDAAsD;AACtD,kDAA+C;AAC/C,4CAAyC;AAEzC,8EAA8E;AAC9E,oFAAoF;AACpF,kBAAe,MAAM,CAAC,MAAM,CAC1B,CAAC,KAAyC,EAAE,EAAE;IAC5C,OAAO,CAAC,wBAAW,CAAC,IAAI,KAAK,CAAC,CAAC,eAAe,CAAC,CAAC,iCAAmB,CAAC,EAAG,CAAC;AAC1E,CAAC,EACD;IACE,MAAM,EAAN,eAAM;IACN,SAAS,EAAT,qBAAS;CACV,CACF,CAAC","sourcesContent":["import type { ComponentProps } from 'react';\n\nimport { stackRouterOverride } from './StackClient';\nimport { RouterModal } from '../modal/web/ModalStack';\nimport { Protected } from '../views/Protected';\nimport { Screen } from '../views/Screen';\n\n// The RouterModal already includes Screen and Protected via withLayoutContext\n// but we need to ensure we forward the stackRouterOverride for singular routes etc.\nexport default Object.assign(\n (props: ComponentProps<typeof RouterModal>) => {\n return <RouterModal {...props} UNSTABLE_router={stackRouterOverride} />;\n },\n {\n Screen,\n Protected,\n }\n);\n"]}
1
+ {"version":3,"file":"ExperimentalModalStack.js","sourceRoot":"","sources":["../../src/layouts/ExperimentalModalStack.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AACb,iCAAqD;AAErD,+CAAoD;AACpD,+CAAmD;AACnD,wDAAsD;AACtD,kDAA+C;AAC/C,4CAAyC;AAEzC,kBAAe,MAAM,CAAC,MAAM,CAC1B,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAsC,EAAE,EAAE;IAC7D,MAAM,UAAU,GAAG,IAAA,eAAO,EACxB,GAAG,EAAE,CAAC,IAAA,gCAAkB,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAC5D,CAAC,QAAQ,CAAC,CACX,CAAC;IACF,OAAO,CAAC,wBAAW,CAAC,IAAI,KAAK,CAAC,CAAC,eAAe,CAAC,CAAC,iCAAmB,CAAC,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,EAAG,CAAC;AAChG,CAAC,EACD;IACE,MAAM,EAAN,eAAM;IACN,SAAS,EAAT,qBAAS;CACV,CACF,CAAC","sourcesContent":["'use client';\nimport { useMemo, type ComponentProps } from 'react';\n\nimport { stackRouterOverride } from './StackClient';\nimport { mapProtectedScreen } from './stack-utils';\nimport { RouterModal } from '../modal/web/ModalStack';\nimport { Protected } from '../views/Protected';\nimport { Screen } from '../views/Screen';\n\nexport default Object.assign(\n ({ children, ...props }: ComponentProps<typeof RouterModal>) => {\n const rnChildren = useMemo(\n () => mapProtectedScreen({ guard: true, children }).children,\n [children]\n );\n return <RouterModal {...props} UNSTABLE_router={stackRouterOverride} children={rnChildren} />;\n },\n {\n Screen,\n Protected,\n }\n);\n"]}
@@ -2,7 +2,7 @@ import { ParamListBase, StackRouter as RNStackRouter, StackNavigationState, type
2
2
  import { NativeStackNavigationEventMap, NativeStackNavigationOptions } from '@react-navigation/native-stack';
3
3
  import React, { ComponentProps } from 'react';
4
4
  import { type StackScreenProps, StackSearchBar } from './stack-utils';
5
- import { Protected, type ProtectedProps } from '../views/Protected';
5
+ import { Protected } from '../views/Protected';
6
6
  /**
7
7
  * We extend NativeStackNavigationOptions with our custom props
8
8
  * to allow for several extra props to be used on web, like modalWidth
@@ -160,7 +160,7 @@ declare const Stack: ((props: ComponentProps<typeof RNStack>) => React.JSX.Eleme
160
160
  Title: typeof import("./stack-utils").StackScreenTitle;
161
161
  BackButton: typeof import("./stack-utils").StackScreenBackButton;
162
162
  };
163
- Protected: React.FunctionComponent<ProtectedProps>;
163
+ Protected: React.FunctionComponent<import("../views/Protected").ProtectedProps>;
164
164
  Header: typeof import("./stack-utils/StackHeaderComponent").StackHeaderComponent;
165
165
  SearchBar: typeof StackSearchBar;
166
166
  Toolbar: {
@@ -1 +1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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKU,CAAC;AA4CxB;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,CAAC,iBAAiB,CAAC,CA4U9F,CAAC;AA8DF;;;;GAIG;AACH,QAAA,MAAM,KAAK,WACD,cAAc,CAAC,OAAO,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;CA0DvC,CAAC;AAoCF,eAAe,KAAK,CAAC;AAErB,eAAO,MAAM,WAAW,EAAE,OAAO,aAMhC,CAAC"}
@@ -46,7 +46,6 @@ const useScreens_1 = require("../useScreens");
46
46
  const stack_utils_1 = require("./stack-utils");
47
47
  const children_1 = require("../utils/children");
48
48
  const Protected_1 = require("../views/Protected");
49
- const Screen_1 = require("../views/Screen");
50
49
  const NativeStackNavigator = (0, createNativeStackNavigator_1.createNativeStackNavigator)().Navigator;
51
50
  const RNStack = (0, withLayoutContext_1.withLayoutContext)(NativeStackNavigator);
52
51
  function isStackAction(action) {
@@ -409,39 +408,6 @@ function filterSingular(state, getId) {
409
408
  routes,
410
409
  };
411
410
  }
412
- function mapProtectedScreen(props) {
413
- return {
414
- ...props,
415
- children: react_1.Children.toArray(props.children)
416
- .map((child, index) => {
417
- if ((0, children_1.isChildOfType)(child, stack_utils_1.StackScreen)) {
418
- const { children, options: childOptions, ...rest } = child.props;
419
- const options = typeof childOptions === 'function'
420
- ? (...params) => (0, stack_utils_1.appendScreenStackPropsToOptions)(childOptions(...params), { children })
421
- : (0, stack_utils_1.appendScreenStackPropsToOptions)(childOptions ?? {}, { children });
422
- return <Screen_1.Screen key={rest.name} {...rest} options={options}/>;
423
- }
424
- else if ((0, children_1.isChildOfType)(child, Protected_1.Protected)) {
425
- return <Protected_1.Protected key={`${index}-${props.guard}`} {...mapProtectedScreen(child.props)}/>;
426
- }
427
- else if ((0, children_1.isChildOfType)(child, stack_utils_1.StackHeader)) {
428
- // Ignore Stack.Header, because it can be used to set header options for Stack
429
- // and we use this function to process children of Stack, as well.
430
- return null;
431
- }
432
- else {
433
- if (react_1.default.isValidElement(child)) {
434
- console.warn(`Unknown child element passed to Stack: ${child.type}`);
435
- }
436
- else {
437
- console.warn(`Unknown child element passed to Stack: ${child}`);
438
- }
439
- }
440
- return null;
441
- })
442
- .filter(Boolean),
443
- };
444
- }
445
411
  /**
446
412
  * Renders a native stack navigator.
447
413
  *
@@ -480,7 +446,7 @@ const Stack = Object.assign((props) => {
480
446
  const condition = isStackAnimationDisabled ? () => true : shouldDisableAnimationBasedOnParams;
481
447
  return disableAnimationInScreenOptions(screenOptionsWithCompositionAPIOptions, condition);
482
448
  }, [screenOptionsWithCompositionAPIOptions, isStackAnimationDisabled]);
483
- const rnChildren = (0, react_1.useMemo)(() => mapProtectedScreen({ guard: true, children: props.children }).children, [props.children]);
449
+ const rnChildren = (0, react_1.useMemo)(() => (0, stack_utils_1.mapProtectedScreen)({ guard: true, children: props.children }).children, [props.children]);
484
450
  return (<RNStack {...props} children={rnChildren} screenOptions={screenOptions} UNSTABLE_router={exports.stackRouterOverride}/>);
485
451
  }, {
486
452
  Screen: stack_utils_1.StackScreen,