expo-router 57.0.27 → 57.0.29
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.
- package/android/build.gradle +2 -2
- package/build/native-tabs/common/elements.d.ts +5 -4
- package/build/native-tabs/common/elements.d.ts.map +1 -1
- package/build/native-tabs/common/elements.js.map +1 -1
- package/build/native-tabs/utils/optionsIconConverter.ios.d.ts.map +1 -1
- package/build/native-tabs/utils/optionsIconConverter.ios.js +20 -4
- package/build/native-tabs/utils/optionsIconConverter.ios.js.map +1 -1
- package/build/react-navigation/bottom-tabs/views/BottomTabView.d.ts.map +1 -1
- package/build/react-navigation/bottom-tabs/views/BottomTabView.js +28 -11
- package/build/react-navigation/bottom-tabs/views/BottomTabView.js.map +1 -1
- package/build/react-navigation/native-stack/views/useHeaderConfigProps.d.ts.map +1 -1
- package/build/react-navigation/native-stack/views/useHeaderConfigProps.js +14 -8
- package/build/react-navigation/native-stack/views/useHeaderConfigProps.js.map +1 -1
- package/build/react-navigation/routers/TabRouter.d.ts.map +1 -1
- package/build/react-navigation/routers/TabRouter.js +11 -2
- package/build/react-navigation/routers/TabRouter.js.map +1 -1
- package/build/typed-routes/types.d.ts +4 -5
- package/build/typed-routes/types.d.ts.map +1 -1
- package/build/typed-routes/types.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.27/expo.modules.router-57.0.27.module → 57.0.29/expo.modules.router-57.0.29.module} +7 -7
- package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.29/expo.modules.router-57.0.29.module.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.29/expo.modules.router-57.0.29.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.29/expo.modules.router-57.0.29.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.29/expo.modules.router-57.0.29.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.27/expo.modules.router-57.0.27.pom → 57.0.29/expo.modules.router-57.0.29.pom} +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.29/expo.modules.router-57.0.29.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.29/expo.modules.router-57.0.29.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.29/expo.modules.router-57.0.29.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.29/expo.modules.router-57.0.29.pom.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml +4 -4
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha512 +1 -1
- package/package.json +5 -5
- package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.27/expo.modules.router-57.0.27.module.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.27/expo.modules.router-57.0.27.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.27/expo.modules.router-57.0.27.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.27/expo.modules.router-57.0.27.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.27/expo.modules.router-57.0.27.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.27/expo.modules.router-57.0.27.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.27/expo.modules.router-57.0.27.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/57.0.27/expo.modules.router-57.0.27.pom.sha512 +0 -1
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.27/expo.modules.router-57.0.27-sources.jar → 57.0.29/expo.modules.router-57.0.29-sources.jar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.27/expo.modules.router-57.0.27-sources.jar.md5 → 57.0.29/expo.modules.router-57.0.29-sources.jar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.27/expo.modules.router-57.0.27-sources.jar.sha1 → 57.0.29/expo.modules.router-57.0.29-sources.jar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.27/expo.modules.router-57.0.27-sources.jar.sha256 → 57.0.29/expo.modules.router-57.0.29-sources.jar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.27/expo.modules.router-57.0.27-sources.jar.sha512 → 57.0.29/expo.modules.router-57.0.29-sources.jar.sha512} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.27/expo.modules.router-57.0.27.aar → 57.0.29/expo.modules.router-57.0.29.aar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.27/expo.modules.router-57.0.27.aar.md5 → 57.0.29/expo.modules.router-57.0.29.aar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.27/expo.modules.router-57.0.27.aar.sha1 → 57.0.29/expo.modules.router-57.0.29.aar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.27/expo.modules.router-57.0.27.aar.sha256 → 57.0.29/expo.modules.router-57.0.29.aar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{57.0.27/expo.modules.router-57.0.27.aar.sha512 → 57.0.29/expo.modules.router-57.0.29.aar.sha512} +0 -0
package/android/build.gradle
CHANGED
|
@@ -4,13 +4,13 @@ plugins {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
group = 'expo.modules.router'
|
|
7
|
-
version = '57.0.
|
|
7
|
+
version = '57.0.29'
|
|
8
8
|
|
|
9
9
|
android {
|
|
10
10
|
namespace "expo.modules.router"
|
|
11
11
|
defaultConfig {
|
|
12
12
|
versionCode 1
|
|
13
|
-
versionName "57.0.
|
|
13
|
+
versionName "57.0.29"
|
|
14
14
|
}
|
|
15
15
|
lintOptions {
|
|
16
16
|
abortOnError false
|
|
@@ -91,11 +91,12 @@ export interface XcassetIcon {
|
|
|
91
91
|
* The name of the iOS asset catalog image to use as an icon.
|
|
92
92
|
*
|
|
93
93
|
* Xcassets provide automatic multi-resolution (@1x/@2x/@3x), dark mode variants,
|
|
94
|
-
* and device-specific images via `[UIImage imageNamed:]`.
|
|
94
|
+
* and device-specific images via `[UIImage imageNamed:]`. Both image sets and
|
|
95
|
+
* symbol sets are supported.
|
|
95
96
|
*
|
|
96
|
-
* The rendering mode
|
|
97
|
-
*
|
|
98
|
-
*
|
|
97
|
+
* > **Note:** The rendering mode comes from the asset's **Render As** setting in the
|
|
98
|
+
* > asset catalog, not from the `renderingMode` prop. Set it to **Template Image** for
|
|
99
|
+
* > the icon to be tinted with `iconColor` and `selectedIconColor`.
|
|
99
100
|
*
|
|
100
101
|
* The value can be provided in two ways:
|
|
101
102
|
* - As a string with the asset catalog image name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/common/elements.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAsB,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAExE,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;I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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../src/native-tabs/common/elements.tsx"],"names":[],"mappings":";;;AAIA,iDAAkE;AAgBrD,QAAA,sBAAsB,GAA0C,kBAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../src/native-tabs/common/elements.tsx"],"names":[],"mappings":";;;AAIA,iDAAkE;AAgBrD,QAAA,sBAAsB,GAA0C,kBAAK,CAAC;AAsKnF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACU,QAAA,qBAAqB,GAAyC,iBAAI,CAAC;AAEhF;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,2BAA2B,GAAG,uBAAU,CAAC;AAM/C,MAAM,4BAA4B,GAAG,SAAS,4BAA4B,CAC/E,KAAwC;IAExC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAJW,QAAA,4BAA4B,gCAIvC;AAiBW,QAAA,sBAAsB,GAA0C,kBAAK,CAAC;AAMnF;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,MAAM,yBAAyB,GAA6C,GAAG,EAAE;IACtF,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAFW,QAAA,yBAAyB,6BAEpC","sourcesContent":["import type { AndroidSymbol } from 'expo-symbols';\nimport type { ColorValue, ImageSourcePropType, StyleProp } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport { Label, Icon, Badge, VectorIcon } from '../../primitives';\nimport type { IconRenderingMode, NativeTabsLabelStyle } from '../types';\n\nexport interface NativeTabsTriggerLabelProps {\n /**\n * The text to display as the label for the tab.\n */\n children?: string;\n selectedStyle?: StyleProp<NativeTabsLabelStyle>;\n /**\n * If true, the label will be hidden.\n * @default false\n */\n hidden?: boolean;\n}\n\nexport const NativeTabsTriggerLabel: React.FC<NativeTabsTriggerLabelProps> = Label;\n\nexport interface SrcIcon {\n /**\n * The image source to use as an icon.\n *\n * When `sf` prop is used it will override this prop on iOS.\n *\n * When `drawable` or `material` prop is used it will override this prop on Android.\n *\n * The value can be provided in two ways:\n * - As an image source\n * - As an object specifying the default and selected states\n *\n * @example\n * ```tsx\n * <Icon src={require('./path/to/icon.png')} />\n * ```\n *\n * @example\n * ```tsx\n * <Icon src={{ default: require('./path/to/icon.png'), selected: require('./path/to/icon-selected.png') }} />\n * ```\n *\n * @platform Android\n * @platform iOS\n */\n src?:\n | ImageSourcePropType\n | React.ReactElement\n | {\n default?: ImageSourcePropType | React.ReactElement;\n selected: ImageSourcePropType | React.ReactElement;\n };\n /**\n * Controls how the image icon is rendered on iOS.\n *\n * - `'template'`: iOS applies tint color to the icon (selected/unselected states)\n * - `'original'`: Preserves original icon colors\n *\n * **Default behavior:**\n * - If tab bar icon color is configured, defaults to `'template'`\n * - If no icon color is set, defaults to `'original'`\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uiimage/renderingmode-swift.enum) for more information.\n *\n * @platform ios\n */\n renderingMode?: IconRenderingMode;\n}\n\nexport interface SFSymbolIcon {\n /**\n * The name of the SF Symbol to use as an icon.\n *\n * The value can be provided in two ways:\n * - As a string with the SF Symbol name\n * - As an object specifying the default and selected states\n *\n * @example\n * ```tsx\n * <Icon sf=\"magnifyingglass\" />\n * ```\n *\n * @example\n * ```tsx\n * <Icon sf={{ default: \"house\", selected: \"house.fill\" }} />\n * ```\n *\n * @platform iOS\n */\n sf?: SFSymbol | { default?: SFSymbol; selected: SFSymbol };\n}\n\nexport interface XcassetIcon {\n /**\n * The name of the iOS asset catalog image to use as an icon.\n *\n * Xcassets provide automatic multi-resolution (@1x/@2x/@3x), dark mode variants,\n * and device-specific images via `[UIImage imageNamed:]`. Both image sets and\n * symbol sets are supported.\n *\n * > **Note:** The rendering mode comes from the asset's **Render As** setting in the\n * > asset catalog, not from the `renderingMode` prop. Set it to **Template Image** for\n * > the icon to be tinted with `iconColor` and `selectedIconColor`.\n *\n * The value can be provided in two ways:\n * - As a string with the asset catalog image name\n * - As an object specifying the default and selected states\n *\n * @example\n * ```tsx\n * <Icon xcasset=\"custom-icon\" />\n * ```\n *\n * @example\n * ```tsx\n * <Icon xcasset={{ default: \"home-outline\", selected: \"home-filled\" }} />\n * ```\n *\n * @platform iOS\n */\n xcasset?: string | { default?: string; selected: string };\n}\n\nexport interface DrawableIcon {\n /**\n * The name of the drawable resource to use as an icon.\n *\n * The value can be provided in two ways:\n * - As a string with the drawable resource name\n * - As an object specifying the default and selected states\n *\n * @example\n * ```tsx\n * <Icon drawable=\"ic_home\" />\n * ```\n *\n * @example\n * ```tsx\n * <Icon drawable={{ default: 'ic_home_outline', selected: 'ic_home_filled' }} />\n * ```\n *\n * @platform android\n */\n drawable?: string | { default?: string; selected: string };\n}\n\n/**\n * Material icon name for Android native tabs.\n *\n * @platform android\n */\nexport interface MaterialIcon {\n /**\n * Material icon glyph name. See the [Material icons for the complete catalog](https://fonts.google.com/icons).\n *\n * The value can be provided in two ways:\n * - As a string with the Material icon name\n * - As an object specifying the default and selected states\n *\n * @example\n * ```tsx\n * <Icon md=\"home\" />\n * ```\n *\n * @example\n * ```tsx\n * <Icon md={{ default: 'home', selected: 'home_filled' }} />\n * ```\n */\n md: AndroidSymbol | { default?: AndroidSymbol; selected: AndroidSymbol };\n}\n\nexport type NativeTabsTriggerIconProps = { selectedColor?: ColorValue } & (\n | (SFSymbolIcon & DrawableIcon)\n | (SFSymbolIcon & MaterialIcon)\n | (SFSymbolIcon & SrcIcon)\n | (XcassetIcon & DrawableIcon)\n | (XcassetIcon & MaterialIcon)\n | (XcassetIcon & SrcIcon)\n | (MaterialIcon & SrcIcon)\n | (DrawableIcon & SrcIcon)\n | SrcIcon\n);\n\n/**\n * Renders an icon for the tab.\n *\n * Accepts various icon sources such as SF Symbols, xcasset images, drawable resources, material icons, or image sources.\n *\n * Each icon prop (`sf`, `xcasset`, `drawable`, `md`, `src`) can be either a single value, or an object\n * with `{ default, selected }` to use a distinct icon when the tab is selected.\n *\n * Acceptable props combinations:\n * - `sf` and `drawable` - `sf` will be used for iOS icon, `drawable` for Android icon\n * - `sf` and `src` - `sf` will be used for iOS icon, `src` for Android icon\n * - `xcasset` and `drawable` - `xcasset` will be used for iOS icon, `drawable` for Android icon\n * - `xcasset` and `md` - `xcasset` will be used for iOS icon, `md` for Android icon\n * - `xcasset` and `src` - `xcasset` will be used for iOS icon, `src` for Android icon\n * - `src` and `drawable` - `src` will be used for iOS icon, `drawable` for Android icon\n * - `src` only - `src` will be used for both iOS and Android icons\n *\n * Priority on iOS: `sf` > `xcasset` > `src`. Priority on Android: `drawable` > `md` > `src`.\n *\n * @platform ios\n * @platform android\n */\nexport const NativeTabsTriggerIcon: React.FC<NativeTabsTriggerIconProps> = Icon;\n\n/**\n * Helper component which can be used to load vector icons for `NativeTabs`.\n *\n * @example\n * ```tsx\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n * import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';\n *\n * export default Layout(){\n * return (\n * <NativeTabs>\n * <NativeTabs.Trigger name=\"index\">\n * <NativeTabs.Trigger.Icon src={<NativeTabs.Trigger.VectorIcon family={MaterialCommunityIcons} name=\"home\" />} />\n * </NativeTabs.Trigger>\n * </NativeTabs>\n * );\n * }\n * ```\n */\nexport const NativeTabsTriggerVectorIcon = VectorIcon;\n\nexport interface NativeTabsTriggerPromiseIconProps {\n loader: () => Promise<ImageSourcePropType | null>;\n}\n\nexport const NativeTabsTriggerPromiseIcon = function NativeTabsTriggerPromiseIcon(\n props: NativeTabsTriggerPromiseIconProps\n) {\n return null;\n};\n\nexport interface NativeTabsTriggerBadgeProps {\n /**\n * The text to display as the badge for the tab.\n * If not provided, the badge will not be displayed.\n */\n children?: string;\n\n /**\n * If true, the badge will be hidden.\n * @default false\n */\n hidden?: boolean;\n selectedBackgroundColor?: ColorValue;\n}\n\nexport const NativeTabsTriggerBadge: React.FC<NativeTabsTriggerBadgeProps> = Badge;\n\nexport interface NativeTabsBottomAccessoryProps {\n children?: React.ReactNode;\n}\n\n/**\n * A [bottom accessory](https://developer.apple.com/documentation/uikit/uitabbarcontroller/bottomaccessory) for `NativeTabs` on iOS 26 and above.\n *\n * @example\n * ```tsx\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default Layout(){\n * return (\n * <NativeTabs>\n * <NativeTabs.BottomAccessory>\n * <YourAccessoryComponent />\n * </NativeTabs.BottomAccessory>\n * <NativeTabs.Trigger name=\"index\" />\n * </NativeTabs>\n * );\n * }\n * ```\n *\n * @platform iOS 26+\n */\nexport const NativeTabsBottomAccessory: React.FC<NativeTabsBottomAccessoryProps> = () => {\n return null;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optionsIconConverter.ios.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/utils/optionsIconConverter.ios.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAuB,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE1C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEpE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"optionsIconConverter.ios.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/utils/optionsIconConverter.ios.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAuB,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE1C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEpE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,0BAA0B,QA8C7F;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,WAAW,GAAG,SAAS,EAC7B,SAAS,CAAC,EAAE,UAAU,GACrB,iBAAiB,GAAG,SAAS,CAM/B;AAED,wBAAgB,oCAAoC,CAClD,IAAI,EAAE,WAAW,GAAG,SAAS,EAC7B,aAAa,CAAC,EAAE,iBAAiB,GAChC,eAAe,GAAG,SAAS,CA0B7B"}
|
|
@@ -28,6 +28,13 @@ function appendIconOptions(options, props) {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
else if ('xcasset' in props && props.xcasset) {
|
|
31
|
+
if (process.env.NODE_ENV !== 'production' &&
|
|
32
|
+
'renderingMode' in props &&
|
|
33
|
+
props.renderingMode !== undefined) {
|
|
34
|
+
console.warn('`renderingMode` has no effect on `xcasset` icons — tinting is controlled by the ' +
|
|
35
|
+
'asset\'s "Render As" setting in the asset catalog instead. Remove `renderingMode`, ' +
|
|
36
|
+
'or use `src` if you need to control tinting from JavaScript.');
|
|
37
|
+
}
|
|
31
38
|
if (typeof props.xcasset === 'string') {
|
|
32
39
|
options.icon = { xcasset: props.xcasset };
|
|
33
40
|
options.selectedIcon = undefined;
|
|
@@ -58,6 +65,16 @@ function convertOptionsIconToScreensPropsIcon(icon, renderingMode) {
|
|
|
58
65
|
name: icon.sf,
|
|
59
66
|
};
|
|
60
67
|
}
|
|
68
|
+
// Asset catalog icons have to be resolved natively with `[UIImage imageNamed:]`.
|
|
69
|
+
// Passing the name to the image loader as a `{ uri }` source happens to work for
|
|
70
|
+
// image sets, but symbol sets can never be produced that way. Tinting is then
|
|
71
|
+
// controlled by the asset's "Render As" setting in the asset catalog, not `renderingMode`.
|
|
72
|
+
if (icon && 'xcasset' in icon && icon.xcasset) {
|
|
73
|
+
return {
|
|
74
|
+
type: 'xcasset',
|
|
75
|
+
name: icon.xcasset,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
61
78
|
const imageSource = getIconImageSource(icon);
|
|
62
79
|
if (!imageSource) {
|
|
63
80
|
return undefined;
|
|
@@ -68,13 +85,12 @@ function convertOptionsIconToScreensPropsIcon(icon, renderingMode) {
|
|
|
68
85
|
}
|
|
69
86
|
return { type: 'templateSource', templateSource: imageSource };
|
|
70
87
|
}
|
|
88
|
+
// Mirrors the precedence in `convertOptionsIconToScreensPropsIcon` — SF Symbols and asset
|
|
89
|
+
// catalog icons aren't resolved through `renderingMode`, so both resolve to `undefined` here.
|
|
71
90
|
function getIconImageSource(icon) {
|
|
72
|
-
if (!icon || ('sf' in icon && icon.sf)) {
|
|
91
|
+
if (!icon || ('sf' in icon && icon.sf) || ('xcasset' in icon && icon.xcasset)) {
|
|
73
92
|
return undefined;
|
|
74
93
|
}
|
|
75
|
-
if ('xcasset' in icon && icon.xcasset) {
|
|
76
|
-
return { uri: icon.xcasset };
|
|
77
|
-
}
|
|
78
94
|
if ('src' in icon && icon.src) {
|
|
79
95
|
return icon.src;
|
|
80
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optionsIconConverter.ios.js","sourceRoot":"","sources":["../../../src/native-tabs/utils/optionsIconConverter.ios.ts"],"names":[],"mappings":";;AAQA,
|
|
1
|
+
{"version":3,"file":"optionsIconConverter.ios.js","sourceRoot":"","sources":["../../../src/native-tabs/utils/optionsIconConverter.ios.ts"],"names":[],"mappings":";;AAQA,8CA8CC;AAED,4DASC;AAED,oFA6BC;AA5FD,+EAAwF;AAIxF,SAAgB,iBAAiB,CAAC,OAAyB,EAAE,KAAiC;IAC5F,IAAI,IAAI,IAAI,KAAK,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC;QAC9B,IAAI,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;YACjC,OAAO,C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,CAAC;IACD,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC7C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,sBAAsB,GAAG,aAAa,IAAI,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAC/E,IAAI,sBAAsB,KAAK,UAAU,EAAE,CAAC;QAC1C,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC;IAC9C,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,CAAC;AACjE,CAAC;AAED,0FAA0F;AAC1F,8FAA8F;AAC9F,SAAS,kBAAkB,CAAC,IAA6B;IACvD,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9E,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,KAAK,IAAI,IAAI,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import type { ColorValue, ImageSourcePropType } from 'react-native';\nimport type { PlatformIconIOS } from 'react-native-screens';\n\nimport type { AwaitedIcon } from './icon';\nimport { applyIconSrcOptions, applySelectedColor } from './optionsIconConverter.shared';\nimport type { NativeTabsTriggerIconProps } from '../common/elements';\nimport type { IconRenderingMode, NativeTabOptions } from '../types';\n\nexport function appendIconOptions(options: NativeTabOptions, props: NativeTabsTriggerIconProps) {\n if ('sf' in props && props.sf) {\n if (typeof props.sf === 'string') {\n options.icon = props.sf\n ? {\n sf: props.sf,\n }\n : undefined;\n options.selectedIcon = undefined;\n } else if (props.sf) {\n options.icon = props.sf.default\n ? {\n sf: props.sf.default,\n }\n : undefined;\n options.selectedIcon = props.sf.selected\n ? {\n sf: props.sf.selected,\n }\n : undefined;\n }\n } else if ('xcasset' in props && props.xcasset) {\n if (\n process.env.NODE_ENV !== 'production' &&\n 'renderingMode' in props &&\n props.renderingMode !== undefined\n ) {\n console.warn(\n '`renderingMode` has no effect on `xcasset` icons — tinting is controlled by the ' +\n 'asset\\'s \"Render As\" setting in the asset catalog instead. Remove `renderingMode`, ' +\n 'or use `src` if you need to control tinting from JavaScript.'\n );\n }\n if (typeof props.xcasset === 'string') {\n options.icon = { xcasset: props.xcasset };\n options.selectedIcon = undefined;\n } else {\n options.icon = props.xcasset.default ? { xcasset: props.xcasset.default } : undefined;\n options.selectedIcon = props.xcasset.selected\n ? { xcasset: props.xcasset.selected }\n : undefined;\n }\n } else if ('src' in props && props.src) {\n applyIconSrcOptions(options, props);\n }\n applySelectedColor(options, props.selectedColor);\n}\n\nexport function resolveIconRenderingMode(\n icon: AwaitedIcon | undefined,\n iconColor?: ColorValue\n): IconRenderingMode | undefined {\n if (!getIconImageSource(icon)) {\n return undefined;\n }\n const renderingMode = icon && 'renderingMode' in icon ? icon.renderingMode : undefined;\n return renderingMode ?? (iconColor !== undefined ? 'template' : 'original');\n}\n\nexport function convertOptionsIconToScreensPropsIcon(\n icon: AwaitedIcon | undefined,\n renderingMode?: IconRenderingMode\n): PlatformIconIOS | undefined {\n if (icon && 'sf' in icon && icon.sf) {\n return {\n type: 'sfSymbol',\n name: icon.sf,\n };\n }\n // Asset catalog icons have to be resolved natively with `[UIImage imageNamed:]`.\n // Passing the name to the image loader as a `{ uri }` source happens to work for\n // image sets, but symbol sets can never be produced that way. Tinting is then\n // controlled by the asset's \"Render As\" setting in the asset catalog, not `renderingMode`.\n if (icon && 'xcasset' in icon && icon.xcasset) {\n return {\n type: 'xcasset',\n name: icon.xcasset,\n };\n }\n const imageSource = getIconImageSource(icon);\n if (!imageSource) {\n return undefined;\n }\n const effectiveRenderingMode = renderingMode ?? resolveIconRenderingMode(icon);\n if (effectiveRenderingMode === 'original') {\n return { type: 'imageSource', imageSource };\n }\n return { type: 'templateSource', templateSource: imageSource };\n}\n\n// Mirrors the precedence in `convertOptionsIconToScreensPropsIcon` — SF Symbols and asset\n// catalog icons aren't resolved through `renderingMode`, so both resolve to `undefined` here.\nfunction getIconImageSource(icon: AwaitedIcon | undefined): ImageSourcePropType | undefined {\n if (!icon || ('sf' in icon && icon.sf) || ('xcasset' in icon && icon.xcasset)) {\n return undefined;\n }\n if ('src' in icon && icon.src) {\n return icon.src;\n }\n return undefined;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomTabView.d.ts","sourceRoot":"","sources":["../../../../src/react-navigation/bottom-tabs/views/BottomTabView.tsx"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAEV,sBAAsB,EAEtB,yBAAyB,EACzB,0BAA0B,EAG3B,MAAM,UAAU,CAAC;AAOlB,KAAK,KAAK,GAAG,yBAAyB,GAAG;IACvC,KAAK,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACzC,UAAU,EAAE,0BAA0B,CAAC;IACvC,WAAW,EAAE,sBAAsB,CAAC;CACrC,CAAC;
|
|
1
|
+
{"version":3,"file":"BottomTabView.d.ts","sourceRoot":"","sources":["../../../../src/react-navigation/bottom-tabs/views/BottomTabView.tsx"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAEV,sBAAsB,EAEtB,yBAAyB,EACzB,0BAA0B,EAG3B,MAAM,UAAU,CAAC;AAOlB,KAAK,KAAK,GAAG,yBAAyB,GAAG;IACvC,KAAK,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACzC,UAAU,EAAE,0BAA0B,CAAC;IACvC,WAAW,EAAE,sBAAsB,CAAC;CACrC,CAAC;AAgCF,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,2CAgRzC"}
|
|
@@ -47,7 +47,6 @@ const ScreenFallback_1 = require("./ScreenFallback");
|
|
|
47
47
|
const BottomTabBarHeightCallbackContext_1 = require("../utils/BottomTabBarHeightCallbackContext");
|
|
48
48
|
const BottomTabBarHeightContext_1 = require("../utils/BottomTabBarHeightContext");
|
|
49
49
|
const useAnimatedHashMap_1 = require("../utils/useAnimatedHashMap");
|
|
50
|
-
const EPSILON = 1e-5;
|
|
51
50
|
const STATE_INACTIVE = 0;
|
|
52
51
|
const STATE_TRANSITIONING_OR_BELOW_TOP = 1;
|
|
53
52
|
const STATE_ON_TOP = 2;
|
|
@@ -86,6 +85,17 @@ function BottomTabView(props) {
|
|
|
86
85
|
}
|
|
87
86
|
const previousRouteKeyRef = React.useRef(focusedRouteKey);
|
|
88
87
|
const tabAnims = (0, useAnimatedHashMap_1.useAnimatedHashMap)(state);
|
|
88
|
+
const [lastUpdate, setLastUpdate] = React.useState({
|
|
89
|
+
current: focusedRouteKey,
|
|
90
|
+
animating: false,
|
|
91
|
+
});
|
|
92
|
+
if (lastUpdate.current !== focusedRouteKey) {
|
|
93
|
+
setLastUpdate({
|
|
94
|
+
current: focusedRouteKey,
|
|
95
|
+
previous: lastUpdate.current,
|
|
96
|
+
animating: true,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
89
99
|
React.useEffect(() => {
|
|
90
100
|
const previousRouteKey = previousRouteKeyRef.current;
|
|
91
101
|
let popToTopAction;
|
|
@@ -99,6 +109,7 @@ function BottomTabView(props) {
|
|
|
99
109
|
};
|
|
100
110
|
}
|
|
101
111
|
}
|
|
112
|
+
let timer;
|
|
102
113
|
const animateToIndex = () => {
|
|
103
114
|
if (previousRouteKey !== focusedRouteKey) {
|
|
104
115
|
navigation.emit({
|
|
@@ -134,10 +145,22 @@ function BottomTabView(props) {
|
|
|
134
145
|
target: focusedRouteKey,
|
|
135
146
|
});
|
|
136
147
|
}
|
|
148
|
+
if (finished) {
|
|
149
|
+
// Delay clearing so the previous screen stays attached
|
|
150
|
+
// This will give time for any native logic to run
|
|
151
|
+
timer = setTimeout(() => {
|
|
152
|
+
setLastUpdate((update) => update.animating ? { ...update, animating: false } : update);
|
|
153
|
+
}, 32);
|
|
154
|
+
}
|
|
137
155
|
});
|
|
138
156
|
};
|
|
139
157
|
animateToIndex();
|
|
140
158
|
previousRouteKeyRef.current = focusedRouteKey;
|
|
159
|
+
return () => {
|
|
160
|
+
if (timer !== undefined) {
|
|
161
|
+
clearTimeout(timer);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
141
164
|
}, [descriptors, focusedRouteKey, navigation, state.index, state.routes, tabAnims]);
|
|
142
165
|
const dimensions = elements_1.SafeAreaProviderCompat.initialMetrics.frame;
|
|
143
166
|
const [tabBarHeight, setTabBarHeight] = React.useState(() => (0, BottomTabBar_1.getTabBarHeight)({
|
|
@@ -186,18 +209,12 @@ function BottomTabView(props) {
|
|
|
186
209
|
},
|
|
187
210
|
}) ?? {};
|
|
188
211
|
const animationEnabled = hasAnimation(descriptor.options);
|
|
212
|
+
const isAnimatingRoute = lastUpdate.animating &&
|
|
213
|
+
(lastUpdate.previous === route.key || lastUpdate.current === route.key);
|
|
189
214
|
const activityState = isFocused
|
|
190
215
|
? STATE_ON_TOP // the screen is on top after the transition
|
|
191
|
-
: animationEnabled //
|
|
192
|
-
?
|
|
193
|
-
inputRange: [0, 1 - EPSILON, 1],
|
|
194
|
-
outputRange: [
|
|
195
|
-
STATE_TRANSITIONING_OR_BELOW_TOP, // screen visible during transition
|
|
196
|
-
STATE_TRANSITIONING_OR_BELOW_TOP,
|
|
197
|
-
STATE_INACTIVE, // the screen is detached after transition
|
|
198
|
-
],
|
|
199
|
-
extrapolate: 'extend',
|
|
200
|
-
})
|
|
216
|
+
: animationEnabled && isAnimatingRoute // if animation is not enabled, immediately move to inactive state
|
|
217
|
+
? STATE_TRANSITIONING_OR_BELOW_TOP // screen visible during transition
|
|
201
218
|
: STATE_INACTIVE;
|
|
202
219
|
return ((0, jsx_runtime_1.jsx)(ScreenFallback_1.MaybeScreen, { style: [react_native_1.StyleSheet.absoluteFill, { zIndex: isFocused ? 0 : -1 }], active: activityState, enabled: detachInactiveScreens, freezeOnBlur: freezeOnBlur, shouldFreeze: activityState === STATE_INACTIVE && !isPreloaded, children: (0, jsx_runtime_1.jsx)(BottomTabBarHeightContext_1.BottomTabBarHeightContext.Provider, { value: tabBarPosition === 'bottom' ? tabBarHeight : 0, children: (0, jsx_runtime_1.jsx)(elements_1.Screen, { focused: isFocused, route: descriptor.route, navigation: descriptor.navigation, headerShown: headerShown, headerStatusBarHeight: headerStatusBarHeight, headerTransparent: headerTransparent, header: header({
|
|
203
220
|
layout: dimensions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomTabView.js","sourceRoot":"","sources":["../../../../src/react-navigation/bottom-tabs/views/BottomTabView.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEb,sCAiPC;;AAjTD,6CAA+B;AAC/B,+CAA8D;AAC9D,mFAAuE;AAEvE,6CAAwF;AACxF,yCAKsB;AACtB,8EAAyF;AAUzF,iDAA+D;AAC/D,qDAAqE;AACrE,kGAA+F;AAC/F,kFAA+E;AAC/E,oEAAiE;AAQjE,MAAM,OAAO,GAAG,IAAI,CAAC;AACrB,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAC3C,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB,MAAM,yBAAyB,GAAG;IAChC,IAAI,EAAE,kCAAc;IACpB,KAAK,EAAE,mCAAe;IACtB,IAAI,EAAE;QACJ,sBAAsB,EAAE,SAAS;QACjC,cAAc,EAAE;YACd,SAAS,EAAE,QAAQ;YACnB,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;S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,QAAQ,IACjC,KAAK,EAAE,cAAc,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YACrD,uBAAC,iBAAM,IACL,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,UAAU,CAAC,KAAK,EACvB,UAAU,EAAE,UAAU,CAAC,UAAU,EACjC,WAAW,EAAE,WAAW,EACxB,qBAAqB,EAAE,qBAAqB,EAC5C,iBAAiB,EAAE,iBAAiB,EACpC,MAAM,EAAE,MAAM,CAAC;oCACb,MAAM,EAAE,UAAU;oCAClB,KAAK,EAAE,UAAU,CAAC,KAAK;oCACvB,UAAU,EAAE,UAAU,CAAC,UAAoD;oCAC3E,OAAO,EAAE,UAAU,CAAC,OAAO;iCAC5B,CAAC,EACF,KAAK,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,IAAI,UAAU,CAAC,YACxD,UAAU,CAAC,MAAM,EAAE,GACb,GAC0B,IAxBhC,KAAK,CAAC,GAAG,CAyBF,CACf,CAAC;gBACJ,CAAC,CAAC,IAjFE,SAAS,CAkFQ,EACtB,cAAc,KAAK,QAAQ,IAAI,cAAc,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,IAC1D,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE;QACP,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,QAAQ;KACnB;CACF,CAAC,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { Animated, Platform, StyleSheet } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nimport { getHeaderTitle, Header, SafeAreaProviderCompat, Screen } from '../../elements';\nimport {\n type NavigationAction,\n type ParamListBase,\n StackActions,\n type TabNavigationState,\n} from '../../native';\nimport { FadeTransition, ShiftTransition } from '../TransitionConfigs/TransitionPresets';\nimport type {\n BottomTabBarProps,\n BottomTabDescriptorMap,\n BottomTabHeaderProps,\n BottomTabNavigationConfig,\n BottomTabNavigationHelpers,\n BottomTabNavigationOptions,\n BottomTabNavigationProp,\n} from '../types';\nimport { BottomTabBar, getTabBarHeight } from './BottomTabBar';\nimport { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';\nimport { BottomTabBarHeightCallbackContext } from '../utils/BottomTabBarHeightCallbackContext';\nimport { BottomTabBarHeightContext } from '../utils/BottomTabBarHeightContext';\nimport { useAnimatedHashMap } from '../utils/useAnimatedHashMap';\n\ntype Props = BottomTabNavigationConfig & {\n state: TabNavigationState<ParamListBase>;\n navigation: BottomTabNavigationHelpers;\n descriptors: BottomTabDescriptorMap;\n};\n\nconst EPSILON = 1e-5;\nconst STATE_INACTIVE = 0;\nconst STATE_TRANSITIONING_OR_BELOW_TOP = 1;\nconst STATE_ON_TOP = 2;\n\nconst NAMED_TRANSITIONS_PRESETS = {\n fade: FadeTransition,\n shift: ShiftTransition,\n none: {\n sceneStyleInterpolator: undefined,\n transitionSpec: {\n animation: 'timing',\n config: { duration: 0 },\n },\n },\n} as const;\n\nconst useNativeDriver = Platform.OS !== 'web';\n\nconst hasAnimation = (options: BottomTabNavigationOptions) => {\n const { animation, transitionSpec } = options;\n\n if (animation) {\n return animation !== 'none';\n }\n\n return Boolean(transitionSpec);\n};\n\nconst renderTabBarDefault = (props: BottomTabBarProps) => <BottomTabBar {...props} />;\n\nexport function BottomTabView(props: Props) {\n const {\n tabBar = renderTabBarDefault,\n state,\n navigation,\n descriptors,\n safeAreaInsets,\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n } = props;\n\n const focusedRouteKey = state.routes[state.index]!.key;\n\n /**\n * List of loaded tabs, tabs will be loaded when navigated to.\n */\n const [loaded, setLoaded] = React.useState([focusedRouteKey]);\n\n if (!loaded.includes(focusedRouteKey)) {\n // Set the current tab to be loaded if it was not loaded before\n setLoaded([...loaded, focusedRouteKey]);\n }\n\n const previousRouteKeyRef = React.useRef(focusedRouteKey);\n const tabAnims = useAnimatedHashMap(state);\n\n React.useEffect(() => {\n const previousRouteKey = previousRouteKeyRef.current;\n\n let popToTopAction: NavigationAction | undefined;\n\n if (\n previousRouteKey !== focusedRouteKey &&\n descriptors[previousRouteKey]?.options.popToTopOnBlur\n ) {\n const prevRoute = state.routes.find((route) => route.key === previousRouteKey);\n\n if (prevRoute?.state?.type === 'stack' && prevRoute.state.key) {\n popToTopAction = {\n ...StackActions.popToTop(),\n target: prevRoute.state.key,\n };\n }\n }\n\n const animateToIndex = () => {\n if (previousRouteKey !== focusedRouteKey) {\n navigation.emit({\n type: 'transitionStart',\n target: focusedRouteKey,\n });\n }\n\n Animated.parallel(\n state.routes\n .map((route, index) => {\n const { options } = descriptors[route.key]!;\n const {\n animation = 'none',\n transitionSpec = NAMED_TRANSITIONS_PRESETS[animation]!.transitionSpec,\n } = options;\n\n let spec = transitionSpec;\n\n if (route.key !== previousRouteKey && route.key !== focusedRouteKey) {\n // Don't animate if the screen is not previous one or new one\n // This will avoid flicker for screens not involved in the transition\n spec = NAMED_TRANSITIONS_PRESETS.none.transitionSpec;\n }\n\n spec = spec ?? NAMED_TRANSITIONS_PRESETS.none.transitionSpec;\n\n const toValue = index === state.index ? 0 : index >= state.index ? 1 : -1;\n\n return Animated[spec.animation](tabAnims[route.key]!, {\n ...spec.config,\n toValue,\n useNativeDriver,\n });\n })\n .filter(Boolean) as Animated.CompositeAnimation[]\n ).start(({ finished }) => {\n if (finished && popToTopAction) {\n navigation.dispatch(popToTopAction);\n }\n\n if (previousRouteKey !== focusedRouteKey) {\n navigation.emit({\n type: 'transitionEnd',\n target: focusedRouteKey,\n });\n }\n });\n };\n\n animateToIndex();\n\n previousRouteKeyRef.current = focusedRouteKey;\n }, [descriptors, focusedRouteKey, navigation, state.index, state.routes, tabAnims]);\n\n const dimensions = SafeAreaProviderCompat.initialMetrics.frame;\n const [tabBarHeight, setTabBarHeight] = React.useState(() =>\n getTabBarHeight({\n state,\n descriptors,\n dimensions,\n insets: {\n ...SafeAreaProviderCompat.initialMetrics.insets,\n ...props.safeAreaInsets,\n },\n style: descriptors[state.routes[state.index]!.key]!.options.tabBarStyle,\n })\n );\n\n const renderTabBar = () => {\n return (\n <SafeAreaInsetsContext.Consumer>\n {(insets) =>\n tabBar({\n state,\n descriptors,\n navigation,\n insets: {\n top: safeAreaInsets?.top ?? insets?.top ?? 0,\n right: safeAreaInsets?.right ?? insets?.right ?? 0,\n bottom: safeAreaInsets?.bottom ?? insets?.bottom ?? 0,\n left: safeAreaInsets?.left ?? insets?.left ?? 0,\n },\n })\n }\n </SafeAreaInsetsContext.Consumer>\n );\n };\n\n const { routes } = state;\n\n // If there is no animation, we only have 2 states: visible and invisible\n const hasTwoStates = !routes.some((route) => hasAnimation(descriptors[route.key]!.options));\n\n const { tabBarPosition = 'bottom' } = descriptors[focusedRouteKey]!.options;\n\n const tabBarElement = (\n <BottomTabBarHeightCallbackContext.Provider key=\"tabbar\" value={setTabBarHeight}>\n {renderTabBar()}\n </BottomTabBarHeightCallbackContext.Provider>\n );\n\n return (\n <SafeAreaProviderCompat\n style={{\n flexDirection: tabBarPosition === 'left' || tabBarPosition === 'right' ? 'row' : 'column',\n }}>\n {tabBarPosition === 'top' || tabBarPosition === 'left' ? tabBarElement : null}\n <MaybeScreenContainer\n key=\"screens\"\n enabled={detachInactiveScreens}\n hasTwoStates={hasTwoStates}\n style={styles.screens}>\n {routes.map((route, index) => {\n const descriptor = descriptors[route.key]!;\n const {\n lazy = true,\n animation = 'none',\n sceneStyleInterpolator = NAMED_TRANSITIONS_PRESETS[animation]!.sceneStyleInterpolator,\n } = descriptor.options;\n const isFocused = state.index === index;\n const isPreloaded = state.preloadedRouteKeys.includes(route.key);\n\n if (lazy && !loaded.includes(route.key) && !isFocused && !isPreloaded) {\n // Don't render a lazy screen if we've never navigated to it or it wasn't preloaded\n return null;\n }\n\n const {\n freezeOnBlur,\n header = ({ layout, options }: BottomTabHeaderProps) => (\n <Header {...options} layout={layout} title={getHeaderTitle(options, route.name)} />\n ),\n headerShown,\n headerStatusBarHeight,\n headerTransparent,\n sceneStyle: customSceneStyle,\n } = descriptor.options;\n\n const { sceneStyle } =\n sceneStyleInterpolator?.({\n current: {\n progress: tabAnims[route.key]!,\n },\n }) ?? {};\n\n const animationEnabled = hasAnimation(descriptor.options);\n const activityState = isFocused\n ? STATE_ON_TOP // the screen is on top after the transition\n : animationEnabled // is animation is not enabled, immediately move to inactive state\n ? tabAnims[route.key]!.interpolate({\n inputRange: [0, 1 - EPSILON, 1],\n outputRange: [\n STATE_TRANSITIONING_OR_BELOW_TOP, // screen visible during transition\n STATE_TRANSITIONING_OR_BELOW_TOP,\n STATE_INACTIVE, // the screen is detached after transition\n ],\n extrapolate: 'extend',\n })\n : STATE_INACTIVE;\n\n return (\n <MaybeScreen\n key={route.key}\n style={[StyleSheet.absoluteFill, { zIndex: isFocused ? 0 : -1 }]}\n active={activityState}\n enabled={detachInactiveScreens}\n freezeOnBlur={freezeOnBlur}\n shouldFreeze={activityState === STATE_INACTIVE && !isPreloaded}>\n <BottomTabBarHeightContext.Provider\n value={tabBarPosition === 'bottom' ? tabBarHeight : 0}>\n <Screen\n focused={isFocused}\n route={descriptor.route}\n navigation={descriptor.navigation}\n headerShown={headerShown}\n headerStatusBarHeight={headerStatusBarHeight}\n headerTransparent={headerTransparent}\n header={header({\n layout: dimensions,\n route: descriptor.route,\n navigation: descriptor.navigation as BottomTabNavigationProp<ParamListBase>,\n options: descriptor.options,\n })}\n style={[customSceneStyle, animationEnabled && sceneStyle]}>\n {descriptor.render()}\n </Screen>\n </BottomTabBarHeightContext.Provider>\n </MaybeScreen>\n );\n })}\n </MaybeScreenContainer>\n {tabBarPosition === 'bottom' || tabBarPosition === 'right' ? tabBarElement : null}\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n screens: {\n flex: 1,\n overflow: 'hidden',\n },\n});\n"]}
|
|
1
|
+
{"version":3,"file":"Bott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,EAChE,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,qBAAqB,EAC9B,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,aAAa,KAAK,cAAc,IAAI,CAAC,WAAW,YAC9D,uBAAC,qDAAyB,CAAC,QAAQ,IACjC,KAAK,EAAE,cAAc,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YACrD,uBAAC,iBAAM,IACL,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,UAAU,CAAC,KAAK,EACvB,UAAU,EAAE,UAAU,CAAC,UAAU,EACjC,WAAW,EAAE,WAAW,EACxB,qBAAqB,EAAE,qBAAqB,EAC5C,iBAAiB,EAAE,iBAAiB,EACpC,MAAM,EAAE,MAAM,CAAC;oCACb,MAAM,EAAE,UAAU;oCAClB,KAAK,EAAE,UAAU,CAAC,KAAK;oCACvB,UAAU,EAAE,UAAU,CAAC,UAAoD;oCAC3E,OAAO,EAAE,UAAU,CAAC,OAAO;iCAC5B,CAAC,EACF,KAAK,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,IAAI,UAAU,CAAC,YACxD,UAAU,CAAC,MAAM,EAAE,GACb,GAC0B,IAxBhC,KAAK,CAAC,GAAG,CAyBF,CACf,CAAC;gBACJ,CAAC,CAAC,IA7EE,SAAS,CA8EQ,EACtB,cAAc,KAAK,QAAQ,IAAI,cAAc,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,IAC1D,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE;QACP,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,QAAQ;KACnB;CACF,CAAC,CAAC","sourcesContent":["'use client';\nimport * as React from 'react';\nimport { Animated, Platform, StyleSheet } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nimport { getHeaderTitle, Header, SafeAreaProviderCompat, Screen } from '../../elements';\nimport {\n type NavigationAction,\n type ParamListBase,\n StackActions,\n type TabNavigationState,\n} from '../../native';\nimport { FadeTransition, ShiftTransition } from '../TransitionConfigs/TransitionPresets';\nimport type {\n BottomTabBarProps,\n BottomTabDescriptorMap,\n BottomTabHeaderProps,\n BottomTabNavigationConfig,\n BottomTabNavigationHelpers,\n BottomTabNavigationOptions,\n BottomTabNavigationProp,\n} from '../types';\nimport { BottomTabBar, getTabBarHeight } from './BottomTabBar';\nimport { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';\nimport { BottomTabBarHeightCallbackContext } from '../utils/BottomTabBarHeightCallbackContext';\nimport { BottomTabBarHeightContext } from '../utils/BottomTabBarHeightContext';\nimport { useAnimatedHashMap } from '../utils/useAnimatedHashMap';\n\ntype Props = BottomTabNavigationConfig & {\n state: TabNavigationState<ParamListBase>;\n navigation: BottomTabNavigationHelpers;\n descriptors: BottomTabDescriptorMap;\n};\n\nconst STATE_INACTIVE = 0;\nconst STATE_TRANSITIONING_OR_BELOW_TOP = 1;\nconst STATE_ON_TOP = 2;\n\nconst NAMED_TRANSITIONS_PRESETS = {\n fade: FadeTransition,\n shift: ShiftTransition,\n none: {\n sceneStyleInterpolator: undefined,\n transitionSpec: {\n animation: 'timing',\n config: { duration: 0 },\n },\n },\n} as const;\n\nconst useNativeDriver = Platform.OS !== 'web';\n\nconst hasAnimation = (options: BottomTabNavigationOptions) => {\n const { animation, transitionSpec } = options;\n\n if (animation) {\n return animation !== 'none';\n }\n\n return Boolean(transitionSpec);\n};\n\nconst renderTabBarDefault = (props: BottomTabBarProps) => <BottomTabBar {...props} />;\n\nexport function BottomTabView(props: Props) {\n const {\n tabBar = renderTabBarDefault,\n state,\n navigation,\n descriptors,\n safeAreaInsets,\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n } = props;\n\n const focusedRouteKey = state.routes[state.index]!.key;\n\n /**\n * List of loaded tabs, tabs will be loaded when navigated to.\n */\n const [loaded, setLoaded] = React.useState([focusedRouteKey]);\n\n if (!loaded.includes(focusedRouteKey)) {\n // Set the current tab to be loaded if it was not loaded before\n setLoaded([...loaded, focusedRouteKey]);\n }\n\n const previousRouteKeyRef = React.useRef(focusedRouteKey);\n const tabAnims = useAnimatedHashMap(state);\n\n const [lastUpdate, setLastUpdate] = React.useState<{\n current: string;\n previous?: string;\n animating: boolean;\n }>({\n current: focusedRouteKey,\n animating: false,\n });\n\n if (lastUpdate.current !== focusedRouteKey) {\n setLastUpdate({\n current: focusedRouteKey,\n previous: lastUpdate.current,\n animating: true,\n });\n }\n\n React.useEffect(() => {\n const previousRouteKey = previousRouteKeyRef.current;\n\n let popToTopAction: NavigationAction | undefined;\n\n if (\n previousRouteKey !== focusedRouteKey &&\n descriptors[previousRouteKey]?.options.popToTopOnBlur\n ) {\n const prevRoute = state.routes.find((route) => route.key === previousRouteKey);\n\n if (prevRoute?.state?.type === 'stack' && prevRoute.state.key) {\n popToTopAction = {\n ...StackActions.popToTop(),\n target: prevRoute.state.key,\n };\n }\n }\n\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n const animateToIndex = () => {\n if (previousRouteKey !== focusedRouteKey) {\n navigation.emit({\n type: 'transitionStart',\n target: focusedRouteKey,\n });\n }\n\n Animated.parallel(\n state.routes\n .map((route, index) => {\n const { options } = descriptors[route.key]!;\n const {\n animation = 'none',\n transitionSpec = NAMED_TRANSITIONS_PRESETS[animation]!.transitionSpec,\n } = options;\n\n let spec = transitionSpec;\n\n if (route.key !== previousRouteKey && route.key !== focusedRouteKey) {\n // Don't animate if the screen is not previous one or new one\n // This will avoid flicker for screens not involved in the transition\n spec = NAMED_TRANSITIONS_PRESETS.none.transitionSpec;\n }\n\n spec = spec ?? NAMED_TRANSITIONS_PRESETS.none.transitionSpec;\n\n const toValue = index === state.index ? 0 : index >= state.index ? 1 : -1;\n\n return Animated[spec.animation](tabAnims[route.key]!, {\n ...spec.config,\n toValue,\n useNativeDriver,\n });\n })\n .filter(Boolean) as Animated.CompositeAnimation[]\n ).start(({ finished }) => {\n if (finished && popToTopAction) {\n navigation.dispatch(popToTopAction);\n }\n\n if (previousRouteKey !== focusedRouteKey) {\n navigation.emit({\n type: 'transitionEnd',\n target: focusedRouteKey,\n });\n }\n\n if (finished) {\n // Delay clearing so the previous screen stays attached\n // This will give time for any native logic to run\n timer = setTimeout(() => {\n setLastUpdate((update) =>\n update.animating ? { ...update, animating: false } : update\n );\n }, 32);\n }\n });\n };\n\n animateToIndex();\n\n previousRouteKeyRef.current = focusedRouteKey;\n\n return () => {\n if (timer !== undefined) {\n clearTimeout(timer);\n }\n };\n }, [descriptors, focusedRouteKey, navigation, state.index, state.routes, tabAnims]);\n\n const dimensions = SafeAreaProviderCompat.initialMetrics.frame;\n const [tabBarHeight, setTabBarHeight] = React.useState(() =>\n getTabBarHeight({\n state,\n descriptors,\n dimensions,\n insets: {\n ...SafeAreaProviderCompat.initialMetrics.insets,\n ...props.safeAreaInsets,\n },\n style: descriptors[state.routes[state.index]!.key]!.options.tabBarStyle,\n })\n );\n\n const renderTabBar = () => {\n return (\n <SafeAreaInsetsContext.Consumer>\n {(insets) =>\n tabBar({\n state,\n descriptors,\n navigation,\n insets: {\n top: safeAreaInsets?.top ?? insets?.top ?? 0,\n right: safeAreaInsets?.right ?? insets?.right ?? 0,\n bottom: safeAreaInsets?.bottom ?? insets?.bottom ?? 0,\n left: safeAreaInsets?.left ?? insets?.left ?? 0,\n },\n })\n }\n </SafeAreaInsetsContext.Consumer>\n );\n };\n\n const { routes } = state;\n\n // If there is no animation, we only have 2 states: visible and invisible\n const hasTwoStates = !routes.some((route) => hasAnimation(descriptors[route.key]!.options));\n\n const { tabBarPosition = 'bottom' } = descriptors[focusedRouteKey]!.options;\n\n const tabBarElement = (\n <BottomTabBarHeightCallbackContext.Provider key=\"tabbar\" value={setTabBarHeight}>\n {renderTabBar()}\n </BottomTabBarHeightCallbackContext.Provider>\n );\n\n return (\n <SafeAreaProviderCompat\n style={{\n flexDirection: tabBarPosition === 'left' || tabBarPosition === 'right' ? 'row' : 'column',\n }}>\n {tabBarPosition === 'top' || tabBarPosition === 'left' ? tabBarElement : null}\n <MaybeScreenContainer\n key=\"screens\"\n enabled={detachInactiveScreens}\n hasTwoStates={hasTwoStates}\n style={styles.screens}>\n {routes.map((route, index) => {\n const descriptor = descriptors[route.key]!;\n const {\n lazy = true,\n animation = 'none',\n sceneStyleInterpolator = NAMED_TRANSITIONS_PRESETS[animation]!.sceneStyleInterpolator,\n } = descriptor.options;\n const isFocused = state.index === index;\n const isPreloaded = state.preloadedRouteKeys.includes(route.key);\n\n if (lazy && !loaded.includes(route.key) && !isFocused && !isPreloaded) {\n // Don't render a lazy screen if we've never navigated to it or it wasn't preloaded\n return null;\n }\n\n const {\n freezeOnBlur,\n header = ({ layout, options }: BottomTabHeaderProps) => (\n <Header {...options} layout={layout} title={getHeaderTitle(options, route.name)} />\n ),\n headerShown,\n headerStatusBarHeight,\n headerTransparent,\n sceneStyle: customSceneStyle,\n } = descriptor.options;\n\n const { sceneStyle } =\n sceneStyleInterpolator?.({\n current: {\n progress: tabAnims[route.key]!,\n },\n }) ?? {};\n\n const animationEnabled = hasAnimation(descriptor.options);\n const isAnimatingRoute =\n lastUpdate.animating &&\n (lastUpdate.previous === route.key || lastUpdate.current === route.key);\n\n const activityState = isFocused\n ? STATE_ON_TOP // the screen is on top after the transition\n : animationEnabled && isAnimatingRoute // if animation is not enabled, immediately move to inactive state\n ? STATE_TRANSITIONING_OR_BELOW_TOP // screen visible during transition\n : STATE_INACTIVE;\n\n return (\n <MaybeScreen\n key={route.key}\n style={[StyleSheet.absoluteFill, { zIndex: isFocused ? 0 : -1 }]}\n active={activityState}\n enabled={detachInactiveScreens}\n freezeOnBlur={freezeOnBlur}\n shouldFreeze={activityState === STATE_INACTIVE && !isPreloaded}>\n <BottomTabBarHeightContext.Provider\n value={tabBarPosition === 'bottom' ? tabBarHeight : 0}>\n <Screen\n focused={isFocused}\n route={descriptor.route}\n navigation={descriptor.navigation}\n headerShown={headerShown}\n headerStatusBarHeight={headerStatusBarHeight}\n headerTransparent={headerTransparent}\n header={header({\n layout: dimensions,\n route: descriptor.route,\n navigation: descriptor.navigation as BottomTabNavigationProp<ParamListBase>,\n options: descriptor.options,\n })}\n style={[customSceneStyle, animationEnabled && sceneStyle]}>\n {descriptor.render()}\n </Screen>\n </BottomTabBarHeightContext.Provider>\n </MaybeScreen>\n );\n })}\n </MaybeScreenContainer>\n {tabBarPosition === 'bottom' || tabBarPosition === 'right' ? tabBarElement : null}\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n screens: {\n flex: 1,\n overflow: 'hidden',\n },\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHeaderConfigProps.d.ts","sourceRoot":"","sources":["../../../../src/react-navigation/native-stack/views/useHeaderConfigProps.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useHeaderConfigProps.d.ts","sourceRoot":"","sources":["../../../../src/react-navigation/native-stack/views/useHeaderConfigProps.tsx"],"names":[],"mappings":"AAGA,OAAO,EAQL,KAAK,4BAA4B,EAKlC,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAE,KAAK,KAAK,EAAmC,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EAKV,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAElB,KAAK,KAAK,GAAG,4BAA4B,GAAG;IAC1C,qBAAqB,EAAE,OAAO,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,GAAG,SAAS,CAAC;IACxE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACtB,CAAC;AAoIF,wBAAgB,oBAAoB,CAAC,EACnC,cAAc,EACd,qBAAqB,EACrB,2BAA2B,EAC3B,2BAA2B,EAC3B,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAAE,0BAA0B,EAC5C,uBAAoD,EACpD,6BAA6B,EAC7B,qBAAqB,EACrB,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,UAAU,EACV,KAAK,EACL,KAAK,EACL,wBAAwB,EAAE,eAAe,EACzC,yBAAyB,EAAE,gBAAgB,EAC3C,oBAAoB,GACrB,EAAE,KAAK,GAAG,4BAA4B,CAgStC"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.useHeaderConfigProps = useHeaderConfigProps;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const expo_glass_effect_1 = require("expo-glass-effect");
|
|
6
7
|
const react_native_1 = require("react-native");
|
|
7
8
|
const react_native_screens_1 = require("react-native-screens");
|
|
8
9
|
const FontProcessor_1 = require("./FontProcessor");
|
|
@@ -124,6 +125,13 @@ function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBac
|
|
|
124
125
|
]) || {};
|
|
125
126
|
const headerStyleFlattened = react_native_1.StyleSheet.flatten(headerStyle) || {};
|
|
126
127
|
const headerLargeStyleFlattened = react_native_1.StyleSheet.flatten(headerLargeStyle) || {};
|
|
128
|
+
const headerBackgroundColor = headerStyleFlattened.backgroundColor ??
|
|
129
|
+
(headerBackground != null ||
|
|
130
|
+
headerTransparent ||
|
|
131
|
+
// The title becomes invisible if background color is set with large title on iOS 26
|
|
132
|
+
(react_native_1.Platform.OS === 'ios' && headerLargeTitleEnabled)
|
|
133
|
+
? 'transparent'
|
|
134
|
+
: colors.card);
|
|
127
135
|
const [backTitleFontFamily, largeTitleFontFamily, titleFontFamily] = (0, FontProcessor_1.processFonts)([
|
|
128
136
|
headerBackTitleStyleFlattened.fontFamily,
|
|
129
137
|
headerLargeTitleStyleFlattened.fontFamily,
|
|
@@ -135,7 +143,12 @@ function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBac
|
|
|
135
143
|
const titleText = (0, elements_1.getHeaderTitle)({ title, headerTitle }, route.name);
|
|
136
144
|
const titleColor = 'color' in headerTitleStyleFlattened
|
|
137
145
|
? headerTitleStyleFlattened.color
|
|
138
|
-
: (
|
|
146
|
+
: (0, expo_glass_effect_1.isLiquidGlassAvailable)() && (headerTransparent || headerBackgroundColor === 'transparent')
|
|
147
|
+
? // On iOS 26, we want header title to change color based on content underneath
|
|
148
|
+
// So we don't set an explicit color when header is transparent
|
|
149
|
+
// Unless a custom tint color is explicitly provided
|
|
150
|
+
headerTintColor
|
|
151
|
+
: (headerTintColor ?? colors.text);
|
|
139
152
|
const titleFontSize = 'fontSize' in headerTitleStyleFlattened ? headerTitleStyleFlattened.fontSize : undefined;
|
|
140
153
|
const titleFontWeight = headerTitleStyleFlattened.fontWeight;
|
|
141
154
|
const largeTitleBackgroundColor = headerLargeStyleFlattened.backgroundColor;
|
|
@@ -154,13 +167,6 @@ function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBac
|
|
|
154
167
|
if (titleFontWeight != null) {
|
|
155
168
|
headerTitleStyleSupported.fontWeight = titleFontWeight;
|
|
156
169
|
}
|
|
157
|
-
const headerBackgroundColor = headerStyleFlattened.backgroundColor ??
|
|
158
|
-
(headerBackground != null ||
|
|
159
|
-
headerTransparent ||
|
|
160
|
-
// The title becomes invisible if background color is set with large title on iOS 26
|
|
161
|
-
(react_native_1.Platform.OS === 'ios' && headerLargeTitleEnabled)
|
|
162
|
-
? 'transparent'
|
|
163
|
-
: colors.card);
|
|
164
170
|
const canGoBack = headerBack != null;
|
|
165
171
|
const headerLeftElement = headerLeft?.({
|
|
166
172
|
tintColor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHeaderConfigProps.js","sourceRoot":"","sources":["../../../../src/react-navigation/native-stack/views/useHeaderConfigProps.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAsKb,oDA2TC;;AAheD,+CAA0E;AAC1E,+DAa8B;AAE9B,mDAA+C;AAC/C,gDAA6C;AAC7C,6CAA6D;AAC7D,yCAA2E;AAgB3E,MAAM,qBAAqB,GAAG,CAC5B,KAA0C,EAC1C,MAAuB,EACvB,KAAqB,EACrB,EAAE;IACF,OAAO,KAAK;QACV,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACpB,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC3B,2EAA2E;YAC3E,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC5B,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CACb,wDAAwD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAC/E,CAAC;YACJ,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACnD,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;gBAC9C,MAAM,IAAI,KAAK,CAAC,kDAAkD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC5F,CAAC;YAED,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;YAEzD,MAAM,mBAAmB,GAAG;gBAC1B,GAAG,IAAI;gBACP,KAAK;gBACL,KAAK,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AU;QACV,eAAe;QACf,aAAa;QACb,eAAe,EAAE,MAAM,CAAC,eAAe,CAAC;QACxC,eAAe,EAAE,qBAAqB;QACtC,WAAW,EAAE,WAAW,KAAK,IAAI;QACjC,QAAQ;QACR,wBAAwB,EAAE,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC;QACzE,yBAAyB,EAAE,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC;QAC3E,+BAA+B,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;QACxD,GAAG,iBAAiB;KACZ,CAAC;AACb,CAAC","sourcesContent":["'use client';\nimport { Platform, StyleSheet, type TextStyle, View } from 'react-native';\nimport {\n type HeaderBarButtonItemMenuAction,\n type HeaderBarButtonItemSubmenu,\n type HeaderBarButtonItemWithAction,\n type HeaderBarButtonItemWithMenu,\n isSearchBarAvailableForCurrentPlatform,\n ScreenStackHeaderBackButtonImage,\n ScreenStackHeaderCenterView,\n type ScreenStackHeaderConfigProps,\n ScreenStackHeaderLeftView,\n ScreenStackHeaderRightView,\n ScreenStackHeaderSearchBarView,\n SearchBar,\n} from 'react-native-screens';\n\nimport { processFonts } from './FontProcessor';\nimport { Color } from '../../../utils/color';\nimport { getHeaderTitle, HeaderTitle } from '../../elements';\nimport { type Route, type Theme, useLocale, useTheme } from '../../native';\nimport type {\n NativeStackHeaderItem,\n NativeStackHeaderItemButton,\n NativeStackHeaderItemMenuAction,\n NativeStackHeaderItemMenuSubmenu,\n NativeStackNavigationOptions,\n} from '../types';\n\ntype Props = NativeStackNavigationOptions & {\n headerTopInsetEnabled: boolean;\n headerHeight: number;\n headerBack: { title?: string | undefined; href: undefined } | undefined;\n route: Route<string>;\n};\n\nconst processBarButtonItems = (\n items: NativeStackHeaderItem[] | undefined,\n colors: Theme['colors'],\n fonts: Theme['fonts']\n) => {\n return items\n ?.map((item, index) => {\n if (item.type === 'custom') {\n // Handled with `ScreenStackHeaderLeftView` or `ScreenStackHeaderRightView`\n return null;\n }\n\n if (item.type === 'spacing') {\n if (item.spacing == null) {\n throw new Error(\n `Spacing item must have a 'spacing' property defined: ${JSON.stringify(item)}`\n );\n }\n\n return item;\n }\n\n if (item.type === 'button' || item.type === 'menu') {\n if (item.type === 'menu' && item.menu == null) {\n throw new Error(`Menu item must have a 'menu' property defined: ${JSON.stringify(item)}`);\n }\n\n const { badge, label, labelStyle, icon, ...rest } = item;\n\n const processedItemCommon = {\n ...rest,\n index,\n title: label,\n titleStyle: {\n ...fonts.regular,\n ...labelStyle,\n },\n icon: transformIcon(icon),\n };\n\n let processedItem: HeaderBarButtonItemWithAction | HeaderBarButtonItemWithMenu;\n\n if (processedItemCommon.type === 'menu' && item.type === 'menu') {\n const { multiselectable, layout } = item.menu;\n\n processedItem = {\n ...processedItemCommon,\n menu: {\n ...processedItemCommon.menu,\n singleSelection: !multiselectable,\n displayAsPalette: layout === 'palette',\n items: item.menu.items.map(getMenuItem),\n },\n };\n } else if (processedItemCommon.type === 'button' && item.type === 'button') {\n processedItem = processedItemCommon;\n } else {\n throw new Error(\n `Invalid item type: ${JSON.stringify(item)}. Valid types are 'button' and 'menu'.`\n );\n }\n\n if (badge) {\n const badgeBackgroundColor = badge.style?.backgroundColor ?? colors.notification;\n const badgeTextColor = Color(badgeBackgroundColor)?.isLight() ? 'black' : 'white';\n\n processedItem = {\n ...processedItem,\n badge: {\n ...badge,\n value: String(badge.value),\n style: {\n backgroundColor: badgeBackgroundColor,\n color: badgeTextColor,\n ...fonts.regular,\n ...badge.style,\n },\n },\n };\n }\n\n return processedItem;\n }\n\n throw new Error(\n `Invalid item type: ${JSON.stringify(item)}. Valid types are 'button', 'menu', 'custom' and 'spacing'.`\n );\n })\n .filter((item) => item != null);\n};\n\nconst transformIcon = (\n icon: NativeStackHeaderItemButton['icon']\n): HeaderBarButtonItemWithAction['icon'] | HeaderBarButtonItemWithMenu['icon'] => {\n if (icon?.type === 'image') {\n return icon.tinted === false\n ? { type: 'imageSource', imageSource: icon.source }\n : { type: 'templateSource', templateSource: icon.source };\n }\n\n return icon;\n};\n\nconst getMenuItem = (\n item: NativeStackHeaderItemMenuAction | NativeStackHeaderItemMenuSubmenu\n): HeaderBarButtonItemMenuAction | HeaderBarButtonItemSubmenu => {\n if (item.type === 'submenu') {\n const { label, icon, inline, layout, items, multiselectable, ...rest } = item;\n\n return {\n ...rest,\n icon: transformIcon(icon),\n title: label,\n displayAsPalette: layout === 'palette',\n displayInline: inline,\n singleSelection: !multiselectable,\n items: items.map(getMenuItem),\n };\n }\n\n const { label, icon, description, ...rest } = item;\n\n return {\n ...rest,\n icon: transformIcon(icon),\n title: label,\n subtitle: description,\n };\n};\n\nexport function useHeaderConfigProps({\n headerBackIcon,\n headerBackImageSource,\n headerBackButtonDisplayMode,\n headerBackButtonMenuEnabled,\n headerBackTitle,\n headerBackTitleStyle,\n headerBackVisible,\n headerShadowVisible,\n headerLargeStyle,\n headerLargeTitle: headerLargeTitleDeprecated,\n headerLargeTitleEnabled = headerLargeTitleDeprecated,\n headerLargeTitleShadowVisible,\n headerLargeTitleStyle,\n headerBackground,\n headerLeft,\n headerRight,\n headerShown,\n headerStyle,\n headerBlurEffect,\n headerTintColor,\n headerTitle,\n headerTitleAlign,\n headerTitleStyle,\n headerTransparent,\n headerSearchBarOptions,\n headerTopInsetEnabled,\n headerBack,\n route,\n title,\n unstable_headerLeftItems: headerLeftItems,\n unstable_headerRightItems: headerRightItems,\n unstable_nativeProps,\n}: Props): ScreenStackHeaderConfigProps {\n const { direction } = useLocale();\n const { colors, fonts, dark } = useTheme();\n const tintColor = headerTintColor ?? (Platform.OS === 'ios' ? colors.primary : colors.text);\n const headerNativeProps = unstable_nativeProps?.headerConfig;\n\n const headerBackTitleStyleFlattened =\n StyleSheet.flatten([fonts.regular, headerBackTitleStyle]) || {};\n const headerLargeTitleStyleFlattened =\n StyleSheet.flatten([\n Platform.select({ ios: fonts.heavy, default: fonts.medium }),\n headerLargeTitleStyle,\n ]) || {};\n const headerTitleStyleFlattened =\n StyleSheet.flatten([\n Platform.select({ ios: fonts.bold, default: fonts.medium }),\n headerTitleStyle,\n ]) || {};\n const headerStyleFlattened = StyleSheet.flatten(headerStyle) || {};\n const headerLargeStyleFlattened = StyleSheet.flatten(headerLargeStyle) || {};\n\n const [backTitleFontFamily, largeTitleFontFamily, titleFontFamily] = processFonts([\n headerBackTitleStyleFlattened.fontFamily,\n headerLargeTitleStyleFlattened.fontFamily,\n headerTitleStyleFlattened.fontFamily,\n ]);\n\n const backTitleFontSize =\n 'fontSize' in headerBackTitleStyleFlattened\n ? headerBackTitleStyleFlattened.fontSize\n : undefined;\n\n const titleText = getHeaderTitle({ title, headerTitle }, route.name);\n const titleColor =\n 'color' in headerTitleStyleFlattened\n ? headerTitleStyleFlattened.color\n : (headerTintColor ?? colors.text);\n const titleFontSize =\n 'fontSize' in headerTitleStyleFlattened ? headerTitleStyleFlattened.fontSize : undefined;\n const titleFontWeight = headerTitleStyleFlattened.fontWeight;\n\n const largeTitleBackgroundColor = headerLargeStyleFlattened.backgroundColor;\n const largeTitleColor =\n 'color' in headerLargeTitleStyleFlattened ? headerLargeTitleStyleFlattened.color : undefined;\n const largeTitleFontSize =\n 'fontSize' in headerLargeTitleStyleFlattened\n ? headerLargeTitleStyleFlattened.fontSize\n : undefined;\n const largeTitleFontWeight = headerLargeTitleStyleFlattened.fontWeight;\n\n const headerTitleStyleSupported: TextStyle = { color: titleColor };\n\n if (headerTitleStyleFlattened.fontFamily != null) {\n headerTitleStyleSupported.fontFamily = headerTitleStyleFlattened.fontFamily;\n }\n\n if (titleFontSize != null) {\n headerTitleStyleSupported.fontSize = titleFontSize;\n }\n\n if (titleFontWeight != null) {\n headerTitleStyleSupported.fontWeight = titleFontWeight;\n }\n\n const headerBackgroundColor =\n headerStyleFlattened.backgroundColor ??\n (headerBackground != null ||\n headerTransparent ||\n // The title becomes invisible if background color is set with large title on iOS 26\n (Platform.OS === 'ios' && headerLargeTitleEnabled)\n ? 'transparent'\n : colors.card);\n\n const canGoBack = headerBack != null;\n\n const headerLeftElement = headerLeft?.({\n tintColor,\n canGoBack,\n backgroundColor: headerBackgroundColor,\n label: headerBackTitle ?? headerBack?.title,\n // `href` is only applicable to web\n href: undefined,\n });\n\n const headerRightElement = headerRight?.({\n tintColor,\n canGoBack,\n backgroundColor: headerBackgroundColor,\n });\n\n const headerTitleElement =\n typeof headerTitle === 'function'\n ? headerTitle({\n tintColor,\n children: titleText,\n })\n : null;\n\n const supportsHeaderSearchBar =\n typeof isSearchBarAvailableForCurrentPlatform === 'boolean'\n ? isSearchBarAvailableForCurrentPlatform\n : // Fallback for older versions of react-native-screens\n Platform.OS === 'ios' && SearchBar != null;\n\n const hasHeaderSearchBar = supportsHeaderSearchBar && headerSearchBarOptions != null;\n\n /**\n * We need to set this in if:\n * - Back button should stay visible when `headerLeft` is specified\n * - If `headerTitle` for Android is specified, so we only need to remove the title and keep the back button\n */\n const backButtonInCustomView =\n headerBackVisible ||\n (Platform.OS === 'android' && headerTitleElement != null && headerLeftElement == null);\n\n const translucent =\n headerBackground != null ||\n headerTransparent ||\n // When using a SearchBar or large title, the header needs to be translucent for it to work on iOS\n ((hasHeaderSearchBar || headerLargeTitleEnabled) &&\n Platform.OS === 'ios' &&\n headerTransparent !== false);\n\n const isBackButtonDisplayModeAvailable =\n // On iOS 14+\n Platform.OS === 'ios' &&\n parseInt(Platform.Version, 10) >= 14 &&\n // Doesn't have custom styling, by default System, see: https://github.com/software-mansion/react-native-screens/pull/2105#discussion_r1565222738\n (backTitleFontFamily == null || backTitleFontFamily === 'System') &&\n backTitleFontSize == null &&\n // Back button menu is not disabled\n headerBackButtonMenuEnabled !== false;\n\n const isCenterViewRenderedAndroid = headerTitleAlign === 'center';\n\n const leftItems = headerLeftItems?.({\n tintColor,\n canGoBack,\n });\n\n let rightItems = headerRightItems?.({\n tintColor,\n canGoBack,\n });\n\n if (rightItems) {\n // iOS renders right items in reverse order\n // So we need to reverse them here to match the order\n rightItems = [...rightItems].reverse();\n }\n\n const children = (\n <>\n {Platform.OS === 'ios' ? (\n <>\n {leftItems ? (\n leftItems.map((item, index) => {\n if (item.type === 'custom') {\n return (\n <ScreenStackHeaderLeftView\n key={index}\n hidesSharedBackground={item.hidesSharedBackground}>\n {item.element}\n </ScreenStackHeaderLeftView>\n );\n }\n\n return null;\n })\n ) : headerLeftElement != null ? (\n <ScreenStackHeaderLeftView>{headerLeftElement}</ScreenStackHeaderLeftView>\n ) : null}\n {headerTitleElement != null ? (\n <ScreenStackHeaderCenterView>{headerTitleElement}</ScreenStackHeaderCenterView>\n ) : null}\n </>\n ) : (\n <>\n {headerLeftElement != null || typeof headerTitle === 'function' ? (\n // The style passed to header left, together with title element being wrapped\n // in flex view is reqruied for proper header layout, in particular,\n // for the text truncation to work.\n <ScreenStackHeaderLeftView style={!isCenterViewRenderedAndroid ? { flex: 1 } : null}>\n {headerLeftElement}\n {headerTitleAlign !== 'center' ? (\n typeof headerTitle === 'function' ? (\n <View style={{ flex: 1 }}>{headerTitleElement}</View>\n ) : (\n <View style={{ flex: 1 }}>\n <HeaderTitle tintColor={tintColor} style={headerTitleStyleSupported}>\n {titleText}\n </HeaderTitle>\n </View>\n )\n ) : null}\n </ScreenStackHeaderLeftView>\n ) : null}\n {isCenterViewRenderedAndroid ? (\n <ScreenStackHeaderCenterView>\n {typeof headerTitle === 'function' ? (\n headerTitleElement\n ) : (\n <HeaderTitle tintColor={tintColor} style={headerTitleStyleSupported}>\n {titleText}\n </HeaderTitle>\n )}\n </ScreenStackHeaderCenterView>\n ) : null}\n </>\n )}\n {headerBackIcon !== undefined || headerBackImageSource !== undefined ? (\n <ScreenStackHeaderBackButtonImage\n source={headerBackIcon?.source ?? headerBackImageSource}\n />\n ) : null}\n {Platform.OS === 'ios' && rightItems ? (\n rightItems.map((item, index) => {\n if (item.type === 'custom') {\n return (\n <ScreenStackHeaderRightView\n key={index}\n hidesSharedBackground={item.hidesSharedBackground}>\n {item.element}\n </ScreenStackHeaderRightView>\n );\n }\n\n return null;\n })\n ) : headerRightElement != null ? (\n <ScreenStackHeaderRightView>{headerRightElement}</ScreenStackHeaderRightView>\n ) : null}\n {hasHeaderSearchBar ? (\n <ScreenStackHeaderSearchBarView>\n <SearchBar {...headerSearchBarOptions} />\n </ScreenStackHeaderSearchBarView>\n ) : null}\n </>\n );\n\n return {\n backButtonInCustomView,\n backgroundColor: headerBackgroundColor,\n backTitle: headerBackTitle,\n backTitleVisible: isBackButtonDisplayModeAvailable\n ? undefined\n : headerBackButtonDisplayMode !== 'minimal',\n backButtonDisplayMode: isBackButtonDisplayModeAvailable\n ? headerBackButtonDisplayMode\n : undefined,\n backTitleFontFamily,\n backTitleFontSize,\n blurEffect: headerBlurEffect,\n color: tintColor,\n direction,\n disableBackButtonMenu: headerBackButtonMenuEnabled === false,\n hidden: headerShown === false,\n hideBackButton: headerBackVisible === false,\n hideShadow:\n headerShadowVisible === false ||\n headerBackground != null ||\n (headerTransparent && headerShadowVisible !== true),\n largeTitle: headerLargeTitleEnabled,\n largeTitleBackgroundColor,\n largeTitleColor,\n largeTitleFontFamily,\n largeTitleFontSize,\n largeTitleFontWeight,\n largeTitleHideShadow: headerLargeTitleShadowVisible === false,\n title: titleText,\n titleColor,\n titleFontFamily,\n titleFontSize,\n titleFontWeight: String(titleFontWeight),\n topInsetEnabled: headerTopInsetEnabled,\n translucent: translucent === true,\n children,\n headerLeftBarButtonItems: processBarButtonItems(leftItems, colors, fonts),\n headerRightBarButtonItems: processBarButtonItems(rightItems, colors, fonts),\n experimental_userInterfaceStyle: dark ? 'dark' : 'light',\n ...headerNativeProps,\n } as const;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useHeaderConfigProps.js","sourceRoot":"","sources":["../../../../src/react-navigation/native-stack/views/useHeaderConfigProps.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAuKb,oDAiUC;;AAveD,yDAA2D;AAC3D,+CAA0E;AAC1E,+DAa8B;AAE9B,mDAA+C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MAAM,CAAC,eAAe,CAAC;QACxC,eAAe,EAAE,qBAAqB;QACtC,WAAW,EAAE,WAAW,KAAK,IAAI;QACjC,QAAQ;QACR,wBAAwB,EAAE,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC;QACzE,yBAAyB,EAAE,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC;QAC3E,+BAA+B,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;QACxD,GAAG,iBAAiB;KACZ,CAAC;AACb,CAAC","sourcesContent":["'use client';\nimport { isLiquidGlassAvailable } from 'expo-glass-effect';\nimport { Platform, StyleSheet, type TextStyle, View } from 'react-native';\nimport {\n type HeaderBarButtonItemMenuAction,\n type HeaderBarButtonItemSubmenu,\n type HeaderBarButtonItemWithAction,\n type HeaderBarButtonItemWithMenu,\n isSearchBarAvailableForCurrentPlatform,\n ScreenStackHeaderBackButtonImage,\n ScreenStackHeaderCenterView,\n type ScreenStackHeaderConfigProps,\n ScreenStackHeaderLeftView,\n ScreenStackHeaderRightView,\n ScreenStackHeaderSearchBarView,\n SearchBar,\n} from 'react-native-screens';\n\nimport { processFonts } from './FontProcessor';\nimport { Color } from '../../../utils/color';\nimport { getHeaderTitle, HeaderTitle } from '../../elements';\nimport { type Route, type Theme, useLocale, useTheme } from '../../native';\nimport type {\n NativeStackHeaderItem,\n NativeStackHeaderItemButton,\n NativeStackHeaderItemMenuAction,\n NativeStackHeaderItemMenuSubmenu,\n NativeStackNavigationOptions,\n} from '../types';\n\ntype Props = NativeStackNavigationOptions & {\n headerTopInsetEnabled: boolean;\n headerHeight: number;\n headerBack: { title?: string | undefined; href: undefined } | undefined;\n route: Route<string>;\n};\n\nconst processBarButtonItems = (\n items: NativeStackHeaderItem[] | undefined,\n colors: Theme['colors'],\n fonts: Theme['fonts']\n) => {\n return items\n ?.map((item, index) => {\n if (item.type === 'custom') {\n // Handled with `ScreenStackHeaderLeftView` or `ScreenStackHeaderRightView`\n return null;\n }\n\n if (item.type === 'spacing') {\n if (item.spacing == null) {\n throw new Error(\n `Spacing item must have a 'spacing' property defined: ${JSON.stringify(item)}`\n );\n }\n\n return item;\n }\n\n if (item.type === 'button' || item.type === 'menu') {\n if (item.type === 'menu' && item.menu == null) {\n throw new Error(`Menu item must have a 'menu' property defined: ${JSON.stringify(item)}`);\n }\n\n const { badge, label, labelStyle, icon, ...rest } = item;\n\n const processedItemCommon = {\n ...rest,\n index,\n title: label,\n titleStyle: {\n ...fonts.regular,\n ...labelStyle,\n },\n icon: transformIcon(icon),\n };\n\n let processedItem: HeaderBarButtonItemWithAction | HeaderBarButtonItemWithMenu;\n\n if (processedItemCommon.type === 'menu' && item.type === 'menu') {\n const { multiselectable, layout } = item.menu;\n\n processedItem = {\n ...processedItemCommon,\n menu: {\n ...processedItemCommon.menu,\n singleSelection: !multiselectable,\n displayAsPalette: layout === 'palette',\n items: item.menu.items.map(getMenuItem),\n },\n };\n } else if (processedItemCommon.type === 'button' && item.type === 'button') {\n processedItem = processedItemCommon;\n } else {\n throw new Error(\n `Invalid item type: ${JSON.stringify(item)}. Valid types are 'button' and 'menu'.`\n );\n }\n\n if (badge) {\n const badgeBackgroundColor = badge.style?.backgroundColor ?? colors.notification;\n const badgeTextColor = Color(badgeBackgroundColor)?.isLight() ? 'black' : 'white';\n\n processedItem = {\n ...processedItem,\n badge: {\n ...badge,\n value: String(badge.value),\n style: {\n backgroundColor: badgeBackgroundColor,\n color: badgeTextColor,\n ...fonts.regular,\n ...badge.style,\n },\n },\n };\n }\n\n return processedItem;\n }\n\n throw new Error(\n `Invalid item type: ${JSON.stringify(item)}. Valid types are 'button', 'menu', 'custom' and 'spacing'.`\n );\n })\n .filter((item) => item != null);\n};\n\nconst transformIcon = (\n icon: NativeStackHeaderItemButton['icon']\n): HeaderBarButtonItemWithAction['icon'] | HeaderBarButtonItemWithMenu['icon'] => {\n if (icon?.type === 'image') {\n return icon.tinted === false\n ? { type: 'imageSource', imageSource: icon.source }\n : { type: 'templateSource', templateSource: icon.source };\n }\n\n return icon;\n};\n\nconst getMenuItem = (\n item: NativeStackHeaderItemMenuAction | NativeStackHeaderItemMenuSubmenu\n): HeaderBarButtonItemMenuAction | HeaderBarButtonItemSubmenu => {\n if (item.type === 'submenu') {\n const { label, icon, inline, layout, items, multiselectable, ...rest } = item;\n\n return {\n ...rest,\n icon: transformIcon(icon),\n title: label,\n displayAsPalette: layout === 'palette',\n displayInline: inline,\n singleSelection: !multiselectable,\n items: items.map(getMenuItem),\n };\n }\n\n const { label, icon, description, ...rest } = item;\n\n return {\n ...rest,\n icon: transformIcon(icon),\n title: label,\n subtitle: description,\n };\n};\n\nexport function useHeaderConfigProps({\n headerBackIcon,\n headerBackImageSource,\n headerBackButtonDisplayMode,\n headerBackButtonMenuEnabled,\n headerBackTitle,\n headerBackTitleStyle,\n headerBackVisible,\n headerShadowVisible,\n headerLargeStyle,\n headerLargeTitle: headerLargeTitleDeprecated,\n headerLargeTitleEnabled = headerLargeTitleDeprecated,\n headerLargeTitleShadowVisible,\n headerLargeTitleStyle,\n headerBackground,\n headerLeft,\n headerRight,\n headerShown,\n headerStyle,\n headerBlurEffect,\n headerTintColor,\n headerTitle,\n headerTitleAlign,\n headerTitleStyle,\n headerTransparent,\n headerSearchBarOptions,\n headerTopInsetEnabled,\n headerBack,\n route,\n title,\n unstable_headerLeftItems: headerLeftItems,\n unstable_headerRightItems: headerRightItems,\n unstable_nativeProps,\n}: Props): ScreenStackHeaderConfigProps {\n const { direction } = useLocale();\n const { colors, fonts, dark } = useTheme();\n\n const tintColor = headerTintColor ?? (Platform.OS === 'ios' ? colors.primary : colors.text);\n const headerNativeProps = unstable_nativeProps?.headerConfig;\n\n const headerBackTitleStyleFlattened =\n StyleSheet.flatten([fonts.regular, headerBackTitleStyle]) || {};\n const headerLargeTitleStyleFlattened =\n StyleSheet.flatten([\n Platform.select({ ios: fonts.heavy, default: fonts.medium }),\n headerLargeTitleStyle,\n ]) || {};\n const headerTitleStyleFlattened =\n StyleSheet.flatten([\n Platform.select({ ios: fonts.bold, default: fonts.medium }),\n headerTitleStyle,\n ]) || {};\n const headerStyleFlattened = StyleSheet.flatten(headerStyle) || {};\n const headerLargeStyleFlattened = StyleSheet.flatten(headerLargeStyle) || {};\n\n const headerBackgroundColor =\n headerStyleFlattened.backgroundColor ??\n (headerBackground != null ||\n headerTransparent ||\n // The title becomes invisible if background color is set with large title on iOS 26\n (Platform.OS === 'ios' && headerLargeTitleEnabled)\n ? 'transparent'\n : colors.card);\n\n const [backTitleFontFamily, largeTitleFontFamily, titleFontFamily] = processFonts([\n headerBackTitleStyleFlattened.fontFamily,\n headerLargeTitleStyleFlattened.fontFamily,\n headerTitleStyleFlattened.fontFamily,\n ]);\n\n const backTitleFontSize =\n 'fontSize' in headerBackTitleStyleFlattened\n ? headerBackTitleStyleFlattened.fontSize\n : undefined;\n\n const titleText = getHeaderTitle({ title, headerTitle }, route.name);\n const titleColor =\n 'color' in headerTitleStyleFlattened\n ? headerTitleStyleFlattened.color\n : isLiquidGlassAvailable() && (headerTransparent || headerBackgroundColor === 'transparent')\n ? // On iOS 26, we want header title to change color based on content underneath\n // So we don't set an explicit color when header is transparent\n // Unless a custom tint color is explicitly provided\n headerTintColor\n : (headerTintColor ?? colors.text);\n const titleFontSize =\n 'fontSize' in headerTitleStyleFlattened ? headerTitleStyleFlattened.fontSize : undefined;\n const titleFontWeight = headerTitleStyleFlattened.fontWeight;\n\n const largeTitleBackgroundColor = headerLargeStyleFlattened.backgroundColor;\n const largeTitleColor =\n 'color' in headerLargeTitleStyleFlattened ? headerLargeTitleStyleFlattened.color : undefined;\n const largeTitleFontSize =\n 'fontSize' in headerLargeTitleStyleFlattened\n ? headerLargeTitleStyleFlattened.fontSize\n : undefined;\n const largeTitleFontWeight = headerLargeTitleStyleFlattened.fontWeight;\n\n const headerTitleStyleSupported: TextStyle = { color: titleColor };\n\n if (headerTitleStyleFlattened.fontFamily != null) {\n headerTitleStyleSupported.fontFamily = headerTitleStyleFlattened.fontFamily;\n }\n\n if (titleFontSize != null) {\n headerTitleStyleSupported.fontSize = titleFontSize;\n }\n\n if (titleFontWeight != null) {\n headerTitleStyleSupported.fontWeight = titleFontWeight;\n }\n\n const canGoBack = headerBack != null;\n\n const headerLeftElement = headerLeft?.({\n tintColor,\n canGoBack,\n backgroundColor: headerBackgroundColor,\n label: headerBackTitle ?? headerBack?.title,\n // `href` is only applicable to web\n href: undefined,\n });\n\n const headerRightElement = headerRight?.({\n tintColor,\n canGoBack,\n backgroundColor: headerBackgroundColor,\n });\n\n const headerTitleElement =\n typeof headerTitle === 'function'\n ? headerTitle({\n tintColor,\n children: titleText,\n })\n : null;\n\n const supportsHeaderSearchBar =\n typeof isSearchBarAvailableForCurrentPlatform === 'boolean'\n ? isSearchBarAvailableForCurrentPlatform\n : // Fallback for older versions of react-native-screens\n Platform.OS === 'ios' && SearchBar != null;\n\n const hasHeaderSearchBar = supportsHeaderSearchBar && headerSearchBarOptions != null;\n\n /**\n * We need to set this in if:\n * - Back button should stay visible when `headerLeft` is specified\n * - If `headerTitle` for Android is specified, so we only need to remove the title and keep the back button\n */\n const backButtonInCustomView =\n headerBackVisible ||\n (Platform.OS === 'android' && headerTitleElement != null && headerLeftElement == null);\n\n const translucent =\n headerBackground != null ||\n headerTransparent ||\n // When using a SearchBar or large title, the header needs to be translucent for it to work on iOS\n ((hasHeaderSearchBar || headerLargeTitleEnabled) &&\n Platform.OS === 'ios' &&\n headerTransparent !== false);\n\n const isBackButtonDisplayModeAvailable =\n // On iOS 14+\n Platform.OS === 'ios' &&\n parseInt(Platform.Version, 10) >= 14 &&\n // Doesn't have custom styling, by default System, see: https://github.com/software-mansion/react-native-screens/pull/2105#discussion_r1565222738\n (backTitleFontFamily == null || backTitleFontFamily === 'System') &&\n backTitleFontSize == null &&\n // Back button menu is not disabled\n headerBackButtonMenuEnabled !== false;\n\n const isCenterViewRenderedAndroid = headerTitleAlign === 'center';\n\n const leftItems = headerLeftItems?.({\n tintColor,\n canGoBack,\n });\n\n let rightItems = headerRightItems?.({\n tintColor,\n canGoBack,\n });\n\n if (rightItems) {\n // iOS renders right items in reverse order\n // So we need to reverse them here to match the order\n rightItems = [...rightItems].reverse();\n }\n\n const children = (\n <>\n {Platform.OS === 'ios' ? (\n <>\n {leftItems ? (\n leftItems.map((item, index) => {\n if (item.type === 'custom') {\n return (\n <ScreenStackHeaderLeftView\n key={index}\n hidesSharedBackground={item.hidesSharedBackground}>\n {item.element}\n </ScreenStackHeaderLeftView>\n );\n }\n\n return null;\n })\n ) : headerLeftElement != null ? (\n <ScreenStackHeaderLeftView>{headerLeftElement}</ScreenStackHeaderLeftView>\n ) : null}\n {headerTitleElement != null ? (\n <ScreenStackHeaderCenterView>{headerTitleElement}</ScreenStackHeaderCenterView>\n ) : null}\n </>\n ) : (\n <>\n {headerLeftElement != null || typeof headerTitle === 'function' ? (\n // The style passed to header left, together with title element being wrapped\n // in flex view is reqruied for proper header layout, in particular,\n // for the text truncation to work.\n <ScreenStackHeaderLeftView style={!isCenterViewRenderedAndroid ? { flex: 1 } : null}>\n {headerLeftElement}\n {headerTitleAlign !== 'center' ? (\n typeof headerTitle === 'function' ? (\n <View style={{ flex: 1 }}>{headerTitleElement}</View>\n ) : (\n <View style={{ flex: 1 }}>\n <HeaderTitle tintColor={tintColor} style={headerTitleStyleSupported}>\n {titleText}\n </HeaderTitle>\n </View>\n )\n ) : null}\n </ScreenStackHeaderLeftView>\n ) : null}\n {isCenterViewRenderedAndroid ? (\n <ScreenStackHeaderCenterView>\n {typeof headerTitle === 'function' ? (\n headerTitleElement\n ) : (\n <HeaderTitle tintColor={tintColor} style={headerTitleStyleSupported}>\n {titleText}\n </HeaderTitle>\n )}\n </ScreenStackHeaderCenterView>\n ) : null}\n </>\n )}\n {headerBackIcon !== undefined || headerBackImageSource !== undefined ? (\n <ScreenStackHeaderBackButtonImage\n source={headerBackIcon?.source ?? headerBackImageSource}\n />\n ) : null}\n {Platform.OS === 'ios' && rightItems ? (\n rightItems.map((item, index) => {\n if (item.type === 'custom') {\n return (\n <ScreenStackHeaderRightView\n key={index}\n hidesSharedBackground={item.hidesSharedBackground}>\n {item.element}\n </ScreenStackHeaderRightView>\n );\n }\n\n return null;\n })\n ) : headerRightElement != null ? (\n <ScreenStackHeaderRightView>{headerRightElement}</ScreenStackHeaderRightView>\n ) : null}\n {hasHeaderSearchBar ? (\n <ScreenStackHeaderSearchBarView>\n <SearchBar {...headerSearchBarOptions} />\n </ScreenStackHeaderSearchBarView>\n ) : null}\n </>\n );\n\n return {\n backButtonInCustomView,\n backgroundColor: headerBackgroundColor,\n backTitle: headerBackTitle,\n backTitleVisible: isBackButtonDisplayModeAvailable\n ? undefined\n : headerBackButtonDisplayMode !== 'minimal',\n backButtonDisplayMode: isBackButtonDisplayModeAvailable\n ? headerBackButtonDisplayMode\n : undefined,\n backTitleFontFamily,\n backTitleFontSize,\n blurEffect: headerBlurEffect,\n color: tintColor,\n direction,\n disableBackButtonMenu: headerBackButtonMenuEnabled === false,\n hidden: headerShown === false,\n hideBackButton: headerBackVisible === false,\n hideShadow:\n headerShadowVisible === false ||\n headerBackground != null ||\n (headerTransparent && headerShadowVisible !== true),\n largeTitle: headerLargeTitleEnabled,\n largeTitleBackgroundColor,\n largeTitleColor,\n largeTitleFontFamily,\n largeTitleFontSize,\n largeTitleFontWeight,\n largeTitleHideShadow: headerLargeTitleShadowVisible === false,\n title: titleText,\n titleColor,\n titleFontFamily,\n titleFontSize,\n titleFontWeight: String(titleFontWeight),\n topInsetEnabled: headerTopInsetEnabled,\n translucent: translucent === true,\n children,\n headerLeftBarButtonItems: processBarButtonItems(leftItems, colors, fonts),\n headerRightBarButtonItems: processBarButtonItems(rightItems, colors, fonts),\n experimental_userInterfaceStyle: dark ? 'dark' : 'light',\n ...headerNativeProps,\n } as const;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabRouter.d.ts","sourceRoot":"","sources":["../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AAE,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,SAAS,SAAS,aAAa,IAAI;IAC9D;;;;;OAKG;IACH,MAAM,CAAC,SAAS,SAAS,MAAM,SAAS,EACtC,GAAG,IAAI,EAAE,SAAS,SAAS,OAAO,GAC9B,SAAS,SAAS,SAAS,CAAC,SAAS,CAAC,GACpC,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,GAClD,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,GACnD,KAAK,GACR,IAAI,CAAC;CACT,CAAC;AAIF,eAAO,MAAM,UAAU;iBACR,MAAM,WAAW,MAAM;;;;;;;CAMrC,CAAC;AA4aF;;GAEG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,gBAAgB,GACrB,MAAM,CAAC,kBAAkB,CAAC,aAAa,CAAC,EAAE,aAAa,GAAG,sBAAsB,CAAC,CA+CnF"}
|
|
@@ -56,6 +56,15 @@ const getRouteHistory = (routes, index, backBehavior, initialRouteName) => {
|
|
|
56
56
|
}
|
|
57
57
|
return history;
|
|
58
58
|
};
|
|
59
|
+
// A route that `getId` re-keys is a new route instance, so it must not keep the nested navigator
|
|
60
|
+
// state of the previous ID.
|
|
61
|
+
function withoutStaleState(route, key) {
|
|
62
|
+
if (key === route.key) {
|
|
63
|
+
return route;
|
|
64
|
+
}
|
|
65
|
+
const { state, ...routeWithoutState } = route;
|
|
66
|
+
return routeWithoutState;
|
|
67
|
+
}
|
|
59
68
|
const changeIndex = (state, index, backBehavior, initialRouteName) => {
|
|
60
69
|
let history = state.history;
|
|
61
70
|
if (backBehavior === 'history' || backBehavior === 'fullHistory') {
|
|
@@ -222,7 +231,7 @@ function BaseTabRouter({ initialRouteName, backBehavior = 'firstRoute' }) {
|
|
|
222
231
|
? action.payload.path
|
|
223
232
|
: route.path;
|
|
224
233
|
return params !== route.params || path !== route.path
|
|
225
|
-
? { ...route, key, path, params }
|
|
234
|
+
? { ...withoutStaleState(route, key), key, path, params }
|
|
226
235
|
: route;
|
|
227
236
|
}),
|
|
228
237
|
}, index, backBehavior, initialRouteName);
|
|
@@ -293,7 +302,7 @@ function BaseTabRouter({ initialRouteName, backBehavior = 'firstRoute' }) {
|
|
|
293
302
|
const nextId = getId?.({ params: action.payload.params });
|
|
294
303
|
const key = currentId === nextId ? route.key : `${route.name}-${(0, non_secure_1.nanoid)()}`;
|
|
295
304
|
const params = (0, createParamsFromAction_1.createParamsFromAction)({ action, routeParamList });
|
|
296
|
-
const newRoute = params !== route.params ? { ...route, key, params } : route;
|
|
305
|
+
const newRoute = params !== route.params ? { ...withoutStaleState(route, key), key, params } : route;
|
|
297
306
|
return {
|
|
298
307
|
...state,
|
|
299
308
|
preloadedRouteKeys: state.preloadedRouteKeys
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabRouter.js","sourceRoot":"","sources":["../../../src/react-navigation/routers/TabRouter.tsx"],"names":[],"mappings":";;;AAyfA,8BAiDC;AA1iBD,kDAA2C;AAE3C,6CAA0C;AAC1C,qEAAkE;AA0ElE,MAAM,UAAU,GAAG,OAAgB,CAAC;AAEvB,QAAA,UAAU,GAAG;IACxB,MAAM,CAAC,IAAY,EAAE,MAAe;QAClC,OAAO;YACL,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACO,CAAC;IACrC,CAAC;CACF,CAAC;AAEF,MAAM,eAAe,GAAG,CACtB,MAAuB,EACvB,KAAa,EACb,YAA0B,EAC1B,gBAAoC,EACpC,EAAE;IACF,MAAM,OAAO,GAAG;QACd;YACE,IAAI,EAAE,UAAU;YAChB,GAAG,EAAE,MAAM,CAAC,KAAK,CAAE,CAAC,GAAG;SACxB;KACF,CAAC;IAEF,IAAI,iBAAiB,CAAC;IAEtB,QAAQ,YAAY,EAAE,CAAC;QACrB,KAAK,OAAO;YAC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Router } from './BaseRouter';\nimport { createParamsFromAction } from './createParamsFromAction';\nimport type {\n CommonNavigationAction,\n DefaultRouterOptions,\n NavigationState,\n ParamListBase,\n PartialState,\n Route,\n Router,\n} from './types';\nimport type { StackActionType } from '../core';\n\nexport type TabActionType = {\n type: 'JUMP_TO';\n payload: { name: string; params?: object };\n source?: string;\n target?: string;\n};\n\nexport type BackBehavior =\n | 'firstRoute'\n | 'initialRoute'\n | 'order'\n | 'history'\n | 'fullHistory'\n | 'none';\n\nexport type TabRouterOptions = DefaultRouterOptions & {\n /**\n * Control how going back should behave\n * - `firstRoute` - return to the first defined route\n * - `initialRoute` - return to the route from `initialRouteName`\n * - `order` - return to the route defined before the focused route\n * - `history` - return to last visited route; if the same route is visited multiple times, the older entries are dropped from the history\n * - `fullHistory` - return to last visited route; doesn't drop duplicate entries unlike `history` - matches behavior of web pages\n * - `none` - do not handle going back\n */\n backBehavior?: BackBehavior;\n};\n\nexport type TabNavigationState<ParamList extends ParamListBase> = Omit<\n NavigationState<ParamList>,\n 'history'\n> & {\n /**\n * Type of the router, in this case, it's tab.\n */\n type: 'tab';\n /**\n * List of previously visited route keys.\n */\n history: { type: 'route'; key: string; params?: object | undefined }[];\n /**\n * List of routes' key, which are supposed to be preloaded before navigating to.\n */\n preloadedRouteKeys: string[];\n};\n\nexport type TabActionHelpers<ParamList extends ParamListBase> = {\n /**\n * Jump to an existing tab.\n *\n * @param screen Name of the route to jump to.\n * @param [params] Params object for the route.\n */\n jumpTo<RouteName extends keyof ParamList>(\n ...args: RouteName extends unknown\n ? undefined extends ParamList[RouteName]\n ? [screen: RouteName, params?: ParamList[RouteName]]\n : [screen: RouteName, params: ParamList[RouteName]]\n : never\n ): void;\n};\n\nconst TYPE_ROUTE = 'route' as const;\n\nexport const TabActions = {\n jumpTo(name: string, params?: object) {\n return {\n type: 'JUMP_TO',\n payload: { name, params },\n } as const satisfies TabActionType;\n },\n};\n\nconst getRouteHistory = (\n routes: Route<string>[],\n index: number,\n backBehavior: BackBehavior,\n initialRouteName: string | undefined\n) => {\n const history = [\n {\n type: TYPE_ROUTE,\n key: routes[index]!.key,\n },\n ];\n\n let initialRouteIndex;\n\n switch (backBehavior) {\n case 'order':\n for (let i = index; i > 0; i--) {\n history.unshift({\n type: TYPE_ROUTE,\n key: routes[i - 1]!.key,\n });\n }\n break;\n case 'firstRoute':\n if (index !== 0) {\n history.unshift({\n type: TYPE_ROUTE,\n key: routes[0]!.key,\n });\n }\n break;\n case 'initialRoute':\n initialRouteIndex = routes.findIndex((route) => route.name === initialRouteName);\n initialRouteIndex = initialRouteIndex === -1 ? 0 : initialRouteIndex;\n\n if (index !== initialRouteIndex) {\n history.unshift({\n type: TYPE_ROUTE,\n key: routes[initialRouteIndex]!.key,\n });\n }\n break;\n case 'history':\n case 'fullHistory':\n // The history will fill up on navigation\n break;\n }\n\n return history;\n};\n\nconst changeIndex = (\n state: TabNavigationState<ParamListBase>,\n index: number,\n backBehavior: BackBehavior,\n initialRouteName: string | undefined\n) => {\n let history = state.history;\n\n if (backBehavior === 'history' || backBehavior === 'fullHistory') {\n const currentRoute = state.routes[index]!;\n\n if (backBehavior === 'history') {\n // Remove the existing key from the history to de-duplicate it\n history = history.filter((it) => (it.type === 'route' ? it.key !== currentRoute.key : false));\n } else if (backBehavior === 'fullHistory') {\n const lastHistoryRouteItemIndex = history.findLastIndex((item) => item.type === 'route');\n\n if (currentRoute.key === history[lastHistoryRouteItemIndex]?.key) {\n // For full-history, only remove if it matches the last route\n // Useful for drawer, if current route was in history, then drawer state changed\n // Then we only need to move the route to the front\n history = [\n ...history.slice(0, lastHistoryRouteItemIndex),\n ...history.slice(lastHistoryRouteItemIndex + 1),\n ];\n }\n }\n\n history = history.concat({\n type: TYPE_ROUTE,\n key: currentRoute.key,\n params: backBehavior === 'fullHistory' ? currentRoute.params : undefined,\n });\n } else {\n history = getRouteHistory(state.routes, index, backBehavior, initialRouteName);\n }\n\n return {\n ...state,\n index,\n history,\n };\n};\n\n// TODO(@ubax): unify the logic into single router instead of BaseTabRouter and override\n// TODO(@ubax): add REPLACE action to CommonAction type and handle it in all routers\nfunction BaseTabRouter({ initialRouteName, backBehavior = 'firstRoute' }: TabRouterOptions) {\n const router: Router<\n TabNavigationState<ParamListBase>,\n TabActionType | CommonNavigationAction\n > = {\n ...BaseRouter,\n\n type: 'tab',\n\n getInitialState({ routeNames, routeParamList }) {\n const index =\n initialRouteName !== undefined && routeNames.includes(initialRouteName)\n ? routeNames.indexOf(initialRouteName)\n : 0;\n\n const routes = routeNames.map((name) => ({\n name,\n key: `${name}-${nanoid()}`,\n params: routeParamList[name],\n }));\n\n const history = getRouteHistory(routes, index, backBehavior, initialRouteName);\n\n return {\n stale: false,\n type: 'tab',\n key: `tab-${nanoid()}`,\n index,\n routeNames,\n history,\n routes,\n preloadedRouteKeys: [],\n };\n },\n\n getRehydratedState(partialState, { routeNames, routeParamList }) {\n const state = partialState;\n\n if (state.stale === false) {\n return state;\n }\n\n const routes = routeNames.map((name) => {\n const route = (state as PartialState<TabNavigationState<ParamListBase>>).routes.find(\n (r) => r.name === name\n );\n\n return {\n ...route,\n name,\n key: route && route.name === name && route.key ? route.key : `${name}-${nanoid()}`,\n params:\n routeParamList[name] !== undefined\n ? {\n ...routeParamList[name],\n ...(route ? route.params : undefined),\n }\n : route\n ? route.params\n : undefined,\n } as Route<string>;\n });\n\n const index = Math.min(\n Math.max(routeNames.indexOf(state.routes[state?.index ?? 0]?.name as string), 0),\n routes.length - 1\n );\n\n const routeKeys = routes.map((route) => route.key);\n\n const history = state.history?.filter((it) => routeKeys.includes(it.key)) ?? [];\n\n return changeIndex(\n {\n stale: false,\n type: 'tab',\n key: `tab-${nanoid()}`,\n index,\n routeNames,\n history,\n routes,\n preloadedRouteKeys:\n state.preloadedRouteKeys?.filter((key) => routeKeys.includes(key)) ?? [],\n },\n index,\n backBehavior,\n initialRouteName\n );\n },\n\n getStateForRouteNamesChange(state, { routeNames, routeParamList, routeKeyChanges }) {\n const routes = routeNames.map(\n (name) =>\n state.routes.find((r) => r.name === name && !routeKeyChanges.includes(r.name)) || {\n name,\n key: `${name}-${nanoid()}`,\n params: routeParamList[name],\n }\n );\n\n const preloadedRouteKeys = state.preloadedRouteKeys.filter((key) =>\n routes.some((route) => route.key === key)\n );\n\n const index = Math.max(0, routeNames.indexOf(state.routes[state.index]!.name));\n\n let history = state.history.filter(\n // Type will always be 'route' for tabs, but could be different in a router extending this (e.g. drawer)\n (it) => it.type !== 'route' || routes.find((r) => r.key === it.key)\n );\n\n if (!history.length) {\n history = getRouteHistory(routes, index, backBehavior, initialRouteName);\n }\n\n return {\n ...state,\n history,\n routeNames,\n routes,\n preloadedRouteKeys,\n index,\n };\n },\n\n getStateForRouteFocus(state, key) {\n const index = state.routes.findIndex((r) => r.key === key);\n\n if (index === -1 || index === state.index) {\n return state;\n }\n\n return changeIndex(state, index, backBehavior, initialRouteName);\n },\n\n getStateForAction(state, action, { routeParamList, routeGetIdList }) {\n switch (action.type) {\n case 'JUMP_TO':\n case 'NAVIGATE':\n case 'NAVIGATE_DEPRECATED': {\n const index = state.routes.findIndex((route) => route.name === action.payload.name);\n\n if (index === -1) {\n return null;\n }\n\n const updatedState = changeIndex(\n {\n ...state,\n routes: state.routes.map((route) => {\n if (route.name !== action.payload.name) {\n return route;\n }\n\n const getId = routeGetIdList[route.name];\n\n const currentId = getId?.({ params: route.params });\n const nextId = getId?.({ params: action.payload.params });\n\n const key = currentId === nextId ? route.key : `${route.name}-${nanoid()}`;\n\n let params;\n\n if (\n (action.type === 'NAVIGATE' || action.type === 'NAVIGATE_DEPRECATED') &&\n action.payload.merge &&\n currentId === nextId\n ) {\n params =\n action.payload.params !== undefined || routeParamList[route.name] !== undefined\n ? {\n ...routeParamList[route.name],\n ...route.params,\n ...action.payload.params,\n }\n : route.params;\n } else {\n params = createParamsFromAction({ action, routeParamList });\n }\n\n const path =\n action.type === 'NAVIGATE' && action.payload.path != null\n ? action.payload.path\n : route.path;\n\n return params !== route.params || path !== route.path\n ? { ...route, key, path, params }\n : route;\n }),\n },\n index,\n backBehavior,\n initialRouteName\n );\n\n return {\n ...updatedState,\n preloadedRouteKeys: updatedState.preloadedRouteKeys.filter(\n (key) => key !== state.routes[updatedState.index]!.key\n ),\n };\n }\n\n case 'SET_PARAMS':\n case 'REPLACE_PARAMS': {\n const nextState = BaseRouter.getStateForAction(state, action);\n\n if (nextState !== null) {\n const index = nextState.index;\n\n if (index != null) {\n const focusedRoute = nextState.routes[index]!;\n const historyItemIndex = state.history.findLastIndex(\n (item) => item.key === focusedRoute.key\n );\n\n let updatedHistory = state.history;\n\n if (historyItemIndex !== -1) {\n updatedHistory = [...state.history];\n updatedHistory[historyItemIndex] = {\n ...updatedHistory[historyItemIndex]!,\n params: focusedRoute.params,\n };\n }\n\n return {\n ...nextState,\n history: updatedHistory,\n };\n }\n }\n\n return nextState;\n }\n\n case 'GO_BACK': {\n if (state.history.length === 1) {\n return null;\n }\n\n const previousHistoryItem = state.history[state.history.length - 2];\n const previousKey = previousHistoryItem?.key;\n const index = state.routes.findLastIndex((route) => route.key === previousKey);\n\n if (index === -1) {\n return null;\n }\n\n let routes = state.routes;\n\n if (\n backBehavior === 'fullHistory' &&\n routes[index]!.params !== previousHistoryItem!.params\n ) {\n routes = [...state.routes];\n routes[index] = {\n ...routes[index]!,\n params: previousHistoryItem!.params,\n };\n }\n\n return {\n ...state,\n routes,\n preloadedRouteKeys: state.preloadedRouteKeys.filter(\n (key) => key !== state.routes[index]!.key\n ),\n history: state.history.slice(0, -1),\n index,\n };\n }\n\n case 'PRELOAD': {\n const routeIndex = state.routes.findIndex((route) => route.name === action.payload.name);\n\n if (routeIndex === -1) {\n return null;\n }\n\n const route = state.routes[routeIndex]!;\n\n const getId = routeGetIdList[route.name];\n\n const currentId = getId?.({ params: route.params });\n const nextId = getId?.({ params: action.payload.params });\n\n const key = currentId === nextId ? route.key : `${route.name}-${nanoid()}`;\n\n const params = createParamsFromAction({ action, routeParamList });\n const newRoute = params !== route.params ? { ...route, key, params } : route;\n\n return {\n ...state,\n preloadedRouteKeys: state.preloadedRouteKeys\n .filter((key) => key !== route.key)\n .concat(newRoute.key),\n routes: state.routes.map((route, index) => (index === routeIndex ? newRoute : route)),\n history:\n key === route.key\n ? state.history\n : state.history.filter((record) => record.key !== route.key),\n };\n }\n\n default:\n return BaseRouter.getStateForAction(state, action);\n }\n },\n\n actionCreators: TabActions,\n };\n\n return router;\n}\n\n/**\n * TabRouter is considered an internal implementation and its behavior may change without a notice between expo-router's version\n */\nexport function TabRouter(\n args: TabRouterOptions\n): Router<TabNavigationState<ParamListBase>, TabActionType | CommonNavigationAction> {\n const base = BaseTabRouter(args);\n return {\n ...base,\n getStateForAction: (state, action, options) => {\n if (action.target && action.target !== state.key) {\n return null;\n }\n\n if ((action.type as string) === 'REPLACE') {\n const replaceAction = action as unknown as Extract<StackActionType, { type: 'REPLACE' }>;\n // Generate the state as if we were using JUMP_TO\n let nextState = base.getStateForAction(\n state,\n {\n ...replaceAction,\n type: 'JUMP_TO',\n },\n options\n );\n\n if (!nextState || nextState.index === undefined || !Array.isArray(nextState.history)) {\n return null;\n }\n\n // If the state is valid and we didn't JUMP_TO a single history state,\n // then remove the previous state.\n if (nextState.index !== 0) {\n const previousIndex = nextState.index - 1;\n\n nextState = {\n ...nextState,\n key: `${nextState.key}-replace`,\n // Omit the previous history entry that we are replacing\n history: [\n ...nextState.history.slice(0, previousIndex),\n ...nextState.history.splice(nextState.index),\n ],\n };\n }\n\n return nextState;\n }\n\n return base.getStateForAction(state, action, options);\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TabRouter.js","sourceRoot":"","sources":["../../../src/react-navigation/routers/TabRouter.tsx"],"names":[],"mappings":";;;AAqgBA,8BAiDC;AAtjBD,kDAA2C;AAE3C,6CAA0C;AAC1C,qEAAkE;AA0ElE,MAAM,UAAU,GAAG,OAAgB,CAAC;AAEvB,QAAA,UAAU,GAAG;IACxB,MAAM,CAAC,IAAY,EAAE,MAAe;QA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K,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;oBACrF,OAAO,IAAI,CAAC;gBACd,CAAC;gBAED,sEAAsE;gBACtE,kCAAkC;gBAClC,IAAI,SAAS,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC;oBAC1B,MAAM,aAAa,GAAG,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC;oBAE1C,SAAS,GAAG;wBACV,GAAG,SAAS;wBACZ,GAAG,EAAE,GAAG,SAAS,CAAC,GAAG,UAAU;wBAC/B,wDAAwD;wBACxD,OAAO,EAAE;4BACP,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC;4BAC5C,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;yBAC7C;qBACF,CAAC;gBACJ,CAAC;gBAED,OAAO,SAAS,CAAC;YACnB,CAAC;YAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { nanoid } from 'nanoid/non-secure';\n\nimport { BaseRouter } from './BaseRouter';\nimport { createParamsFromAction } from './createParamsFromAction';\nimport type {\n CommonNavigationAction,\n DefaultRouterOptions,\n NavigationState,\n ParamListBase,\n PartialState,\n Route,\n Router,\n} from './types';\nimport type { StackActionType } from '../core';\n\nexport type TabActionType = {\n type: 'JUMP_TO';\n payload: { name: string; params?: object };\n source?: string;\n target?: string;\n};\n\nexport type BackBehavior =\n | 'firstRoute'\n | 'initialRoute'\n | 'order'\n | 'history'\n | 'fullHistory'\n | 'none';\n\nexport type TabRouterOptions = DefaultRouterOptions & {\n /**\n * Control how going back should behave\n * - `firstRoute` - return to the first defined route\n * - `initialRoute` - return to the route from `initialRouteName`\n * - `order` - return to the route defined before the focused route\n * - `history` - return to last visited route; if the same route is visited multiple times, the older entries are dropped from the history\n * - `fullHistory` - return to last visited route; doesn't drop duplicate entries unlike `history` - matches behavior of web pages\n * - `none` - do not handle going back\n */\n backBehavior?: BackBehavior;\n};\n\nexport type TabNavigationState<ParamList extends ParamListBase> = Omit<\n NavigationState<ParamList>,\n 'history'\n> & {\n /**\n * Type of the router, in this case, it's tab.\n */\n type: 'tab';\n /**\n * List of previously visited route keys.\n */\n history: { type: 'route'; key: string; params?: object | undefined }[];\n /**\n * List of routes' key, which are supposed to be preloaded before navigating to.\n */\n preloadedRouteKeys: string[];\n};\n\nexport type TabActionHelpers<ParamList extends ParamListBase> = {\n /**\n * Jump to an existing tab.\n *\n * @param screen Name of the route to jump to.\n * @param [params] Params object for the route.\n */\n jumpTo<RouteName extends keyof ParamList>(\n ...args: RouteName extends unknown\n ? undefined extends ParamList[RouteName]\n ? [screen: RouteName, params?: ParamList[RouteName]]\n : [screen: RouteName, params: ParamList[RouteName]]\n : never\n ): void;\n};\n\nconst TYPE_ROUTE = 'route' as const;\n\nexport const TabActions = {\n jumpTo(name: string, params?: object) {\n return {\n type: 'JUMP_TO',\n payload: { name, params },\n } as const satisfies TabActionType;\n },\n};\n\nconst getRouteHistory = (\n routes: Route<string>[],\n index: number,\n backBehavior: BackBehavior,\n initialRouteName: string | undefined\n) => {\n const history = [\n {\n type: TYPE_ROUTE,\n key: routes[index]!.key,\n },\n ];\n\n let initialRouteIndex;\n\n switch (backBehavior) {\n case 'order':\n for (let i = index; i > 0; i--) {\n history.unshift({\n type: TYPE_ROUTE,\n key: routes[i - 1]!.key,\n });\n }\n break;\n case 'firstRoute':\n if (index !== 0) {\n history.unshift({\n type: TYPE_ROUTE,\n key: routes[0]!.key,\n });\n }\n break;\n case 'initialRoute':\n initialRouteIndex = routes.findIndex((route) => route.name === initialRouteName);\n initialRouteIndex = initialRouteIndex === -1 ? 0 : initialRouteIndex;\n\n if (index !== initialRouteIndex) {\n history.unshift({\n type: TYPE_ROUTE,\n key: routes[initialRouteIndex]!.key,\n });\n }\n break;\n case 'history':\n case 'fullHistory':\n // The history will fill up on navigation\n break;\n }\n\n return history;\n};\n\n// A route that `getId` re-keys is a new route instance, so it must not keep the nested navigator\n// state of the previous ID.\nfunction withoutStaleState<T extends Route<string> & { state?: unknown }>(route: T, key: string) {\n if (key === route.key) {\n return route;\n }\n\n const { state, ...routeWithoutState } = route;\n return routeWithoutState;\n}\n\nconst changeIndex = (\n state: TabNavigationState<ParamListBase>,\n index: number,\n backBehavior: BackBehavior,\n initialRouteName: string | undefined\n) => {\n let history = state.history;\n\n if (backBehavior === 'history' || backBehavior === 'fullHistory') {\n const currentRoute = state.routes[index]!;\n\n if (backBehavior === 'history') {\n // Remove the existing key from the history to de-duplicate it\n history = history.filter((it) => (it.type === 'route' ? it.key !== currentRoute.key : false));\n } else if (backBehavior === 'fullHistory') {\n const lastHistoryRouteItemIndex = history.findLastIndex((item) => item.type === 'route');\n\n if (currentRoute.key === history[lastHistoryRouteItemIndex]?.key) {\n // For full-history, only remove if it matches the last route\n // Useful for drawer, if current route was in history, then drawer state changed\n // Then we only need to move the route to the front\n history = [\n ...history.slice(0, lastHistoryRouteItemIndex),\n ...history.slice(lastHistoryRouteItemIndex + 1),\n ];\n }\n }\n\n history = history.concat({\n type: TYPE_ROUTE,\n key: currentRoute.key,\n params: backBehavior === 'fullHistory' ? currentRoute.params : undefined,\n });\n } else {\n history = getRouteHistory(state.routes, index, backBehavior, initialRouteName);\n }\n\n return {\n ...state,\n index,\n history,\n };\n};\n\n// TODO(@ubax): unify the logic into single router instead of BaseTabRouter and override\n// TODO(@ubax): add REPLACE action to CommonAction type and handle it in all routers\nfunction BaseTabRouter({ initialRouteName, backBehavior = 'firstRoute' }: TabRouterOptions) {\n const router: Router<\n TabNavigationState<ParamListBase>,\n TabActionType | CommonNavigationAction\n > = {\n ...BaseRouter,\n\n type: 'tab',\n\n getInitialState({ routeNames, routeParamList }) {\n const index =\n initialRouteName !== undefined && routeNames.includes(initialRouteName)\n ? routeNames.indexOf(initialRouteName)\n : 0;\n\n const routes = routeNames.map((name) => ({\n name,\n key: `${name}-${nanoid()}`,\n params: routeParamList[name],\n }));\n\n const history = getRouteHistory(routes, index, backBehavior, initialRouteName);\n\n return {\n stale: false,\n type: 'tab',\n key: `tab-${nanoid()}`,\n index,\n routeNames,\n history,\n routes,\n preloadedRouteKeys: [],\n };\n },\n\n getRehydratedState(partialState, { routeNames, routeParamList }) {\n const state = partialState;\n\n if (state.stale === false) {\n return state;\n }\n\n const routes = routeNames.map((name) => {\n const route = (state as PartialState<TabNavigationState<ParamListBase>>).routes.find(\n (r) => r.name === name\n );\n\n return {\n ...route,\n name,\n key: route && route.name === name && route.key ? route.key : `${name}-${nanoid()}`,\n params:\n routeParamList[name] !== undefined\n ? {\n ...routeParamList[name],\n ...(route ? route.params : undefined),\n }\n : route\n ? route.params\n : undefined,\n } as Route<string>;\n });\n\n const index = Math.min(\n Math.max(routeNames.indexOf(state.routes[state?.index ?? 0]?.name as string), 0),\n routes.length - 1\n );\n\n const routeKeys = routes.map((route) => route.key);\n\n const history = state.history?.filter((it) => routeKeys.includes(it.key)) ?? [];\n\n return changeIndex(\n {\n stale: false,\n type: 'tab',\n key: `tab-${nanoid()}`,\n index,\n routeNames,\n history,\n routes,\n preloadedRouteKeys:\n state.preloadedRouteKeys?.filter((key) => routeKeys.includes(key)) ?? [],\n },\n index,\n backBehavior,\n initialRouteName\n );\n },\n\n getStateForRouteNamesChange(state, { routeNames, routeParamList, routeKeyChanges }) {\n const routes = routeNames.map(\n (name) =>\n state.routes.find((r) => r.name === name && !routeKeyChanges.includes(r.name)) || {\n name,\n key: `${name}-${nanoid()}`,\n params: routeParamList[name],\n }\n );\n\n const preloadedRouteKeys = state.preloadedRouteKeys.filter((key) =>\n routes.some((route) => route.key === key)\n );\n\n const index = Math.max(0, routeNames.indexOf(state.routes[state.index]!.name));\n\n let history = state.history.filter(\n // Type will always be 'route' for tabs, but could be different in a router extending this (e.g. drawer)\n (it) => it.type !== 'route' || routes.find((r) => r.key === it.key)\n );\n\n if (!history.length) {\n history = getRouteHistory(routes, index, backBehavior, initialRouteName);\n }\n\n return {\n ...state,\n history,\n routeNames,\n routes,\n preloadedRouteKeys,\n index,\n };\n },\n\n getStateForRouteFocus(state, key) {\n const index = state.routes.findIndex((r) => r.key === key);\n\n if (index === -1 || index === state.index) {\n return state;\n }\n\n return changeIndex(state, index, backBehavior, initialRouteName);\n },\n\n getStateForAction(state, action, { routeParamList, routeGetIdList }) {\n switch (action.type) {\n case 'JUMP_TO':\n case 'NAVIGATE':\n case 'NAVIGATE_DEPRECATED': {\n const index = state.routes.findIndex((route) => route.name === action.payload.name);\n\n if (index === -1) {\n return null;\n }\n\n const updatedState = changeIndex(\n {\n ...state,\n routes: state.routes.map((route) => {\n if (route.name !== action.payload.name) {\n return route;\n }\n\n const getId = routeGetIdList[route.name];\n\n const currentId = getId?.({ params: route.params });\n const nextId = getId?.({ params: action.payload.params });\n\n const key = currentId === nextId ? route.key : `${route.name}-${nanoid()}`;\n\n let params;\n\n if (\n (action.type === 'NAVIGATE' || action.type === 'NAVIGATE_DEPRECATED') &&\n action.payload.merge &&\n currentId === nextId\n ) {\n params =\n action.payload.params !== undefined || routeParamList[route.name] !== undefined\n ? {\n ...routeParamList[route.name],\n ...route.params,\n ...action.payload.params,\n }\n : route.params;\n } else {\n params = createParamsFromAction({ action, routeParamList });\n }\n\n const path =\n action.type === 'NAVIGATE' && action.payload.path != null\n ? action.payload.path\n : route.path;\n\n return params !== route.params || path !== route.path\n ? { ...withoutStaleState(route, key), key, path, params }\n : route;\n }),\n },\n index,\n backBehavior,\n initialRouteName\n );\n\n return {\n ...updatedState,\n preloadedRouteKeys: updatedState.preloadedRouteKeys.filter(\n (key) => key !== state.routes[updatedState.index]!.key\n ),\n };\n }\n\n case 'SET_PARAMS':\n case 'REPLACE_PARAMS': {\n const nextState = BaseRouter.getStateForAction(state, action);\n\n if (nextState !== null) {\n const index = nextState.index;\n\n if (index != null) {\n const focusedRoute = nextState.routes[index]!;\n const historyItemIndex = state.history.findLastIndex(\n (item) => item.key === focusedRoute.key\n );\n\n let updatedHistory = state.history;\n\n if (historyItemIndex !== -1) {\n updatedHistory = [...state.history];\n updatedHistory[historyItemIndex] = {\n ...updatedHistory[historyItemIndex]!,\n params: focusedRoute.params,\n };\n }\n\n return {\n ...nextState,\n history: updatedHistory,\n };\n }\n }\n\n return nextState;\n }\n\n case 'GO_BACK': {\n if (state.history.length === 1) {\n return null;\n }\n\n const previousHistoryItem = state.history[state.history.length - 2];\n const previousKey = previousHistoryItem?.key;\n const index = state.routes.findLastIndex((route) => route.key === previousKey);\n\n if (index === -1) {\n return null;\n }\n\n let routes = state.routes;\n\n if (\n backBehavior === 'fullHistory' &&\n routes[index]!.params !== previousHistoryItem!.params\n ) {\n routes = [...state.routes];\n routes[index] = {\n ...routes[index]!,\n params: previousHistoryItem!.params,\n };\n }\n\n return {\n ...state,\n routes,\n preloadedRouteKeys: state.preloadedRouteKeys.filter(\n (key) => key !== state.routes[index]!.key\n ),\n history: state.history.slice(0, -1),\n index,\n };\n }\n\n case 'PRELOAD': {\n const routeIndex = state.routes.findIndex((route) => route.name === action.payload.name);\n\n if (routeIndex === -1) {\n return null;\n }\n\n const route = state.routes[routeIndex]!;\n\n const getId = routeGetIdList[route.name];\n\n const currentId = getId?.({ params: route.params });\n const nextId = getId?.({ params: action.payload.params });\n\n const key = currentId === nextId ? route.key : `${route.name}-${nanoid()}`;\n\n const params = createParamsFromAction({ action, routeParamList });\n const newRoute =\n params !== route.params ? { ...withoutStaleState(route, key), key, params } : route;\n\n return {\n ...state,\n preloadedRouteKeys: state.preloadedRouteKeys\n .filter((key) => key !== route.key)\n .concat(newRoute.key),\n routes: state.routes.map((route, index) => (index === routeIndex ? newRoute : route)),\n history:\n key === route.key\n ? state.history\n : state.history.filter((record) => record.key !== route.key),\n };\n }\n\n default:\n return BaseRouter.getStateForAction(state, action);\n }\n },\n\n actionCreators: TabActions,\n };\n\n return router;\n}\n\n/**\n * TabRouter is considered an internal implementation and its behavior may change without a notice between expo-router's version\n */\nexport function TabRouter(\n args: TabRouterOptions\n): Router<TabNavigationState<ParamListBase>, TabActionType | CommonNavigationAction> {\n const base = BaseTabRouter(args);\n return {\n ...base,\n getStateForAction: (state, action, options) => {\n if (action.target && action.target !== state.key) {\n return null;\n }\n\n if ((action.type as string) === 'REPLACE') {\n const replaceAction = action as unknown as Extract<StackActionType, { type: 'REPLACE' }>;\n // Generate the state as if we were using JUMP_TO\n let nextState = base.getStateForAction(\n state,\n {\n ...replaceAction,\n type: 'JUMP_TO',\n },\n options\n );\n\n if (!nextState || nextState.index === undefined || !Array.isArray(nextState.history)) {\n return null;\n }\n\n // If the state is valid and we didn't JUMP_TO a single history state,\n // then remove the previous state.\n if (nextState.index !== 0) {\n const previousIndex = nextState.index - 1;\n\n nextState = {\n ...nextState,\n key: `${nextState.key}-replace`,\n // Omit the previous history entry that we are replacing\n history: [\n ...nextState.history.slice(0, previousIndex),\n ...nextState.history.splice(nextState.index),\n ],\n };\n }\n\n return nextState;\n }\n\n return base.getStateForAction(state, action, options);\n },\n };\n}\n"]}
|
|
@@ -60,11 +60,10 @@ export type HrefOutputParams<T extends ExpoRouter.__routes = ExpoRouter.__routes
|
|
|
60
60
|
/**
|
|
61
61
|
* @hidden
|
|
62
62
|
*/
|
|
63
|
-
export type RouteInputParams<T> =
|
|
64
|
-
pathname:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}>['params'];
|
|
63
|
+
export type RouteInputParams<T> = HrefInputParams extends infer U ? U extends {
|
|
64
|
+
pathname: string;
|
|
65
|
+
params?: infer Params;
|
|
66
|
+
} ? T extends U['pathname'] ? Params : never : never : never;
|
|
68
67
|
/**
|
|
69
68
|
* @hidden
|
|
70
69
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/typed-routes/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,yBAAiB,UAAU,CAAC;IAE1B,UAAi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AC,GACpB,cAAc,SAAS,GAAG,MAAM,KAAK,IAAI,MAAM,KAAK,EAAE,GACpD,CAAC,KAAK,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,GAChC,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/typed-routes/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The main routing type for Expo Router.\n *\n * @internal\n * @hidden\n */\nexport namespace ExpoRouter {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-object-type\n export interface __routes {}\n}\n\nexport type HrefObject = {\n /** The path of the route. */\n pathname: string;\n /** Optional parameters for the route. */\n params?: UnknownInputParams;\n};\n\n/**\n * @hidden\n */\nexport type HrefInputParamsObject = {\n /** The path of the route. */\n pathname: string;\n /** Optional input parameters for the route. */\n params?: UnknownInputParams;\n};\n\n/**\n * @hidden\n */\nexport type HrefOutputParamsObject = {\n /** The path of the route */\n pathname: string;\n /** Optional output parameters for the route */\n params?: UnknownOutputParams;\n};\n\nexport type RelativePathString = `./${string}` | `../${string}` | '..';\nexport type SearchOrHash = `?${string}` | `#${string}`;\nexport type ExternalPathString = `${string}:${string}` | `//${string}`;\nexport type RoutePath = Exclude<\n Extract<Href, object>['pathname'], // Use the HrefObject, as it doesn't have query params\n RelativePathString | ExternalPathString\n>;\n\n/**\n * The main routing type for Expo Router. It includes all available routes with strongly\n * typed parameters. It can either be:\n * - **string**: A full path like `/profile/settings` or a relative path like `../settings`.\n * - **object**: An object with a `pathname` and optional `params`. The `pathname` can be\n * a full path like `/profile/settings` or a relative path like `../settings`.\n * The params can be an object of key-value pairs.\n *\n * An Href can either be a string or an object.\n */\nexport type Href<T extends ExpoRouter.__routes = ExpoRouter.__routes> = T extends { href: any }\n ? T['href']\n : string | HrefObject;\n\n/*\n * @hidden\n */\nexport type HrefInputParams<T extends ExpoRouter.__routes = ExpoRouter.__routes> = T extends {\n hrefInputParams: any;\n}\n ? T['hrefInputParams']\n : HrefInputParamsObject;\n\n/*\n * @hidden\n */\nexport type HrefOutputParams<T extends ExpoRouter.__routes = ExpoRouter.__routes> = T extends {\n hrefOutputParams: any;\n}\n ? T['hrefOutputParams']\n : HrefOutputParamsObject;\n\n/**\n * @hidden\n */\nexport type RouteInputParams<T>
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/typed-routes/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The main routing type for Expo Router.\n *\n * @internal\n * @hidden\n */\nexport namespace ExpoRouter {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-object-type\n export interface __routes {}\n}\n\nexport type HrefObject = {\n /** The path of the route. */\n pathname: string;\n /** Optional parameters for the route. */\n params?: UnknownInputParams;\n};\n\n/**\n * @hidden\n */\nexport type HrefInputParamsObject = {\n /** The path of the route. */\n pathname: string;\n /** Optional input parameters for the route. */\n params?: UnknownInputParams;\n};\n\n/**\n * @hidden\n */\nexport type HrefOutputParamsObject = {\n /** The path of the route */\n pathname: string;\n /** Optional output parameters for the route */\n params?: UnknownOutputParams;\n};\n\nexport type RelativePathString = `./${string}` | `../${string}` | '..';\nexport type SearchOrHash = `?${string}` | `#${string}`;\nexport type ExternalPathString = `${string}:${string}` | `//${string}`;\nexport type RoutePath = Exclude<\n Extract<Href, object>['pathname'], // Use the HrefObject, as it doesn't have query params\n RelativePathString | ExternalPathString\n>;\n\n/**\n * The main routing type for Expo Router. It includes all available routes with strongly\n * typed parameters. It can either be:\n * - **string**: A full path like `/profile/settings` or a relative path like `../settings`.\n * - **object**: An object with a `pathname` and optional `params`. The `pathname` can be\n * a full path like `/profile/settings` or a relative path like `../settings`.\n * The params can be an object of key-value pairs.\n *\n * An Href can either be a string or an object.\n */\nexport type Href<T extends ExpoRouter.__routes = ExpoRouter.__routes> = T extends { href: any }\n ? T['href']\n : string | HrefObject;\n\n/*\n * @hidden\n */\nexport type HrefInputParams<T extends ExpoRouter.__routes = ExpoRouter.__routes> = T extends {\n hrefInputParams: any;\n}\n ? T['hrefInputParams']\n : HrefInputParamsObject;\n\n/*\n * @hidden\n */\nexport type HrefOutputParams<T extends ExpoRouter.__routes = ExpoRouter.__routes> = T extends {\n hrefOutputParams: any;\n}\n ? T['hrefOutputParams']\n : HrefOutputParamsObject;\n\n/**\n * @hidden\n */\nexport type RouteInputParams<T> = HrefInputParams extends infer U\n ? U extends { pathname: string; params?: infer Params }\n ? T extends U['pathname']\n ? Params\n : never\n : never\n : never;\n\n/**\n * @hidden\n */\nexport type RouteOutputParams<T> = HrefOutputParams extends infer U\n ? U extends { pathname: string; params?: infer Params }\n ? T extends U['pathname']\n ? Params\n : never\n : never\n : never;\n\nexport type { RouteOutputParams as RouteParams };\n\n/**\n * Routes can have known inputs (e.g query params).\n * Unlike outputs, inputs can be `undefined` or `null`.\n *\n * @hidden\n */\nexport type UnknownInputParams = Record<\n string,\n string | number | undefined | null | (string | number)[]\n>;\n\n/**\n * Routes can have unknown outputs (e.g query params).\n * Unlike inputs, outputs can't be undefined or null.\n *\n * @hidden\n */\nexport type UnknownOutputParams = Record<string, string | string[]>;\n\n/**\n * Return only the RoutePart of a string. If the string has multiple parts return never\n *\n * string | type\n *| ---------|------|\n *| 123 | 123 |\n *| /123/abc | never |\n *| 123?abc | never |\n *| ./123 | never |\n *| /123 | never |\n *| 123/../ | never |\n *\n * @hidden\n */\nexport type SingleRoutePart<S extends string | object> = S extends object\n ? never\n : S extends `${string}/${string}`\n ? never\n : S extends `${string}${SearchOrHash}`\n ? never\n : S extends ''\n ? never\n : S extends `(${string})`\n ? never\n : S extends `[${string}]`\n ? never\n : S;\n\n/**\n * @hidden\n */\nexport type RouteSegments<HrefOrSegments> = HrefOrSegments extends string[]\n ? HrefOrSegments\n : HrefOrSegments extends `.${string}`\n ? never\n : HrefOrSegments extends ``\n ? never\n : HrefOrSegments extends `/${infer PartA}`\n ? RouteSegments<PartA>\n : HrefOrSegments extends `${infer PartA}?${string}`\n ? RouteSegments<PartA>\n : HrefOrSegments extends `${infer PartA}#${string}`\n ? RouteSegments<PartA>\n : HrefOrSegments extends `${infer PartA}/${infer PartB}`\n ? [PartA, ...RouteSegments<PartB>]\n : [HrefOrSegments];\n"]}
|
package/expo-module.config.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "expo.modules.router",
|
|
5
5
|
"module": "expo.modules.router",
|
|
6
|
-
"version": "57.0.
|
|
6
|
+
"version": "57.0.29",
|
|
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-57.0.
|
|
28
|
-
"url": "expo.modules.router-57.0.
|
|
27
|
+
"name": "expo.modules.router-57.0.29.aar",
|
|
28
|
+
"url": "expo.modules.router-57.0.29.aar",
|
|
29
29
|
"size": 15835,
|
|
30
30
|
"sha512": "72b5be73401c4b0a8807373f01bd79e202212f07713d071019c24eb27227a4c8568d6148d0a48338f6955f9dbe713f56e7877d8e3fe0acec28dbb68533953d90",
|
|
31
31
|
"sha256": "7c41d508ab24d199ead0eb06525957cdd227a73925863865bf2956d48cb707ef",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
],
|
|
75
75
|
"files": [
|
|
76
76
|
{
|
|
77
|
-
"name": "expo.modules.router-57.0.
|
|
78
|
-
"url": "expo.modules.router-57.0.
|
|
77
|
+
"name": "expo.modules.router-57.0.29.aar",
|
|
78
|
+
"url": "expo.modules.router-57.0.29.aar",
|
|
79
79
|
"size": 15835,
|
|
80
80
|
"sha512": "72b5be73401c4b0a8807373f01bd79e202212f07713d071019c24eb27227a4c8568d6148d0a48338f6955f9dbe713f56e7877d8e3fe0acec28dbb68533953d90",
|
|
81
81
|
"sha256": "7c41d508ab24d199ead0eb06525957cdd227a73925863865bf2956d48cb707ef",
|
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
},
|
|
95
95
|
"files": [
|
|
96
96
|
{
|
|
97
|
-
"name": "expo.modules.router-57.0.
|
|
98
|
-
"url": "expo.modules.router-57.0.
|
|
97
|
+
"name": "expo.modules.router-57.0.29-sources.jar",
|
|
98
|
+
"url": "expo.modules.router-57.0.29-sources.jar",
|
|
99
99
|
"size": 2326,
|
|
100
100
|
"sha512": "a1a1537b57bc0d66efbf2bdfd5f514684400b9598e549eaf53c528d1bf32ff42b7826e74fb6e115f8ec0490b9e06ffbb3c3efe9f2f703652c13291ef82b0fa03",
|
|
101
101
|
"sha256": "2add0f802e663eb9b5f90e086dca0e0e337a1442e15fb372a05945e01ee0d289",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3fd2acbf4ff2a9437b93d00431597a82
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
97badeb443753e3aa61e79ff621778f98c8654ce
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
11380bd20f5413689469df295843def795d77d0a0fd97921faed8a403a4f9525
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7c7d6d74174281081e4c3254f72fbe9359386da8ace6d61841645bf817626d4e2c8682107344602262d172c63db26857120e72fe9d6f4546573472b321dd893c
|
|
@@ -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>57.0.
|
|
12
|
+
<version>57.0.29</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
|
+
13c9fe0ed9304c4c4f4e4bea93e054eb
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ca1df98fa190279cecbad68bb88dece66d894cdb
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4106e89f07111d666c1ff863d3add326a45723ae70cc0d424bb8efac4972f05d
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
aabacc92964a47ed1db009d5afa1245cebb3bdd3d36400145b4f9075d70651f16e8fe0b06d1cca49c6e413ef853e5b7daee05425e06d004caa8f5d9eb9a406df
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>expo.modules.router</groupId>
|
|
4
4
|
<artifactId>expo.modules.router</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>57.0.
|
|
7
|
-
<release>57.0.
|
|
6
|
+
<latest>57.0.29</latest>
|
|
7
|
+
<release>57.0.29</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>57.0.
|
|
9
|
+
<version>57.0.29</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20261021142105</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
b8c7c96ce919b314ae70bce7ae0123b0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
454bc0ad17eb3c777b7eb404c9468ffd9c50e0ae
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
679d4362607dac57c1af8946a3fab2952f5b002756189df0437a985d52dac761
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
6124a92a4de4f5f6dc23b4bb71cf02df6ddc2ce86000a53a815ee6524db83e7204e78d049f9b664c2debaec65a4dba03e5c0852579f21c84dfbc9272ed3a5e4d
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-router",
|
|
3
|
-
"version": "57.0.
|
|
3
|
+
"version": "57.0.29",
|
|
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",
|
|
@@ -140,13 +140,13 @@
|
|
|
140
140
|
"react-native-web": "~0.21.0",
|
|
141
141
|
"react-server-dom-webpack": "~19.0.6",
|
|
142
142
|
"tsd": "^0.33.0",
|
|
143
|
-
"expo": "57.0.
|
|
143
|
+
"expo": "57.0.31"
|
|
144
144
|
},
|
|
145
145
|
"dependencies": {
|
|
146
146
|
"@expo/log-box": "^57.0.4",
|
|
147
147
|
"@expo/metro-runtime": "^57.0.17",
|
|
148
148
|
"@expo/schema-utils": "^57.0.2",
|
|
149
|
-
"@expo/ui": "^57.0.
|
|
149
|
+
"@expo/ui": "^57.0.26",
|
|
150
150
|
"@radix-ui/react-slot": "^1.2.0",
|
|
151
151
|
"@radix-ui/react-tabs": "^1.1.12",
|
|
152
152
|
"@react-native-masked-view/masked-view": "^0.3.2",
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"query-string": "^7.1.3",
|
|
164
164
|
"react-fast-compare": "^3.2.2",
|
|
165
165
|
"react-is": "^19.1.0",
|
|
166
|
-
"react-native-drawer-layout": "^4.2.
|
|
166
|
+
"react-native-drawer-layout": "^4.2.12",
|
|
167
167
|
"react-native-screens": "^4.26.0",
|
|
168
168
|
"server-only": "^0.0.1",
|
|
169
169
|
"sf-symbols-typescript": "^2.1.0",
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
"standard-navigation": "^0.0.5",
|
|
172
172
|
"vaul": "^1.1.2"
|
|
173
173
|
},
|
|
174
|
-
"gitHead": "
|
|
174
|
+
"gitHead": "c5a313cb64de255fef39c54cc3c8d08537cf7133",
|
|
175
175
|
"scripts": {
|
|
176
176
|
"build": "node ./scripts/build.js",
|
|
177
177
|
"clean": "expo-module clean",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
163748ae574169187e41be1a630c37ef
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7f6029b81b3601b9b8f714de27ea5c92e886a07e
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
78fddc9e65cba6d8f011e2817ef7130070101c2102d330fb1ef7277c8caad4e4
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
bc0084823443a07fb4b9173cf0a490905a29cfbd47e556cc6ed6adff7521d486db7d32e8cff70b2630004abc2641d08c67acce57ce6d912907c9602d88bddbf3
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a97628b704485388967f837dc2af1460
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0fd97c240707b8707dad9706c13a540700c1b594
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
22cb8e8544c9efd14126344ac3fac501152255fb390ac8a6aec384c2c85b67a5
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
dff6a94a9d88e436da4260946d495d1281efd0910624db2e38eb9edfb96c9c35064051b447c2f1f8fdd11cd1072cbecb7b8a72065ba8f267f981f187b244859d
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|