expo-router 6.0.0-beta.4 → 6.0.0-beta.6
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/assets/modal.module.css +15 -14
- package/build/layouts/StackClient.d.ts +5 -0
- package/build/layouts/StackClient.d.ts.map +1 -1
- package/build/layouts/StackClient.js.map +1 -1
- package/build/modal/web/ModalStackRouteDrawer.js +9 -10
- package/build/modal/web/ModalStackRouteDrawer.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts +9 -3
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js +125 -51
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts +3 -2
- package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.d.ts +24 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.d.ts.map +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.js +28 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.js.map +1 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.js +78 -18
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.js +57 -27
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/appearance.d.ts +20 -0
- package/build/native-tabs/NativeBottomTabs/appearance.d.ts.map +1 -0
- package/build/native-tabs/NativeBottomTabs/appearance.js +131 -0
- package/build/native-tabs/NativeBottomTabs/appearance.js.map +1 -0
- package/build/native-tabs/NativeBottomTabs/types.d.ts +262 -97
- package/build/native-tabs/NativeBottomTabs/types.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/types.js +14 -0
- package/build/native-tabs/NativeBottomTabs/types.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/utils.d.ts +2 -1
- package/build/native-tabs/NativeBottomTabs/utils.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/utils.js +7 -0
- package/build/native-tabs/NativeBottomTabs/utils.js.map +1 -1
- package/build/native-tabs/common/elements.d.ts +41 -21
- 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/index.d.ts +2 -1
- package/build/native-tabs/index.d.ts.map +1 -1
- package/build/native-tabs/index.js +3 -1
- package/build/native-tabs/index.js.map +1 -1
- package/build/useFocusEffect.js +1 -1
- package/build/useFocusEffect.js.map +1 -1
- package/ios/ExpoHead.podspec +2 -0
- package/ios/LinkPreview/LinkPreviewNativeModule.swift +1 -1
- package/package.json +5 -5
- package/plugin/tsconfig.tsbuildinfo +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTabTrigger.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabTrigger.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAiDb,4CAqBC;AAED,4DAsEC;AAED,gDAgCC;AA9KD,qDAAmE;AACnE,iCAA0E;AAG1E,mCAAuE;AACvE,yEAAsE;AACtE,iDAAwD;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,SAAgB,gBAAgB,CAAC,KAA4B;IAC3D,MAAM,KAAK,GAAG,IAAA,iBAAQ,GAAE,CAAC;IACzB,MAAM,UAAU,GAAG,IAAA,sBAAa,GAAE,CAAC;IACnC,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;IAEzC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AAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["'use client';\n\nimport { useNavigation, useRoute } from '@react-navigation/native';\nimport { isValidElement, type ReactElement, type ReactNode } from 'react';\n\nimport type { ExtendedNativeTabOptions, NativeTabTriggerProps } from './types';\nimport { filterAllowedChildrenElements, isChildOfType } from './utils';\nimport { useSafeLayoutEffect } from '../../views/useSafeLayoutEffect';\nimport { Icon, Badge, Label } from '../common/elements';\n\n/**\n * The component used to customize the native tab options both in the _layout file and from the tab screen.\n *\n * When used in the _layout file, you need to provide a `name` prop.\n * When used in the tab screen, the `name` prop takes no effect.\n *\n * @example\n * ```tsx\n * // In _layout file\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default function Layout() {\n * return (\n * <NativeTabs>\n * <NativeTabs.Trigger name=\"home\" />\n * <NativeTabs.Trigger name=\"settings\" />\n * </NativeTabs>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // In a tab screen\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default function HomeScreen() {\n * return (\n * <View>\n * <NativeTabs.Trigger>\n * <Label>Home</Label>\n * </NativeTabs.Trigger>\n * <Text>This is home screen!</Text>\n * </View>\n * );\n * }\n *\n * **Note:** You can use the alias `NativeTabs.Trigger` for this component.\n */\nexport function NativeTabTrigger(props: NativeTabTriggerProps) {\n const route = useRoute();\n const navigation = useNavigation();\n const isFocused = navigation.isFocused();\n\n useSafeLayoutEffect(() => {\n // This will cause the tab to update only when it is focused.\n // As long as all tabs are loaded at the start, we don't need this check.\n // It is here to ensure similar behavior to stack\n if (isFocused) {\n if (navigation.getState()?.type !== 'tab') {\n throw new Error(\n `Trigger component can only be used in the tab screen. Current route: ${route.name}`\n );\n }\n const options = convertTabPropsToOptions(props);\n navigation.setOptions(options);\n }\n }, [isFocused, props]);\n\n return null;\n}\n\nexport function convertTabPropsToOptions({\n options,\n hidden,\n children,\n disablePopToTop,\n disableScrollToTop,\n}: NativeTabTriggerProps) {\n const initialOptions: ExtendedNativeTabOptions = {\n ...options,\n hidden: !!hidden,\n specialEffects: {\n repeatedTabSelection: {\n popToRoot: !disablePopToTop,\n scrollToTop: !disableScrollToTop,\n },\n },\n };\n const allowedChildren = filterAllowedChildrenElements(children, [Badge, Label, Icon]);\n return allowedChildren.reduce<ExtendedNativeTabOptions>(\n (acc, child) => {\n if (isChildOfType(child, Badge)) {\n if (child.props.children) {\n acc.badgeValue = String(child.props.children);\n } else if (!child.props.hidden) {\n // If no value is provided, we set it to a space to show the badge\n // Otherwise, the `react-native-screens` will interpret it as a hidden badge\n // https://github.com/software-mansion/react-native-screens/blob/b4358fd95dd0736fc54df6bb97f210dc89edf24c/ios/bottom-tabs/RNSBottomTabsScreenComponentView.mm#L172\n acc.badgeValue = ' ';\n }\n } else if (isChildOfType(child, Label)) {\n if (child.props.hidden) {\n acc.title = '';\n } else {\n acc.title = child.props.children;\n }\n } else if (isChildOfType(child, Icon)) {\n if ('src' in child.props || 'selectedSrc' in child.props) {\n acc.icon = child.props.src\n ? {\n src: child.props.src,\n }\n : undefined;\n acc.selectedIcon = child.props.selectedSrc\n ? {\n src: child.props.selectedSrc,\n }\n : undefined;\n } else if ('sf' in child.props || 'selectedSf' in child.props) {\n if (process.env.EXPO_OS === 'ios') {\n acc.icon = child.props.sf\n ? {\n sf: child.props.sf,\n }\n : undefined;\n acc.selectedIcon = child.props.selectedSf\n ? {\n sf: child.props.selectedSf,\n }\n : undefined;\n }\n }\n if (process.env.EXPO_OS === 'android') {\n acc.icon = { drawable: child.props.drawable };\n acc.selectedIcon = undefined;\n }\n }\n return acc;\n },\n { ...initialOptions }\n );\n}\n\nexport function isNativeTabTrigger(\n child: ReactNode,\n contextKey?: string\n): child is ReactElement<NativeTabTriggerProps & { name: string }> {\n if (isValidElement(child) && child && child.type === NativeTabTrigger) {\n if (\n typeof child.props === 'object' &&\n child.props &&\n 'name' in child.props &&\n !child.props.name\n ) {\n throw new Error(\n `<Trigger /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must have a \\`name\\` prop when used as a child of a Layout Route.`\n );\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (\n ['component', 'getComponent'].some(\n (key) => child.props && typeof child.props === 'object' && key in child.props\n )\n ) {\n throw new Error(\n `<Trigger /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must not have a \\`component\\` or \\`getComponent\\` prop when used as a child of a Layout Route`\n );\n }\n }\n\n return true;\n }\n\n return false;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"NativeTabTrigger.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabTrigger.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AA0Fb,4DAwCC;AAmHD,gDAgCC;AAnRD,qDAAmE;AACnE,iCAA0E;AAG1E,uEAAoE;AAMpE,mCAAuE;AACvE,yEAAsE;AACtE,iDAO4B;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,SAAS,oBAAoB,CAAC,KAA4B;IACxD,MAAM,KAAK,GAAG,IAAA,iBAAQ,GAAE,CAAC;IACzB,MAAM,UAAU,GAAG,IAAA,sBAAa,GAAE,CAAC;IACnC,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;IAEzC,IAAA,yCAAmB,EAAC,GAAG,EAAE;QACvB,6DAA6D;QAC7D,yEAAyE;QACzE,iDAAiD;QACjD,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,UAAU,CAAC,QAAQ,EAAE,EAAE,IAAI,KAAK,KAAK,EAAE,CAAC;gBAC1C,MAAM,IAAI,KAAK,CACb,wEAAwE,KAAK,CAAC,IAAI,EAAE,CACrF,CAAC;YACJ,CAAC;YACD,MAAM,OAAO,GAAG,wBAAwB,CAAC,KAAK,CAAC,CAAC;YAChD,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;Q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I,IAAA,sBAAc,EAAC,KAAK,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,wBAAgB,EAAE,CAAC;QACtE,IACE,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;YAC/B,KAAK,CAAC,KAAK;YACX,MAAM,IAAI,KAAK,CAAC,KAAK;YACrB,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EACjB,CAAC;YACD,MAAM,IAAI,KAAK,CACb,uDAAuD,UAAU,8EAA8E,CAChJ,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;YAC1C,IACE,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,IAAI,CAChC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,GAAG,IAAI,KAAK,CAAC,KAAK,CAC9E,EACD,CAAC;gBACD,MAAM,IAAI,KAAK,CACb,uDAAuD,UAAU,0GAA0G,CAC5K,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["'use client';\n\nimport { useNavigation, useRoute } from '@react-navigation/native';\nimport { isValidElement, type ReactElement, type ReactNode } from 'react';\nimport type { ImageSourcePropType } from 'react-native';\n\nimport { NativeTabsTriggerTabBar } from './NativeTabsTriggerTabBar';\nimport type {\n ExtendedNativeTabOptions,\n NativeTabsTriggerTabBarProps,\n NativeTabTriggerProps,\n} from './types';\nimport { filterAllowedChildrenElements, isChildOfType } from './utils';\nimport { useSafeLayoutEffect } from '../../views/useSafeLayoutEffect';\nimport {\n Icon,\n Badge,\n Label,\n type LabelProps,\n type IconProps,\n type BadgeProps,\n} from '../common/elements';\n\n/**\n * The component used to customize the native tab options both in the _layout file and from the tab screen.\n *\n * When used in the _layout file, you need to provide a `name` prop.\n * When used in the tab screen, the `name` prop takes no effect.\n *\n * @example\n * ```tsx\n * // In _layout file\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default function Layout() {\n * return (\n * <NativeTabs>\n * <NativeTabs.Trigger name=\"home\" />\n * <NativeTabs.Trigger name=\"settings\" />\n * </NativeTabs>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // In a tab screen\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default function HomeScreen() {\n * return (\n * <View>\n * <NativeTabs.Trigger>\n * <Label>Home</Label>\n * </NativeTabs.Trigger>\n * <Text>This is home screen!</Text>\n * </View>\n * );\n * }\n * ```\n *\n * > **Note:** You can use the alias `NativeTabs.Trigger` for this component.\n */\nfunction NativeTabTriggerImpl(props: NativeTabTriggerProps) {\n const route = useRoute();\n const navigation = useNavigation();\n const isFocused = navigation.isFocused();\n\n useSafeLayoutEffect(() => {\n // This will cause the tab to update only when it is focused.\n // As long as all tabs are loaded at the start, we don't need this check.\n // It is here to ensure similar behavior to stack\n if (isFocused) {\n if (navigation.getState()?.type !== 'tab') {\n throw new Error(\n `Trigger component can only be used in the tab screen. Current route: ${route.name}`\n );\n }\n const options = convertTabPropsToOptions(props);\n navigation.setOptions(options);\n }\n }, [isFocused, props]);\n\n return null;\n}\n\nexport const NativeTabTrigger = Object.assign(NativeTabTriggerImpl, {\n TabBar: NativeTabsTriggerTabBar,\n});\n\nexport function convertTabPropsToOptions({\n options,\n hidden,\n children,\n role,\n disablePopToTop,\n disableScrollToTop,\n}: NativeTabTriggerProps) {\n const initialOptions: ExtendedNativeTabOptions = {\n ...options,\n hidden: !!hidden,\n specialEffects: {\n repeatedTabSelection: {\n popToRoot: !disablePopToTop,\n scrollToTop: !disableScrollToTop,\n },\n },\n role: role ?? options?.role,\n };\n const allowedChildren = filterAllowedChildrenElements(children, [\n Badge,\n Label,\n Icon,\n NativeTabsTriggerTabBar,\n ]);\n return allowedChildren.reduce<ExtendedNativeTabOptions>(\n (acc, child) => {\n if (isChildOfType(child, Badge)) {\n appendBadgeOptions(acc, child.props);\n } else if (isChildOfType(child, Label)) {\n appendLabelOptions(acc, child.props);\n } else if (isChildOfType(child, Icon)) {\n appendIconOptions(acc, child.props);\n } else if (isChildOfType(child, NativeTabsTriggerTabBar)) {\n appendTabBarOptions(acc, child.props);\n }\n return acc;\n },\n { ...initialOptions }\n );\n}\n\nfunction appendBadgeOptions(options: ExtendedNativeTabOptions, props: BadgeProps) {\n if (props.children) {\n options.badgeValue = String(props.children);\n options.selectedBadgeBackgroundColor = props.selectedBackgroundColor;\n } else if (!props.hidden) {\n // If no value is provided, we set it to a space to show the badge\n // Otherwise, the `react-native-screens` will interpret it as a hidden badge\n // https://github.com/software-mansion/react-native-screens/blob/b4358fd95dd0736fc54df6bb97f210dc89edf24c/ios/bottom-tabs/RNSBottomTabsScreenComponentView.mm#L172\n options.badgeValue = ' ';\n }\n}\n\nfunction appendLabelOptions(options: ExtendedNativeTabOptions, props: LabelProps) {\n if (props.hidden) {\n options.title = '';\n } else {\n options.title = props.children;\n options.selectedLabelStyle = props.selectedStyle;\n }\n}\n\nfunction appendIconOptions(options: ExtendedNativeTabOptions, props: IconProps) {\n if ('src' in props && props.src) {\n if (typeof props.src === 'object' && 'default' in props.src) {\n options.icon = props.src.default\n ? {\n src: props.src.default,\n }\n : undefined;\n options.selectedIcon = props.src.selected\n ? {\n src: props.src.selected,\n }\n : undefined;\n } else {\n options.icon = props.src\n ? {\n src: props.src as ImageSourcePropType,\n }\n : undefined;\n }\n } else if ('sf' in props && process.env.EXPO_OS === 'ios') {\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 ('drawable' in props && process.env.EXPO_OS === 'android') {\n options.icon = { drawable: props.drawable };\n options.selectedIcon = undefined;\n }\n options.selectedIconColor = props.selectedColor;\n}\n\nfunction appendTabBarOptions(\n options: ExtendedNativeTabOptions,\n props: NativeTabsTriggerTabBarProps\n) {\n const {\n backgroundColor,\n blurEffect,\n iconColor,\n disableTransparentOnScrollEdge,\n badgeBackgroundColor,\n badgeTextColor,\n indicatorColor,\n labelStyle,\n } = props;\n\n if (backgroundColor) {\n options.backgroundColor = backgroundColor;\n }\n // We need better native integration of this on Android\n // Simulating from JS side creates ugly transitions\n if (process.env.EXPO_OS !== 'android') {\n if (blurEffect) {\n options.blurEffect = blurEffect;\n }\n if (iconColor) {\n options.iconColor = iconColor;\n }\n if (disableTransparentOnScrollEdge !== undefined) {\n options.disableTransparentOnScrollEdge = disableTransparentOnScrollEdge;\n }\n if (badgeBackgroundColor) {\n options.badgeBackgroundColor = badgeBackgroundColor;\n }\n if (badgeTextColor) {\n options.badgeTextColor = badgeTextColor;\n }\n if (indicatorColor) {\n options.indicatorColor = indicatorColor;\n }\n if (labelStyle) {\n options.labelStyle = labelStyle;\n }\n }\n}\n\nexport function isNativeTabTrigger(\n child: ReactNode,\n contextKey?: string\n): child is ReactElement<NativeTabTriggerProps & { name: string }> {\n if (isValidElement(child) && child && child.type === NativeTabTrigger) {\n if (\n typeof child.props === 'object' &&\n child.props &&\n 'name' in child.props &&\n !child.props.name\n ) {\n throw new Error(\n `<Trigger /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must have a \\`name\\` prop when used as a child of a Layout Route.`\n );\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (\n ['component', 'getComponent'].some(\n (key) => child.props && typeof child.props === 'object' && key in child.props\n )\n ) {\n throw new Error(\n `<Trigger /> component in \\`default export\\` at \\`app${contextKey}/_layout\\` must not have a \\`component\\` or \\`getComponent\\` prop when used as a child of a Layout Route`\n );\n }\n }\n\n return true;\n }\n\n return false;\n}\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { NativeTabTrigger } from './NativeTabTrigger';
|
|
2
1
|
import type { NativeTabsProps } from './types';
|
|
3
2
|
/**
|
|
4
3
|
* The component used to create native tabs layout.
|
|
@@ -19,6 +18,8 @@ import type { NativeTabsProps } from './types';
|
|
|
19
18
|
* ```
|
|
20
19
|
*/
|
|
21
20
|
export declare const NativeTabs: ((props: NativeTabsProps) => import("react").JSX.Element) & {
|
|
22
|
-
Trigger:
|
|
21
|
+
Trigger: ((props: import("./types").NativeTabTriggerProps) => null) & {
|
|
22
|
+
TabBar: typeof import("./NativeTabsTriggerTabBar").NativeTabsTriggerTabBar;
|
|
23
|
+
};
|
|
23
24
|
};
|
|
24
25
|
//# sourceMappingURL=NativeTabs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTabs.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabs.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NativeTabs.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabs.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU,WACb,eAAe;;;;CAIxB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { NativeTabsTriggerTabBarProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The component used to customize the style of the tab bar, when given trigger is selected.
|
|
4
|
+
*
|
|
5
|
+
* Prefer this to global changes of tab bar styles, directly in the page.
|
|
6
|
+
*
|
|
7
|
+
* > **Note:** You can use the alias `NativeTabs.Trigger.TabBar` for this component.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <NativeTabs
|
|
12
|
+
* backgroundColor="black"
|
|
13
|
+
* >
|
|
14
|
+
* <NativeTabs.Trigger name="page">
|
|
15
|
+
* <NativeTabs.Trigger.TabBar
|
|
16
|
+
* backgroundColor="white"
|
|
17
|
+
* />
|
|
18
|
+
* <Label>Page</Label>
|
|
19
|
+
* </NativeTabs.Trigger>
|
|
20
|
+
* </NativeTabs>
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export declare function NativeTabsTriggerTabBar(props: NativeTabsTriggerTabBarProps): React.ReactNode;
|
|
24
|
+
//# sourceMappingURL=NativeTabsTriggerTabBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeTabsTriggerTabBar.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,GAAG,KAAK,CAAC,SAAS,CAE5F"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NativeTabsTriggerTabBar = NativeTabsTriggerTabBar;
|
|
4
|
+
/**
|
|
5
|
+
* The component used to customize the style of the tab bar, when given trigger is selected.
|
|
6
|
+
*
|
|
7
|
+
* Prefer this to global changes of tab bar styles, directly in the page.
|
|
8
|
+
*
|
|
9
|
+
* > **Note:** You can use the alias `NativeTabs.Trigger.TabBar` for this component.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <NativeTabs
|
|
14
|
+
* backgroundColor="black"
|
|
15
|
+
* >
|
|
16
|
+
* <NativeTabs.Trigger name="page">
|
|
17
|
+
* <NativeTabs.Trigger.TabBar
|
|
18
|
+
* backgroundColor="white"
|
|
19
|
+
* />
|
|
20
|
+
* <Label>Page</Label>
|
|
21
|
+
* </NativeTabs.Trigger>
|
|
22
|
+
* </NativeTabs>
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
function NativeTabsTriggerTabBar(props) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=NativeTabsTriggerTabBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeTabsTriggerTabBar.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.tsx"],"names":[],"mappings":";;AAuBA,0DAEC;AAvBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,uBAAuB,CAAC,KAAmC;IACzE,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { NativeTabsTriggerTabBarProps } from './types';\n\n/**\n * The component used to customize the style of the tab bar, when given trigger is selected.\n *\n * Prefer this to global changes of tab bar styles, directly in the page.\n *\n * > **Note:** You can use the alias `NativeTabs.Trigger.TabBar` for this component.\n *\n * @example\n * ```tsx\n * <NativeTabs\n * backgroundColor=\"black\"\n * >\n * <NativeTabs.Trigger name=\"page\">\n * <NativeTabs.Trigger.TabBar\n * backgroundColor=\"white\"\n * />\n * <Label>Page</Label>\n * </NativeTabs.Trigger>\n * </NativeTabs>\n *\n */\nexport function NativeTabsTriggerTabBar(props: NativeTabsTriggerTabBarProps): React.ReactNode {\n return null;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTabsView.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NativeTabsView.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAiBhD,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,SAAS,CAAC;AAOjB,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBAwIxD"}
|
|
@@ -36,32 +36,67 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.NativeTabsView = NativeTabsView;
|
|
37
37
|
const react_1 = __importStar(require("react"));
|
|
38
38
|
const react_native_screens_1 = require("react-native-screens");
|
|
39
|
+
const appearance_1 = require("./appearance");
|
|
39
40
|
const types_1 = require("./types");
|
|
40
41
|
const utils_1 = require("./utils");
|
|
41
42
|
// We let native tabs to control the changes. This requires freeze to be disabled for tab bar.
|
|
42
43
|
// Otherwise user may see glitches when switching between tabs.
|
|
43
44
|
react_native_screens_1.featureFlags.experiment.controlledBottomTabs = false;
|
|
44
45
|
function NativeTabsView(props) {
|
|
45
|
-
const { builder,
|
|
46
|
+
const { builder, minimizeBehavior, disableIndicator, focusedIndex, disableTransparentOnScrollEdge, } = props;
|
|
46
47
|
const { state, descriptors, navigation } = builder;
|
|
47
48
|
const { routes } = state;
|
|
48
49
|
const deferredFocusedIndex = (0, react_1.useDeferredValue)(focusedIndex);
|
|
50
|
+
let standardAppearance = (0, appearance_1.convertStyleToAppearance)({
|
|
51
|
+
...props.labelStyle,
|
|
52
|
+
iconColor: props.iconColor,
|
|
53
|
+
blurEffect: props.blurEffect,
|
|
54
|
+
backgroundColor: props.backgroundColor,
|
|
55
|
+
badgeBackgroundColor: props.badgeBackgroundColor,
|
|
56
|
+
});
|
|
57
|
+
if (props.tintColor) {
|
|
58
|
+
standardAppearance = (0, appearance_1.appendSelectedStyleToAppearance)({ iconColor: props.tintColor, color: props.tintColor }, standardAppearance);
|
|
59
|
+
}
|
|
60
|
+
const scrollEdgeAppearance = (0, appearance_1.convertStyleToAppearance)({
|
|
61
|
+
...props.labelStyle,
|
|
62
|
+
iconColor: props.iconColor,
|
|
63
|
+
blurEffect: disableTransparentOnScrollEdge ? props.blurEffect : 'none',
|
|
64
|
+
backgroundColor: disableTransparentOnScrollEdge ? props.backgroundColor : null,
|
|
65
|
+
badgeBackgroundColor: props.badgeBackgroundColor,
|
|
66
|
+
});
|
|
67
|
+
const appearances = routes.map((route) => ({
|
|
68
|
+
standardAppearance: (0, appearance_1.createStandardAppearanceFromOptions)(descriptors[route.key].options, standardAppearance),
|
|
69
|
+
scrollEdgeAppearance: (0, appearance_1.createScrollEdgeAppearanceFromOptions)(descriptors[route.key].options, scrollEdgeAppearance),
|
|
70
|
+
}));
|
|
71
|
+
const options = routes.map((route) => descriptors[route.key].options);
|
|
49
72
|
const children = routes
|
|
50
73
|
.map((route, index) => ({ route, index }))
|
|
51
74
|
.filter(({ route: { key } }) => (0, utils_1.shouldTabBeVisible)(descriptors[key].options))
|
|
52
75
|
.map(({ route, index }) => {
|
|
53
76
|
const descriptor = descriptors[route.key];
|
|
54
77
|
const isFocused = index === deferredFocusedIndex;
|
|
55
|
-
|
|
56
|
-
return (<react_native_screens_1.BottomTabsScreen key={route.key} {...descriptor.options} tabBarItemBadgeBackgroundColor={style?.badgeBackgroundColor} tabBarItemBadgeTextColor={style?.badgeTextColor} tabBarItemTitlePositionAdjustment={style?.titlePositionAdjustment} iconResourceName={descriptor.options.icon?.drawable} icon={convertOptionsIconToPropsIcon(descriptor.options.icon)} selectedIcon={convertOptionsIconToPropsIcon(descriptor.options.selectedIcon)} title={title} freezeContents={false} tabKey={route.key} isFocused={isFocused}>
|
|
57
|
-
{descriptor.render()}
|
|
58
|
-
</react_native_screens_1.BottomTabsScreen>);
|
|
78
|
+
return (<Screen key={route.key} routeKey={route.key} name={route.name} descriptor={descriptor} isFocused={isFocused} standardAppearance={appearances[index].standardAppearance} scrollEdgeAppearance={appearances[index].scrollEdgeAppearance} badgeTextColor={props.badgeTextColor}/>);
|
|
59
79
|
});
|
|
60
|
-
return (<BottomTabsWrapper
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
80
|
+
return (<BottomTabsWrapper
|
|
81
|
+
// #region android props
|
|
82
|
+
tabBarItemTitleFontColor={appearances[deferredFocusedIndex].standardAppearance.stacked?.normal
|
|
83
|
+
?.tabBarItemTitleFontColor} tabBarItemTitleFontFamily={appearances[deferredFocusedIndex].standardAppearance.stacked?.normal
|
|
84
|
+
?.tabBarItemTitleFontFamily} tabBarItemTitleFontSize={appearances[deferredFocusedIndex].standardAppearance.stacked?.normal
|
|
85
|
+
?.tabBarItemTitleFontSize} tabBarItemTitleFontSizeActive={appearances[deferredFocusedIndex].standardAppearance.stacked?.normal
|
|
86
|
+
?.tabBarItemTitleFontSize} tabBarItemTitleFontWeight={appearances[deferredFocusedIndex].standardAppearance.stacked?.normal
|
|
87
|
+
?.tabBarItemTitleFontWeight} tabBarItemTitleFontStyle={appearances[deferredFocusedIndex].standardAppearance.stacked?.normal
|
|
88
|
+
?.tabBarItemTitleFontStyle} tabBarItemIconColor={appearances[deferredFocusedIndex].standardAppearance.stacked?.normal?.tabBarItemIconColor} tabBarBackgroundColor={appearances[deferredFocusedIndex].standardAppearance.tabBarBackgroundColor ??
|
|
89
|
+
props.backgroundColor ??
|
|
90
|
+
undefined} tabBarItemRippleColor={props.rippleColor} tabBarItemLabelVisibilityMode={props.labelVisibilityMode} tabBarItemIconColorActive={appearances[deferredFocusedIndex].standardAppearance?.stacked?.selected
|
|
91
|
+
?.tabBarItemIconColor ?? props?.tintColor} tabBarItemTitleFontColorActive={appearances[deferredFocusedIndex].standardAppearance?.stacked?.selected
|
|
92
|
+
?.tabBarItemTitleFontColor ?? props?.tintColor}
|
|
93
|
+
// tabBarItemTitleFontSizeActive={activeStyle?.fontSize}
|
|
94
|
+
tabBarItemActiveIndicatorColor={options[deferredFocusedIndex]?.indicatorColor ?? props?.indicatorColor} tabBarItemActiveIndicatorEnabled={!disableIndicator}
|
|
95
|
+
// #endregion
|
|
96
|
+
// #region iOS props
|
|
97
|
+
tabBarTintColor={props?.tintColor} tabBarMinimizeBehavior={minimizeBehavior}
|
|
98
|
+
// #endregion
|
|
99
|
+
onNativeFocusChange={({ nativeEvent: { tabKey } }) => {
|
|
65
100
|
const descriptor = descriptors[tabKey];
|
|
66
101
|
const route = descriptor.route;
|
|
67
102
|
navigation.dispatch({
|
|
@@ -75,6 +110,21 @@ function NativeTabsView(props) {
|
|
|
75
110
|
{children}
|
|
76
111
|
</BottomTabsWrapper>);
|
|
77
112
|
}
|
|
113
|
+
function Screen(props) {
|
|
114
|
+
const { routeKey, name, descriptor, isFocused, standardAppearance, scrollEdgeAppearance, badgeTextColor, } = props;
|
|
115
|
+
const title = descriptor.options.title ?? name;
|
|
116
|
+
let icon = convertOptionsIconToPropsIcon(descriptor.options.icon);
|
|
117
|
+
// Fix for an issue in screens
|
|
118
|
+
if (descriptor.options.role) {
|
|
119
|
+
switch (descriptor.options.role) {
|
|
120
|
+
case 'search':
|
|
121
|
+
icon = { sfSymbolName: 'magnifyingglass' };
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return (<react_native_screens_1.BottomTabsScreen {...descriptor.options} tabBarItemBadgeBackgroundColor={standardAppearance.stacked?.normal?.tabBarItemBadgeBackgroundColor} tabBarItemBadgeTextColor={badgeTextColor} standardAppearance={standardAppearance} scrollEdgeAppearance={scrollEdgeAppearance} iconResourceName={getAndroidIconResourceName(descriptor.options.icon)} iconResource={getAndroidIconResource(descriptor.options.icon)} icon={icon} selectedIcon={convertOptionsIconToPropsIcon(descriptor.options.selectedIcon)} title={title} freezeContents={false} tabKey={routeKey} systemItem={descriptor.options.role} isFocused={isFocused}>
|
|
125
|
+
{descriptor.render()}
|
|
126
|
+
</react_native_screens_1.BottomTabsScreen>);
|
|
127
|
+
}
|
|
78
128
|
function convertOptionsIconToPropsIcon(icon) {
|
|
79
129
|
if (!icon) {
|
|
80
130
|
return undefined;
|
|
@@ -87,21 +137,31 @@ function convertOptionsIconToPropsIcon(icon) {
|
|
|
87
137
|
}
|
|
88
138
|
return undefined;
|
|
89
139
|
}
|
|
140
|
+
function getAndroidIconResource(icon) {
|
|
141
|
+
if (icon && 'src' in icon && icon.src) {
|
|
142
|
+
return icon.src;
|
|
143
|
+
}
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
function getAndroidIconResourceName(icon) {
|
|
147
|
+
if (icon && 'drawable' in icon && icon.drawable) {
|
|
148
|
+
return icon.drawable;
|
|
149
|
+
}
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
90
152
|
const supportedTabBarMinimizeBehaviorsSet = new Set(types_1.SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS);
|
|
91
153
|
const supportedTabBarItemLabelVisibilityModesSet = new Set(types_1.SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES);
|
|
92
|
-
const supportedBlurEffectsSet = new Set(types_1.SUPPORTED_BLUR_EFFECTS);
|
|
93
154
|
function BottomTabsWrapper(props) {
|
|
94
|
-
|
|
155
|
+
let { tabBarMinimizeBehavior, tabBarItemLabelVisibilityMode, ...rest } = props;
|
|
95
156
|
if (tabBarMinimizeBehavior && !supportedTabBarMinimizeBehaviorsSet.has(tabBarMinimizeBehavior)) {
|
|
96
|
-
|
|
157
|
+
console.warn(`Unsupported minimizeBehavior: ${tabBarMinimizeBehavior}. Supported values are: ${types_1.SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS.map((behavior) => `"${behavior}"`).join(', ')}`);
|
|
158
|
+
tabBarMinimizeBehavior = undefined;
|
|
97
159
|
}
|
|
98
160
|
if (tabBarItemLabelVisibilityMode &&
|
|
99
161
|
!supportedTabBarItemLabelVisibilityModesSet.has(tabBarItemLabelVisibilityMode)) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (tabBarBlurEffect && !supportedBlurEffectsSet.has(tabBarBlurEffect)) {
|
|
103
|
-
throw new Error(`Unsupported blurEffect: ${tabBarBlurEffect}. Supported values are: ${types_1.SUPPORTED_BLUR_EFFECTS.map((effect) => `"${effect}"`).join(', ')}`);
|
|
162
|
+
console.warn(`Unsupported labelVisibilityMode: ${tabBarItemLabelVisibilityMode}. Supported values are: ${types_1.SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES.map((mode) => `"${mode}"`).join(', ')}`);
|
|
163
|
+
tabBarItemLabelVisibilityMode = undefined;
|
|
104
164
|
}
|
|
105
|
-
return (<react_native_screens_1.BottomTabs
|
|
165
|
+
return (<react_native_screens_1.BottomTabs tabBarItemLabelVisibilityMode={tabBarItemLabelVisibilityMode} tabBarMinimizeBehavior={tabBarMinimizeBehavior} {...rest}/>);
|
|
106
166
|
}
|
|
107
167
|
//# sourceMappingURL=NativeTabsView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTabsView.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,wCAyEC;AA/FD,+CAAgD;AAChD,+DAM8B;AAE9B,mCAMiB;AACjB,mCAA6C;AAE7C,8FAA8F;AAC9F,+DAA+D;AAC/D,mCAAY,CAAC,UAAU,CAAC,oBAAoB,GAAG,KAAK,CAAC;AAErD,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IACnF,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACnD,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEzB,MAAM,oBAAoB,GAAG,IAAA,wBAAgB,EAAC,YAAY,CAAC,CAAC;IAE5D,MAAM,QAAQ,GAAG,MAAM;SACpB,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;SACzC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,IAAA,0BAAkB,EAAC,WA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AAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACvK,CAAC;IACJ,CAAC;IACD,IACE,6BAA6B;QAC7B,CAAC,0CAA0C,CAAC,GAAG,CAAC,6BAA6B,CAAC,EAC9E,CAAC;QACD,MAAM,IAAI,KAAK,CACb,oCAAoC,6BAA6B,2BAA2B,qDAA6C,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAClL,CAAC;IACJ,CAAC;IACD,IAAI,gBAAgB,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACvE,MAAM,IAAI,KAAK,CACb,2BAA2B,gBAAgB,2BAA2B,8BAAsB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACzI,CAAC;IACJ,CAAC;IAED,OAAO,CACL,CAAC,iCAAU,CACT,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CACnC,6BAA6B,CAAC,CAAC,6BAA6B,CAAC,CAC7D,sBAAsB,CAAC,CAAC,sBAAsB,CAAC,CAC/C,IAAI,IAAI,CAAC,EACT,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React, { useDeferredValue } from 'react';\nimport {\n BottomTabs,\n BottomTabsScreen,\n featureFlags,\n type BottomTabsProps,\n type BottomTabsScreenProps,\n} from 'react-native-screens';\n\nimport {\n SUPPORTED_BLUR_EFFECTS,\n SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES,\n SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS,\n type NativeTabOptions,\n type NativeTabsViewProps,\n} from './types';\nimport { shouldTabBeVisible } from './utils';\n\n// We let native tabs to control the changes. This requires freeze to be disabled for tab bar.\n// Otherwise user may see glitches when switching between tabs.\nfeatureFlags.experiment.controlledBottomTabs = false;\n\nexport function NativeTabsView(props: NativeTabsViewProps) {\n const { builder, style, minimizeBehavior, disableIndicator, focusedIndex } = props;\n const { state, descriptors, navigation } = builder;\n const { routes } = state;\n\n const deferredFocusedIndex = useDeferredValue(focusedIndex);\n\n const children = routes\n .map((route, index) => ({ route, index }))\n .filter(({ route: { key } }) => shouldTabBeVisible(descriptors[key].options))\n .map(({ route, index }) => {\n const descriptor = descriptors[route.key];\n const isFocused = index === deferredFocusedIndex;\n const title = descriptor.options.title ?? route.name;\n\n return (\n <BottomTabsScreen\n key={route.key}\n {...descriptor.options}\n tabBarItemBadgeBackgroundColor={style?.badgeBackgroundColor}\n tabBarItemBadgeTextColor={style?.badgeTextColor}\n tabBarItemTitlePositionAdjustment={style?.titlePositionAdjustment}\n iconResourceName={descriptor.options.icon?.drawable}\n icon={convertOptionsIconToPropsIcon(descriptor.options.icon)}\n selectedIcon={convertOptionsIconToPropsIcon(descriptor.options.selectedIcon)}\n title={title}\n freezeContents={false}\n tabKey={route.key}\n isFocused={isFocused}>\n {descriptor.render()}\n </BottomTabsScreen>\n );\n });\n\n return (\n <BottomTabsWrapper\n tabBarItemTitleFontColor={style?.color}\n tabBarItemTitleFontFamily={style?.fontFamily}\n tabBarItemTitleFontSize={style?.fontSize}\n // Only string values are accepted by screens\n tabBarItemTitleFontWeight={\n style?.fontWeight\n ? (String(style.fontWeight) as `${NonNullable<(typeof style)['fontWeight']>}`)\n : undefined\n }\n tabBarItemTitleFontStyle={style?.fontStyle}\n tabBarBackgroundColor={style?.backgroundColor}\n tabBarBlurEffect={style?.blurEffect}\n tabBarTintColor={style?.tintColor}\n tabBarItemBadgeBackgroundColor={style?.badgeBackgroundColor}\n tabBarItemRippleColor={style?.rippleColor}\n tabBarItemLabelVisibilityMode={style?.labelVisibilityMode}\n tabBarItemIconColor={style?.iconColor}\n tabBarItemIconColorActive={style?.['&:active']?.iconColor ?? style?.tintColor}\n tabBarItemTitleFontColorActive={style?.['&:active']?.color ?? style?.tintColor}\n tabBarItemTitleFontSizeActive={style?.['&:active']?.fontSize}\n tabBarItemActiveIndicatorColor={style?.['&:active']?.indicatorColor}\n tabBarItemActiveIndicatorEnabled={!disableIndicator}\n tabBarMinimizeBehavior={minimizeBehavior}\n onNativeFocusChange={({ nativeEvent: { tabKey } }) => {\n const descriptor = descriptors[tabKey];\n const route = descriptor.route;\n navigation.dispatch({\n type: 'JUMP_TO',\n target: state.key,\n payload: {\n name: route.name,\n },\n });\n }}>\n {children}\n </BottomTabsWrapper>\n );\n}\n\nfunction convertOptionsIconToPropsIcon(\n icon: NativeTabOptions['icon']\n): BottomTabsScreenProps['icon'] {\n if (!icon) {\n return undefined;\n }\n if ('sf' in icon && icon.sf) {\n return { sfSymbolName: icon.sf };\n } else if ('src' in icon && icon.src) {\n return { templateSource: icon.src };\n }\n return undefined;\n}\n\nconst supportedTabBarMinimizeBehaviorsSet = new Set<string>(SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS);\nconst supportedTabBarItemLabelVisibilityModesSet = new Set<string>(\n SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES\n);\nconst supportedBlurEffectsSet = new Set<string>(SUPPORTED_BLUR_EFFECTS);\n\nfunction BottomTabsWrapper(props: BottomTabsProps) {\n const { tabBarMinimizeBehavior, tabBarItemLabelVisibilityMode, tabBarBlurEffect, ...rest } =\n props;\n if (tabBarMinimizeBehavior && !supportedTabBarMinimizeBehaviorsSet.has(tabBarMinimizeBehavior)) {\n throw new Error(\n `Unsupported minimizeBehavior: ${tabBarMinimizeBehavior}. Supported values are: ${SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS.map((behavior) => `\"${behavior}\"`).join(', ')}`\n );\n }\n if (\n tabBarItemLabelVisibilityMode &&\n !supportedTabBarItemLabelVisibilityModesSet.has(tabBarItemLabelVisibilityMode)\n ) {\n throw new Error(\n `Unsupported labelVisibilityMode: ${tabBarItemLabelVisibilityMode}. Supported values are: ${SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES.map((mode) => `\"${mode}\"`).join(', ')}`\n );\n }\n if (tabBarBlurEffect && !supportedBlurEffectsSet.has(tabBarBlurEffect)) {\n throw new Error(\n `Unsupported blurEffect: ${tabBarBlurEffect}. Supported values are: ${SUPPORTED_BLUR_EFFECTS.map((effect) => `\"${effect}\"`).join(', ')}`\n );\n }\n\n return (\n <BottomTabs\n tabBarBlurEffect={tabBarBlurEffect}\n tabBarItemLabelVisibilityMode={tabBarItemLabelVisibilityMode}\n tabBarMinimizeBehavior={tabBarMinimizeBehavior}\n {...rest}\n />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"NativeTabsView.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,wCAwIC;AArKD,+CAAgD;AAEhD,+DAO8B;AAE9B,6CAKsB;AACtB,mCAKiB;AACjB,mCAA6C;AAE7C,8FAA8F;AAC9F,+DAA+D;AAC/D,mCAAY,CAAC,UAAU,CAAC,oBAAoB,GAAG,KAAK,CAAC;AAErD,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,EACJ,OAAO,EACP,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,8BAA8B,GAC/B,GAAG,KAAK,CAAC;IACV,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACnD,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEzB,MAAM,oBAAoB,GAAG,IAAA,wBAAgB,EAAC,YAAY,CAAC,CAAC;IAC5D,IAAI,kBAAkB,GAAG,IAAA,qCAAwB,EAAC;QAChD,GAAG,KAAK,CAAC,UAAU;QACnB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,eAAe,EAAE,KAAK,CAAC,eAAe;QACtC,oBAAoB,EAAE,KAAK,C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\n BottomTabsScreen,\n featureFlags,\n type BottomTabsProps,\n type BottomTabsScreenAppearance,\n type BottomTabsScreenProps,\n} from 'react-native-screens';\n\nimport {\n appendSelectedStyleToAppearance,\n convertStyleToAppearance,\n createScrollEdgeAppearanceFromOptions,\n createStandardAppearanceFromOptions,\n} from './appearance';\nimport {\n SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES,\n SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS,\n type NativeTabOptions,\n type NativeTabsViewProps,\n} from './types';\nimport { shouldTabBeVisible } from './utils';\n\n// We let native tabs to control the changes. This requires freeze to be disabled for tab bar.\n// Otherwise user may see glitches when switching between tabs.\nfeatureFlags.experiment.controlledBottomTabs = false;\n\nexport function NativeTabsView(props: NativeTabsViewProps) {\n const {\n builder,\n minimizeBehavior,\n disableIndicator,\n focusedIndex,\n disableTransparentOnScrollEdge,\n } = props;\n const { state, descriptors, navigation } = builder;\n const { routes } = state;\n\n const deferredFocusedIndex = useDeferredValue(focusedIndex);\n let standardAppearance = convertStyleToAppearance({\n ...props.labelStyle,\n iconColor: props.iconColor,\n blurEffect: props.blurEffect,\n backgroundColor: props.backgroundColor,\n badgeBackgroundColor: props.badgeBackgroundColor,\n });\n if (props.tintColor) {\n standardAppearance = appendSelectedStyleToAppearance(\n { iconColor: props.tintColor, color: props.tintColor },\n standardAppearance\n );\n }\n const scrollEdgeAppearance = convertStyleToAppearance({\n ...props.labelStyle,\n iconColor: props.iconColor,\n blurEffect: disableTransparentOnScrollEdge ? props.blurEffect : 'none',\n backgroundColor: disableTransparentOnScrollEdge ? props.backgroundColor : null,\n badgeBackgroundColor: props.badgeBackgroundColor,\n });\n\n const appearances = routes.map((route) => ({\n standardAppearance: createStandardAppearanceFromOptions(\n descriptors[route.key].options,\n standardAppearance\n ),\n scrollEdgeAppearance: createScrollEdgeAppearanceFromOptions(\n descriptors[route.key].options,\n scrollEdgeAppearance\n ),\n }));\n\n const options = routes.map((route) => descriptors[route.key].options);\n\n const children = routes\n .map((route, index) => ({ route, index }))\n .filter(({ route: { key } }) => shouldTabBeVisible(descriptors[key].options))\n .map(({ route, index }) => {\n const descriptor = descriptors[route.key];\n const isFocused = index === deferredFocusedIndex;\n\n return (\n <Screen\n key={route.key}\n routeKey={route.key}\n name={route.name}\n descriptor={descriptor}\n isFocused={isFocused}\n standardAppearance={appearances[index].standardAppearance}\n scrollEdgeAppearance={appearances[index].scrollEdgeAppearance}\n badgeTextColor={props.badgeTextColor}\n />\n );\n });\n\n return (\n <BottomTabsWrapper\n // #region android props\n tabBarItemTitleFontColor={\n appearances[deferredFocusedIndex].standardAppearance.stacked?.normal\n ?.tabBarItemTitleFontColor\n }\n tabBarItemTitleFontFamily={\n appearances[deferredFocusedIndex].standardAppearance.stacked?.normal\n ?.tabBarItemTitleFontFamily\n }\n tabBarItemTitleFontSize={\n appearances[deferredFocusedIndex].standardAppearance.stacked?.normal\n ?.tabBarItemTitleFontSize\n }\n tabBarItemTitleFontSizeActive={\n appearances[deferredFocusedIndex].standardAppearance.stacked?.normal\n ?.tabBarItemTitleFontSize\n }\n tabBarItemTitleFontWeight={\n appearances[deferredFocusedIndex].standardAppearance.stacked?.normal\n ?.tabBarItemTitleFontWeight\n }\n tabBarItemTitleFontStyle={\n appearances[deferredFocusedIndex].standardAppearance.stacked?.normal\n ?.tabBarItemTitleFontStyle\n }\n tabBarItemIconColor={\n appearances[deferredFocusedIndex].standardAppearance.stacked?.normal?.tabBarItemIconColor\n }\n tabBarBackgroundColor={\n appearances[deferredFocusedIndex].standardAppearance.tabBarBackgroundColor ??\n props.backgroundColor ??\n undefined\n }\n tabBarItemRippleColor={props.rippleColor}\n tabBarItemLabelVisibilityMode={props.labelVisibilityMode}\n tabBarItemIconColorActive={\n appearances[deferredFocusedIndex].standardAppearance?.stacked?.selected\n ?.tabBarItemIconColor ?? props?.tintColor\n }\n tabBarItemTitleFontColorActive={\n appearances[deferredFocusedIndex].standardAppearance?.stacked?.selected\n ?.tabBarItemTitleFontColor ?? props?.tintColor\n }\n // tabBarItemTitleFontSizeActive={activeStyle?.fontSize}\n tabBarItemActiveIndicatorColor={\n options[deferredFocusedIndex]?.indicatorColor ?? props?.indicatorColor\n }\n tabBarItemActiveIndicatorEnabled={!disableIndicator}\n // #endregion\n // #region iOS props\n tabBarTintColor={props?.tintColor}\n tabBarMinimizeBehavior={minimizeBehavior}\n // #endregion\n onNativeFocusChange={({ nativeEvent: { tabKey } }) => {\n const descriptor = descriptors[tabKey];\n const route = descriptor.route;\n navigation.dispatch({\n type: 'JUMP_TO',\n target: state.key,\n payload: {\n name: route.name,\n },\n });\n }}>\n {children}\n </BottomTabsWrapper>\n );\n}\n\nfunction Screen(props: {\n routeKey: string;\n name: string;\n descriptor: NativeTabsViewProps['builder']['descriptors'][string];\n isFocused: boolean;\n standardAppearance: BottomTabsScreenAppearance;\n scrollEdgeAppearance: BottomTabsScreenAppearance;\n badgeTextColor: ColorValue | undefined;\n}) {\n const {\n routeKey,\n name,\n descriptor,\n isFocused,\n standardAppearance,\n scrollEdgeAppearance,\n badgeTextColor,\n } = props;\n const title = descriptor.options.title ?? name;\n\n let icon = convertOptionsIconToPropsIcon(descriptor.options.icon);\n\n // Fix for an issue in screens\n if (descriptor.options.role) {\n switch (descriptor.options.role) {\n case 'search':\n icon = { sfSymbolName: 'magnifyingglass' };\n }\n }\n\n return (\n <BottomTabsScreen\n {...descriptor.options}\n tabBarItemBadgeBackgroundColor={\n standardAppearance.stacked?.normal?.tabBarItemBadgeBackgroundColor\n }\n tabBarItemBadgeTextColor={badgeTextColor}\n standardAppearance={standardAppearance}\n scrollEdgeAppearance={scrollEdgeAppearance}\n iconResourceName={getAndroidIconResourceName(descriptor.options.icon)}\n iconResource={getAndroidIconResource(descriptor.options.icon)}\n icon={icon}\n selectedIcon={convertOptionsIconToPropsIcon(descriptor.options.selectedIcon)}\n title={title}\n freezeContents={false}\n tabKey={routeKey}\n systemItem={descriptor.options.role}\n isFocused={isFocused}>\n {descriptor.render()}\n </BottomTabsScreen>\n );\n}\n\nfunction convertOptionsIconToPropsIcon(\n icon: NativeTabOptions['icon']\n): BottomTabsScreenProps['icon'] {\n if (!icon) {\n return undefined;\n }\n if ('sf' in icon && icon.sf) {\n return { sfSymbolName: icon.sf };\n } else if ('src' in icon && icon.src) {\n return { templateSource: icon.src };\n }\n return undefined;\n}\n\nfunction getAndroidIconResource(\n icon: NativeTabOptions['icon']\n): BottomTabsScreenProps['iconResource'] {\n if (icon && 'src' in icon && icon.src) {\n return icon.src;\n }\n return undefined;\n}\n\nfunction getAndroidIconResourceName(\n icon: NativeTabOptions['icon']\n): BottomTabsScreenProps['iconResourceName'] {\n if (icon && 'drawable' in icon && icon.drawable) {\n return icon.drawable;\n }\n return undefined;\n}\n\nconst supportedTabBarMinimizeBehaviorsSet = new Set<string>(SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS);\nconst supportedTabBarItemLabelVisibilityModesSet = new Set<string>(\n SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES\n);\n\nfunction BottomTabsWrapper(props: BottomTabsProps) {\n let { tabBarMinimizeBehavior, tabBarItemLabelVisibilityMode, ...rest } = props;\n if (tabBarMinimizeBehavior && !supportedTabBarMinimizeBehaviorsSet.has(tabBarMinimizeBehavior)) {\n console.warn(\n `Unsupported minimizeBehavior: ${tabBarMinimizeBehavior}. Supported values are: ${SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS.map((behavior) => `\"${behavior}\"`).join(', ')}`\n );\n tabBarMinimizeBehavior = undefined;\n }\n if (\n tabBarItemLabelVisibilityMode &&\n !supportedTabBarItemLabelVisibilityModesSet.has(tabBarItemLabelVisibilityMode)\n ) {\n console.warn(\n `Unsupported labelVisibilityMode: ${tabBarItemLabelVisibilityMode}. Supported values are: ${SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES.map((mode) => `\"${mode}\"`).join(', ')}`\n );\n tabBarItemLabelVisibilityMode = undefined;\n }\n\n return (\n <BottomTabs\n tabBarItemLabelVisibilityMode={tabBarItemLabelVisibilityMode}\n tabBarMinimizeBehavior={tabBarMinimizeBehavior}\n {...rest}\n />\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTabsView.web.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsView.web.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"NativeTabsView.web.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsView.web.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAoB,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAIrE,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBAwDxD"}
|
|
@@ -47,6 +47,7 @@ function NativeTabsView(props) {
|
|
|
47
47
|
const { routes } = state;
|
|
48
48
|
const defaultTabName = (0, react_1.useMemo)(() => state.routes[focusedIndex]?.name ?? state.routes[0].name, []);
|
|
49
49
|
const value = state.routes[focusedIndex]?.name ?? state.routes[0].name;
|
|
50
|
+
const currentTabKey = state.routes[focusedIndex]?.key ?? state.routes[0].key;
|
|
50
51
|
const items = routes
|
|
51
52
|
.filter(({ key }) => (0, utils_1.shouldTabBeVisible)(descriptors[key].options))
|
|
52
53
|
.map((route) => (<TabItem key={route.key} route={route} title={descriptors[route.key].options.title ?? route.name} badgeValue={descriptors[route.key].options.badgeValue}/>));
|
|
@@ -65,7 +66,7 @@ function NativeTabsView(props) {
|
|
|
65
66
|
name: value,
|
|
66
67
|
},
|
|
67
68
|
});
|
|
68
|
-
}} style={convertNativeTabsPropsToStyleVars(props
|
|
69
|
+
}} style={convertNativeTabsPropsToStyleVars(props, descriptors[currentTabKey]?.options)}>
|
|
69
70
|
<react_tabs_1.TabsList aria-label="Main" className={native_tabs_module_css_1.default.navigationMenuRoot}>
|
|
70
71
|
{items}
|
|
71
72
|
</react_tabs_1.TabsList>
|
|
@@ -82,46 +83,75 @@ function TabItem(props) {
|
|
|
82
83
|
</div>)}
|
|
83
84
|
</react_tabs_1.TabsTrigger>);
|
|
84
85
|
}
|
|
85
|
-
function convertNativeTabsPropsToStyleVars(
|
|
86
|
+
function convertNativeTabsPropsToStyleVars(props, currentTabOptions) {
|
|
86
87
|
const vars = {};
|
|
87
|
-
if (!
|
|
88
|
+
if (!props) {
|
|
88
89
|
return vars;
|
|
89
90
|
}
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
const { labelStyle } = props;
|
|
92
|
+
const optionsLabelStyle = currentTabOptions?.labelStyle;
|
|
93
|
+
if (optionsLabelStyle?.fontFamily) {
|
|
94
|
+
vars['--expo-router-tabs-font-family'] = String(optionsLabelStyle.fontFamily);
|
|
92
95
|
}
|
|
93
|
-
if (
|
|
94
|
-
vars['--expo-router-tabs-font-
|
|
96
|
+
else if (labelStyle?.fontFamily) {
|
|
97
|
+
vars['--expo-router-tabs-font-family'] = String(labelStyle.fontFamily);
|
|
95
98
|
}
|
|
96
|
-
if (
|
|
97
|
-
vars['--expo-router-tabs-font-
|
|
99
|
+
if (optionsLabelStyle?.fontSize) {
|
|
100
|
+
vars['--expo-router-tabs-font-size'] = String(optionsLabelStyle.fontSize);
|
|
98
101
|
}
|
|
99
|
-
if (
|
|
100
|
-
vars['--expo-router-tabs-font-
|
|
102
|
+
else if (labelStyle?.fontSize) {
|
|
103
|
+
vars['--expo-router-tabs-font-size'] = String(labelStyle.fontSize);
|
|
101
104
|
}
|
|
102
|
-
if (
|
|
103
|
-
vars['--expo-router-tabs-
|
|
105
|
+
if (optionsLabelStyle?.fontWeight) {
|
|
106
|
+
vars['--expo-router-tabs-font-weight'] = String(optionsLabelStyle.fontWeight);
|
|
104
107
|
}
|
|
105
|
-
if (
|
|
106
|
-
vars['--expo-router-tabs-
|
|
108
|
+
else if (labelStyle?.fontWeight) {
|
|
109
|
+
vars['--expo-router-tabs-font-weight'] = String(labelStyle.fontWeight);
|
|
107
110
|
}
|
|
108
|
-
|
|
109
|
-
vars['--expo-router-tabs-
|
|
111
|
+
if (optionsLabelStyle?.fontStyle) {
|
|
112
|
+
vars['--expo-router-tabs-font-style'] = String(optionsLabelStyle.fontStyle);
|
|
110
113
|
}
|
|
111
|
-
if (
|
|
112
|
-
vars['--expo-router-tabs-
|
|
114
|
+
else if (labelStyle?.fontStyle) {
|
|
115
|
+
vars['--expo-router-tabs-font-style'] = String(labelStyle.fontStyle);
|
|
113
116
|
}
|
|
114
|
-
if (
|
|
115
|
-
vars['--expo-router-tabs-
|
|
117
|
+
if (optionsLabelStyle?.color) {
|
|
118
|
+
vars['--expo-router-tabs-text-color'] = String(optionsLabelStyle.color);
|
|
116
119
|
}
|
|
117
|
-
if (
|
|
118
|
-
vars['--expo-router-tabs-
|
|
120
|
+
else if (labelStyle?.color) {
|
|
121
|
+
vars['--expo-router-tabs-text-color'] = String(labelStyle.color);
|
|
119
122
|
}
|
|
120
|
-
if (
|
|
121
|
-
vars['--expo-router-tabs-
|
|
123
|
+
if (currentTabOptions?.selectedLabelStyle?.color) {
|
|
124
|
+
vars['--expo-router-tabs-active-text-color'] = String(currentTabOptions.selectedLabelStyle.color);
|
|
122
125
|
}
|
|
123
|
-
if (
|
|
124
|
-
vars['--expo-router-tabs-
|
|
126
|
+
else if (props.tintColor) {
|
|
127
|
+
vars['--expo-router-tabs-active-text-color'] = String(props.tintColor);
|
|
128
|
+
}
|
|
129
|
+
if (currentTabOptions?.selectedLabelStyle?.fontSize) {
|
|
130
|
+
vars['--expo-router-tabs-active-font-size'] = String(currentTabOptions.selectedLabelStyle.fontSize);
|
|
131
|
+
}
|
|
132
|
+
if (currentTabOptions?.indicatorColor) {
|
|
133
|
+
vars['--expo-router-tabs-active-background-color'] = String(currentTabOptions.indicatorColor);
|
|
134
|
+
}
|
|
135
|
+
else if (props.indicatorColor) {
|
|
136
|
+
vars['--expo-router-tabs-active-background-color'] = String(props.indicatorColor);
|
|
137
|
+
}
|
|
138
|
+
if (currentTabOptions?.backgroundColor) {
|
|
139
|
+
vars['--expo-router-tabs-background-color'] = String(currentTabOptions.backgroundColor);
|
|
140
|
+
}
|
|
141
|
+
else if (props.backgroundColor) {
|
|
142
|
+
vars['--expo-router-tabs-background-color'] = String(props.backgroundColor);
|
|
143
|
+
}
|
|
144
|
+
if (currentTabOptions?.badgeBackgroundColor) {
|
|
145
|
+
vars['--expo-router-tabs-badge-background-color'] = String(currentTabOptions.badgeBackgroundColor);
|
|
146
|
+
}
|
|
147
|
+
else if (props.badgeBackgroundColor) {
|
|
148
|
+
vars['--expo-router-tabs-badge-background-color'] = String(props.badgeBackgroundColor);
|
|
149
|
+
}
|
|
150
|
+
if (currentTabOptions?.badgeTextColor) {
|
|
151
|
+
vars['--expo-router-tabs-badge-text-color'] = String(currentTabOptions.badgeTextColor);
|
|
152
|
+
}
|
|
153
|
+
else if (props.badgeTextColor) {
|
|
154
|
+
vars['--expo-router-tabs-badge-text-color'] = String(props.badgeTextColor);
|
|
125
155
|
}
|
|
126
156
|
return vars;
|
|
127
157
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTabsView.web.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsView.web.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,wCAuDC;AA9DD,qDAAgF;AAChF,+CAAuC;AAGvC,mCAA6C;AAC7C,oGAAsE;AAEtE,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IACxC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACnD,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzB,MAAM,cAAc,GAAG,IAAA,eAAO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M,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;QAC3B,IAAI,CAAC,sCAAsC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACzE,CAAC;IACD,IAAI,KAAK,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC;QAChC,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC;IACnF,CAAC;IACD,IAAI,KAAK,CAAC,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;QACtC,IAAI,CAAC,4CAA4C,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,cAAc,CAAC,CAAC;IAChG,CAAC;IACD,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC;QAC1B,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAC9E,CAAC;IACD,IAAI,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC/B,IAAI,CAAC,2CAA2C,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACzF,CAAC;IACD,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;QACzB,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { Tabs, TabsContent, TabsList, TabsTrigger } from '@radix-ui/react-tabs';\nimport React, { useMemo } from 'react';\n\nimport type { NativeTabsViewProps } from './types';\nimport { shouldTabBeVisible } from './utils';\nimport nativeTabsStyles from '../../../assets/native-tabs.module.css';\n\nexport function NativeTabsView(props: NativeTabsViewProps) {\n const { builder, focusedIndex } = props;\n const { state, descriptors, navigation } = builder;\n const { routes } = state;\n const defaultTabName = useMemo(\n () => state.routes[focusedIndex]?.name ?? state.routes[0].name,\n []\n );\n const value = state.routes[focusedIndex]?.name ?? state.routes[0].name;\n\n const items = routes\n .filter(({ key }) => shouldTabBeVisible(descriptors[key].options))\n .map((route) => (\n <TabItem\n key={route.key}\n route={route}\n title={descriptors[route.key].options.title ?? route.name}\n badgeValue={descriptors[route.key].options.badgeValue}\n />\n ));\n const children = routes\n .filter(({ key }) => shouldTabBeVisible(descriptors[key].options))\n .map((route) => {\n return (\n <TabsContent\n key={route.name}\n value={route.name}\n className={nativeTabsStyles.tabContent}\n forceMount>\n {descriptors[route.key].render()}\n </TabsContent>\n );\n });\n\n return (\n <Tabs\n className={nativeTabsStyles.nativeTabsContainer}\n defaultValue={defaultTabName}\n value={value}\n onValueChange={(value) => {\n navigation.dispatch({\n type: 'JUMP_TO',\n target: state.key,\n payload: {\n name: value,\n },\n });\n }}\n style={convertNativeTabsPropsToStyleVars(props.style)}>\n <TabsList aria-label=\"Main\" className={nativeTabsStyles.navigationMenuRoot}>\n {items}\n </TabsList>\n {children}\n </Tabs>\n );\n}\n\ninterface TabItemProps {\n title: string;\n badgeValue?: string;\n route: { name: string };\n}\n\nfunction TabItem(props: TabItemProps) {\n const { title, badgeValue, route } = props;\n const isBadgeEmpty = badgeValue === ' ';\n\n return (\n <TabsTrigger value={route.name} className={nativeTabsStyles.navigationMenuTrigger}>\n <span className={nativeTabsStyles.tabText}>{title}</span>\n {badgeValue && (\n <div\n className={`${nativeTabsStyles.tabBadge} ${isBadgeEmpty ? nativeTabsStyles.emptyTabBadge : ''}`}>\n {badgeValue}\n </div>\n )}\n </TabsTrigger>\n );\n}\n\nfunction convertNativeTabsPropsToStyleVars(\n style: NativeTabsViewProps['style'] | undefined\n): Record<string, string | undefined> {\n const vars: Record<`--expo-router-tabs-${string}`, string | undefined> = {};\n if (!style) {\n return vars;\n }\n if (style.fontFamily) {\n vars['--expo-router-tabs-font-family'] = String(style.fontFamily);\n }\n if (style.fontSize) {\n vars['--expo-router-tabs-font-size'] = String(style.fontSize);\n }\n if (style.fontWeight) {\n vars['--expo-router-tabs-font-weight'] = String(style.fontWeight);\n }\n if (style.fontStyle) {\n vars['--expo-router-tabs-font-style'] = String(style.fontStyle);\n }\n if (style.color) {\n vars['--expo-router-tabs-text-color'] = String(style.color);\n }\n if (style['&:active']?.color) {\n vars['--expo-router-tabs-active-text-color'] = String(style['&:active'].color);\n } else if (style.tintColor) {\n vars['--expo-router-tabs-active-text-color'] = String(style.tintColor);\n }\n if (style['&:active']?.fontSize) {\n vars['--expo-router-tabs-active-font-size'] = String(style['&:active'].fontSize);\n }\n if (style['&:active']?.indicatorColor) {\n vars['--expo-router-tabs-active-background-color'] = String(style['&:active'].indicatorColor);\n }\n if (style.backgroundColor) {\n vars['--expo-router-tabs-background-color'] = String(style.backgroundColor);\n }\n if (style.badgeBackgroundColor) {\n vars['--expo-router-tabs-badge-background-color'] = String(style.badgeBackgroundColor);\n }\n if (style.badgeTextColor) {\n vars['--expo-router-tabs-badge-text-color'] = String(style.badgeTextColor);\n }\n return vars;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"NativeTabsView.web.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsView.web.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,wCAwDC;AA/DD,qDAAgF;AAChF,+CAAuC;AAGvC,mCAA6C;AAC7C,oGAAsE;AAEtE,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IACxC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACnD,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzB,MAAM,cAAc,GAAG,IAAA,eAAO,EAC5B,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,IAAI,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,I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AAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;IAChG,CAAC;SAAM,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;QAChC,IAAI,CAAC,4CAA4C,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACpF,CAAC;IACD,IAAI,iBAAiB,EAAE,eAAe,EAAE,CAAC;QACvC,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;IAC1F,CAAC;SAAM,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC;QACjC,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAC9E,CAAC;IACD,IAAI,iBAAiB,EAAE,oBAAoB,EAAE,CAAC;QAC5C,IAAI,CAAC,2CAA2C,CAAC,GAAG,MAAM,CACxD,iBAAiB,CAAC,oBAAoB,CACvC,CAAC;IACJ,CAAC;SAAM,IAAI,KAAK,CAAC,oBAAoB,EAAE,CAAC;QACtC,IAAI,CAAC,2CAA2C,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACzF,CAAC;IACD,IAAI,iBAAiB,EAAE,cAAc,EAAE,CAAC;QACtC,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACzF,CAAC;SAAM,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;QAChC,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { Tabs, TabsContent, TabsList, TabsTrigger } from '@radix-ui/react-tabs';\nimport React, { useMemo } from 'react';\n\nimport type { NativeTabOptions, NativeTabsViewProps } from './types';\nimport { shouldTabBeVisible } from './utils';\nimport nativeTabsStyles from '../../../assets/native-tabs.module.css';\n\nexport function NativeTabsView(props: NativeTabsViewProps) {\n const { builder, focusedIndex } = props;\n const { state, descriptors, navigation } = builder;\n const { routes } = state;\n const defaultTabName = useMemo(\n () => state.routes[focusedIndex]?.name ?? state.routes[0].name,\n []\n );\n const value = state.routes[focusedIndex]?.name ?? state.routes[0].name;\n const currentTabKey = state.routes[focusedIndex]?.key ?? state.routes[0].key;\n\n const items = routes\n .filter(({ key }) => shouldTabBeVisible(descriptors[key].options))\n .map((route) => (\n <TabItem\n key={route.key}\n route={route}\n title={descriptors[route.key].options.title ?? route.name}\n badgeValue={descriptors[route.key].options.badgeValue}\n />\n ));\n const children = routes\n .filter(({ key }) => shouldTabBeVisible(descriptors[key].options))\n .map((route) => {\n return (\n <TabsContent\n key={route.name}\n value={route.name}\n className={nativeTabsStyles.tabContent}\n forceMount>\n {descriptors[route.key].render()}\n </TabsContent>\n );\n });\n\n return (\n <Tabs\n className={nativeTabsStyles.nativeTabsContainer}\n defaultValue={defaultTabName}\n value={value}\n onValueChange={(value) => {\n navigation.dispatch({\n type: 'JUMP_TO',\n target: state.key,\n payload: {\n name: value,\n },\n });\n }}\n style={convertNativeTabsPropsToStyleVars(props, descriptors[currentTabKey]?.options)}>\n <TabsList aria-label=\"Main\" className={nativeTabsStyles.navigationMenuRoot}>\n {items}\n </TabsList>\n {children}\n </Tabs>\n );\n}\n\ninterface TabItemProps {\n title: string;\n badgeValue?: string;\n route: { name: string };\n}\n\nfunction TabItem(props: TabItemProps) {\n const { title, badgeValue, route } = props;\n const isBadgeEmpty = badgeValue === ' ';\n\n return (\n <TabsTrigger value={route.name} className={nativeTabsStyles.navigationMenuTrigger}>\n <span className={nativeTabsStyles.tabText}>{title}</span>\n {badgeValue && (\n <div\n className={`${nativeTabsStyles.tabBadge} ${isBadgeEmpty ? nativeTabsStyles.emptyTabBadge : ''}`}>\n {badgeValue}\n </div>\n )}\n </TabsTrigger>\n );\n}\n\nfunction convertNativeTabsPropsToStyleVars(\n props: NativeTabsViewProps | undefined,\n currentTabOptions: NativeTabOptions | undefined\n): Record<string, string | undefined> {\n const vars: Record<`--expo-router-tabs-${string}`, string | undefined> = {};\n if (!props) {\n return vars;\n }\n const { labelStyle } = props;\n const optionsLabelStyle = currentTabOptions?.labelStyle;\n if (optionsLabelStyle?.fontFamily) {\n vars['--expo-router-tabs-font-family'] = String(optionsLabelStyle.fontFamily);\n } else if (labelStyle?.fontFamily) {\n vars['--expo-router-tabs-font-family'] = String(labelStyle.fontFamily);\n }\n if (optionsLabelStyle?.fontSize) {\n vars['--expo-router-tabs-font-size'] = String(optionsLabelStyle.fontSize);\n } else if (labelStyle?.fontSize) {\n vars['--expo-router-tabs-font-size'] = String(labelStyle.fontSize);\n }\n if (optionsLabelStyle?.fontWeight) {\n vars['--expo-router-tabs-font-weight'] = String(optionsLabelStyle.fontWeight);\n } else if (labelStyle?.fontWeight) {\n vars['--expo-router-tabs-font-weight'] = String(labelStyle.fontWeight);\n }\n if (optionsLabelStyle?.fontStyle) {\n vars['--expo-router-tabs-font-style'] = String(optionsLabelStyle.fontStyle);\n } else if (labelStyle?.fontStyle) {\n vars['--expo-router-tabs-font-style'] = String(labelStyle.fontStyle);\n }\n if (optionsLabelStyle?.color) {\n vars['--expo-router-tabs-text-color'] = String(optionsLabelStyle.color);\n } else if (labelStyle?.color) {\n vars['--expo-router-tabs-text-color'] = String(labelStyle.color);\n }\n if (currentTabOptions?.selectedLabelStyle?.color) {\n vars['--expo-router-tabs-active-text-color'] = String(\n currentTabOptions.selectedLabelStyle.color\n );\n } else if (props.tintColor) {\n vars['--expo-router-tabs-active-text-color'] = String(props.tintColor);\n }\n if (currentTabOptions?.selectedLabelStyle?.fontSize) {\n vars['--expo-router-tabs-active-font-size'] = String(\n currentTabOptions.selectedLabelStyle.fontSize\n );\n }\n if (currentTabOptions?.indicatorColor) {\n vars['--expo-router-tabs-active-background-color'] = String(currentTabOptions.indicatorColor);\n } else if (props.indicatorColor) {\n vars['--expo-router-tabs-active-background-color'] = String(props.indicatorColor);\n }\n if (currentTabOptions?.backgroundColor) {\n vars['--expo-router-tabs-background-color'] = String(currentTabOptions.backgroundColor);\n } else if (props.backgroundColor) {\n vars['--expo-router-tabs-background-color'] = String(props.backgroundColor);\n }\n if (currentTabOptions?.badgeBackgroundColor) {\n vars['--expo-router-tabs-badge-background-color'] = String(\n currentTabOptions.badgeBackgroundColor\n );\n } else if (props.badgeBackgroundColor) {\n vars['--expo-router-tabs-badge-background-color'] = String(props.badgeBackgroundColor);\n }\n if (currentTabOptions?.badgeTextColor) {\n vars['--expo-router-tabs-badge-text-color'] = String(currentTabOptions.badgeTextColor);\n } else if (props.badgeTextColor) {\n vars['--expo-router-tabs-badge-text-color'] = String(props.badgeTextColor);\n }\n return vars;\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ColorValue } from 'react-native';
|
|
2
|
+
import type { BottomTabsScreenAppearance, BottomTabsScreenItemStateAppearance } from 'react-native-screens';
|
|
3
|
+
import { type NativeTabOptions, type NativeTabsBlurEffect, type NativeTabsLabelStyle } from './types';
|
|
4
|
+
export declare function createStandardAppearanceFromOptions(options: NativeTabOptions, baseStandardAppearance: BottomTabsScreenAppearance): BottomTabsScreenAppearance;
|
|
5
|
+
export declare function createScrollEdgeAppearanceFromOptions(options: NativeTabOptions, baseScrollEdgeAppearance: BottomTabsScreenAppearance): BottomTabsScreenAppearance;
|
|
6
|
+
export interface AppearanceStyle extends NativeTabsLabelStyle {
|
|
7
|
+
iconColor?: ColorValue;
|
|
8
|
+
backgroundColor?: ColorValue | null;
|
|
9
|
+
blurEffect?: NativeTabsBlurEffect;
|
|
10
|
+
badgeBackgroundColor?: ColorValue;
|
|
11
|
+
titlePositionAdjustment?: {
|
|
12
|
+
horizontal?: number;
|
|
13
|
+
vertical?: number;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare function appendSelectedStyleToAppearance(selectedStyle: AppearanceStyle, appearance: BottomTabsScreenAppearance): BottomTabsScreenAppearance;
|
|
17
|
+
export declare function appendStyleToAppearance(style: AppearanceStyle, appearance: BottomTabsScreenAppearance, states: ('selected' | 'focused' | 'disabled' | 'normal')[]): BottomTabsScreenAppearance;
|
|
18
|
+
export declare function convertStyleToAppearance(style: AppearanceStyle | undefined): BottomTabsScreenAppearance;
|
|
19
|
+
export declare function convertStyleToItemStateAppearance(style: AppearanceStyle | undefined): BottomTabsScreenItemStateAppearance;
|
|
20
|
+
//# sourceMappingURL=appearance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appearance.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/appearance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EACV,0BAA0B,EAE1B,mCAAmC,EACpC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,SAAS,CAAC;AAEjB,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,gBAAgB,EACzB,sBAAsB,EAAE,0BAA0B,GACjD,0BAA0B,CAsB5B;AAED,wBAAgB,qCAAqC,CACnD,OAAO,EAAE,gBAAgB,EACzB,wBAAwB,EAAE,0BAA0B,GACnD,0BAA0B,CAsB5B;AAED,MAAM,WAAW,eAAgB,SAAQ,oBAAoB;IAC3D,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,eAAe,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IACpC,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC,uBAAuB,CAAC,EAAE;QACxB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,wBAAgB,+BAA+B,CAC7C,aAAa,EAAE,e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