expo-router 7.0.0-canary-20251216-6e1f9a7 → 7.0.0-canary-20251216-3f01dbf

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 (46) hide show
  1. package/android/build.gradle +2 -2
  2. package/build/layouts/StackClient.d.ts +2 -2
  3. package/build/layouts/stack-utils/StackHeaderComponent.d.ts +84 -1
  4. package/build/layouts/stack-utils/StackHeaderComponent.d.ts.map +1 -1
  5. package/build/layouts/stack-utils/StackHeaderComponent.js +54 -1
  6. package/build/layouts/stack-utils/StackHeaderComponent.js.map +1 -1
  7. package/build/layouts/stack-utils/StackHeaderLeftRight.d.ts +107 -3
  8. package/build/layouts/stack-utils/StackHeaderLeftRight.d.ts.map +1 -1
  9. package/build/layouts/stack-utils/StackHeaderLeftRight.js +101 -8
  10. package/build/layouts/stack-utils/StackHeaderLeftRight.js.map +1 -1
  11. package/build/layouts/stack-utils/index.d.ts +2 -2
  12. package/expo-module.config.json +1 -1
  13. package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.module → 7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.module} +7 -7
  14. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.module.md5 +1 -0
  15. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.module.sha1 +1 -0
  16. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.module.sha256 +1 -0
  17. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.module.sha512 +1 -0
  18. package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.pom → 7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.pom} +1 -1
  19. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.pom.md5 +1 -0
  20. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.pom.sha1 +1 -0
  21. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.pom.sha256 +1 -0
  22. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.pom.sha512 +1 -0
  23. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml +4 -4
  24. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.md5 +1 -1
  25. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha1 +1 -1
  26. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha256 +1 -1
  27. package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha512 +1 -1
  28. package/package.json +10 -10
  29. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.module.md5 +0 -1
  30. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.module.sha1 +0 -1
  31. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.module.sha256 +0 -1
  32. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.module.sha512 +0 -1
  33. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.pom.md5 +0 -1
  34. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.pom.sha1 +0 -1
  35. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.pom.sha256 +0 -1
  36. package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.pom.sha512 +0 -1
  37. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7-sources.jar → 7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf-sources.jar} +0 -0
  38. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7-sources.jar.md5 → 7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf-sources.jar.md5} +0 -0
  39. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7-sources.jar.sha1 → 7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf-sources.jar.sha1} +0 -0
  40. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7-sources.jar.sha256 → 7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf-sources.jar.sha256} +0 -0
  41. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7-sources.jar.sha512 → 7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf-sources.jar.sha512} +0 -0
  42. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.aar → 7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.aar} +0 -0
  43. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.aar.md5 → 7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.aar.md5} +0 -0
  44. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.aar.sha1 → 7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.aar.sha1} +0 -0
  45. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.aar.sha256 → 7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.aar.sha256} +0 -0
  46. /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251216-6e1f9a7/expo.modules.router-7.0.0-canary-20251216-6e1f9a7.aar.sha512 → 7.0.0-canary-20251216-3f01dbf/expo.modules.router-7.0.0-canary-20251216-3f01dbf.aar.sha512} +0 -0
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'expo.modules.router'
7
- version = '7.0.0-canary-20251216-6e1f9a7'
7
+ version = '7.0.0-canary-20251216-3f01dbf'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.router"
11
11
  defaultConfig {
12
12
  versionCode 1
13
- versionName "7.0.0-canary-20251216-6e1f9a7"
13
+ versionName "7.0.0-canary-20251216-3f01dbf"
14
14
  }
15
15
  lintOptions {
16
16
  abortOnError false
@@ -154,8 +154,8 @@ declare const Stack: ((props: ComponentProps<typeof RNStack>) => React.JSX.Eleme
154
154
  Screen: typeof StackScreen;
155
155
  Protected: React.FunctionComponent<ProtectedProps>;
156
156
  Header: typeof import("./stack-utils/StackHeaderComponent").StackHeaderComponent & {
157
- Left: typeof import("./stack-utils").StackHeaderLeft;
158
- Right: typeof import("./stack-utils").StackHeaderRight;
157
+ Left: React.FC<import("./stack-utils").StackHeaderLeftProps>;
158
+ Right: React.FC<import("./stack-utils").StackHeaderRightProps>;
159
159
  BackButton: typeof import("./stack-utils").StackHeaderBackButton;
160
160
  Title: typeof import("./stack-utils").StackHeaderTitle;
161
161
  SearchBar: typeof import("./stack-utils").StackHeaderSearchBar;
@@ -3,20 +3,103 @@ import { type ReactNode } from 'react';
3
3
  import { type ColorValue, type StyleProp } from 'react-native';
4
4
  import type { ScreenStackHeaderConfigProps } from 'react-native-screens';
5
5
  export interface StackHeaderProps {
6
+ /**
7
+ * Child elements to compose the header. Can include Stack.Header.Title, Stack.Header.Left,
8
+ * Stack.Header.Right, Stack.Header.BackButton, and Stack.Header.SearchBar components.
9
+ */
6
10
  children?: ReactNode;
11
+ /**
12
+ * Whether to hide the header completely. When set to `true`, the header will not be rendered.
13
+ *
14
+ * @default false
15
+ */
7
16
  hidden?: boolean;
17
+ /**
18
+ * When `true`, renders children as a custom header component, replacing the default header entirely.
19
+ * Use this to implement fully custom header layouts.
20
+ *
21
+ * @default false
22
+ */
8
23
  asChild?: boolean;
24
+ /**
25
+ * The blur effect to apply to the header background on iOS.
26
+ * Common values include 'regular', 'prominent', 'systemMaterial', etc.
27
+ *
28
+ * @platform ios
29
+ */
9
30
  blurEffect?: ScreenStackHeaderConfigProps['blurEffect'];
31
+ /**
32
+ * Style properties for the standard-sized header.
33
+ * - `color`: Tint color for header elements (similar to tintColor in React Navigation)
34
+ * - `backgroundColor`: Background color of the header
35
+ * - `shadowColor`: Set to 'transparent' to hide the header shadow/border
36
+ */
10
37
  style?: StyleProp<{
11
38
  color?: ColorValue;
12
39
  backgroundColor?: ScreenStackHeaderConfigProps['backgroundColor'];
13
40
  shadowColor?: undefined | 'transparent';
14
41
  }>;
42
+ /**
43
+ * Style properties for the large title header (iOS).
44
+ * - `backgroundColor`: Background color of the large title header
45
+ * - `shadowColor`: Set to 'transparent' to hide the large title shadow/border
46
+ *
47
+ * @platform ios
48
+ */
15
49
  largeStyle?: StyleProp<{
16
50
  backgroundColor?: ScreenStackHeaderConfigProps['largeTitleBackgroundColor'];
17
51
  shadowColor?: undefined | 'transparent';
18
52
  }>;
19
53
  }
20
- export declare function StackHeaderComponent(props: StackHeaderProps): null;
54
+ /**
55
+ * The component used to configure the whole stack header.
56
+ *
57
+ * When used inside a screen, it allows you to customize the header dynamically by composing
58
+ * header subcomponents (title, left/right areas, back button, search bar, etc.).
59
+ *
60
+ * ```tsx
61
+ * import { Stack } from 'expo-router';
62
+ *
63
+ * export default function Page() {
64
+ * return (
65
+ * <>
66
+ * <Stack.Header>
67
+ * <Stack.Header.Title>Page title</Stack.Header.Title>
68
+ * <Stack.Header.Left>
69
+ * <Stack.Header.Button onPress={() => alert('Left pressed')} />
70
+ * </Stack.Header.Left>
71
+ * <Stack.Header.Right>
72
+ * <Stack.Header.Button onPress={() => alert('Right pressed')} />
73
+ * </Stack.Header.Right>
74
+ * </Stack.Header>
75
+ * <ScreenContent />
76
+ * </>
77
+ * );
78
+ * }
79
+ * ```
80
+ *
81
+ * When used inside a layout, it needs to be wrapped in `Stack.Screen` to take effect.
82
+ *
83
+ * Example (inside a layout):
84
+ * ```tsx
85
+ * import { Stack } from 'expo-router';
86
+ *
87
+ * export default function Layout() {
88
+ * return (
89
+ * <Stack>
90
+ * <Stack.Screen name="index">
91
+ * <Stack.Header>
92
+ * <Stack.Header.Title>Layout title</Stack.Header.Title>
93
+ * <Stack.Header.Right>
94
+ * <Stack.Header.Button onPress={() => alert('Right pressed')} />
95
+ * </Stack.Header.Right>
96
+ * </Stack.Header>
97
+ * </Stack.Screen>
98
+ * </Stack>
99
+ * );
100
+ * }
101
+ * ```
102
+ */
103
+ export declare function StackHeaderComponent(props: StackHeaderProps): import("react").JSX.Element;
21
104
  export declare function appendStackHeaderPropsToOptions(options: NativeStackNavigationOptions, props: StackHeaderProps): NativeStackNavigationOptions;
22
105
  //# sourceMappingURL=StackHeaderComponent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StackHeaderComponent.d.ts","sourceRoot":"","sources":["../../../src/layouts/stack-utils/StackHeaderComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAc,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAmBzE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,4BAA4B,CAAC,YAAY,CAAC,CAAC;IACxD,KAAK,CAAC,EAAE,SAAS,CAAC;QAChB,KAAK,CAAC,EAAE,UAAU,CAAC;QACnB,eAAe,CAAC,EAAE,4BAA4B,CAAC,iBAAiB,CAAC,CAAC;QAClE,WAAW,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;KACzC,CAAC,CAAC;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;QACrB,eAAe,CAAC,EAA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CAAC;KACzC,CAAC,CAAC;CACJ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,+BAK3D;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,4BAA4B,EACrC,KAAK,EAAE,gBAAgB,GACtB,4BAA4B,CAqD9B"}
@@ -9,8 +9,61 @@ const StackHeaderLeftRight_1 = require("./StackHeaderLeftRight");
9
9
  const StackHeaderSearchBar_1 = require("./StackHeaderSearchBar");
10
10
  const StackHeaderTitle_1 = require("./StackHeaderTitle");
11
11
  const children_1 = require("../../utils/children");
12
+ const Screen_1 = require("../../views/Screen");
13
+ /**
14
+ * The component used to configure the whole stack header.
15
+ *
16
+ * When used inside a screen, it allows you to customize the header dynamically by composing
17
+ * header subcomponents (title, left/right areas, back button, search bar, etc.).
18
+ *
19
+ * ```tsx
20
+ * import { Stack } from 'expo-router';
21
+ *
22
+ * export default function Page() {
23
+ * return (
24
+ * <>
25
+ * <Stack.Header>
26
+ * <Stack.Header.Title>Page title</Stack.Header.Title>
27
+ * <Stack.Header.Left>
28
+ * <Stack.Header.Button onPress={() => alert('Left pressed')} />
29
+ * </Stack.Header.Left>
30
+ * <Stack.Header.Right>
31
+ * <Stack.Header.Button onPress={() => alert('Right pressed')} />
32
+ * </Stack.Header.Right>
33
+ * </Stack.Header>
34
+ * <ScreenContent />
35
+ * </>
36
+ * );
37
+ * }
38
+ * ```
39
+ *
40
+ * When used inside a layout, it needs to be wrapped in `Stack.Screen` to take effect.
41
+ *
42
+ * Example (inside a layout):
43
+ * ```tsx
44
+ * import { Stack } from 'expo-router';
45
+ *
46
+ * export default function Layout() {
47
+ * return (
48
+ * <Stack>
49
+ * <Stack.Screen name="index">
50
+ * <Stack.Header>
51
+ * <Stack.Header.Title>Layout title</Stack.Header.Title>
52
+ * <Stack.Header.Right>
53
+ * <Stack.Header.Button onPress={() => alert('Right pressed')} />
54
+ * </Stack.Header.Right>
55
+ * </Stack.Header>
56
+ * </Stack.Screen>
57
+ * </Stack>
58
+ * );
59
+ * }
60
+ * ```
61
+ */
12
62
  function StackHeaderComponent(props) {
13
- return null;
63
+ // This component will only render when used inside a page
64
+ // but only if it is not wrapped in Stack.Screen
65
+ const updatedOptions = (0, react_1.useMemo)(() => appendStackHeaderPropsToOptions({}, props), [props]);
66
+ return <Screen_1.Screen options={updatedOptions}/>;
14
67
  }
15
68
  function appendStackHeaderPropsToOptions(options, props) {
16
69
  const flattenedStyle = react_native_1.StyleSheet.flatten(props.style);
@@ -1 +1 @@
1
- {"version":3,"file":"StackHeaderComponent.js","sourceRoot":"","sources":["../../../src/layouts/stack-utils/StackHeaderComponent.tsx"],"names":[],"mappings":";;AAsCA,oDAEC;AAED,0EAwDC;AAjGD,iCAAiE;AACjE,+CAA2E;AAG3E,mEAGiC;AACjC,iEAKgC;AAChC,iEAGgC;AAChC,yDAA4F;AAC5F,mDAAqD;AAkBrD,SAAgB,oBAAoB,CAAC,KAAuB;IAC1D,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,+BAA+B,CAC7C,OAAqC,EACrC,KAAuB;IAEvB,MAAM,cAAc,GAAG,yBAAU,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvD,MAAM,mBAAmB,GAAG,yBAAU,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAEjE,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;IAC5C,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IACtD,CAAC;IAED,IAAI,cAAc,GAAiC;QACjD,GAAG,OAAO;QACV,WAAW,EAAE,CAA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I,CACV,0DAA2D,KAAK,CAAC,IAAyB,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,CAChH,CAAC;QACJ,CAAC;QACD,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,gBAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;QACzC,IAAI,IAAA,sBAAc,EAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,cAAc,GAAG,kBAAkB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,cAAc,CAAC;AACxB,CAAC","sourcesContent":["import { NativeStackNavigationOptions } from '@react-navigation/native-stack';\nimport { Children, isValidElement, type ReactNode } from 'react';\nimport { StyleSheet, type ColorValue, type StyleProp } from 'react-native';\nimport type { ScreenStackHeaderConfigProps } from 'react-native-screens';\n\nimport {\n appendStackHeaderBackButtonPropsToOptions,\n StackHeaderBackButton,\n} from './StackHeaderBackButton';\nimport {\n appendStackHeaderLeftPropsToOptions,\n appendStackHeaderRightPropsToOptions,\n StackHeaderLeft,\n StackHeaderRight,\n} from './StackHeaderLeftRight';\nimport {\n appendStackHeaderSearchBarPropsToOptions,\n StackHeaderSearchBar,\n} from './StackHeaderSearchBar';\nimport { appendStackHeaderTitlePropsToOptions, StackHeaderTitle } from './StackHeaderTitle';\nimport { isChildOfType } from '../../utils/children';\n\nexport interface StackHeaderProps {\n children?: ReactNode;\n hidden?: boolean;\n asChild?: boolean;\n blurEffect?: ScreenStackHeaderConfigProps['blurEffect'];\n style?: StyleProp<{\n color?: ColorValue; // tintColor from ReactNavigation\n backgroundColor?: ScreenStackHeaderConfigProps['backgroundColor'];\n shadowColor?: undefined | 'transparent';\n }>;\n largeStyle?: StyleProp<{\n backgroundColor?: ScreenStackHeaderConfigProps['largeTitleBackgroundColor'];\n shadowColor?: undefined | 'transparent';\n }>;\n}\n\nexport function StackHeaderComponent(props: StackHeaderProps) {\n return null;\n}\n\nexport function appendStackHeaderPropsToOptions(\n options: NativeStackNavigationOptions,\n props: StackHeaderProps\n): NativeStackNavigationOptions {\n const flattenedStyle = StyleSheet.flatten(props.style);\n const flattenedLargeStyle = StyleSheet.flatten(props.largeStyle);\n\n if (props.hidden) {\n return { ...options, headerShown: false };\n }\n\n if (props.asChild) {\n return { ...options, header: () => props.children };\n }\n\n let updatedOptions: NativeStackNavigationOptions = {\n ...options,\n headerShown: !props.hidden,\n headerBlurEffect: props.blurEffect,\n headerStyle: {\n backgroundColor: flattenedStyle?.backgroundColor as string | undefined,\n },\n headerLargeStyle: {\n backgroundColor: flattenedLargeStyle?.backgroundColor as string | undefined,\n },\n headerShadowVisible: flattenedStyle?.shadowColor !== 'transparent',\n headerLargeTitleShadowVisible: flattenedLargeStyle?.shadowColor !== 'transparent',\n };\n\n function appendChildOptions(child: React.ReactElement, options: NativeStackNavigationOptions) {\n let updatedOptions = options;\n if (isChildOfType(child, StackHeaderTitle)) {\n updatedOptions = appendStackHeaderTitlePropsToOptions(updatedOptions, child.props);\n } else if (isChildOfType(child, StackHeaderLeft)) {\n updatedOptions = appendStackHeaderLeftPropsToOptions(updatedOptions, child.props);\n } else if (isChildOfType(child, StackHeaderRight)) {\n updatedOptions = appendStackHeaderRightPropsToOptions(updatedOptions, child.props);\n } else if (isChildOfType(child, StackHeaderBackButton)) {\n updatedOptions = appendStackHeaderBackButtonPropsToOptions(updatedOptions, child.props);\n } else if (isChildOfType(child, StackHeaderSearchBar)) {\n updatedOptions = appendStackHeaderSearchBarPropsToOptions(updatedOptions, child.props);\n } else {\n console.warn(\n `Warning: Unknown child element passed to Stack.Header: ${(child.type as { name: string }).name ?? child.type}`\n );\n }\n return updatedOptions;\n }\n\n Children.forEach(props.children, (child) => {\n if (isValidElement(child)) {\n updatedOptions = appendChildOptions(child, updatedOptions);\n }\n });\n\n return updatedOptions;\n}\n"]}
1
+ {"version":3,"file":"StackHeaderComponent.js","sourceRoot":"","sources":["../../../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AC;IAED,gBAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;QACzC,IAAI,IAAA,sBAAc,EAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,cAAc,GAAG,kBAAkB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,cAAc,CAAC;AACxB,CAAC","sourcesContent":["import { NativeStackNavigationOptions } from '@react-navigation/native-stack';\nimport { Children, isValidElement, useMemo, type ReactNode } from 'react';\nimport { StyleSheet, type ColorValue, type StyleProp } from 'react-native';\nimport type { ScreenStackHeaderConfigProps } from 'react-native-screens';\n\nimport {\n appendStackHeaderBackButtonPropsToOptions,\n StackHeaderBackButton,\n} from './StackHeaderBackButton';\nimport {\n appendStackHeaderLeftPropsToOptions,\n appendStackHeaderRightPropsToOptions,\n StackHeaderLeft,\n StackHeaderRight,\n} from './StackHeaderLeftRight';\nimport {\n appendStackHeaderSearchBarPropsToOptions,\n StackHeaderSearchBar,\n} from './StackHeaderSearchBar';\nimport { appendStackHeaderTitlePropsToOptions, StackHeaderTitle } from './StackHeaderTitle';\nimport { isChildOfType } from '../../utils/children';\nimport { Screen } from '../../views/Screen';\n\nexport interface StackHeaderProps {\n /**\n * Child elements to compose the header. Can include Stack.Header.Title, Stack.Header.Left,\n * Stack.Header.Right, Stack.Header.BackButton, and Stack.Header.SearchBar components.\n */\n children?: ReactNode;\n /**\n * Whether to hide the header completely. When set to `true`, the header will not be rendered.\n *\n * @default false\n */\n hidden?: boolean;\n /**\n * When `true`, renders children as a custom header component, replacing the default header entirely.\n * Use this to implement fully custom header layouts.\n *\n * @default false\n */\n asChild?: boolean;\n /**\n * The blur effect to apply to the header background on iOS.\n * Common values include 'regular', 'prominent', 'systemMaterial', etc.\n *\n * @platform ios\n */\n blurEffect?: ScreenStackHeaderConfigProps['blurEffect'];\n /**\n * Style properties for the standard-sized header.\n * - `color`: Tint color for header elements (similar to tintColor in React Navigation)\n * - `backgroundColor`: Background color of the header\n * - `shadowColor`: Set to 'transparent' to hide the header shadow/border\n */\n style?: StyleProp<{\n color?: ColorValue; // tintColor from ReactNavigation\n backgroundColor?: ScreenStackHeaderConfigProps['backgroundColor'];\n shadowColor?: undefined | 'transparent';\n }>;\n /**\n * Style properties for the large title header (iOS).\n * - `backgroundColor`: Background color of the large title header\n * - `shadowColor`: Set to 'transparent' to hide the large title shadow/border\n *\n * @platform ios\n */\n largeStyle?: StyleProp<{\n backgroundColor?: ScreenStackHeaderConfigProps['largeTitleBackgroundColor'];\n shadowColor?: undefined | 'transparent';\n }>;\n}\n\n/**\n * The component used to configure the whole stack header.\n *\n * When used inside a screen, it allows you to customize the header dynamically by composing\n * header subcomponents (title, left/right areas, back button, search bar, etc.).\n *\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Header>\n * <Stack.Header.Title>Page title</Stack.Header.Title>\n * <Stack.Header.Left>\n * <Stack.Header.Button onPress={() => alert('Left pressed')} />\n * </Stack.Header.Left>\n * <Stack.Header.Right>\n * <Stack.Header.Button onPress={() => alert('Right pressed')} />\n * </Stack.Header.Right>\n * </Stack.Header>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * When used inside a layout, it needs to be wrapped in `Stack.Screen` to take effect.\n *\n * Example (inside a layout):\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Layout() {\n * return (\n * <Stack>\n * <Stack.Screen name=\"index\">\n * <Stack.Header>\n * <Stack.Header.Title>Layout title</Stack.Header.Title>\n * <Stack.Header.Right>\n * <Stack.Header.Button onPress={() => alert('Right pressed')} />\n * </Stack.Header.Right>\n * </Stack.Header>\n * </Stack.Screen>\n * </Stack>\n * );\n * }\n * ```\n */\nexport function StackHeaderComponent(props: StackHeaderProps) {\n // This component will only render when used inside a page\n // but only if it is not wrapped in Stack.Screen\n const updatedOptions = useMemo(() => appendStackHeaderPropsToOptions({}, props), [props]);\n return <Screen options={updatedOptions} />;\n}\n\nexport function appendStackHeaderPropsToOptions(\n options: NativeStackNavigationOptions,\n props: StackHeaderProps\n): NativeStackNavigationOptions {\n const flattenedStyle = StyleSheet.flatten(props.style);\n const flattenedLargeStyle = StyleSheet.flatten(props.largeStyle);\n\n if (props.hidden) {\n return { ...options, headerShown: false };\n }\n\n if (props.asChild) {\n return { ...options, header: () => props.children };\n }\n\n let updatedOptions: NativeStackNavigationOptions = {\n ...options,\n headerShown: !props.hidden,\n headerBlurEffect: props.blurEffect,\n headerStyle: {\n backgroundColor: flattenedStyle?.backgroundColor as string | undefined,\n },\n headerLargeStyle: {\n backgroundColor: flattenedLargeStyle?.backgroundColor as string | undefined,\n },\n headerShadowVisible: flattenedStyle?.shadowColor !== 'transparent',\n headerLargeTitleShadowVisible: flattenedLargeStyle?.shadowColor !== 'transparent',\n };\n\n function appendChildOptions(child: React.ReactElement, options: NativeStackNavigationOptions) {\n let updatedOptions = options;\n if (isChildOfType(child, StackHeaderTitle)) {\n updatedOptions = appendStackHeaderTitlePropsToOptions(updatedOptions, child.props);\n } else if (isChildOfType(child, StackHeaderLeft)) {\n updatedOptions = appendStackHeaderLeftPropsToOptions(updatedOptions, child.props);\n } else if (isChildOfType(child, StackHeaderRight)) {\n updatedOptions = appendStackHeaderRightPropsToOptions(updatedOptions, child.props);\n } else if (isChildOfType(child, StackHeaderBackButton)) {\n updatedOptions = appendStackHeaderBackButtonPropsToOptions(updatedOptions, child.props);\n } else if (isChildOfType(child, StackHeaderSearchBar)) {\n updatedOptions = appendStackHeaderSearchBarPropsToOptions(updatedOptions, child.props);\n } else {\n console.warn(\n `Warning: Unknown child element passed to Stack.Header: ${(child.type as { name: string }).name ?? child.type}`\n );\n }\n return updatedOptions;\n }\n\n Children.forEach(props.children, (child) => {\n if (isValidElement(child)) {\n updatedOptions = appendChildOptions(child, updatedOptions);\n }\n });\n\n return updatedOptions;\n}\n"]}
@@ -1,15 +1,119 @@
1
1
  import { NativeStackNavigationOptions } from '@react-navigation/native-stack';
2
- import { type ReactNode } from 'react';
2
+ import React, { type ReactNode } from 'react';
3
3
  export interface StackHeaderLeftProps {
4
+ /**
5
+ * Child elements to compose the left area of the header. Can include Stack.Header.Button,
6
+ * Stack.Header.Menu, Stack.Header.Item, and Stack.Header.Spacer components.
7
+ */
4
8
  children?: ReactNode;
9
+ /**
10
+ * When `true`, renders children as a custom component in the header left area,
11
+ * replacing the default header left layout.
12
+ *
13
+ * @default false
14
+ */
5
15
  asChild?: boolean;
6
16
  }
7
17
  export interface StackHeaderRightProps {
18
+ /**
19
+ * Child elements to compose the right area of the header. Can include Stack.Header.Button,
20
+ * Stack.Header.Menu, Stack.Header.Item, and Stack.Header.Spacer components.
21
+ */
8
22
  children?: ReactNode;
23
+ /**
24
+ * When `true`, renders children as a custom component in the header right area,
25
+ * replacing the default header right layout.
26
+ *
27
+ * @default false
28
+ */
9
29
  asChild?: boolean;
10
30
  }
11
- export declare function StackHeaderLeft(props: StackHeaderLeftProps): null;
12
- export declare function StackHeaderRight(props: StackHeaderRightProps): null;
31
+ /**
32
+ * The component used to configure the left area of the stack header.
33
+ *
34
+ * When used inside a screen, it allows you to customize the left side of the header dynamically.
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * import { Stack } from 'expo-router';
39
+ *
40
+ * export default function Page() {
41
+ * return (
42
+ * <>
43
+ * <Stack.Header.Left>
44
+ * <Stack.Header.Button onPress={() => alert('Left button pressed!')} />
45
+ * </Stack.Header.Left>
46
+ * <ScreenContent />
47
+ * </>
48
+ * );
49
+ * }
50
+ * ```
51
+ *
52
+ * When used inside the layout, it needs to be wrapped in `Stack.Header` to take effect.
53
+ *
54
+ * @example
55
+ * ```tsx
56
+ * import { Stack } from 'expo-router';
57
+ *
58
+ * export default function Layout() {
59
+ * return (
60
+ * <Stack>
61
+ * <Stack.Screen name="index">
62
+ * <Stack.Header>
63
+ * <Stack.Header.Left>
64
+ * <Stack.Header.Button onPress={() => alert('Left button pressed!')} />
65
+ * </Stack.Header.Left>
66
+ * </Stack.Header>
67
+ * </Stack.Screen>
68
+ * </Stack>
69
+ * );
70
+ * }
71
+ * ```
72
+ */
73
+ export declare const StackHeaderLeft: React.FC<StackHeaderLeftProps>;
74
+ /**
75
+ * The component used to configure the right area of the stack header.
76
+ *
77
+ * When used inside a screen, it allows you to customize the right side of the header dynamically.
78
+ *
79
+ * @example
80
+ * ```tsx
81
+ * import { Stack } from 'expo-router';
82
+ *
83
+ * export default function Page() {
84
+ * return (
85
+ * <>
86
+ * <Stack.Header.Right>
87
+ * <Stack.Header.Button onPress={() => alert('Right button pressed!')} />
88
+ * </Stack.Header.Right>
89
+ * <ScreenContent />
90
+ * </>
91
+ * );
92
+ * }
93
+ * ```
94
+ *
95
+ * When used inside the layout, it needs to be wrapped in `Stack.Header` to take effect.
96
+ *
97
+ * @example
98
+ * ```tsx
99
+ * import { Stack } from 'expo-router';
100
+ *
101
+ * export default function Layout() {
102
+ * return (
103
+ * <Stack>
104
+ * <Stack.Screen name="index">
105
+ * <Stack.Header>
106
+ * <Stack.Header.Right>
107
+ * <Stack.Header.Button onPress={() => alert('Right button pressed!')} />
108
+ * </Stack.Header.Right>
109
+ * </Stack.Header>
110
+ * </Stack.Screen>
111
+ * </Stack>
112
+ * );
113
+ * }
114
+ * ```
115
+ */
116
+ export declare const StackHeaderRight: React.FC<StackHeaderRightProps>;
13
117
  export declare function appendStackHeaderRightPropsToOptions(options: NativeStackNavigationOptions, props: StackHeaderRightProps): NativeStackNavigationOptions;
14
118
  export declare function appendStackHeaderLeftPropsToOptions(options: NativeStackNavigationOptions, props: StackHeaderLeftProps): NativeStackNavigationOptions;
15
119
  //# sourceMappingURL=StackHeaderLeftRight.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StackHeaderLeftRight.d.ts","sourceRoot":"","sources":["../../../src/layouts/stack-utils/StackHeaderLeftRight.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAK5D,CAAC;AA+CF,wBAAgB,oCAAoC,CAClD,OAAO,EAAE,4BAA4B,EACrC,KAAK,EAAE,qBAAqB,GAC3B,4BAA4B,CAe9B;AAED,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,4BAA4B,EACrC,KAAK,EAAE,oBAAoB,GAC1B,4BAA4B,CAW9B"}
@@ -33,22 +33,115 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.StackHeaderLeft = StackHeaderLeft;
37
- exports.StackHeaderRight = StackHeaderRight;
36
+ exports.StackHeaderRight = exports.StackHeaderLeft = void 0;
38
37
  exports.appendStackHeaderRightPropsToOptions = appendStackHeaderRightPropsToOptions;
39
38
  exports.appendStackHeaderLeftPropsToOptions = appendStackHeaderLeftPropsToOptions;
40
39
  const react_1 = __importStar(require("react"));
40
+ const react_2 = require("react");
41
41
  const StackHeaderButton_1 = require("./StackHeaderButton");
42
42
  const StackHeaderItem_1 = require("./StackHeaderItem");
43
43
  const StackHeaderMenu_1 = require("./StackHeaderMenu");
44
44
  const StackHeaderSpacer_1 = require("./StackHeaderSpacer");
45
45
  const children_1 = require("../../utils/children");
46
- function StackHeaderLeft(props) {
47
- return null;
48
- }
49
- function StackHeaderRight(props) {
50
- return null;
51
- }
46
+ const Screen_1 = require("../../views/Screen");
47
+ /**
48
+ * The component used to configure the left area of the stack header.
49
+ *
50
+ * When used inside a screen, it allows you to customize the left side of the header dynamically.
51
+ *
52
+ * @example
53
+ * ```tsx
54
+ * import { Stack } from 'expo-router';
55
+ *
56
+ * export default function Page() {
57
+ * return (
58
+ * <>
59
+ * <Stack.Header.Left>
60
+ * <Stack.Header.Button onPress={() => alert('Left button pressed!')} />
61
+ * </Stack.Header.Left>
62
+ * <ScreenContent />
63
+ * </>
64
+ * );
65
+ * }
66
+ * ```
67
+ *
68
+ * When used inside the layout, it needs to be wrapped in `Stack.Header` to take effect.
69
+ *
70
+ * @example
71
+ * ```tsx
72
+ * import { Stack } from 'expo-router';
73
+ *
74
+ * export default function Layout() {
75
+ * return (
76
+ * <Stack>
77
+ * <Stack.Screen name="index">
78
+ * <Stack.Header>
79
+ * <Stack.Header.Left>
80
+ * <Stack.Header.Button onPress={() => alert('Left button pressed!')} />
81
+ * </Stack.Header.Left>
82
+ * </Stack.Header>
83
+ * </Stack.Screen>
84
+ * </Stack>
85
+ * );
86
+ * }
87
+ * ```
88
+ */
89
+ const StackHeaderLeft = (props) => {
90
+ // This component will only render when used inside a page
91
+ // but only if it is not wrapped in Stack.Screen.Header
92
+ const updatedOptions = (0, react_2.useMemo)(() => appendStackHeaderLeftPropsToOptions({}, props), [props]);
93
+ return <Screen_1.Screen options={updatedOptions}/>;
94
+ };
95
+ exports.StackHeaderLeft = StackHeaderLeft;
96
+ /**
97
+ * The component used to configure the right area of the stack header.
98
+ *
99
+ * When used inside a screen, it allows you to customize the right side of the header dynamically.
100
+ *
101
+ * @example
102
+ * ```tsx
103
+ * import { Stack } from 'expo-router';
104
+ *
105
+ * export default function Page() {
106
+ * return (
107
+ * <>
108
+ * <Stack.Header.Right>
109
+ * <Stack.Header.Button onPress={() => alert('Right button pressed!')} />
110
+ * </Stack.Header.Right>
111
+ * <ScreenContent />
112
+ * </>
113
+ * );
114
+ * }
115
+ * ```
116
+ *
117
+ * When used inside the layout, it needs to be wrapped in `Stack.Header` to take effect.
118
+ *
119
+ * @example
120
+ * ```tsx
121
+ * import { Stack } from 'expo-router';
122
+ *
123
+ * export default function Layout() {
124
+ * return (
125
+ * <Stack>
126
+ * <Stack.Screen name="index">
127
+ * <Stack.Header>
128
+ * <Stack.Header.Right>
129
+ * <Stack.Header.Button onPress={() => alert('Right button pressed!')} />
130
+ * </Stack.Header.Right>
131
+ * </Stack.Header>
132
+ * </Stack.Screen>
133
+ * </Stack>
134
+ * );
135
+ * }
136
+ * ```
137
+ */
138
+ const StackHeaderRight = (props) => {
139
+ // This component will only render when used inside a page
140
+ // but only if it is not wrapped in Stack.Screen.Header
141
+ const updatedOptions = (0, react_2.useMemo)(() => appendStackHeaderRightPropsToOptions({}, props), [props]);
142
+ return <Screen_1.Screen options={updatedOptions}/>;
143
+ };
144
+ exports.StackHeaderRight = StackHeaderRight;
52
145
  function convertHeaderRightLeftChildrenToUnstableItems(children, side) {
53
146
  const allChildren = react_1.default.Children.toArray(children);
54
147
  const actions = allChildren.filter((child) => (0, children_1.isChildOfType)(child, StackHeaderButton_1.StackHeaderButton) ||
@@ -1 +1 @@
1
- {"version":3,"file":"StackHeaderLeftRight.js","sourceRoot":"","sources":["../../../src/layouts/stack-utils/StackHeaderLeftRight.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,0CAEC;AAED,4CAEC;AA+CD,oFAkBC;AAED,kFAcC;AA/GD,+CAAwE;AAExE,2DAG6B;AAC7B,uDAA+F;AAC/F,uDAA+F;AAC/F,2DAG6B;AAC7B,mDAAqD;AAYrD,SAAgB,eAAe,CAAC,KAA2B;IACzD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,gBAAgB,CAAC,KAA4B;IAC3D,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,6CAA6C,CACpD,QAAyB,EACzB,IAAsB;IAItB,MAAM,WAAW,GAAG,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrD,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAChC,CAAC,KAAK,EAAE,EAAE,CACR,IAAA,wBAAa,EAAC,KAAK,EAAE,qCAAiB,CAAC;QACvC,IAAA,wBAAa,EAAC,KAAK,EAAE,iCAAe,CAAC;QACrC,IAAA,wBAAa,EAAC,KAAK,EAAE,qCAAiB,CAAC;QACvC,IAAA,wBAAa,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AAC,EAAE,CAAC;YACpD,OAAO,IAAA,+DAA2C,EAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,IAAA,2DAAyC,EAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAgB,oCAAoC,CAClD,OAAqC,EACrC,KAA4B;IAE5B,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO;YACL,GAAG,OAAO;YACV,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ;SAClC,CAAC;IACJ,CAAC;IAED,OAAO;QACL,GAAG,OAAO;QACV,yBAAyB,EAAE,6CAA6C,CACtE,KAAK,CAAC,QAAQ,EACd,OAAO,CACR;KACF,CAAC;AACJ,CAAC;AAED,SAAgB,mCAAmC,CACjD,OAAqC,EACrC,KAA2B;IAE3B,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO;YACL,GAAG,OAAO;YACV,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ;SACjC,CAAC;IACJ,CAAC;IACD,OAAO;QACL,GAAG,OAAO;QACV,wBAAwB,EAAE,6CAA6C,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC;KAChG,CAAC;AACJ,CAAC","sourcesContent":["import { NativeStackNavigationOptions } from '@react-navigation/native-stack';\nimport React, { Fragment, isValidElement, type ReactNode } from 'react';\n\nimport {\n convertStackHeaderButtonPropsToRNHeaderItem,\n StackHeaderButton,\n} from './StackHeaderButton';\nimport { convertStackHeaderItemPropsToRNHeaderItem, StackHeaderItem } from './StackHeaderItem';\nimport { convertStackHeaderMenuPropsToRNHeaderItem, StackHeaderMenu } from './StackHeaderMenu';\nimport {\n convertStackHeaderSpacerPropsToRNHeaderItem,\n StackHeaderSpacer,\n} from './StackHeaderSpacer';\nimport { isChildOfType } from '../../utils/children';\n\nexport interface StackHeaderLeftProps {\n children?: ReactNode;\n asChild?: boolean;\n}\n\nexport interface StackHeaderRightProps {\n children?: ReactNode;\n asChild?: boolean;\n}\n\nexport function StackHeaderLeft(props: StackHeaderLeftProps) {\n return null;\n}\n\nexport function StackHeaderRight(props: StackHeaderRightProps) {\n return null;\n}\n\nfunction convertHeaderRightLeftChildrenToUnstableItems(\n children: React.ReactNode,\n side: 'Left' | 'Right'\n):\n | NativeStackNavigationOptions['unstable_headerRightItems']\n | NativeStackNavigationOptions['unstable_headerLeftItems'] {\n const allChildren = React.Children.toArray(children);\n const actions = allChildren.filter(\n (child) =>\n isChildOfType(child, StackHeaderButton) ||\n isChildOfType(child, StackHeaderMenu) ||\n isChildOfType(child, StackHeaderSpacer) ||\n isChildOfType(child, StackHeaderItem)\n );\n if (actions.length !== allChildren.length && process.env.NODE_ENV !== 'production') {\n const otherElements = allChildren\n .filter((child) => !actions.some((action) => action === child))\n .map((e) => {\n if (isValidElement(e)) {\n if (e.type === Fragment) {\n return '<Fragment>';\n } else {\n return (e.type as { name: string })?.name ?? e.type;\n }\n }\n\n return String(e);\n });\n console.warn(\n `Stack.Header.${side} only accepts <Stack.Header.Button>, <Stack.Header.Menu>, <Menu>, and <Stack.Header.Item> as children. Found invalid children: ${otherElements.join(', ')}`\n );\n }\n return () =>\n actions.map((action) => {\n if (isChildOfType(action, StackHeaderButton)) {\n return convertStackHeaderButtonPropsToRNHeaderItem(action.props);\n } else if (isChildOfType(action, StackHeaderMenu)) {\n return convertStackHeaderMenuPropsToRNHeaderItem(action.props);\n } else if (isChildOfType(action, StackHeaderSpacer)) {\n return convertStackHeaderSpacerPropsToRNHeaderItem(action.props);\n }\n return convertStackHeaderItemPropsToRNHeaderItem(action.props);\n });\n}\n\nexport function appendStackHeaderRightPropsToOptions(\n options: NativeStackNavigationOptions,\n props: StackHeaderRightProps\n): NativeStackNavigationOptions {\n if (props.asChild) {\n return {\n ...options,\n headerRight: () => props.children,\n };\n }\n\n return {\n ...options,\n unstable_headerRightItems: convertHeaderRightLeftChildrenToUnstableItems(\n props.children,\n 'Right'\n ),\n };\n}\n\nexport function appendStackHeaderLeftPropsToOptions(\n options: NativeStackNavigationOptions,\n props: StackHeaderLeftProps\n): NativeStackNavigationOptions {\n if (props.asChild) {\n return {\n ...options,\n headerLeft: () => props.children,\n };\n }\n return {\n ...options,\n unstable_headerLeftItems: convertHeaderRightLeftChildrenToUnstableItems(props.children, 'Left'),\n };\n}\n"]}
1
+ {"version":3,"file":"StackHeaderLeftRight.js","sourceRoot":"","sources":["../../../src/layouts/stack-utils/StackHeaderLeftRight.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8LA,oFAkBC;AAED,kFAcC;AA/ND,+CAAwE;AACxE,iCAAgC;AAEhC,2DAG6B;AAC7B,uDAA+F;AAC/F,uDAA+F;AAC/F,2DAG6B;AAC7B,mDAAqD;AACrD,+CAA4C;AAgC5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACI,MAAM,eAAe,GAAmC,CAAC,KAAK,EAAE,EAAE;IACvE,0DAA0D;IAC1D,uDAAuD;IACvD,MAAM,cAAc,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,mCAAmC,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9F,OAAO,CAAC,eAAM,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,EAAG,CAAC;AAC7C,CAAC,CAAC;AALW,QAAA,eAAe,mBAK1B;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACI,MAAM,gBAAgB,GAAoC,CAAC,KAAK,EAAE,EAAE;IACzE,0DAA0D;IAC1D,uDAAuD;IACvD,MAAM,cAAc,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,oCAAoC,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/F,O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6CAA6C,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC;KAChG,CAAC;AACJ,CAAC","sourcesContent":["import { NativeStackNavigationOptions } from '@react-navigation/native-stack';\nimport React, { Fragment, isValidElement, type ReactNode } from 'react';\nimport { useMemo } from 'react';\n\nimport {\n convertStackHeaderButtonPropsToRNHeaderItem,\n StackHeaderButton,\n} from './StackHeaderButton';\nimport { convertStackHeaderItemPropsToRNHeaderItem, StackHeaderItem } from './StackHeaderItem';\nimport { convertStackHeaderMenuPropsToRNHeaderItem, StackHeaderMenu } from './StackHeaderMenu';\nimport {\n convertStackHeaderSpacerPropsToRNHeaderItem,\n StackHeaderSpacer,\n} from './StackHeaderSpacer';\nimport { isChildOfType } from '../../utils/children';\nimport { Screen } from '../../views/Screen';\n\nexport interface StackHeaderLeftProps {\n /**\n * Child elements to compose the left area of the header. Can include Stack.Header.Button,\n * Stack.Header.Menu, Stack.Header.Item, and Stack.Header.Spacer components.\n */\n children?: ReactNode;\n /**\n * When `true`, renders children as a custom component in the header left area,\n * replacing the default header left layout.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\nexport interface StackHeaderRightProps {\n /**\n * Child elements to compose the right area of the header. Can include Stack.Header.Button,\n * Stack.Header.Menu, Stack.Header.Item, and Stack.Header.Spacer components.\n */\n children?: ReactNode;\n /**\n * When `true`, renders children as a custom component in the header right area,\n * replacing the default header right layout.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\n/**\n * The component used to configure the left area of the stack header.\n *\n * When used inside a screen, it allows you to customize the left side of the header dynamically.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Header.Left>\n * <Stack.Header.Button onPress={() => alert('Left button pressed!')} />\n * </Stack.Header.Left>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * When used inside the layout, it needs to be wrapped in `Stack.Header` to take effect.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Layout() {\n * return (\n * <Stack>\n * <Stack.Screen name=\"index\">\n * <Stack.Header>\n * <Stack.Header.Left>\n * <Stack.Header.Button onPress={() => alert('Left button pressed!')} />\n * </Stack.Header.Left>\n * </Stack.Header>\n * </Stack.Screen>\n * </Stack>\n * );\n * }\n * ```\n */\nexport const StackHeaderLeft: React.FC<StackHeaderLeftProps> = (props) => {\n // This component will only render when used inside a page\n // but only if it is not wrapped in Stack.Screen.Header\n const updatedOptions = useMemo(() => appendStackHeaderLeftPropsToOptions({}, props), [props]);\n return <Screen options={updatedOptions} />;\n};\n\n/**\n * The component used to configure the right area of the stack header.\n *\n * When used inside a screen, it allows you to customize the right side of the header dynamically.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Header.Right>\n * <Stack.Header.Button onPress={() => alert('Right button pressed!')} />\n * </Stack.Header.Right>\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * When used inside the layout, it needs to be wrapped in `Stack.Header` to take effect.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Layout() {\n * return (\n * <Stack>\n * <Stack.Screen name=\"index\">\n * <Stack.Header>\n * <Stack.Header.Right>\n * <Stack.Header.Button onPress={() => alert('Right button pressed!')} />\n * </Stack.Header.Right>\n * </Stack.Header>\n * </Stack.Screen>\n * </Stack>\n * );\n * }\n * ```\n */\nexport const StackHeaderRight: React.FC<StackHeaderRightProps> = (props) => {\n // This component will only render when used inside a page\n // but only if it is not wrapped in Stack.Screen.Header\n const updatedOptions = useMemo(() => appendStackHeaderRightPropsToOptions({}, props), [props]);\n return <Screen options={updatedOptions} />;\n};\n\nfunction convertHeaderRightLeftChildrenToUnstableItems(\n children: React.ReactNode,\n side: 'Left' | 'Right'\n):\n | NativeStackNavigationOptions['unstable_headerRightItems']\n | NativeStackNavigationOptions['unstable_headerLeftItems'] {\n const allChildren = React.Children.toArray(children);\n const actions = allChildren.filter(\n (child) =>\n isChildOfType(child, StackHeaderButton) ||\n isChildOfType(child, StackHeaderMenu) ||\n isChildOfType(child, StackHeaderSpacer) ||\n isChildOfType(child, StackHeaderItem)\n );\n if (actions.length !== allChildren.length && process.env.NODE_ENV !== 'production') {\n const otherElements = allChildren\n .filter((child) => !actions.some((action) => action === child))\n .map((e) => {\n if (isValidElement(e)) {\n if (e.type === Fragment) {\n return '<Fragment>';\n } else {\n return (e.type as { name: string })?.name ?? e.type;\n }\n }\n\n return String(e);\n });\n console.warn(\n `Stack.Header.${side} only accepts <Stack.Header.Button>, <Stack.Header.Menu>, <Menu>, and <Stack.Header.Item> as children. Found invalid children: ${otherElements.join(', ')}`\n );\n }\n return () =>\n actions.map((action) => {\n if (isChildOfType(action, StackHeaderButton)) {\n return convertStackHeaderButtonPropsToRNHeaderItem(action.props);\n } else if (isChildOfType(action, StackHeaderMenu)) {\n return convertStackHeaderMenuPropsToRNHeaderItem(action.props);\n } else if (isChildOfType(action, StackHeaderSpacer)) {\n return convertStackHeaderSpacerPropsToRNHeaderItem(action.props);\n }\n return convertStackHeaderItemPropsToRNHeaderItem(action.props);\n });\n}\n\nexport function appendStackHeaderRightPropsToOptions(\n options: NativeStackNavigationOptions,\n props: StackHeaderRightProps\n): NativeStackNavigationOptions {\n if (props.asChild) {\n return {\n ...options,\n headerRight: () => props.children,\n };\n }\n\n return {\n ...options,\n unstable_headerRightItems: convertHeaderRightLeftChildrenToUnstableItems(\n props.children,\n 'Right'\n ),\n };\n}\n\nexport function appendStackHeaderLeftPropsToOptions(\n options: NativeStackNavigationOptions,\n props: StackHeaderLeftProps\n): NativeStackNavigationOptions {\n if (props.asChild) {\n return {\n ...options,\n headerLeft: () => props.children,\n };\n }\n return {\n ...options,\n unstable_headerLeftItems: convertHeaderRightLeftChildrenToUnstableItems(props.children, 'Left'),\n };\n}\n"]}
@@ -10,8 +10,8 @@ import { StackHeaderTitle, type StackHeaderTitleProps } from './StackHeaderTitle
10
10
  import { StackHeaderBadge, StackHeaderIcon, StackHeaderLabel, type StackHeaderBadgeProps, type StackHeaderIconProps, type StackHeaderLabelProps } from './common-primitives';
11
11
  import type { StackHeaderItemSharedProps } from './shared';
12
12
  export declare const StackHeader: typeof StackHeaderComponent & {
13
- Left: typeof StackHeaderLeft;
14
- Right: typeof StackHeaderRight;
13
+ Left: import("react").FC<StackHeaderLeftProps>;
14
+ Right: import("react").FC<StackHeaderRightProps>;
15
15
  BackButton: typeof StackHeaderBackButton;
16
16
  Title: typeof StackHeaderTitle;
17
17
  SearchBar: typeof StackHeaderSearchBar;
@@ -9,7 +9,7 @@
9
9
  "publication": {
10
10
  "groupId": "expo.modules.router",
11
11
  "artifactId": "expo.modules.router",
12
- "version": "7.0.0-canary-20251216-6e1f9a7",
12
+ "version": "7.0.0-canary-20251216-3f01dbf",
13
13
  "repository": "local-maven-repo"
14
14
  }
15
15
  }
@@ -3,7 +3,7 @@
3
3
  "component": {
4
4
  "group": "expo.modules.router",
5
5
  "module": "expo.modules.router",
6
- "version": "7.0.0-canary-20251216-6e1f9a7",
6
+ "version": "7.0.0-canary-20251216-3f01dbf",
7
7
  "attributes": {
8
8
  "org.gradle.status": "release"
9
9
  }
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "files": [
26
26
  {
27
- "name": "expo.modules.router-7.0.0-canary-20251216-6e1f9a7.aar",
28
- "url": "expo.modules.router-7.0.0-canary-20251216-6e1f9a7.aar",
27
+ "name": "expo.modules.router-7.0.0-canary-20251216-3f01dbf.aar",
28
+ "url": "expo.modules.router-7.0.0-canary-20251216-3f01dbf.aar",
29
29
  "size": 13671,
30
30
  "sha512": "f51bd2a6d3fcc9075dbf99d66f77162d530586d0793d68e109a55f6edfbe4ff98bc9c9c5d587d0feec99807b6ae94a729232000e89f840278b21f4d423caa520",
31
31
  "sha256": "089d182f36875a201ad1b30b44d39812cd5155af987f3d33cd5eef8542103c82",
@@ -60,8 +60,8 @@
60
60
  ],
61
61
  "files": [
62
62
  {
63
- "name": "expo.modules.router-7.0.0-canary-20251216-6e1f9a7.aar",
64
- "url": "expo.modules.router-7.0.0-canary-20251216-6e1f9a7.aar",
63
+ "name": "expo.modules.router-7.0.0-canary-20251216-3f01dbf.aar",
64
+ "url": "expo.modules.router-7.0.0-canary-20251216-3f01dbf.aar",
65
65
  "size": 13671,
66
66
  "sha512": "f51bd2a6d3fcc9075dbf99d66f77162d530586d0793d68e109a55f6edfbe4ff98bc9c9c5d587d0feec99807b6ae94a729232000e89f840278b21f4d423caa520",
67
67
  "sha256": "089d182f36875a201ad1b30b44d39812cd5155af987f3d33cd5eef8542103c82",
@@ -80,8 +80,8 @@
80
80
  },
81
81
  "files": [
82
82
  {
83
- "name": "expo.modules.router-7.0.0-canary-20251216-6e1f9a7-sources.jar",
84
- "url": "expo.modules.router-7.0.0-canary-20251216-6e1f9a7-sources.jar",
83
+ "name": "expo.modules.router-7.0.0-canary-20251216-3f01dbf-sources.jar",
84
+ "url": "expo.modules.router-7.0.0-canary-20251216-3f01dbf-sources.jar",
85
85
  "size": 2318,
86
86
  "sha512": "9864add8e93e3c0a9a9c930aaed67016b15054c3fafd59a0bd3a5402d7cdc5827be84c22c2c137f3e5acb4e39270d9bfb9ca3fe11234458d4f2e0d4c78747f48",
87
87
  "sha256": "d5dff6259e86de721fc0f07fe740a5e18088e19b76738719b0a6f94caef06224",
@@ -0,0 +1 @@
1
+ 7237f4347e6074bf802bbb98fb3b5e8f492b5f2a4468a0b9bf69400622ec3c7ded0d66c1a027534cf905f0626ff8ec860f371987fd2a89ac5f78dac1ef38f5b4
@@ -9,7 +9,7 @@
9
9
  <modelVersion>4.0.0</modelVersion>
10
10
  <groupId>expo.modules.router</groupId>
11
11
  <artifactId>expo.modules.router</artifactId>
12
- <version>7.0.0-canary-20251216-6e1f9a7</version>
12
+ <version>7.0.0-canary-20251216-3f01dbf</version>
13
13
  <packaging>aar</packaging>
14
14
  <name>expo.modules.router</name>
15
15
  <url>https://github.com/expo/expo</url>
@@ -0,0 +1 @@
1
+ 7265c79b09c5f0f94adb2ce3b8494377dbcb201112282df4de4cfc97aac57527a9d6ceed820a8249be7dc5d723de2db63f685a0ee4004554a064070cb4c5066b
@@ -3,11 +3,11 @@
3
3
  <groupId>expo.modules.router</groupId>
4
4
  <artifactId>expo.modules.router</artifactId>
5
5
  <versioning>
6
- <latest>7.0.0-canary-20251216-6e1f9a7</latest>
7
- <release>7.0.0-canary-20251216-6e1f9a7</release>
6
+ <latest>7.0.0-canary-20251216-3f01dbf</latest>
7
+ <release>7.0.0-canary-20251216-3f01dbf</release>
8
8
  <versions>
9
- <version>7.0.0-canary-20251216-6e1f9a7</version>
9
+ <version>7.0.0-canary-20251216-3f01dbf</version>
10
10
  </versions>
11
- <lastUpdated>20251216074519</lastUpdated>
11
+ <lastUpdated>20251216100703</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 2a4f62869e73091472ab8285a3723da5
1
+ dcb34d0007a906a1f8599fda8c76af9b
@@ -1 +1 @@
1
- 0bf438566c4abf2eb9360ea041d7570ba4607032
1
+ efe2fbed7b724d595979cf7bd89e8f2ee66001f5
@@ -1 +1 @@
1
- 543f585654035c7f66c63d4a89ec26cf6c0a434d6b743944e9aa19cf5a532d38
1
+ 1e41c4205eff8fd4eae2ca72fee52318ae65e23e26f917e32887ecbe195e6018
@@ -1 +1 @@
1
- 51d9160727f18e8b69ad1de60f6a27f75bf1510d64f591e1a2201d49597673f6a4fd8d1a4128e57fa1072c03a7f697b9c641d48c7afffe16401412a4a70a1d52
1
+ 1023e15a73becd063b37d27c12ef62342c1c059aad29e2ed1782b0d9542dd2702b258d1d36536710c1052f630191df57eaff82f30b12dcdfb7f3cb58dd5cc21c
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-router",
3
- "version": "7.0.0-canary-20251216-6e1f9a7",
3
+ "version": "7.0.0-canary-20251216-3f01dbf",
4
4
  "description": "Expo Router is a file-based router for React Native and web applications.",
5
5
  "author": "650 Industries, Inc.",
6
6
  "license": "MIT",
@@ -83,14 +83,14 @@
83
83
  "expo"
84
84
  ],
85
85
  "peerDependencies": {
86
- "@expo/metro-runtime": "6.2.0-canary-20251216-6e1f9a7",
87
- "@expo/log-box": "0.0.13-canary-20251216-6e1f9a7",
86
+ "@expo/metro-runtime": "6.2.0-canary-20251216-3f01dbf",
87
+ "@expo/log-box": "0.0.13-canary-20251216-3f01dbf",
88
88
  "@react-navigation/drawer": "^7.7.2",
89
89
  "@testing-library/react-native": ">= 12.0.0",
90
- "expo": "55.0.0-canary-20251216-6e1f9a7",
91
- "expo-constants": "18.1.0-canary-20251216-6e1f9a7",
92
- "expo-linking": "8.0.11-canary-20251216-6e1f9a7",
93
- "expo-symbols": "1.1.0-canary-20251216-6e1f9a7",
90
+ "expo": "55.0.0-canary-20251216-3f01dbf",
91
+ "expo-constants": "18.1.0-canary-20251216-3f01dbf",
92
+ "expo-linking": "8.0.11-canary-20251216-3f01dbf",
93
+ "expo-symbols": "1.1.0-canary-20251216-3f01dbf",
94
94
  "react": "*",
95
95
  "react-dom": "*",
96
96
  "react-native": "*",
@@ -135,8 +135,8 @@
135
135
  "react-server-dom-webpack": "~19.0.3"
136
136
  },
137
137
  "dependencies": {
138
- "@expo/metro-runtime": "6.2.0-canary-20251216-6e1f9a7",
139
- "@expo/schema-utils": "0.1.9-canary-20251216-6e1f9a7",
138
+ "@expo/metro-runtime": "6.2.0-canary-20251216-3f01dbf",
139
+ "@expo/schema-utils": "0.1.9-canary-20251216-3f01dbf",
140
140
  "@radix-ui/react-slot": "1.2.0",
141
141
  "@radix-ui/react-tabs": "^1.1.12",
142
142
  "@react-navigation/bottom-tabs": "^7.7.3",
@@ -145,7 +145,7 @@
145
145
  "client-only": "^0.0.1",
146
146
  "debug": "^4.3.4",
147
147
  "escape-string-regexp": "^4.0.0",
148
- "expo-server": "1.0.6-canary-20251216-6e1f9a7",
148
+ "expo-server": "1.0.6-canary-20251216-3f01dbf",
149
149
  "fast-deep-equal": "^3.1.3",
150
150
  "invariant": "^2.2.4",
151
151
  "nanoid": "^3.3.8",
@@ -1 +0,0 @@
1
- d9665917800ec6a62bc4b9adaffb0aac3cf6534c3499fff8ff8d4d3fa5bdd199832a4ca51feebd86d2f1d1f3a86e13cd260ae8fa9c29ae33ad22f5013e8c71e7
@@ -1 +0,0 @@
1
- ebe337d50192acd4ef69978915e08d3b51ad7e4078a52bb498de32bfae043866bbbc4cacff17af781deaec0b65e7e6a0a1496aab395dd4cba3634ca931efcca3