@react-navigation/bottom-tabs 6.4.1 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.tsx"],"sourcesContent":["import type { HeaderOptions } from '@react-navigation/elements';\nimport type {\n Descriptor,\n NavigationHelpers,\n NavigationProp,\n ParamListBase,\n RouteProp,\n TabActionHelpers,\n TabNavigationState,\n} from '@react-navigation/native';\nimport type * as React from 'react';\nimport type {\n Animated,\n GestureResponderEvent,\n StyleProp,\n TextStyle,\n TouchableWithoutFeedbackProps,\n ViewStyle,\n} from 'react-native';\nimport type { EdgeInsets } from 'react-native-safe-area-context';\n\nexport type Layout = { width: number; height: number };\n\nexport type BottomTabNavigationEventMap = {\n /**\n * Event which fires on tapping on the tab in the tab bar.\n */\n tabPress: { data: undefined; canPreventDefault: true };\n /**\n * Event which fires on long press on the tab in the tab bar.\n */\n tabLongPress: { data: undefined };\n};\n\nexport type LabelPosition = 'beside-icon' | 'below-icon';\n\nexport type BottomTabNavigationHelpers = NavigationHelpers<\n ParamListBase,\n BottomTabNavigationEventMap\n> &\n TabActionHelpers<ParamListBase>;\n\nexport type BottomTabNavigationProp<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n NavigatorID extends string | undefined = undefined\n> = NavigationProp<\n ParamList,\n RouteName,\n NavigatorID,\n TabNavigationState<ParamList>,\n BottomTabNavigationOptions,\n BottomTabNavigationEventMap\n> &\n TabActionHelpers<ParamList>;\n\nexport type BottomTabScreenProps<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n NavigatorID extends string | undefined = undefined\n> = {\n navigation: BottomTabNavigationProp<ParamList, RouteName, NavigatorID>;\n route: RouteProp<ParamList, RouteName>;\n};\n\nexport type TimingKeyboardAnimationConfig = {\n animation: 'timing';\n config?: Omit<\n Partial<Animated.TimingAnimationConfig>,\n 'toValue' | 'useNativeDriver'\n >;\n};\n\nexport type SpringKeyboardAnimationConfig = {\n animation: 'spring';\n config?: Omit<\n Partial<Animated.SpringAnimationConfig>,\n 'toValue' | 'useNativeDriver'\n >;\n};\n\nexport type TabBarVisibilityAnimationConfig =\n | TimingKeyboardAnimationConfig\n | SpringKeyboardAnimationConfig;\n\nexport type BottomTabNavigationOptions = HeaderOptions & {\n /**\n * Title text for the screen.\n */\n title?: string;\n\n /**\n * Title string of a tab displayed in the tab bar\n * or a function that given { focused: boolean, color: string, position: 'below-icon' | 'beside-icon' } returns a React.Node to display in tab bar.\n *\n * When undefined, scene title is used. Use `tabBarShowLabel` to hide the label.\n */\n tabBarLabel?:\n | string\n | ((props: {\n focused: boolean;\n color: string;\n position: LabelPosition;\n }) => React.ReactNode);\n\n /**\n * Whether the tab label should be visible. Defaults to `true`.\n */\n tabBarShowLabel?: boolean;\n\n /**\n * Whether the label is shown below the icon or beside the icon.\n *\n * - `below-icon`: the label is shown below the icon (typical for iPhones)\n * - `beside-icon` the label is shown next to the icon (typical for iPad)\n *\n * By default, the position is chosen automatically based on device width.\n */\n tabBarLabelPosition?: LabelPosition;\n\n /**\n * Style object for the tab label.\n */\n tabBarLabelStyle?: StyleProp<TextStyle>;\n\n /**\n * Whether label font should scale to respect Text Size accessibility settings.\n */\n tabBarAllowFontScaling?: boolean;\n\n /**\n * A function that given { focused: boolean, color: string } returns a React.Node to display in the tab bar.\n */\n tabBarIcon?: (props: {\n focused: boolean;\n color: string;\n size: number;\n }) => React.ReactNode;\n\n /**\n * Style object for the tab icon.\n */\n tabBarIconStyle?: StyleProp<TextStyle>;\n\n /**\n * Text to show in a badge on the tab icon.\n */\n tabBarBadge?: number | string;\n\n /**\n * Custom style for the tab bar badge.\n * You can specify a background color or text color here.\n */\n tabBarBadgeStyle?: StyleProp<TextStyle>;\n\n /**\n * Accessibility label for the tab button. This is read by the screen reader when the user taps the tab.\n * It's recommended to set this if you don't have a label for the tab.\n */\n tabBarAccessibilityLabel?: string;\n\n /**\n * ID to locate this tab button in tests.\n */\n tabBarTestID?: string;\n\n /**\n * Function which returns a React element to render as the tab bar button.\n * Renders `Pressable` by default.\n */\n tabBarButton?: (props: BottomTabBarButtonProps) => React.ReactNode;\n\n /**\n * Color for the icon and label in the active tab.\n */\n tabBarActiveTintColor?: string;\n\n /**\n * Color for the icon and label in the inactive tabs.\n */\n tabBarInactiveTintColor?: string;\n\n /**\n * Background color for the active tab.\n */\n tabBarActiveBackgroundColor?: string;\n\n /**\n * Background color for the inactive tabs.\n */\n tabBarInactiveBackgroundColor?: string;\n\n /**\n * Style object for the tab item container.\n */\n tabBarItemStyle?: StyleProp<ViewStyle>;\n\n /**\n * Whether the tab bar gets hidden when the keyboard is shown. Defaults to `false`.\n */\n tabBarHideOnKeyboard?: boolean;\n\n /**\n * Animation config for showing and hiding the tab bar when the keyboard is shown/hidden.\n */\n tabBarVisibilityAnimationConfig?: {\n show?: TabBarVisibilityAnimationConfig;\n hide?: TabBarVisibilityAnimationConfig;\n };\n\n /**\n * Style object for the tab bar container.\n */\n tabBarStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;\n\n /**\n * Function which returns a React Element to use as background for the tab bar.\n * You could render an image, a gradient, blur view etc.\n *\n * When using `BlurView`, make sure to set `position: 'absolute'` in `tabBarStyle` as well.\n * You'd also need to use `useBottomTabBarHeight()` to add a bottom padding to your content.\n */\n tabBarBackground?: () => React.ReactNode;\n\n /**\n * Whether this screens should render the first time it's accessed. Defaults to `true`.\n * Set it to `false` if you want to render the screen on initial render.\n */\n lazy?: boolean;\n\n /**\n * Function that given returns a React Element to display as a header.\n */\n header?: (props: BottomTabHeaderProps) => React.ReactNode;\n\n /**\n * Whether to show the header. Setting this to `false` hides the header.\n * Defaults to `true`.\n */\n headerShown?: boolean;\n\n /**\n * Whether this screen should be unmounted when navigating away from it.\n * Defaults to `false`.\n */\n unmountOnBlur?: boolean;\n\n /**\n * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.\n * Defaults to `true` when `enableFreeze()` is run at the top of the application.\n * Requires `react-native-screens` version >=3.16.0.\n *\n * Only supported on iOS and Android.\n */\n freezeOnBlur?: boolean;\n};\n\nexport type BottomTabDescriptor = Descriptor<\n BottomTabNavigationOptions,\n BottomTabNavigationProp<ParamListBase>,\n RouteProp<ParamListBase>\n>;\n\nexport type BottomTabDescriptorMap = Record<string, BottomTabDescriptor>;\n\nexport type BottomTabNavigationConfig = {\n /**\n * Function that returns a React element to display as the tab bar.\n */\n tabBar?: (props: BottomTabBarProps) => React.ReactNode;\n /**\n * Safe area insets for the tab bar. This is used to avoid elements like the navigation bar on Android and bottom safe area on iOS.\n * By default, the device's safe area insets are automatically detected. You can override the behavior with this option.\n */\n safeAreaInsets?: {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n };\n /**\n * Whether inactive screens should be detached from the view hierarchy to save memory.\n * Make sure to call `enableScreens` from `react-native-screens` to make it work.\n * Defaults to `true` on Android.\n */\n detachInactiveScreens?: boolean;\n /**\n * Style object for the component wrapping the screen content.\n */\n sceneContainerStyle?: StyleProp<ViewStyle>;\n};\n\nexport type BottomTabHeaderProps = {\n /**\n * Layout of the screen.\n */\n layout: Layout;\n /**\n * Options for the current screen.\n */\n options: BottomTabNavigationOptions;\n /**\n * Route object for the current screen.\n */\n route: RouteProp<ParamListBase>;\n /**\n * Navigation prop for the header.\n */\n navigation: BottomTabNavigationProp<ParamListBase>;\n};\n\nexport type BottomTabBarProps = {\n state: TabNavigationState<ParamListBase>;\n descriptors: BottomTabDescriptorMap;\n navigation: NavigationHelpers<ParamListBase, BottomTabNavigationEventMap>;\n insets: EdgeInsets;\n};\n\nexport type BottomTabBarButtonProps = Omit<\n TouchableWithoutFeedbackProps,\n 'onPress'\n> & {\n to?: string;\n children: React.ReactNode;\n onPress?: (\n e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent\n ) => void;\n};\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["types.tsx"],"sourcesContent":["import type { HeaderOptions } from '@react-navigation/elements';\nimport type {\n Descriptor,\n NavigationHelpers,\n NavigationProp,\n ParamListBase,\n RouteProp,\n TabActionHelpers,\n TabNavigationState,\n} from '@react-navigation/native';\nimport type * as React from 'react';\nimport type {\n Animated,\n GestureResponderEvent,\n StyleProp,\n TextStyle,\n TouchableWithoutFeedbackProps,\n ViewStyle,\n} from 'react-native';\nimport type { EdgeInsets } from 'react-native-safe-area-context';\n\nexport type Layout = { width: number; height: number };\n\nexport type BottomTabNavigationEventMap = {\n /**\n * Event which fires on tapping on the tab in the tab bar.\n */\n tabPress: { data: undefined; canPreventDefault: true };\n /**\n * Event which fires on long press on the tab in the tab bar.\n */\n tabLongPress: { data: undefined };\n};\n\nexport type LabelPosition = 'beside-icon' | 'below-icon';\n\nexport type BottomTabNavigationHelpers = NavigationHelpers<\n ParamListBase,\n BottomTabNavigationEventMap\n> &\n TabActionHelpers<ParamListBase>;\n\nexport type BottomTabNavigationProp<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n NavigatorID extends string | undefined = undefined\n> = NavigationProp<\n ParamList,\n RouteName,\n NavigatorID,\n TabNavigationState<ParamList>,\n BottomTabNavigationOptions,\n BottomTabNavigationEventMap\n> &\n TabActionHelpers<ParamList>;\n\nexport type BottomTabScreenProps<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n NavigatorID extends string | undefined = undefined\n> = {\n navigation: BottomTabNavigationProp<ParamList, RouteName, NavigatorID>;\n route: RouteProp<ParamList, RouteName>;\n};\n\nexport type TimingKeyboardAnimationConfig = {\n animation: 'timing';\n config?: Omit<\n Partial<Animated.TimingAnimationConfig>,\n 'toValue' | 'useNativeDriver'\n >;\n};\n\nexport type SpringKeyboardAnimationConfig = {\n animation: 'spring';\n config?: Omit<\n Partial<Animated.SpringAnimationConfig>,\n 'toValue' | 'useNativeDriver'\n >;\n};\n\nexport type TabBarVisibilityAnimationConfig =\n | TimingKeyboardAnimationConfig\n | SpringKeyboardAnimationConfig;\n\nexport type BottomTabNavigationOptions = HeaderOptions & {\n /**\n * Title text for the screen.\n */\n title?: string;\n\n /**\n * Title string of a tab displayed in the tab bar\n * or a function that given { focused: boolean, color: string, position: 'below-icon' | 'beside-icon', children: string } returns a React.Node to display in tab bar.\n *\n * When undefined, scene title is used. Use `tabBarShowLabel` to hide the label.\n */\n tabBarLabel?:\n | string\n | ((props: {\n focused: boolean;\n color: string;\n position: LabelPosition;\n children: string;\n }) => React.ReactNode);\n\n /**\n * Whether the tab label should be visible. Defaults to `true`.\n */\n tabBarShowLabel?: boolean;\n\n /**\n * Whether the label is shown below the icon or beside the icon.\n *\n * - `below-icon`: the label is shown below the icon (typical for iPhones)\n * - `beside-icon` the label is shown next to the icon (typical for iPad)\n *\n * By default, the position is chosen automatically based on device width.\n */\n tabBarLabelPosition?: LabelPosition;\n\n /**\n * Style object for the tab label.\n */\n tabBarLabelStyle?: StyleProp<TextStyle>;\n\n /**\n * Whether label font should scale to respect Text Size accessibility settings.\n */\n tabBarAllowFontScaling?: boolean;\n\n /**\n * A function that given { focused: boolean, color: string } returns a React.Node to display in the tab bar.\n */\n tabBarIcon?: (props: {\n focused: boolean;\n color: string;\n size: number;\n }) => React.ReactNode;\n\n /**\n * Style object for the tab icon.\n */\n tabBarIconStyle?: StyleProp<TextStyle>;\n\n /**\n * Text to show in a badge on the tab icon.\n */\n tabBarBadge?: number | string;\n\n /**\n * Custom style for the tab bar badge.\n * You can specify a background color or text color here.\n */\n tabBarBadgeStyle?: StyleProp<TextStyle>;\n\n /**\n * Accessibility label for the tab button. This is read by the screen reader when the user taps the tab.\n * It's recommended to set this if you don't have a label for the tab.\n */\n tabBarAccessibilityLabel?: string;\n\n /**\n * ID to locate this tab button in tests.\n */\n tabBarTestID?: string;\n\n /**\n * Function which returns a React element to render as the tab bar button.\n * Renders `Pressable` by default.\n */\n tabBarButton?: (props: BottomTabBarButtonProps) => React.ReactNode;\n\n /**\n * Color for the icon and label in the active tab.\n */\n tabBarActiveTintColor?: string;\n\n /**\n * Color for the icon and label in the inactive tabs.\n */\n tabBarInactiveTintColor?: string;\n\n /**\n * Background color for the active tab.\n */\n tabBarActiveBackgroundColor?: string;\n\n /**\n * Background color for the inactive tabs.\n */\n tabBarInactiveBackgroundColor?: string;\n\n /**\n * Style object for the tab item container.\n */\n tabBarItemStyle?: StyleProp<ViewStyle>;\n\n /**\n * Whether the tab bar gets hidden when the keyboard is shown. Defaults to `false`.\n */\n tabBarHideOnKeyboard?: boolean;\n\n /**\n * Animation config for showing and hiding the tab bar when the keyboard is shown/hidden.\n */\n tabBarVisibilityAnimationConfig?: {\n show?: TabBarVisibilityAnimationConfig;\n hide?: TabBarVisibilityAnimationConfig;\n };\n\n /**\n * Style object for the tab bar container.\n */\n tabBarStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;\n\n /**\n * Function which returns a React Element to use as background for the tab bar.\n * You could render an image, a gradient, blur view etc.\n *\n * When using `BlurView`, make sure to set `position: 'absolute'` in `tabBarStyle` as well.\n * You'd also need to use `useBottomTabBarHeight()` to add a bottom padding to your content.\n */\n tabBarBackground?: () => React.ReactNode;\n\n /**\n * Whether this screens should render the first time it's accessed. Defaults to `true`.\n * Set it to `false` if you want to render the screen on initial render.\n */\n lazy?: boolean;\n\n /**\n * Function that given returns a React Element to display as a header.\n */\n header?: (props: BottomTabHeaderProps) => React.ReactNode;\n\n /**\n * Whether to show the header. Setting this to `false` hides the header.\n * Defaults to `true`.\n */\n headerShown?: boolean;\n\n /**\n * Whether this screen should be unmounted when navigating away from it.\n * Defaults to `false`.\n */\n unmountOnBlur?: boolean;\n\n /**\n * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.\n * Defaults to `true` when `enableFreeze()` is run at the top of the application.\n * Requires `react-native-screens` version >=3.16.0.\n *\n * Only supported on iOS and Android.\n */\n freezeOnBlur?: boolean;\n};\n\nexport type BottomTabDescriptor = Descriptor<\n BottomTabNavigationOptions,\n BottomTabNavigationProp<ParamListBase>,\n RouteProp<ParamListBase>\n>;\n\nexport type BottomTabDescriptorMap = Record<string, BottomTabDescriptor>;\n\nexport type BottomTabNavigationConfig = {\n /**\n * Function that returns a React element to display as the tab bar.\n */\n tabBar?: (props: BottomTabBarProps) => React.ReactNode;\n /**\n * Safe area insets for the tab bar. This is used to avoid elements like the navigation bar on Android and bottom safe area on iOS.\n * By default, the device's safe area insets are automatically detected. You can override the behavior with this option.\n */\n safeAreaInsets?: {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n };\n /**\n * Whether inactive screens should be detached from the view hierarchy to save memory.\n * Make sure to call `enableScreens` from `react-native-screens` to make it work.\n * Defaults to `true` on Android.\n */\n detachInactiveScreens?: boolean;\n /**\n * Style object for the component wrapping the screen content.\n */\n sceneContainerStyle?: StyleProp<ViewStyle>;\n};\n\nexport type BottomTabHeaderProps = {\n /**\n * Layout of the screen.\n */\n layout: Layout;\n /**\n * Options for the current screen.\n */\n options: BottomTabNavigationOptions;\n /**\n * Route object for the current screen.\n */\n route: RouteProp<ParamListBase>;\n /**\n * Navigation prop for the header.\n */\n navigation: BottomTabNavigationProp<ParamListBase>;\n};\n\nexport type BottomTabBarProps = {\n state: TabNavigationState<ParamListBase>;\n descriptors: BottomTabDescriptorMap;\n navigation: NavigationHelpers<ParamListBase, BottomTabNavigationEventMap>;\n insets: EdgeInsets;\n};\n\nexport type BottomTabBarButtonProps = Omit<\n TouchableWithoutFeedbackProps,\n 'onPress'\n> & {\n to?: string;\n children: React.ReactNode;\n onPress?: (\n e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent\n ) => void;\n};\n"],"mappings":""}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = useFloatingBottomTabBarHeight;
6
+ exports.default = useBottomTabBarHeight;
7
7
 
8
8
  var React = _interopRequireWildcard(require("react"));
9
9
 
@@ -15,7 +15,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
15
15
 
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
 
18
- function useFloatingBottomTabBarHeight() {
18
+ function useBottomTabBarHeight() {
19
19
  const height = React.useContext(_BottomTabBarHeightContext.default);
20
20
 
21
21
  if (height === undefined) {
@@ -1 +1 @@
1
- {"version":3,"names":["useFloatingBottomTabBarHeight","height","React","useContext","BottomTabBarHeightContext","undefined","Error"],"sources":["useBottomTabBarHeight.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport BottomTabBarHeightContext from './BottomTabBarHeightContext';\n\nexport default function useFloatingBottomTabBarHeight() {\n const height = React.useContext(BottomTabBarHeightContext);\n\n if (height === undefined) {\n throw new Error(\n \"Couldn't find the bottom tab bar height. Are you inside a screen in Bottom Tab Navigator?\"\n );\n }\n\n return height;\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;AAEe,SAASA,6BAAT,GAAyC;EACtD,MAAMC,MAAM,GAAGC,KAAK,CAACC,UAAN,CAAiBC,kCAAjB,CAAf;;EAEA,IAAIH,MAAM,KAAKI,SAAf,EAA0B;IACxB,MAAM,IAAIC,KAAJ,CACJ,2FADI,CAAN;EAGD;;EAED,OAAOL,MAAP;AACD"}
1
+ {"version":3,"names":["useBottomTabBarHeight","height","React","useContext","BottomTabBarHeightContext","undefined","Error"],"sources":["useBottomTabBarHeight.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport BottomTabBarHeightContext from './BottomTabBarHeightContext';\n\nexport default function useBottomTabBarHeight() {\n const height = React.useContext(BottomTabBarHeightContext);\n\n if (height === undefined) {\n throw new Error(\n \"Couldn't find the bottom tab bar height. Are you inside a screen in Bottom Tab Navigator?\"\n );\n }\n\n return height;\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;AAEe,SAASA,qBAAT,GAAiC;EAC9C,MAAMC,MAAM,GAAGC,KAAK,CAACC,UAAN,CAAiBC,kCAAjB,CAAf;;EAEA,IAAIH,MAAM,KAAKI,SAAf,EAA0B;IACxB,MAAM,IAAIC,KAAJ,CACJ,2FADI,CAAN;EAGD;;EAED,OAAOL,MAAP;AACD"}
@@ -306,6 +306,7 @@ function BottomTabBar(_ref3) {
306
306
  value: route
307
307
  }, /*#__PURE__*/_react.default.createElement(_BottomTabItem.default, {
308
308
  route: route,
309
+ descriptor: descriptors[route.key],
309
310
  focused: focused,
310
311
  horizontal: hasHorizontalLabels,
311
312
  onPress: onPress,
@@ -1 +1 @@
1
- {"version":3,"names":["DEFAULT_TABBAR_HEIGHT","COMPACT_TABBAR_HEIGHT","DEFAULT_MAX_TAB_ITEM_WIDTH","useNativeDriver","Platform","OS","shouldUseHorizontalLabels","state","descriptors","layout","dimensions","tabBarLabelPosition","routes","index","key","options","width","maxTabWidth","reduce","acc","route","tabBarItemStyle","flattenedStyle","StyleSheet","flatten","maxWidth","height","getPaddingBottom","insets","Math","max","bottom","select","ios","default","getTabBarHeight","style","rest","customHeight","isLandscape","horizontalLabels","paddingBottom","isPad","BottomTabBar","navigation","colors","useTheme","buildLink","useLinkBuilder","focusedRoute","focusedDescriptor","focusedOptions","tabBarShowLabel","tabBarHideOnKeyboard","tabBarVisibilityAnimationConfig","tabBarStyle","tabBarBackground","tabBarActiveTintColor","tabBarInactiveTintColor","tabBarActiveBackgroundColor","tabBarInactiveBackgroundColor","useSafeAreaFrame","isKeyboardShown","useIsKeyboardShown","onHeightChange","React","useContext","BottomTabBarHeightCallbackContext","shouldShowTabBar","visibilityAnimationConfigRef","useRef","useEffect","current","isTabBarHidden","setIsTabBarHidden","useState","visible","Animated","Value","visibilityAnimationConfig","animation","show","spring","timing","toValue","duration","config","start","finished","hide","stopAnimation","setLayout","handleLayout","e","nativeEvent","tabBarHeight","hasHorizontalLabels","tabBarBackgroundElement","styles","tabBar","backgroundColor","card","borderTopColor","border","transform","translateY","interpolate","inputRange","outputRange","hairlineWidth","position","paddingHorizontal","left","right","absoluteFill","content","map","focused","onPress","event","emit","type","target","canPreventDefault","defaultPrevented","dispatch","CommonActions","navigate","name","merge","onLongPress","label","tabBarLabel","undefined","title","accessibilityLabel","tabBarAccessibilityLabel","length","params","tabBarTestID","tabBarAllowFontScaling","tabBarButton","tabBarIcon","color","size","tabBarBadge","tabBarBadgeStyle","tabBarLabelStyle","tabBarIconStyle","create","borderTopWidth","elevation","flex","flexDirection"],"sources":["BottomTabBar.tsx"],"sourcesContent":["import { MissingIcon } from '@react-navigation/elements';\nimport {\n CommonActions,\n NavigationContext,\n NavigationRouteContext,\n ParamListBase,\n TabNavigationState,\n useLinkBuilder,\n useTheme,\n} from '@react-navigation/native';\nimport React from 'react';\nimport {\n Animated,\n LayoutChangeEvent,\n Platform,\n StyleProp,\n StyleSheet,\n View,\n ViewStyle,\n} from 'react-native';\nimport { EdgeInsets, useSafeAreaFrame } from 'react-native-safe-area-context';\n\nimport type { BottomTabBarProps, BottomTabDescriptorMap } from '../types';\nimport BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';\nimport useIsKeyboardShown from '../utils/useIsKeyboardShown';\nimport BottomTabItem from './BottomTabItem';\n\ntype Props = BottomTabBarProps & {\n style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;\n};\n\nconst DEFAULT_TABBAR_HEIGHT = 49;\nconst COMPACT_TABBAR_HEIGHT = 32;\nconst DEFAULT_MAX_TAB_ITEM_WIDTH = 125;\n\nconst useNativeDriver = Platform.OS !== 'web';\n\ntype Options = {\n state: TabNavigationState<ParamListBase>;\n descriptors: BottomTabDescriptorMap;\n layout: { height: number; width: number };\n dimensions: { height: number; width: number };\n};\n\nconst shouldUseHorizontalLabels = ({\n state,\n descriptors,\n layout,\n dimensions,\n}: Options) => {\n const { tabBarLabelPosition } =\n descriptors[state.routes[state.index].key].options;\n\n if (tabBarLabelPosition) {\n switch (tabBarLabelPosition) {\n case 'beside-icon':\n return true;\n case 'below-icon':\n return false;\n }\n }\n\n if (layout.width >= 768) {\n // Screen size matches a tablet\n const maxTabWidth = state.routes.reduce((acc, route) => {\n const { tabBarItemStyle } = descriptors[route.key].options;\n const flattenedStyle = StyleSheet.flatten(tabBarItemStyle);\n\n if (flattenedStyle) {\n if (typeof flattenedStyle.width === 'number') {\n return acc + flattenedStyle.width;\n } else if (typeof flattenedStyle.maxWidth === 'number') {\n return acc + flattenedStyle.maxWidth;\n }\n }\n\n return acc + DEFAULT_MAX_TAB_ITEM_WIDTH;\n }, 0);\n\n return maxTabWidth <= layout.width;\n } else {\n return dimensions.width > dimensions.height;\n }\n};\n\nconst getPaddingBottom = (insets: EdgeInsets) =>\n Math.max(insets.bottom - Platform.select({ ios: 4, default: 0 }), 0);\n\nexport const getTabBarHeight = ({\n state,\n descriptors,\n dimensions,\n insets,\n style,\n ...rest\n}: Options & {\n insets: EdgeInsets;\n style: Animated.WithAnimatedValue<StyleProp<ViewStyle>> | undefined;\n}) => {\n // @ts-ignore\n const customHeight = StyleSheet.flatten(style)?.height;\n\n if (typeof customHeight === 'number') {\n return customHeight;\n }\n\n const isLandscape = dimensions.width > dimensions.height;\n const horizontalLabels = shouldUseHorizontalLabels({\n state,\n descriptors,\n dimensions,\n ...rest,\n });\n const paddingBottom = getPaddingBottom(insets);\n\n if (\n Platform.OS === 'ios' &&\n !Platform.isPad &&\n isLandscape &&\n horizontalLabels\n ) {\n return COMPACT_TABBAR_HEIGHT + paddingBottom;\n }\n\n return DEFAULT_TABBAR_HEIGHT + paddingBottom;\n};\n\nexport default function BottomTabBar({\n state,\n navigation,\n descriptors,\n insets,\n style,\n}: Props) {\n const { colors } = useTheme();\n const buildLink = useLinkBuilder();\n\n const focusedRoute = state.routes[state.index];\n const focusedDescriptor = descriptors[focusedRoute.key];\n const focusedOptions = focusedDescriptor.options;\n\n const {\n tabBarShowLabel,\n tabBarHideOnKeyboard = false,\n tabBarVisibilityAnimationConfig,\n tabBarStyle,\n tabBarBackground,\n tabBarActiveTintColor,\n tabBarInactiveTintColor,\n tabBarActiveBackgroundColor,\n tabBarInactiveBackgroundColor,\n } = focusedOptions;\n\n const dimensions = useSafeAreaFrame();\n const isKeyboardShown = useIsKeyboardShown();\n\n const onHeightChange = React.useContext(BottomTabBarHeightCallbackContext);\n\n const shouldShowTabBar = !(tabBarHideOnKeyboard && isKeyboardShown);\n\n const visibilityAnimationConfigRef = React.useRef(\n tabBarVisibilityAnimationConfig\n );\n\n React.useEffect(() => {\n visibilityAnimationConfigRef.current = tabBarVisibilityAnimationConfig;\n });\n\n const [isTabBarHidden, setIsTabBarHidden] = React.useState(!shouldShowTabBar);\n\n const [visible] = React.useState(\n () => new Animated.Value(shouldShowTabBar ? 1 : 0)\n );\n\n React.useEffect(() => {\n const visibilityAnimationConfig = visibilityAnimationConfigRef.current;\n\n if (shouldShowTabBar) {\n const animation =\n visibilityAnimationConfig?.show?.animation === 'spring'\n ? Animated.spring\n : Animated.timing;\n\n animation(visible, {\n toValue: 1,\n useNativeDriver,\n duration: 250,\n ...visibilityAnimationConfig?.show?.config,\n }).start(({ finished }) => {\n if (finished) {\n setIsTabBarHidden(false);\n }\n });\n } else {\n setIsTabBarHidden(true);\n\n const animation =\n visibilityAnimationConfig?.hide?.animation === 'spring'\n ? Animated.spring\n : Animated.timing;\n\n animation(visible, {\n toValue: 0,\n useNativeDriver,\n duration: 200,\n ...visibilityAnimationConfig?.hide?.config,\n }).start();\n }\n\n return () => visible.stopAnimation();\n }, [visible, shouldShowTabBar]);\n\n const [layout, setLayout] = React.useState({\n height: 0,\n width: dimensions.width,\n });\n\n const handleLayout = (e: LayoutChangeEvent) => {\n const { height, width } = e.nativeEvent.layout;\n\n onHeightChange?.(height);\n\n setLayout((layout) => {\n if (height === layout.height && width === layout.width) {\n return layout;\n } else {\n return {\n height,\n width,\n };\n }\n });\n };\n\n const { routes } = state;\n\n const paddingBottom = getPaddingBottom(insets);\n const tabBarHeight = getTabBarHeight({\n state,\n descriptors,\n insets,\n dimensions,\n layout,\n style: [tabBarStyle, style],\n });\n\n const hasHorizontalLabels = shouldUseHorizontalLabels({\n state,\n descriptors,\n dimensions,\n layout,\n });\n\n const tabBarBackgroundElement = tabBarBackground?.();\n\n return (\n <Animated.View\n style={[\n styles.tabBar,\n {\n backgroundColor:\n tabBarBackgroundElement != null ? 'transparent' : colors.card,\n borderTopColor: colors.border,\n },\n {\n transform: [\n {\n translateY: visible.interpolate({\n inputRange: [0, 1],\n outputRange: [\n layout.height + paddingBottom + StyleSheet.hairlineWidth,\n 0,\n ],\n }),\n },\n ],\n // Absolutely position the tab bar so that the content is below it\n // This is needed to avoid gap at bottom when the tab bar is hidden\n position: isTabBarHidden ? 'absolute' : (null as any),\n },\n {\n height: tabBarHeight,\n paddingBottom,\n paddingHorizontal: Math.max(insets.left, insets.right),\n },\n tabBarStyle,\n ]}\n pointerEvents={isTabBarHidden ? 'none' : 'auto'}\n onLayout={handleLayout}\n >\n <View pointerEvents=\"none\" style={StyleSheet.absoluteFill}>\n {tabBarBackgroundElement}\n </View>\n <View accessibilityRole=\"tablist\" style={styles.content}>\n {routes.map((route, index) => {\n const focused = index === state.index;\n const { options } = descriptors[route.key];\n\n const onPress = () => {\n const event = navigation.emit({\n type: 'tabPress',\n target: route.key,\n canPreventDefault: true,\n });\n\n if (!focused && !event.defaultPrevented) {\n navigation.dispatch({\n ...CommonActions.navigate({ name: route.name, merge: true }),\n target: state.key,\n });\n }\n };\n\n const onLongPress = () => {\n navigation.emit({\n type: 'tabLongPress',\n target: route.key,\n });\n };\n\n const label =\n options.tabBarLabel !== undefined\n ? options.tabBarLabel\n : options.title !== undefined\n ? options.title\n : route.name;\n\n const accessibilityLabel =\n options.tabBarAccessibilityLabel !== undefined\n ? options.tabBarAccessibilityLabel\n : typeof label === 'string' && Platform.OS === 'ios'\n ? `${label}, tab, ${index + 1} of ${routes.length}`\n : undefined;\n\n return (\n <NavigationContext.Provider\n key={route.key}\n value={descriptors[route.key].navigation}\n >\n <NavigationRouteContext.Provider value={route}>\n <BottomTabItem\n route={route}\n focused={focused}\n horizontal={hasHorizontalLabels}\n onPress={onPress}\n onLongPress={onLongPress}\n accessibilityLabel={accessibilityLabel}\n to={buildLink(route.name, route.params)}\n testID={options.tabBarTestID}\n allowFontScaling={options.tabBarAllowFontScaling}\n activeTintColor={tabBarActiveTintColor}\n inactiveTintColor={tabBarInactiveTintColor}\n activeBackgroundColor={tabBarActiveBackgroundColor}\n inactiveBackgroundColor={tabBarInactiveBackgroundColor}\n button={options.tabBarButton}\n icon={\n options.tabBarIcon ??\n (({ color, size }) => (\n <MissingIcon color={color} size={size} />\n ))\n }\n badge={options.tabBarBadge}\n badgeStyle={options.tabBarBadgeStyle}\n label={label}\n showLabel={tabBarShowLabel}\n labelStyle={options.tabBarLabelStyle}\n iconStyle={options.tabBarIconStyle}\n style={options.tabBarItemStyle}\n />\n </NavigationRouteContext.Provider>\n </NavigationContext.Provider>\n );\n })}\n </View>\n </Animated.View>\n );\n}\n\nconst styles = StyleSheet.create({\n tabBar: {\n left: 0,\n right: 0,\n bottom: 0,\n borderTopWidth: StyleSheet.hairlineWidth,\n elevation: 8,\n },\n content: {\n flex: 1,\n flexDirection: 'row',\n },\n});\n"],"mappings":";;;;;;;;AAAA;;AACA;;AASA;;AACA;;AASA;;AAGA;;AACA;;AACA;;;;AAMA,MAAMA,qBAAqB,GAAG,EAA9B;AACA,MAAMC,qBAAqB,GAAG,EAA9B;AACA,MAAMC,0BAA0B,GAAG,GAA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AAEnF,qBAVnB;MAWE,iBAAiB,EAAEC,uBAXrB;MAYE,qBAAqB,EAAEC,2BAZzB;MAaE,uBAAuB,EAAEC,6BAb3B;MAcE,MAAM,EAAE7C,OAAO,CAAC8H,YAdlB;MAeE,IAAI,yBACF9H,OAAO,CAAC+H,UADN,qEAED;QAAA,IAAC;UAAEC,KAAF;UAASC;QAAT,CAAD;QAAA,oBACC,6BAAC,qBAAD;UAAa,KAAK,EAAED,KAApB;UAA2B,IAAI,EAAEC;QAAjC,EADD;MAAA,CAjBL;MAqBE,KAAK,EAAEjI,OAAO,CAACkI,WArBjB;MAsBE,UAAU,EAAElI,OAAO,CAACmI,gBAtBtB;MAuBE,KAAK,EAAEf,KAvBT;MAwBE,SAAS,EAAE/E,eAxBb;MAyBE,UAAU,EAAErC,OAAO,CAACoI,gBAzBtB;MA0BE,SAAS,EAAEpI,OAAO,CAACqI,eA1BrB;MA2BE,KAAK,EAAErI,OAAO,CAACM;IA3BjB,EADF,CAJF,CADF;EAsCD,CA9EA,CADH,CArCF,CADF;AAyHD;;AAED,MAAM6E,MAAM,GAAG3E,uBAAA,CAAW8H,MAAX,CAAkB;EAC/BlD,MAAM,EAAE;IACNa,IAAI,EAAE,CADA;IAENC,KAAK,EAAE,CAFD;IAGNlF,MAAM,EAAE,CAHF;IAINuH,cAAc,EAAE/H,uBAAA,CAAWsF,aAJrB;IAKN0C,SAAS,EAAE;EALL,CADuB;EAQ/BpC,OAAO,EAAE;IACPqC,IAAI,EAAE,CADC;IAEPC,aAAa,EAAE;EAFR;AARsB,CAAlB,CAAf"}
1
+ {"version":3,"names":["DEFAULT_TABBAR_HEIGHT","COMPACT_TABBAR_HEIGHT","DEFAULT_MAX_TAB_ITEM_WIDTH","useNativeDriver","Platform","OS","shouldUseHorizontalLabels","state","descriptors","layout","dimensions","tabBarLabelPosition","routes","index","key","options","width","maxTabWidth","reduce","acc","route","tabBarItemStyle","flattenedStyle","StyleSheet","flatten","maxWidth","height","getPaddingBottom","insets","Math","max","bottom","select","ios","default","getTabBarHeight","style","rest","customHeight","isLandscape","horizontalLabels","paddingBottom","isPad","BottomTabBar","navigation","colors","useTheme","buildLink","useLinkBuilder","focusedRoute","focusedDescriptor","focusedOptions","tabBarShowLabel","tabBarHideOnKeyboard","tabBarVisibilityAnimationConfig","tabBarStyle","tabBarBackground","tabBarActiveTintColor","tabBarInactiveTintColor","tabBarActiveBackgroundColor","tabBarInactiveBackgroundColor","useSafeAreaFrame","isKeyboardShown","useIsKeyboardShown","onHeightChange","React","useContext","BottomTabBarHeightCallbackContext","shouldShowTabBar","visibilityAnimationConfigRef","useRef","useEffect","current","isTabBarHidden","setIsTabBarHidden","useState","visible","Animated","Value","visibilityAnimationConfig","animation","show","spring","timing","toValue","duration","config","start","finished","hide","stopAnimation","setLayout","handleLayout","e","nativeEvent","tabBarHeight","hasHorizontalLabels","tabBarBackgroundElement","styles","tabBar","backgroundColor","card","borderTopColor","border","transform","translateY","interpolate","inputRange","outputRange","hairlineWidth","position","paddingHorizontal","left","right","absoluteFill","content","map","focused","onPress","event","emit","type","target","canPreventDefault","defaultPrevented","dispatch","CommonActions","navigate","name","merge","onLongPress","label","tabBarLabel","undefined","title","accessibilityLabel","tabBarAccessibilityLabel","length","params","tabBarTestID","tabBarAllowFontScaling","tabBarButton","tabBarIcon","color","size","tabBarBadge","tabBarBadgeStyle","tabBarLabelStyle","tabBarIconStyle","create","borderTopWidth","elevation","flex","flexDirection"],"sources":["BottomTabBar.tsx"],"sourcesContent":["import { MissingIcon } from '@react-navigation/elements';\nimport {\n CommonActions,\n NavigationContext,\n NavigationRouteContext,\n ParamListBase,\n TabNavigationState,\n useLinkBuilder,\n useTheme,\n} from '@react-navigation/native';\nimport React from 'react';\nimport {\n Animated,\n LayoutChangeEvent,\n Platform,\n StyleProp,\n StyleSheet,\n View,\n ViewStyle,\n} from 'react-native';\nimport { EdgeInsets, useSafeAreaFrame } from 'react-native-safe-area-context';\n\nimport type { BottomTabBarProps, BottomTabDescriptorMap } from '../types';\nimport BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';\nimport useIsKeyboardShown from '../utils/useIsKeyboardShown';\nimport BottomTabItem from './BottomTabItem';\n\ntype Props = BottomTabBarProps & {\n style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;\n};\n\nconst DEFAULT_TABBAR_HEIGHT = 49;\nconst COMPACT_TABBAR_HEIGHT = 32;\nconst DEFAULT_MAX_TAB_ITEM_WIDTH = 125;\n\nconst useNativeDriver = Platform.OS !== 'web';\n\ntype Options = {\n state: TabNavigationState<ParamListBase>;\n descriptors: BottomTabDescriptorMap;\n layout: { height: number; width: number };\n dimensions: { height: number; width: number };\n};\n\nconst shouldUseHorizontalLabels = ({\n state,\n descriptors,\n layout,\n dimensions,\n}: Options) => {\n const { tabBarLabelPosition } =\n descriptors[state.routes[state.index].key].options;\n\n if (tabBarLabelPosition) {\n switch (tabBarLabelPosition) {\n case 'beside-icon':\n return true;\n case 'below-icon':\n return false;\n }\n }\n\n if (layout.width >= 768) {\n // Screen size matches a tablet\n const maxTabWidth = state.routes.reduce((acc, route) => {\n const { tabBarItemStyle } = descriptors[route.key].options;\n const flattenedStyle = StyleSheet.flatten(tabBarItemStyle);\n\n if (flattenedStyle) {\n if (typeof flattenedStyle.width === 'number') {\n return acc + flattenedStyle.width;\n } else if (typeof flattenedStyle.maxWidth === 'number') {\n return acc + flattenedStyle.maxWidth;\n }\n }\n\n return acc + DEFAULT_MAX_TAB_ITEM_WIDTH;\n }, 0);\n\n return maxTabWidth <= layout.width;\n } else {\n return dimensions.width > dimensions.height;\n }\n};\n\nconst getPaddingBottom = (insets: EdgeInsets) =>\n Math.max(insets.bottom - Platform.select({ ios: 4, default: 0 }), 0);\n\nexport const getTabBarHeight = ({\n state,\n descriptors,\n dimensions,\n insets,\n style,\n ...rest\n}: Options & {\n insets: EdgeInsets;\n style: Animated.WithAnimatedValue<StyleProp<ViewStyle>> | undefined;\n}) => {\n // @ts-ignore\n const customHeight = StyleSheet.flatten(style)?.height;\n\n if (typeof customHeight === 'number') {\n return customHeight;\n }\n\n const isLandscape = dimensions.width > dimensions.height;\n const horizontalLabels = shouldUseHorizontalLabels({\n state,\n descriptors,\n dimensions,\n ...rest,\n });\n const paddingBottom = getPaddingBottom(insets);\n\n if (\n Platform.OS === 'ios' &&\n !Platform.isPad &&\n isLandscape &&\n horizontalLabels\n ) {\n return COMPACT_TABBAR_HEIGHT + paddingBottom;\n }\n\n return DEFAULT_TABBAR_HEIGHT + paddingBottom;\n};\n\nexport default function BottomTabBar({\n state,\n navigation,\n descriptors,\n insets,\n style,\n}: Props) {\n const { colors } = useTheme();\n const buildLink = useLinkBuilder();\n\n const focusedRoute = state.routes[state.index];\n const focusedDescriptor = descriptors[focusedRoute.key];\n const focusedOptions = focusedDescriptor.options;\n\n const {\n tabBarShowLabel,\n tabBarHideOnKeyboard = false,\n tabBarVisibilityAnimationConfig,\n tabBarStyle,\n tabBarBackground,\n tabBarActiveTintColor,\n tabBarInactiveTintColor,\n tabBarActiveBackgroundColor,\n tabBarInactiveBackgroundColor,\n } = focusedOptions;\n\n const dimensions = useSafeAreaFrame();\n const isKeyboardShown = useIsKeyboardShown();\n\n const onHeightChange = React.useContext(BottomTabBarHeightCallbackContext);\n\n const shouldShowTabBar = !(tabBarHideOnKeyboard && isKeyboardShown);\n\n const visibilityAnimationConfigRef = React.useRef(\n tabBarVisibilityAnimationConfig\n );\n\n React.useEffect(() => {\n visibilityAnimationConfigRef.current = tabBarVisibilityAnimationConfig;\n });\n\n const [isTabBarHidden, setIsTabBarHidden] = React.useState(!shouldShowTabBar);\n\n const [visible] = React.useState(\n () => new Animated.Value(shouldShowTabBar ? 1 : 0)\n );\n\n React.useEffect(() => {\n const visibilityAnimationConfig = visibilityAnimationConfigRef.current;\n\n if (shouldShowTabBar) {\n const animation =\n visibilityAnimationConfig?.show?.animation === 'spring'\n ? Animated.spring\n : Animated.timing;\n\n animation(visible, {\n toValue: 1,\n useNativeDriver,\n duration: 250,\n ...visibilityAnimationConfig?.show?.config,\n }).start(({ finished }) => {\n if (finished) {\n setIsTabBarHidden(false);\n }\n });\n } else {\n setIsTabBarHidden(true);\n\n const animation =\n visibilityAnimationConfig?.hide?.animation === 'spring'\n ? Animated.spring\n : Animated.timing;\n\n animation(visible, {\n toValue: 0,\n useNativeDriver,\n duration: 200,\n ...visibilityAnimationConfig?.hide?.config,\n }).start();\n }\n\n return () => visible.stopAnimation();\n }, [visible, shouldShowTabBar]);\n\n const [layout, setLayout] = React.useState({\n height: 0,\n width: dimensions.width,\n });\n\n const handleLayout = (e: LayoutChangeEvent) => {\n const { height, width } = e.nativeEvent.layout;\n\n onHeightChange?.(height);\n\n setLayout((layout) => {\n if (height === layout.height && width === layout.width) {\n return layout;\n } else {\n return {\n height,\n width,\n };\n }\n });\n };\n\n const { routes } = state;\n\n const paddingBottom = getPaddingBottom(insets);\n const tabBarHeight = getTabBarHeight({\n state,\n descriptors,\n insets,\n dimensions,\n layout,\n style: [tabBarStyle, style],\n });\n\n const hasHorizontalLabels = shouldUseHorizontalLabels({\n state,\n descriptors,\n dimensions,\n layout,\n });\n\n const tabBarBackgroundElement = tabBarBackground?.();\n\n return (\n <Animated.View\n style={[\n styles.tabBar,\n {\n backgroundColor:\n tabBarBackgroundElement != null ? 'transparent' : colors.card,\n borderTopColor: colors.border,\n },\n {\n transform: [\n {\n translateY: visible.interpolate({\n inputRange: [0, 1],\n outputRange: [\n layout.height + paddingBottom + StyleSheet.hairlineWidth,\n 0,\n ],\n }),\n },\n ],\n // Absolutely position the tab bar so that the content is below it\n // This is needed to avoid gap at bottom when the tab bar is hidden\n position: isTabBarHidden ? 'absolute' : (null as any),\n },\n {\n height: tabBarHeight,\n paddingBottom,\n paddingHorizontal: Math.max(insets.left, insets.right),\n },\n tabBarStyle,\n ]}\n pointerEvents={isTabBarHidden ? 'none' : 'auto'}\n onLayout={handleLayout}\n >\n <View pointerEvents=\"none\" style={StyleSheet.absoluteFill}>\n {tabBarBackgroundElement}\n </View>\n <View accessibilityRole=\"tablist\" style={styles.content}>\n {routes.map((route, index) => {\n const focused = index === state.index;\n const { options } = descriptors[route.key];\n\n const onPress = () => {\n const event = navigation.emit({\n type: 'tabPress',\n target: route.key,\n canPreventDefault: true,\n });\n\n if (!focused && !event.defaultPrevented) {\n navigation.dispatch({\n ...CommonActions.navigate({ name: route.name, merge: true }),\n target: state.key,\n });\n }\n };\n\n const onLongPress = () => {\n navigation.emit({\n type: 'tabLongPress',\n target: route.key,\n });\n };\n\n const label =\n options.tabBarLabel !== undefined\n ? options.tabBarLabel\n : options.title !== undefined\n ? options.title\n : route.name;\n\n const accessibilityLabel =\n options.tabBarAccessibilityLabel !== undefined\n ? options.tabBarAccessibilityLabel\n : typeof label === 'string' && Platform.OS === 'ios'\n ? `${label}, tab, ${index + 1} of ${routes.length}`\n : undefined;\n\n return (\n <NavigationContext.Provider\n key={route.key}\n value={descriptors[route.key].navigation}\n >\n <NavigationRouteContext.Provider value={route}>\n <BottomTabItem\n route={route}\n descriptor={descriptors[route.key]}\n focused={focused}\n horizontal={hasHorizontalLabels}\n onPress={onPress}\n onLongPress={onLongPress}\n accessibilityLabel={accessibilityLabel}\n to={buildLink(route.name, route.params)}\n testID={options.tabBarTestID}\n allowFontScaling={options.tabBarAllowFontScaling}\n activeTintColor={tabBarActiveTintColor}\n inactiveTintColor={tabBarInactiveTintColor}\n activeBackgroundColor={tabBarActiveBackgroundColor}\n inactiveBackgroundColor={tabBarInactiveBackgroundColor}\n button={options.tabBarButton}\n icon={\n options.tabBarIcon ??\n (({ color, size }) => (\n <MissingIcon color={color} size={size} />\n ))\n }\n badge={options.tabBarBadge}\n badgeStyle={options.tabBarBadgeStyle}\n label={label}\n showLabel={tabBarShowLabel}\n labelStyle={options.tabBarLabelStyle}\n iconStyle={options.tabBarIconStyle}\n style={options.tabBarItemStyle}\n />\n </NavigationRouteContext.Provider>\n </NavigationContext.Provider>\n );\n })}\n </View>\n </Animated.View>\n );\n}\n\nconst styles = StyleSheet.create({\n tabBar: {\n left: 0,\n right: 0,\n bottom: 0,\n borderTopWidth: StyleSheet.hairlineWidth,\n elevation: 8,\n },\n content: {\n flex: 1,\n flexDirection: 'row',\n },\n});\n"],"mappings":";;;;;;;;AAAA;;AACA;;AASA;;AACA;;AASA;;AAGA;;AACA;;AACA;;;;AAMA,MAAMA,qBAAqB,GAAG,EAA9B;AACA,MAAMC,qBAAqB,GAAG,EAA9B;AACA,MAAMC,0BAA0B,GAAG,GAAnC;AAEA,MAAMC,eAAe,GAAGC,qBAAA,CAASC,EAAT,KAAgB,KAAxC;;AASA,MAAMC,yBAAyB,GAAG,QAKnB;EAAA,IALoB;IACjCC,KADiC;IAEjCC,WAFiC;IAGjCC,MAHiC;IAIjCC;EAJiC,CAKpB;EACb,MAAM;IAAEC;EAAF,IACJH,WAAW,CAACD,KAAK,CAACK,MAAN,CAAaL,KAAK,CAACM,KAAnB,EAA0BC,GAA3B,CAAX,CAA2CC,OAD7C;;EAGA,IAAIJ,mBAAJ,EAAyB;IACvB,QAAQA,mBAAR;MACE,KAAK,aAAL;QACE,OAAO,IAAP;;MACF,KAAK,YAAL;QACE,OAAO,KAAP;IAJJ;EAMD;;EAED,IAAIF,MAAM,CAACO,KAAP,IAAgB,GAApB,EAAyB;IACvB;IACA,MAAMC,WAAW,GAAGV,KAAK,CAACK,MAAN,CAAaM,MAAb,CAAoB,CAACC,GAAD,EAAMC,KAAN,KAAgB;MACtD,MAAM;QAAEC;MAAF,IAAsBb,WAAW,CAACY,KAAK,CAACN,GAAP,CAAX,CAAuBC,OAAnD;;MACA,MAAMO,cAAc,GAAGC,uBAAA,CAAWC,OAAX,CAAmBH,eAAnB,CAAvB;;MAEA,IAAIC,cAAJ,EAAoB;QAClB,IAAI,OAAOA,cAAc,CAACN,KAAtB,KAAgC,QAApC,EAA8C;UAC5C,OAAOG,GAAG,GAAGG,cAAc,CAACN,KAA5B;QACD,CAFD,MAEO,IAAI,OAAOM,cAAc,CAACG,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AS,EAAE;EALL,CADuB;EAQ/BpC,OAAO,EAAE;IACPqC,IAAI,EAAE,CADC;IAEPC,aAAa,EAAE;EAFR;AARsB,CAAlB,CAAf"}
@@ -23,6 +23,7 @@ function BottomTabBarItem(_ref) {
23
23
  let {
24
24
  focused,
25
25
  route,
26
+ descriptor,
26
27
  label,
27
28
  icon,
28
29
  badge,
@@ -103,10 +104,15 @@ function BottomTabBarItem(_ref) {
103
104
  }, label);
104
105
  }
105
106
 
107
+ const {
108
+ options
109
+ } = descriptor;
110
+ const children = typeof options.tabBarLabel === 'string' ? options.tabBarLabel : options.title !== undefined ? options.title : route.name;
106
111
  return label({
107
112
  focused,
108
113
  color,
109
- position: horizontal ? 'beside-icon' : 'below-icon'
114
+ position: horizontal ? 'beside-icon' : 'below-icon',
115
+ children
110
116
  });
111
117
  };
112
118
 
@@ -1 +1 @@
1
- {"version":3,"names":["BottomTabBarItem","focused","route","label","icon","badge","badgeStyle","to","button","children","style","onPress","accessibilityRole","rest","Platform","OS","styles","e","metaKey","altKey","ctrlKey","shiftKey","preventDefault","accessibilityLabel","testID","onLongPress","horizontal","activeTintColor","customActiveTintColor","inactiveTintColor","customInactiveTintColor","activeBackgroundColor","inactiveBackgroundColor","showLabel","allowFontScaling","labelStyle","iconStyle","colors","useTheme","undefined","primary","Color","text","mix","card","hex","renderLabel","color","labelBeside","labelBeneath","position","renderIcon","activeOpacity","inactiveOpacity","scene","backgroundColor","select","ios","default","accessibilityState","selected","accessibilityStates","tab","tabLandscape","tabPortrait","StyleSheet","create","flex","alignItems","justifyContent","flexDirection","textAlign","fontSize","marginLeft","marginTop","display"],"sources":["BottomTabItem.tsx"],"sourcesContent":["import { Link, Route, useTheme } from '@react-navigation/native';\nimport Color from 'color';\nimport React from 'react';\nimport {\n GestureResponderEvent,\n Platform,\n Pressable,\n StyleProp,\n StyleSheet,\n Text,\n TextStyle,\n ViewStyle,\n} from 'react-native';\n\nimport type { BottomTabBarButtonProps, LabelPosition } from '../types';\nimport TabBarIcon from './TabBarIcon';\n\ntype Props = {\n /**\n * Whether the tab is focused.\n */\n focused: boolean;\n /**\n * The route object which should be specified by the tab.\n */\n route: Route<string>;\n /**\n * The label text of the tab.\n */\n label:\n | string\n | ((props: {\n focused: boolean;\n color: string;\n position: LabelPosition;\n }) => React.ReactNode);\n /**\n * Icon to display for the tab.\n */\n icon: (props: {\n focused: boolean;\n size: number;\n color: string;\n }) => React.ReactNode;\n /**\n * Text to show in a badge on the tab icon.\n */\n badge?: number | string;\n /**\n * Custom style for the badge.\n */\n badgeStyle?: StyleProp<TextStyle>;\n /**\n * URL to use for the link to the tab.\n */\n to?: string;\n /**\n * The button for the tab. Uses a `TouchableWithoutFeedback` by default.\n */\n button?: (props: BottomTabBarButtonProps) => React.ReactNode;\n /**\n * The accessibility label for the tab.\n */\n accessibilityLabel?: string;\n /**\n * An unique ID for testing for the tab.\n */\n testID?: string;\n /**\n * Function to execute on press in React Native.\n * On the web, this will use onClick.\n */\n onPress: (\n e: React.MouseEvent<HTMLElement, MouseEvent> | GestureResponderEvent\n ) => void;\n /**\n * Function to execute on long press.\n */\n onLongPress: (e: GestureResponderEvent) => void;\n /**\n * Whether the label should be aligned with the icon horizontally.\n */\n horizontal: boolean;\n /**\n * Color for the icon and label when the item is active.\n */\n activeTintColor?: string;\n /**\n * Color for the icon and label when the item is inactive.\n */\n inactiveTintColor?: string;\n /**\n * Background color for item when its active.\n */\n activeBackgroundColor?: string;\n /**\n * Background color for item when its inactive.\n */\n inactiveBackgroundColor?: string;\n /**\n * Whether to show the label text for the tab.\n */\n showLabel?: boolean;\n /**\n * Whether to allow scaling the font for the label for accessibility purposes.\n */\n allowFontScaling?: boolean;\n /**\n * Style object for the label element.\n */\n labelStyle?: StyleProp<TextStyle>;\n /**\n * Style object for the icon element.\n */\n iconStyle?: StyleProp<ViewStyle>;\n /**\n * Style object for the wrapper element.\n */\n style?: StyleProp<ViewStyle>;\n};\n\nexport default function BottomTabBarItem({\n focused,\n route,\n label,\n icon,\n badge,\n badgeStyle,\n to,\n button = ({\n children,\n style,\n onPress,\n to,\n accessibilityRole,\n ...rest\n }: BottomTabBarButtonProps) => {\n if (Platform.OS === 'web' && to) {\n // React Native Web doesn't forward `onClick` if we use `TouchableWithoutFeedback`.\n // We need to use `onClick` to be able to prevent default browser handling of links.\n return (\n <Link\n {...rest}\n to={to}\n style={[styles.button, style]}\n onPress={(e: any) => {\n if (\n !(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && // ignore clicks with modifier keys\n (e.button == null || e.button === 0) // ignore everything but left clicks\n ) {\n e.preventDefault();\n onPress?.(e);\n }\n }}\n >\n {children}\n </Link>\n );\n } else {\n return (\n <Pressable\n {...rest}\n accessibilityRole={accessibilityRole}\n onPress={onPress}\n style={style}\n >\n {children}\n </Pressable>\n );\n }\n },\n accessibilityLabel,\n testID,\n onPress,\n onLongPress,\n horizontal,\n activeTintColor: customActiveTintColor,\n inactiveTintColor: customInactiveTintColor,\n activeBackgroundColor = 'transparent',\n inactiveBackgroundColor = 'transparent',\n showLabel = true,\n allowFontScaling,\n labelStyle,\n iconStyle,\n style,\n}: Props) {\n const { colors } = useTheme();\n\n const activeTintColor =\n customActiveTintColor === undefined\n ? colors.primary\n : customActiveTintColor;\n\n const inactiveTintColor =\n customInactiveTintColor === undefined\n ? Color(colors.text).mix(Color(colors.card), 0.5).hex()\n : customInactiveTintColor;\n\n const renderLabel = ({ focused }: { focused: boolean }) => {\n if (showLabel === false) {\n return null;\n }\n\n const color = focused ? activeTintColor : inactiveTintColor;\n\n if (typeof label === 'string') {\n return (\n <Text\n numberOfLines={1}\n style={[\n styles.label,\n { color },\n horizontal ? styles.labelBeside : styles.labelBeneath,\n labelStyle,\n ]}\n allowFontScaling={allowFontScaling}\n >\n {label}\n </Text>\n );\n }\n\n return label({\n focused,\n color,\n position: horizontal ? 'beside-icon' : 'below-icon',\n });\n };\n\n const renderIcon = ({ focused }: { focused: boolean }) => {\n if (icon === undefined) {\n return null;\n }\n\n const activeOpacity = focused ? 1 : 0;\n const inactiveOpacity = focused ? 0 : 1;\n\n return (\n <TabBarIcon\n route={route}\n horizontal={horizontal}\n badge={badge}\n badgeStyle={badgeStyle}\n activeOpacity={activeOpacity}\n inactiveOpacity={inactiveOpacity}\n activeTintColor={activeTintColor}\n inactiveTintColor={inactiveTintColor}\n renderIcon={icon}\n style={iconStyle}\n />\n );\n };\n\n const scene = { route, focused };\n\n const backgroundColor = focused\n ? activeBackgroundColor\n : inactiveBackgroundColor;\n\n return button({\n to,\n onPress,\n onLongPress,\n testID,\n accessibilityLabel,\n // FIXME: accessibilityRole: 'tab' doesn't seem to work as expected on iOS\n accessibilityRole: Platform.select({ ios: 'button', default: 'tab' }),\n accessibilityState: { selected: focused },\n // @ts-expect-error: keep for compatibility with older React Native versions\n accessibilityStates: focused ? ['selected'] : [],\n style: [\n styles.tab,\n { backgroundColor },\n horizontal ? styles.tabLandscape : styles.tabPortrait,\n style,\n ],\n children: (\n <React.Fragment>\n {renderIcon(scene)}\n {renderLabel(scene)}\n </React.Fragment>\n ),\n }) as React.ReactElement;\n}\n\nconst styles = StyleSheet.create({\n tab: {\n flex: 1,\n alignItems: 'center',\n },\n tabPortrait: {\n justifyContent: 'flex-end',\n flexDirection: 'column',\n },\n tabLandscape: {\n justifyContent: 'center',\n flexDirection: 'row',\n },\n label: {\n textAlign: 'center',\n backgroundColor: 'transparent',\n },\n labelBeneath: {\n fontSize: 10,\n },\n labelBeside: {\n fontSize: 13,\n marginLeft: 20,\n marginTop: 3,\n },\n button: {\n display: 'flex',\n },\n});\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAYA;;;;;;AA0Ge,SAASA,gBAAT,OAgEL;EAAA,IAhE+B;IACvCC,OADuC;IAEvCC,KAFuC;IAGvCC,KAHuC;IAIvCC,IAJuC;IAKvCC,KALuC;IAMvCC,UANuC;IAOvCC,EAPuC;IAQvCC,MAAM,GAAG,SAOsB;MAAA,IAPrB;QACRC,QADQ;QAERC,K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,CALkB;EAS/BP,YAAY,EAAE;IACZM,cAAc,EAAE,QADJ;IAEZC,aAAa,EAAE;EAFH,CATiB;EAa/BnE,KAAK,EAAE;IACLoE,SAAS,EAAE,QADN;IAELhB,eAAe,EAAE;EAFZ,CAbwB;EAiB/BN,YAAY,EAAE;IACZuB,QAAQ,EAAE;EADE,CAjBiB;EAoB/BxB,WAAW,EAAE;IACXwB,QAAQ,EAAE,EADC;IAEXC,UAAU,EAAE,EAFD;IAGXC,SAAS,EAAE;EAHA,CApBkB;EAyB/BlE,MAAM,EAAE;IACNmE,OAAO,EAAE;EADH;AAzBuB,CAAlB,CAAf"}
1
+ {"version":3,"names":["BottomTabBarItem","focused","route","descriptor","label","icon","badge","badgeStyle","to","button","children","style","onPress","accessibilityRole","rest","Platform","OS","styles","e","metaKey","altKey","ctrlKey","shiftKey","preventDefault","accessibilityLabel","testID","onLongPress","horizontal","activeTintColor","customActiveTintColor","inactiveTintColor","customInactiveTintColor","activeBackgroundColor","inactiveBackgroundColor","showLabel","allowFontScaling","labelStyle","iconStyle","colors","useTheme","undefined","primary","Color","text","mix","card","hex","renderLabel","color","labelBeside","labelBeneath","options","tabBarLabel","title","name","position","renderIcon","activeOpacity","inactiveOpacity","scene","backgroundColor","select","ios","default","accessibilityState","selected","accessibilityStates","tab","tabLandscape","tabPortrait","StyleSheet","create","flex","alignItems","justifyContent","flexDirection","textAlign","fontSize","marginLeft","marginTop","display"],"sources":["BottomTabItem.tsx"],"sourcesContent":["import { Link, Route, useTheme } from '@react-navigation/native';\nimport Color from 'color';\nimport React from 'react';\nimport {\n GestureResponderEvent,\n Platform,\n Pressable,\n StyleProp,\n StyleSheet,\n Text,\n TextStyle,\n ViewStyle,\n} from 'react-native';\n\nimport type {\n BottomTabBarButtonProps,\n BottomTabDescriptor,\n LabelPosition,\n} from '../types';\nimport TabBarIcon from './TabBarIcon';\n\ntype Props = {\n /**\n * Whether the tab is focused.\n */\n focused: boolean;\n /**\n * The route object which should be specified by the tab.\n */\n route: Route<string>;\n /**\n * The descriptor object for the route.\n */\n descriptor: BottomTabDescriptor;\n /**\n * The label text of the tab.\n */\n label:\n | string\n | ((props: {\n focused: boolean;\n color: string;\n position: LabelPosition;\n children: string;\n }) => React.ReactNode);\n /**\n * Icon to display for the tab.\n */\n icon: (props: {\n focused: boolean;\n size: number;\n color: string;\n }) => React.ReactNode;\n /**\n * Text to show in a badge on the tab icon.\n */\n badge?: number | string;\n /**\n * Custom style for the badge.\n */\n badgeStyle?: StyleProp<TextStyle>;\n /**\n * URL to use for the link to the tab.\n */\n to?: string;\n /**\n * The button for the tab. Uses a `TouchableWithoutFeedback` by default.\n */\n button?: (props: BottomTabBarButtonProps) => React.ReactNode;\n /**\n * The accessibility label for the tab.\n */\n accessibilityLabel?: string;\n /**\n * An unique ID for testing for the tab.\n */\n testID?: string;\n /**\n * Function to execute on press in React Native.\n * On the web, this will use onClick.\n */\n onPress: (\n e: React.MouseEvent<HTMLElement, MouseEvent> | GestureResponderEvent\n ) => void;\n /**\n * Function to execute on long press.\n */\n onLongPress: (e: GestureResponderEvent) => void;\n /**\n * Whether the label should be aligned with the icon horizontally.\n */\n horizontal: boolean;\n /**\n * Color for the icon and label when the item is active.\n */\n activeTintColor?: string;\n /**\n * Color for the icon and label when the item is inactive.\n */\n inactiveTintColor?: string;\n /**\n * Background color for item when its active.\n */\n activeBackgroundColor?: string;\n /**\n * Background color for item when its inactive.\n */\n inactiveBackgroundColor?: string;\n /**\n * Whether to show the label text for the tab.\n */\n showLabel?: boolean;\n /**\n * Whether to allow scaling the font for the label for accessibility purposes.\n */\n allowFontScaling?: boolean;\n /**\n * Style object for the label element.\n */\n labelStyle?: StyleProp<TextStyle>;\n /**\n * Style object for the icon element.\n */\n iconStyle?: StyleProp<ViewStyle>;\n /**\n * Style object for the wrapper element.\n */\n style?: StyleProp<ViewStyle>;\n};\n\nexport default function BottomTabBarItem({\n focused,\n route,\n descriptor,\n label,\n icon,\n badge,\n badgeStyle,\n to,\n button = ({\n children,\n style,\n onPress,\n to,\n accessibilityRole,\n ...rest\n }: BottomTabBarButtonProps) => {\n if (Platform.OS === 'web' && to) {\n // React Native Web doesn't forward `onClick` if we use `TouchableWithoutFeedback`.\n // We need to use `onClick` to be able to prevent default browser handling of links.\n return (\n <Link\n {...rest}\n to={to}\n style={[styles.button, style]}\n onPress={(e: any) => {\n if (\n !(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && // ignore clicks with modifier keys\n (e.button == null || e.button === 0) // ignore everything but left clicks\n ) {\n e.preventDefault();\n onPress?.(e);\n }\n }}\n >\n {children}\n </Link>\n );\n } else {\n return (\n <Pressable\n {...rest}\n accessibilityRole={accessibilityRole}\n onPress={onPress}\n style={style}\n >\n {children}\n </Pressable>\n );\n }\n },\n accessibilityLabel,\n testID,\n onPress,\n onLongPress,\n horizontal,\n activeTintColor: customActiveTintColor,\n inactiveTintColor: customInactiveTintColor,\n activeBackgroundColor = 'transparent',\n inactiveBackgroundColor = 'transparent',\n showLabel = true,\n allowFontScaling,\n labelStyle,\n iconStyle,\n style,\n}: Props) {\n const { colors } = useTheme();\n\n const activeTintColor =\n customActiveTintColor === undefined\n ? colors.primary\n : customActiveTintColor;\n\n const inactiveTintColor =\n customInactiveTintColor === undefined\n ? Color(colors.text).mix(Color(colors.card), 0.5).hex()\n : customInactiveTintColor;\n\n const renderLabel = ({ focused }: { focused: boolean }) => {\n if (showLabel === false) {\n return null;\n }\n\n const color = focused ? activeTintColor : inactiveTintColor;\n\n if (typeof label === 'string') {\n return (\n <Text\n numberOfLines={1}\n style={[\n styles.label,\n { color },\n horizontal ? styles.labelBeside : styles.labelBeneath,\n labelStyle,\n ]}\n allowFontScaling={allowFontScaling}\n >\n {label}\n </Text>\n );\n }\n\n const { options } = descriptor;\n const children =\n typeof options.tabBarLabel === 'string'\n ? options.tabBarLabel\n : options.title !== undefined\n ? options.title\n : route.name;\n\n return label({\n focused,\n color,\n position: horizontal ? 'beside-icon' : 'below-icon',\n children,\n });\n };\n\n const renderIcon = ({ focused }: { focused: boolean }) => {\n if (icon === undefined) {\n return null;\n }\n\n const activeOpacity = focused ? 1 : 0;\n const inactiveOpacity = focused ? 0 : 1;\n\n return (\n <TabBarIcon\n route={route}\n horizontal={horizontal}\n badge={badge}\n badgeStyle={badgeStyle}\n activeOpacity={activeOpacity}\n inactiveOpacity={inactiveOpacity}\n activeTintColor={activeTintColor}\n inactiveTintColor={inactiveTintColor}\n renderIcon={icon}\n style={iconStyle}\n />\n );\n };\n\n const scene = { route, focused };\n\n const backgroundColor = focused\n ? activeBackgroundColor\n : inactiveBackgroundColor;\n\n return button({\n to,\n onPress,\n onLongPress,\n testID,\n accessibilityLabel,\n // FIXME: accessibilityRole: 'tab' doesn't seem to work as expected on iOS\n accessibilityRole: Platform.select({ ios: 'button', default: 'tab' }),\n accessibilityState: { selected: focused },\n // @ts-expect-error: keep for compatibility with older React Native versions\n accessibilityStates: focused ? ['selected'] : [],\n style: [\n styles.tab,\n { backgroundColor },\n horizontal ? styles.tabLandscape : styles.tabPortrait,\n style,\n ],\n children: (\n <React.Fragment>\n {renderIcon(scene)}\n {renderLabel(scene)}\n </React.Fragment>\n ),\n }) as React.ReactElement;\n}\n\nconst styles = StyleSheet.create({\n tab: {\n flex: 1,\n alignItems: 'center',\n },\n tabPortrait: {\n justifyContent: 'flex-end',\n flexDirection: 'column',\n },\n tabLandscape: {\n justifyContent: 'center',\n flexDirection: 'row',\n },\n label: {\n textAlign: 'center',\n backgroundColor: 'transparent',\n },\n labelBeneath: {\n fontSize: 10,\n },\n labelBeside: {\n fontSize: 13,\n marginLeft: 20,\n marginTop: 3,\n },\n button: {\n display: 'flex',\n },\n});\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAgBA;;;;;;AA+Ge,SAASA,gBAAT,OAiEL;EAAA,IAjE+B;IACvCC,OADuC;IAEvCC,KAFuC;IAGvCC,UAHuC;IAIvCC,KAJuC;IAKvCC,IALuC;IAMvCC,KANuC;IAOvCC,UA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C,cAAD,CAAO,QAAP,QACG8C,UAAU,CAACG,KAAD,CADb,EAEGZ,WAAW,CAACY,KAAD,CAFd;EAlBU,CAAD,CAAb;AAwBD;;AAED,MAAM1C,MAAM,GAAGqD,uBAAA,CAAWC,MAAX,CAAkB;EAC/BJ,GAAG,EAAE;IACHK,IAAI,EAAE,CADH;IAEHC,UAAU,EAAE;EAFT,CAD0B;EAK/BJ,WAAW,EAAE;IACXK,cAAc,EAAE,UADL;IAEXC,aAAa,EAAE;EAFJ,CALkB;EAS/BP,YAAY,EAAE;IACZM,cAAc,EAAE,QADJ;IAEZC,aAAa,EAAE;EAFH,CATiB;EAa/BvE,KAAK,EAAE;IACLwE,SAAS,EAAE,QADN;IAELhB,eAAe,EAAE;EAFZ,CAbwB;EAiB/BV,YAAY,EAAE;IACZ2B,QAAQ,EAAE;EADE,CAjBiB;EAoB/B5B,WAAW,EAAE;IACX4B,QAAQ,EAAE,EADC;IAEXC,UAAU,EAAE,EAFD;IAGXC,SAAS,EAAE;EAHA,CApBkB;EAyB/BtE,MAAM,EAAE;IACNuE,OAAO,EAAE;EADH;AAzBuB,CAAlB,CAAf"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.tsx"],"sourcesContent":["import type { HeaderOptions } from '@react-navigation/elements';\nimport type {\n Descriptor,\n NavigationHelpers,\n NavigationProp,\n ParamListBase,\n RouteProp,\n TabActionHelpers,\n TabNavigationState,\n} from '@react-navigation/native';\nimport type * as React from 'react';\nimport type {\n Animated,\n GestureResponderEvent,\n StyleProp,\n TextStyle,\n TouchableWithoutFeedbackProps,\n ViewStyle,\n} from 'react-native';\nimport type { EdgeInsets } from 'react-native-safe-area-context';\n\nexport type Layout = { width: number; height: number };\n\nexport type BottomTabNavigationEventMap = {\n /**\n * Event which fires on tapping on the tab in the tab bar.\n */\n tabPress: { data: undefined; canPreventDefault: true };\n /**\n * Event which fires on long press on the tab in the tab bar.\n */\n tabLongPress: { data: undefined };\n};\n\nexport type LabelPosition = 'beside-icon' | 'below-icon';\n\nexport type BottomTabNavigationHelpers = NavigationHelpers<\n ParamListBase,\n BottomTabNavigationEventMap\n> &\n TabActionHelpers<ParamListBase>;\n\nexport type BottomTabNavigationProp<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n NavigatorID extends string | undefined = undefined\n> = NavigationProp<\n ParamList,\n RouteName,\n NavigatorID,\n TabNavigationState<ParamList>,\n BottomTabNavigationOptions,\n BottomTabNavigationEventMap\n> &\n TabActionHelpers<ParamList>;\n\nexport type BottomTabScreenProps<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n NavigatorID extends string | undefined = undefined\n> = {\n navigation: BottomTabNavigationProp<ParamList, RouteName, NavigatorID>;\n route: RouteProp<ParamList, RouteName>;\n};\n\nexport type TimingKeyboardAnimationConfig = {\n animation: 'timing';\n config?: Omit<\n Partial<Animated.TimingAnimationConfig>,\n 'toValue' | 'useNativeDriver'\n >;\n};\n\nexport type SpringKeyboardAnimationConfig = {\n animation: 'spring';\n config?: Omit<\n Partial<Animated.SpringAnimationConfig>,\n 'toValue' | 'useNativeDriver'\n >;\n};\n\nexport type TabBarVisibilityAnimationConfig =\n | TimingKeyboardAnimationConfig\n | SpringKeyboardAnimationConfig;\n\nexport type BottomTabNavigationOptions = HeaderOptions & {\n /**\n * Title text for the screen.\n */\n title?: string;\n\n /**\n * Title string of a tab displayed in the tab bar\n * or a function that given { focused: boolean, color: string, position: 'below-icon' | 'beside-icon' } returns a React.Node to display in tab bar.\n *\n * When undefined, scene title is used. Use `tabBarShowLabel` to hide the label.\n */\n tabBarLabel?:\n | string\n | ((props: {\n focused: boolean;\n color: string;\n position: LabelPosition;\n }) => React.ReactNode);\n\n /**\n * Whether the tab label should be visible. Defaults to `true`.\n */\n tabBarShowLabel?: boolean;\n\n /**\n * Whether the label is shown below the icon or beside the icon.\n *\n * - `below-icon`: the label is shown below the icon (typical for iPhones)\n * - `beside-icon` the label is shown next to the icon (typical for iPad)\n *\n * By default, the position is chosen automatically based on device width.\n */\n tabBarLabelPosition?: LabelPosition;\n\n /**\n * Style object for the tab label.\n */\n tabBarLabelStyle?: StyleProp<TextStyle>;\n\n /**\n * Whether label font should scale to respect Text Size accessibility settings.\n */\n tabBarAllowFontScaling?: boolean;\n\n /**\n * A function that given { focused: boolean, color: string } returns a React.Node to display in the tab bar.\n */\n tabBarIcon?: (props: {\n focused: boolean;\n color: string;\n size: number;\n }) => React.ReactNode;\n\n /**\n * Style object for the tab icon.\n */\n tabBarIconStyle?: StyleProp<TextStyle>;\n\n /**\n * Text to show in a badge on the tab icon.\n */\n tabBarBadge?: number | string;\n\n /**\n * Custom style for the tab bar badge.\n * You can specify a background color or text color here.\n */\n tabBarBadgeStyle?: StyleProp<TextStyle>;\n\n /**\n * Accessibility label for the tab button. This is read by the screen reader when the user taps the tab.\n * It's recommended to set this if you don't have a label for the tab.\n */\n tabBarAccessibilityLabel?: string;\n\n /**\n * ID to locate this tab button in tests.\n */\n tabBarTestID?: string;\n\n /**\n * Function which returns a React element to render as the tab bar button.\n * Renders `Pressable` by default.\n */\n tabBarButton?: (props: BottomTabBarButtonProps) => React.ReactNode;\n\n /**\n * Color for the icon and label in the active tab.\n */\n tabBarActiveTintColor?: string;\n\n /**\n * Color for the icon and label in the inactive tabs.\n */\n tabBarInactiveTintColor?: string;\n\n /**\n * Background color for the active tab.\n */\n tabBarActiveBackgroundColor?: string;\n\n /**\n * Background color for the inactive tabs.\n */\n tabBarInactiveBackgroundColor?: string;\n\n /**\n * Style object for the tab item container.\n */\n tabBarItemStyle?: StyleProp<ViewStyle>;\n\n /**\n * Whether the tab bar gets hidden when the keyboard is shown. Defaults to `false`.\n */\n tabBarHideOnKeyboard?: boolean;\n\n /**\n * Animation config for showing and hiding the tab bar when the keyboard is shown/hidden.\n */\n tabBarVisibilityAnimationConfig?: {\n show?: TabBarVisibilityAnimationConfig;\n hide?: TabBarVisibilityAnimationConfig;\n };\n\n /**\n * Style object for the tab bar container.\n */\n tabBarStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;\n\n /**\n * Function which returns a React Element to use as background for the tab bar.\n * You could render an image, a gradient, blur view etc.\n *\n * When using `BlurView`, make sure to set `position: 'absolute'` in `tabBarStyle` as well.\n * You'd also need to use `useBottomTabBarHeight()` to add a bottom padding to your content.\n */\n tabBarBackground?: () => React.ReactNode;\n\n /**\n * Whether this screens should render the first time it's accessed. Defaults to `true`.\n * Set it to `false` if you want to render the screen on initial render.\n */\n lazy?: boolean;\n\n /**\n * Function that given returns a React Element to display as a header.\n */\n header?: (props: BottomTabHeaderProps) => React.ReactNode;\n\n /**\n * Whether to show the header. Setting this to `false` hides the header.\n * Defaults to `true`.\n */\n headerShown?: boolean;\n\n /**\n * Whether this screen should be unmounted when navigating away from it.\n * Defaults to `false`.\n */\n unmountOnBlur?: boolean;\n\n /**\n * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.\n * Defaults to `true` when `enableFreeze()` is run at the top of the application.\n * Requires `react-native-screens` version >=3.16.0.\n *\n * Only supported on iOS and Android.\n */\n freezeOnBlur?: boolean;\n};\n\nexport type BottomTabDescriptor = Descriptor<\n BottomTabNavigationOptions,\n BottomTabNavigationProp<ParamListBase>,\n RouteProp<ParamListBase>\n>;\n\nexport type BottomTabDescriptorMap = Record<string, BottomTabDescriptor>;\n\nexport type BottomTabNavigationConfig = {\n /**\n * Function that returns a React element to display as the tab bar.\n */\n tabBar?: (props: BottomTabBarProps) => React.ReactNode;\n /**\n * Safe area insets for the tab bar. This is used to avoid elements like the navigation bar on Android and bottom safe area on iOS.\n * By default, the device's safe area insets are automatically detected. You can override the behavior with this option.\n */\n safeAreaInsets?: {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n };\n /**\n * Whether inactive screens should be detached from the view hierarchy to save memory.\n * Make sure to call `enableScreens` from `react-native-screens` to make it work.\n * Defaults to `true` on Android.\n */\n detachInactiveScreens?: boolean;\n /**\n * Style object for the component wrapping the screen content.\n */\n sceneContainerStyle?: StyleProp<ViewStyle>;\n};\n\nexport type BottomTabHeaderProps = {\n /**\n * Layout of the screen.\n */\n layout: Layout;\n /**\n * Options for the current screen.\n */\n options: BottomTabNavigationOptions;\n /**\n * Route object for the current screen.\n */\n route: RouteProp<ParamListBase>;\n /**\n * Navigation prop for the header.\n */\n navigation: BottomTabNavigationProp<ParamListBase>;\n};\n\nexport type BottomTabBarProps = {\n state: TabNavigationState<ParamListBase>;\n descriptors: BottomTabDescriptorMap;\n navigation: NavigationHelpers<ParamListBase, BottomTabNavigationEventMap>;\n insets: EdgeInsets;\n};\n\nexport type BottomTabBarButtonProps = Omit<\n TouchableWithoutFeedbackProps,\n 'onPress'\n> & {\n to?: string;\n children: React.ReactNode;\n onPress?: (\n e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent\n ) => void;\n};\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["types.tsx"],"sourcesContent":["import type { HeaderOptions } from '@react-navigation/elements';\nimport type {\n Descriptor,\n NavigationHelpers,\n NavigationProp,\n ParamListBase,\n RouteProp,\n TabActionHelpers,\n TabNavigationState,\n} from '@react-navigation/native';\nimport type * as React from 'react';\nimport type {\n Animated,\n GestureResponderEvent,\n StyleProp,\n TextStyle,\n TouchableWithoutFeedbackProps,\n ViewStyle,\n} from 'react-native';\nimport type { EdgeInsets } from 'react-native-safe-area-context';\n\nexport type Layout = { width: number; height: number };\n\nexport type BottomTabNavigationEventMap = {\n /**\n * Event which fires on tapping on the tab in the tab bar.\n */\n tabPress: { data: undefined; canPreventDefault: true };\n /**\n * Event which fires on long press on the tab in the tab bar.\n */\n tabLongPress: { data: undefined };\n};\n\nexport type LabelPosition = 'beside-icon' | 'below-icon';\n\nexport type BottomTabNavigationHelpers = NavigationHelpers<\n ParamListBase,\n BottomTabNavigationEventMap\n> &\n TabActionHelpers<ParamListBase>;\n\nexport type BottomTabNavigationProp<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n NavigatorID extends string | undefined = undefined\n> = NavigationProp<\n ParamList,\n RouteName,\n NavigatorID,\n TabNavigationState<ParamList>,\n BottomTabNavigationOptions,\n BottomTabNavigationEventMap\n> &\n TabActionHelpers<ParamList>;\n\nexport type BottomTabScreenProps<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n NavigatorID extends string | undefined = undefined\n> = {\n navigation: BottomTabNavigationProp<ParamList, RouteName, NavigatorID>;\n route: RouteProp<ParamList, RouteName>;\n};\n\nexport type TimingKeyboardAnimationConfig = {\n animation: 'timing';\n config?: Omit<\n Partial<Animated.TimingAnimationConfig>,\n 'toValue' | 'useNativeDriver'\n >;\n};\n\nexport type SpringKeyboardAnimationConfig = {\n animation: 'spring';\n config?: Omit<\n Partial<Animated.SpringAnimationConfig>,\n 'toValue' | 'useNativeDriver'\n >;\n};\n\nexport type TabBarVisibilityAnimationConfig =\n | TimingKeyboardAnimationConfig\n | SpringKeyboardAnimationConfig;\n\nexport type BottomTabNavigationOptions = HeaderOptions & {\n /**\n * Title text for the screen.\n */\n title?: string;\n\n /**\n * Title string of a tab displayed in the tab bar\n * or a function that given { focused: boolean, color: string, position: 'below-icon' | 'beside-icon', children: string } returns a React.Node to display in tab bar.\n *\n * When undefined, scene title is used. Use `tabBarShowLabel` to hide the label.\n */\n tabBarLabel?:\n | string\n | ((props: {\n focused: boolean;\n color: string;\n position: LabelPosition;\n children: string;\n }) => React.ReactNode);\n\n /**\n * Whether the tab label should be visible. Defaults to `true`.\n */\n tabBarShowLabel?: boolean;\n\n /**\n * Whether the label is shown below the icon or beside the icon.\n *\n * - `below-icon`: the label is shown below the icon (typical for iPhones)\n * - `beside-icon` the label is shown next to the icon (typical for iPad)\n *\n * By default, the position is chosen automatically based on device width.\n */\n tabBarLabelPosition?: LabelPosition;\n\n /**\n * Style object for the tab label.\n */\n tabBarLabelStyle?: StyleProp<TextStyle>;\n\n /**\n * Whether label font should scale to respect Text Size accessibility settings.\n */\n tabBarAllowFontScaling?: boolean;\n\n /**\n * A function that given { focused: boolean, color: string } returns a React.Node to display in the tab bar.\n */\n tabBarIcon?: (props: {\n focused: boolean;\n color: string;\n size: number;\n }) => React.ReactNode;\n\n /**\n * Style object for the tab icon.\n */\n tabBarIconStyle?: StyleProp<TextStyle>;\n\n /**\n * Text to show in a badge on the tab icon.\n */\n tabBarBadge?: number | string;\n\n /**\n * Custom style for the tab bar badge.\n * You can specify a background color or text color here.\n */\n tabBarBadgeStyle?: StyleProp<TextStyle>;\n\n /**\n * Accessibility label for the tab button. This is read by the screen reader when the user taps the tab.\n * It's recommended to set this if you don't have a label for the tab.\n */\n tabBarAccessibilityLabel?: string;\n\n /**\n * ID to locate this tab button in tests.\n */\n tabBarTestID?: string;\n\n /**\n * Function which returns a React element to render as the tab bar button.\n * Renders `Pressable` by default.\n */\n tabBarButton?: (props: BottomTabBarButtonProps) => React.ReactNode;\n\n /**\n * Color for the icon and label in the active tab.\n */\n tabBarActiveTintColor?: string;\n\n /**\n * Color for the icon and label in the inactive tabs.\n */\n tabBarInactiveTintColor?: string;\n\n /**\n * Background color for the active tab.\n */\n tabBarActiveBackgroundColor?: string;\n\n /**\n * Background color for the inactive tabs.\n */\n tabBarInactiveBackgroundColor?: string;\n\n /**\n * Style object for the tab item container.\n */\n tabBarItemStyle?: StyleProp<ViewStyle>;\n\n /**\n * Whether the tab bar gets hidden when the keyboard is shown. Defaults to `false`.\n */\n tabBarHideOnKeyboard?: boolean;\n\n /**\n * Animation config for showing and hiding the tab bar when the keyboard is shown/hidden.\n */\n tabBarVisibilityAnimationConfig?: {\n show?: TabBarVisibilityAnimationConfig;\n hide?: TabBarVisibilityAnimationConfig;\n };\n\n /**\n * Style object for the tab bar container.\n */\n tabBarStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;\n\n /**\n * Function which returns a React Element to use as background for the tab bar.\n * You could render an image, a gradient, blur view etc.\n *\n * When using `BlurView`, make sure to set `position: 'absolute'` in `tabBarStyle` as well.\n * You'd also need to use `useBottomTabBarHeight()` to add a bottom padding to your content.\n */\n tabBarBackground?: () => React.ReactNode;\n\n /**\n * Whether this screens should render the first time it's accessed. Defaults to `true`.\n * Set it to `false` if you want to render the screen on initial render.\n */\n lazy?: boolean;\n\n /**\n * Function that given returns a React Element to display as a header.\n */\n header?: (props: BottomTabHeaderProps) => React.ReactNode;\n\n /**\n * Whether to show the header. Setting this to `false` hides the header.\n * Defaults to `true`.\n */\n headerShown?: boolean;\n\n /**\n * Whether this screen should be unmounted when navigating away from it.\n * Defaults to `false`.\n */\n unmountOnBlur?: boolean;\n\n /**\n * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.\n * Defaults to `true` when `enableFreeze()` is run at the top of the application.\n * Requires `react-native-screens` version >=3.16.0.\n *\n * Only supported on iOS and Android.\n */\n freezeOnBlur?: boolean;\n};\n\nexport type BottomTabDescriptor = Descriptor<\n BottomTabNavigationOptions,\n BottomTabNavigationProp<ParamListBase>,\n RouteProp<ParamListBase>\n>;\n\nexport type BottomTabDescriptorMap = Record<string, BottomTabDescriptor>;\n\nexport type BottomTabNavigationConfig = {\n /**\n * Function that returns a React element to display as the tab bar.\n */\n tabBar?: (props: BottomTabBarProps) => React.ReactNode;\n /**\n * Safe area insets for the tab bar. This is used to avoid elements like the navigation bar on Android and bottom safe area on iOS.\n * By default, the device's safe area insets are automatically detected. You can override the behavior with this option.\n */\n safeAreaInsets?: {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n };\n /**\n * Whether inactive screens should be detached from the view hierarchy to save memory.\n * Make sure to call `enableScreens` from `react-native-screens` to make it work.\n * Defaults to `true` on Android.\n */\n detachInactiveScreens?: boolean;\n /**\n * Style object for the component wrapping the screen content.\n */\n sceneContainerStyle?: StyleProp<ViewStyle>;\n};\n\nexport type BottomTabHeaderProps = {\n /**\n * Layout of the screen.\n */\n layout: Layout;\n /**\n * Options for the current screen.\n */\n options: BottomTabNavigationOptions;\n /**\n * Route object for the current screen.\n */\n route: RouteProp<ParamListBase>;\n /**\n * Navigation prop for the header.\n */\n navigation: BottomTabNavigationProp<ParamListBase>;\n};\n\nexport type BottomTabBarProps = {\n state: TabNavigationState<ParamListBase>;\n descriptors: BottomTabDescriptorMap;\n navigation: NavigationHelpers<ParamListBase, BottomTabNavigationEventMap>;\n insets: EdgeInsets;\n};\n\nexport type BottomTabBarButtonProps = Omit<\n TouchableWithoutFeedbackProps,\n 'onPress'\n> & {\n to?: string;\n children: React.ReactNode;\n onPress?: (\n e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent\n ) => void;\n};\n"],"mappings":""}
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import BottomTabBarHeightContext from './BottomTabBarHeightContext';
3
- export default function useFloatingBottomTabBarHeight() {
3
+ export default function useBottomTabBarHeight() {
4
4
  const height = React.useContext(BottomTabBarHeightContext);
5
5
 
6
6
  if (height === undefined) {
@@ -1 +1 @@
1
- {"version":3,"names":["React","BottomTabBarHeightContext","useFloatingBottomTabBarHeight","height","useContext","undefined","Error"],"sources":["useBottomTabBarHeight.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport BottomTabBarHeightContext from './BottomTabBarHeightContext';\n\nexport default function useFloatingBottomTabBarHeight() {\n const height = React.useContext(BottomTabBarHeightContext);\n\n if (height === undefined) {\n throw new Error(\n \"Couldn't find the bottom tab bar height. Are you inside a screen in Bottom Tab Navigator?\"\n );\n }\n\n return height;\n}\n"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,OAAOC,yBAAP,MAAsC,6BAAtC;AAEA,eAAe,SAASC,6BAAT,GAAyC;EACtD,MAAMC,MAAM,GAAGH,KAAK,CAACI,UAAN,CAAiBH,yBAAjB,CAAf;;EAEA,IAAIE,MAAM,KAAKE,SAAf,EAA0B;IACxB,MAAM,IAAIC,KAAJ,CACJ,2FADI,CAAN;EAGD;;EAED,OAAOH,MAAP;AACD"}
1
+ {"version":3,"names":["React","BottomTabBarHeightContext","useBottomTabBarHeight","height","useContext","undefined","Error"],"sources":["useBottomTabBarHeight.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport BottomTabBarHeightContext from './BottomTabBarHeightContext';\n\nexport default function useBottomTabBarHeight() {\n const height = React.useContext(BottomTabBarHeightContext);\n\n if (height === undefined) {\n throw new Error(\n \"Couldn't find the bottom tab bar height. Are you inside a screen in Bottom Tab Navigator?\"\n );\n }\n\n return height;\n}\n"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,OAAOC,yBAAP,MAAsC,6BAAtC;AAEA,eAAe,SAASC,qBAAT,GAAiC;EAC9C,MAAMC,MAAM,GAAGH,KAAK,CAACI,UAAN,CAAiBH,yBAAjB,CAAf;;EAEA,IAAIE,MAAM,KAAKE,SAAf,EAA0B;IACxB,MAAM,IAAIC,KAAJ,CACJ,2FADI,CAAN;EAGD;;EAED,OAAOH,MAAP;AACD"}
@@ -276,6 +276,7 @@ export default function BottomTabBar(_ref3) {
276
276
  value: route
277
277
  }, /*#__PURE__*/React.createElement(BottomTabItem, {
278
278
  route: route,
279
+ descriptor: descriptors[route.key],
279
280
  focused: focused,
280
281
  horizontal: hasHorizontalLabels,
281
282
  onPress: onPress,
@@ -1 +1 @@
1
- {"version":3,"names":["MissingIcon","CommonActions","NavigationContext","NavigationRouteContext","useLinkBuilder","useTheme","React","Animated","Platform","StyleSheet","View","useSafeAreaFrame","BottomTabBarHeightCallbackContext","useIsKeyboardShown","BottomTabItem","DEFAULT_TABBAR_HEIGHT","COMPACT_TABBAR_HEIGHT","DEFAULT_MAX_TAB_ITEM_WIDTH","useNativeDriver","OS","shouldUseHorizontalLabels","state","descriptors","layout","dimensions","tabBarLabelPosition","routes","index","key","options","width","maxTabWidth","reduce","acc","route","tabBarItemStyle","flattenedStyle","flatten","maxWidth","height","getPaddingBottom","insets","Math","max","bottom","select","ios","default","getTabBarHeight","style","rest","customHeight","isLandscape","horizontalLabels","paddingBottom","isPad","BottomTabBar","navigation","colors","buildLink","focusedRoute","focusedDescriptor","focusedOptions","tabBarShowLabel","tabBarHideOnKeyboard","tabBarVisibilityAnimationConfig","tabBarStyle","tabBarBackground","tabBarActiveTintColor","tabBarInactiveTintColor","tabBarActiveBackgroundColor","tabBarInactiveBackgroundColor","isKeyboardShown","onHeightChange","useContext","shouldShowTabBar","visibilityAnimationConfigRef","useRef","useEffect","current","isTabBarHidden","setIsTabBarHidden","useState","visible","Value","visibilityAnimationConfig","animation","show","spring","timing","toValue","duration","config","start","finished","hide","stopAnimation","setLayout","handleLayout","e","nativeEvent","tabBarHeight","hasHorizontalLabels","tabBarBackgroundElement","styles","tabBar","backgroundColor","card","borderTopColor","border","transform","translateY","interpolate","inputRange","outputRange","hairlineWidth","position","paddingHorizontal","left","right","absoluteFill","content","map","focused","onPress","event","emit","type","target","canPreventDefault","defaultPrevented","dispatch","navigate","name","merge","onLongPress","label","tabBarLabel","undefined","title","accessibilityLabel","tabBarAccessibilityLabel","length","params","tabBarTestID","tabBarAllowFontScaling","tabBarButton","tabBarIcon","color","size","tabBarBadge","tabBarBadgeStyle","tabBarLabelStyle","tabBarIconStyle","create","borderTopWidth","elevation","flex","flexDirection"],"sources":["BottomTabBar.tsx"],"sourcesContent":["import { MissingIcon } from '@react-navigation/elements';\nimport {\n CommonActions,\n NavigationContext,\n NavigationRouteContext,\n ParamListBase,\n TabNavigationState,\n useLinkBuilder,\n useTheme,\n} from '@react-navigation/native';\nimport React from 'react';\nimport {\n Animated,\n LayoutChangeEvent,\n Platform,\n StyleProp,\n StyleSheet,\n View,\n ViewStyle,\n} from 'react-native';\nimport { EdgeInsets, useSafeAreaFrame } from 'react-native-safe-area-context';\n\nimport type { BottomTabBarProps, BottomTabDescriptorMap } from '../types';\nimport BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';\nimport useIsKeyboardShown from '../utils/useIsKeyboardShown';\nimport BottomTabItem from './BottomTabItem';\n\ntype Props = BottomTabBarProps & {\n style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;\n};\n\nconst DEFAULT_TABBAR_HEIGHT = 49;\nconst COMPACT_TABBAR_HEIGHT = 32;\nconst DEFAULT_MAX_TAB_ITEM_WIDTH = 125;\n\nconst useNativeDriver = Platform.OS !== 'web';\n\ntype Options = {\n state: TabNavigationState<ParamListBase>;\n descriptors: BottomTabDescriptorMap;\n layout: { height: number; width: number };\n dimensions: { height: number; width: number };\n};\n\nconst shouldUseHorizontalLabels = ({\n state,\n descriptors,\n layout,\n dimensions,\n}: Options) => {\n const { tabBarLabelPosition } =\n descriptors[state.routes[state.index].key].options;\n\n if (tabBarLabelPosition) {\n switch (tabBarLabelPosition) {\n case 'beside-icon':\n return true;\n case 'below-icon':\n return false;\n }\n }\n\n if (layout.width >= 768) {\n // Screen size matches a tablet\n const maxTabWidth = state.routes.reduce((acc, route) => {\n const { tabBarItemStyle } = descriptors[route.key].options;\n const flattenedStyle = StyleSheet.flatten(tabBarItemStyle);\n\n if (flattenedStyle) {\n if (typeof flattenedStyle.width === 'number') {\n return acc + flattenedStyle.width;\n } else if (typeof flattenedStyle.maxWidth === 'number') {\n return acc + flattenedStyle.maxWidth;\n }\n }\n\n return acc + DEFAULT_MAX_TAB_ITEM_WIDTH;\n }, 0);\n\n return maxTabWidth <= layout.width;\n } else {\n return dimensions.width > dimensions.height;\n }\n};\n\nconst getPaddingBottom = (insets: EdgeInsets) =>\n Math.max(insets.bottom - Platform.select({ ios: 4, default: 0 }), 0);\n\nexport const getTabBarHeight = ({\n state,\n descriptors,\n dimensions,\n insets,\n style,\n ...rest\n}: Options & {\n insets: EdgeInsets;\n style: Animated.WithAnimatedValue<StyleProp<ViewStyle>> | undefined;\n}) => {\n // @ts-ignore\n const customHeight = StyleSheet.flatten(style)?.height;\n\n if (typeof customHeight === 'number') {\n return customHeight;\n }\n\n const isLandscape = dimensions.width > dimensions.height;\n const horizontalLabels = shouldUseHorizontalLabels({\n state,\n descriptors,\n dimensions,\n ...rest,\n });\n const paddingBottom = getPaddingBottom(insets);\n\n if (\n Platform.OS === 'ios' &&\n !Platform.isPad &&\n isLandscape &&\n horizontalLabels\n ) {\n return COMPACT_TABBAR_HEIGHT + paddingBottom;\n }\n\n return DEFAULT_TABBAR_HEIGHT + paddingBottom;\n};\n\nexport default function BottomTabBar({\n state,\n navigation,\n descriptors,\n insets,\n style,\n}: Props) {\n const { colors } = useTheme();\n const buildLink = useLinkBuilder();\n\n const focusedRoute = state.routes[state.index];\n const focusedDescriptor = descriptors[focusedRoute.key];\n const focusedOptions = focusedDescriptor.options;\n\n const {\n tabBarShowLabel,\n tabBarHideOnKeyboard = false,\n tabBarVisibilityAnimationConfig,\n tabBarStyle,\n tabBarBackground,\n tabBarActiveTintColor,\n tabBarInactiveTintColor,\n tabBarActiveBackgroundColor,\n tabBarInactiveBackgroundColor,\n } = focusedOptions;\n\n const dimensions = useSafeAreaFrame();\n const isKeyboardShown = useIsKeyboardShown();\n\n const onHeightChange = React.useContext(BottomTabBarHeightCallbackContext);\n\n const shouldShowTabBar = !(tabBarHideOnKeyboard && isKeyboardShown);\n\n const visibilityAnimationConfigRef = React.useRef(\n tabBarVisibilityAnimationConfig\n );\n\n React.useEffect(() => {\n visibilityAnimationConfigRef.current = tabBarVisibilityAnimationConfig;\n });\n\n const [isTabBarHidden, setIsTabBarHidden] = React.useState(!shouldShowTabBar);\n\n const [visible] = React.useState(\n () => new Animated.Value(shouldShowTabBar ? 1 : 0)\n );\n\n React.useEffect(() => {\n const visibilityAnimationConfig = visibilityAnimationConfigRef.current;\n\n if (shouldShowTabBar) {\n const animation =\n visibilityAnimationConfig?.show?.animation === 'spring'\n ? Animated.spring\n : Animated.timing;\n\n animation(visible, {\n toValue: 1,\n useNativeDriver,\n duration: 250,\n ...visibilityAnimationConfig?.show?.config,\n }).start(({ finished }) => {\n if (finished) {\n setIsTabBarHidden(false);\n }\n });\n } else {\n setIsTabBarHidden(true);\n\n const animation =\n visibilityAnimationConfig?.hide?.animation === 'spring'\n ? Animated.spring\n : Animated.timing;\n\n animation(visible, {\n toValue: 0,\n useNativeDriver,\n duration: 200,\n ...visibilityAnimationConfig?.hide?.config,\n }).start();\n }\n\n return () => visible.stopAnimation();\n }, [visible, shouldShowTabBar]);\n\n const [layout, setLayout] = React.useState({\n height: 0,\n width: dimensions.width,\n });\n\n const handleLayout = (e: LayoutChangeEvent) => {\n const { height, width } = e.nativeEvent.layout;\n\n onHeightChange?.(height);\n\n setLayout((layout) => {\n if (height === layout.height && width === layout.width) {\n return layout;\n } else {\n return {\n height,\n width,\n };\n }\n });\n };\n\n const { routes } = state;\n\n const paddingBottom = getPaddingBottom(insets);\n const tabBarHeight = getTabBarHeight({\n state,\n descriptors,\n insets,\n dimensions,\n layout,\n style: [tabBarStyle, style],\n });\n\n const hasHorizontalLabels = shouldUseHorizontalLabels({\n state,\n descriptors,\n dimensions,\n layout,\n });\n\n const tabBarBackgroundElement = tabBarBackground?.();\n\n return (\n <Animated.View\n style={[\n styles.tabBar,\n {\n backgroundColor:\n tabBarBackgroundElement != null ? 'transparent' : colors.card,\n borderTopColor: colors.border,\n },\n {\n transform: [\n {\n translateY: visible.interpolate({\n inputRange: [0, 1],\n outputRange: [\n layout.height + paddingBottom + StyleSheet.hairlineWidth,\n 0,\n ],\n }),\n },\n ],\n // Absolutely position the tab bar so that the content is below it\n // This is needed to avoid gap at bottom when the tab bar is hidden\n position: isTabBarHidden ? 'absolute' : (null as any),\n },\n {\n height: tabBarHeight,\n paddingBottom,\n paddingHorizontal: Math.max(insets.left, insets.right),\n },\n tabBarStyle,\n ]}\n pointerEvents={isTabBarHidden ? 'none' : 'auto'}\n onLayout={handleLayout}\n >\n <View pointerEvents=\"none\" style={StyleSheet.absoluteFill}>\n {tabBarBackgroundElement}\n </View>\n <View accessibilityRole=\"tablist\" style={styles.content}>\n {routes.map((route, index) => {\n const focused = index === state.index;\n const { options } = descriptors[route.key];\n\n const onPress = () => {\n const event = navigation.emit({\n type: 'tabPress',\n target: route.key,\n canPreventDefault: true,\n });\n\n if (!focused && !event.defaultPrevented) {\n navigation.dispatch({\n ...CommonActions.navigate({ name: route.name, merge: true }),\n target: state.key,\n });\n }\n };\n\n const onLongPress = () => {\n navigation.emit({\n type: 'tabLongPress',\n target: route.key,\n });\n };\n\n const label =\n options.tabBarLabel !== undefined\n ? options.tabBarLabel\n : options.title !== undefined\n ? options.title\n : route.name;\n\n const accessibilityLabel =\n options.tabBarAccessibilityLabel !== undefined\n ? options.tabBarAccessibilityLabel\n : typeof label === 'string' && Platform.OS === 'ios'\n ? `${label}, tab, ${index + 1} of ${routes.length}`\n : undefined;\n\n return (\n <NavigationContext.Provider\n key={route.key}\n value={descriptors[route.key].navigation}\n >\n <NavigationRouteContext.Provider value={route}>\n <BottomTabItem\n route={route}\n focused={focused}\n horizontal={hasHorizontalLabels}\n onPress={onPress}\n onLongPress={onLongPress}\n accessibilityLabel={accessibilityLabel}\n to={buildLink(route.name, route.params)}\n testID={options.tabBarTestID}\n allowFontScaling={options.tabBarAllowFontScaling}\n activeTintColor={tabBarActiveTintColor}\n inactiveTintColor={tabBarInactiveTintColor}\n activeBackgroundColor={tabBarActiveBackgroundColor}\n inactiveBackgroundColor={tabBarInactiveBackgroundColor}\n button={options.tabBarButton}\n icon={\n options.tabBarIcon ??\n (({ color, size }) => (\n <MissingIcon color={color} size={size} />\n ))\n }\n badge={options.tabBarBadge}\n badgeStyle={options.tabBarBadgeStyle}\n label={label}\n showLabel={tabBarShowLabel}\n labelStyle={options.tabBarLabelStyle}\n iconStyle={options.tabBarIconStyle}\n style={options.tabBarItemStyle}\n />\n </NavigationRouteContext.Provider>\n </NavigationContext.Provider>\n );\n })}\n </View>\n </Animated.View>\n );\n}\n\nconst styles = StyleSheet.create({\n tabBar: {\n left: 0,\n right: 0,\n bottom: 0,\n borderTopWidth: StyleSheet.hairlineWidth,\n elevation: 8,\n },\n content: {\n flex: 1,\n flexDirection: 'row',\n },\n});\n"],"mappings":"AAAA,SAASA,WAAT,QAA4B,4BAA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+G,cAAc,EAAElJ,UAAU,CAAC0G,aAJrB;IAKNyC,SAAS,EAAE;EALL,CADuB;EAQ/BnC,OAAO,EAAE;IACPoC,IAAI,EAAE,CADC;IAEPC,aAAa,EAAE;EAFR;AARsB,CAAlB,CAAf"}
1
+ {"version":3,"names":["MissingIcon","CommonActions","NavigationContext","NavigationRouteContext","useLinkBuilder","useTheme","React","Animated","Platform","StyleSheet","View","useSafeAreaFrame","BottomTabBarHeightCallbackContext","useIsKeyboardShown","BottomTabItem","DEFAULT_TABBAR_HEIGHT","COMPACT_TABBAR_HEIGHT","DEFAULT_MAX_TAB_ITEM_WIDTH","useNativeDriver","OS","shouldUseHorizontalLabels","state","descriptors","layout","dimensions","tabBarLabelPosition","routes","index","key","options","width","maxTabWidth","reduce","acc","route","tabBarItemStyle","flattenedStyle","flatten","maxWidth","height","getPaddingBottom","insets","Math","max","bottom","select","ios","default","getTabBarHeight","style","rest","customHeight","isLandscape","horizontalLabels","paddingBottom","isPad","BottomTabBar","navigation","colors","buildLink","focusedRoute","focusedDescriptor","focusedOptions","tabBarShowLabel","tabBarHideOnKeyboard","tabBarVisibilityAnimationConfig","tabBarStyle","tabBarBackground","tabBarActiveTintColor","tabBarInactiveTintColor","tabBarActiveBackgroundColor","tabBarInactiveBackgroundColor","isKeyboardShown","onHeightChange","useContext","shouldShowTabBar","visibilityAnimationConfigRef","useRef","useEffect","current","isTabBarHidden","setIsTabBarHidden","useState","visible","Value","visibilityAnimationConfig","animation","show","spring","timing","toValue","duration","config","start","finished","hide","stopAnimation","setLayout","handleLayout","e","nativeEvent","tabBarHeight","hasHorizontalLabels","tabBarBackgroundElement","styles","tabBar","backgroundColor","card","borderTopColor","border","transform","translateY","interpolate","inputRange","outputRange","hairlineWidth","position","paddingHorizontal","left","right","absoluteFill","content","map","focused","onPress","event","emit","type","target","canPreventDefault","defaultPrevented","dispatch","navigate","name","merge","onLongPress","label","tabBarLabel","undefined","title","accessibilityLabel","tabBarAccessibilityLabel","length","params","tabBarTestID","tabBarAllowFontScaling","tabBarButton","tabBarIcon","color","size","tabBarBadge","tabBarBadgeStyle","tabBarLabelStyle","tabBarIconStyle","create","borderTopWidth","elevation","flex","flexDirection"],"sources":["BottomTabBar.tsx"],"sourcesContent":["import { MissingIcon } from '@react-navigation/elements';\nimport {\n CommonActions,\n NavigationContext,\n NavigationRouteContext,\n ParamListBase,\n TabNavigationState,\n useLinkBuilder,\n useTheme,\n} from '@react-navigation/native';\nimport React from 'react';\nimport {\n Animated,\n LayoutChangeEvent,\n Platform,\n StyleProp,\n StyleSheet,\n View,\n ViewStyle,\n} from 'react-native';\nimport { EdgeInsets, useSafeAreaFrame } from 'react-native-safe-area-context';\n\nimport type { BottomTabBarProps, BottomTabDescriptorMap } from '../types';\nimport BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';\nimport useIsKeyboardShown from '../utils/useIsKeyboardShown';\nimport BottomTabItem from './BottomTabItem';\n\ntype Props = BottomTabBarProps & {\n style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;\n};\n\nconst DEFAULT_TABBAR_HEIGHT = 49;\nconst COMPACT_TABBAR_HEIGHT = 32;\nconst DEFAULT_MAX_TAB_ITEM_WIDTH = 125;\n\nconst useNativeDriver = Platform.OS !== 'web';\n\ntype Options = {\n state: TabNavigationState<ParamListBase>;\n descriptors: BottomTabDescriptorMap;\n layout: { height: number; width: number };\n dimensions: { height: number; width: number };\n};\n\nconst shouldUseHorizontalLabels = ({\n state,\n descriptors,\n layout,\n dimensions,\n}: Options) => {\n const { tabBarLabelPosition } =\n descriptors[state.routes[state.index].key].options;\n\n if (tabBarLabelPosition) {\n switch (tabBarLabelPosition) {\n case 'beside-icon':\n return true;\n case 'below-icon':\n return false;\n }\n }\n\n if (layout.width >= 768) {\n // Screen size matches a tablet\n const maxTabWidth = state.routes.reduce((acc, route) => {\n const { tabBarItemStyle } = descriptors[route.key].options;\n const flattenedStyle = StyleSheet.flatten(tabBarItemStyle);\n\n if (flattenedStyle) {\n if (typeof flattenedStyle.width === 'number') {\n return acc + flattenedStyle.width;\n } else if (typeof flattenedStyle.maxWidth === 'number') {\n return acc + flattenedStyle.maxWidth;\n }\n }\n\n return acc + DEFAULT_MAX_TAB_ITEM_WIDTH;\n }, 0);\n\n return maxTabWidth <= layout.width;\n } else {\n return dimensions.width > dimensions.height;\n }\n};\n\nconst getPaddingBottom = (insets: EdgeInsets) =>\n Math.max(insets.bottom - Platform.select({ ios: 4, default: 0 }), 0);\n\nexport const getTabBarHeight = ({\n state,\n descriptors,\n dimensions,\n insets,\n style,\n ...rest\n}: Options & {\n insets: EdgeInsets;\n style: Animated.WithAnimatedValue<StyleProp<ViewStyle>> | undefined;\n}) => {\n // @ts-ignore\n const customHeight = StyleSheet.flatten(style)?.height;\n\n if (typeof customHeight === 'number') {\n return customHeight;\n }\n\n const isLandscape = dimensions.width > dimensions.height;\n const horizontalLabels = shouldUseHorizontalLabels({\n state,\n descriptors,\n dimensions,\n ...rest,\n });\n const paddingBottom = getPaddingBottom(insets);\n\n if (\n Platform.OS === 'ios' &&\n !Platform.isPad &&\n isLandscape &&\n horizontalLabels\n ) {\n return COMPACT_TABBAR_HEIGHT + paddingBottom;\n }\n\n return DEFAULT_TABBAR_HEIGHT + paddingBottom;\n};\n\nexport default function BottomTabBar({\n state,\n navigation,\n descriptors,\n insets,\n style,\n}: Props) {\n const { colors } = useTheme();\n const buildLink = useLinkBuilder();\n\n const focusedRoute = state.routes[state.index];\n const focusedDescriptor = descriptors[focusedRoute.key];\n const focusedOptions = focusedDescriptor.options;\n\n const {\n tabBarShowLabel,\n tabBarHideOnKeyboard = false,\n tabBarVisibilityAnimationConfig,\n tabBarStyle,\n tabBarBackground,\n tabBarActiveTintColor,\n tabBarInactiveTintColor,\n tabBarActiveBackgroundColor,\n tabBarInactiveBackgroundColor,\n } = focusedOptions;\n\n const dimensions = useSafeAreaFrame();\n const isKeyboardShown = useIsKeyboardShown();\n\n const onHeightChange = React.useContext(BottomTabBarHeightCallbackContext);\n\n const shouldShowTabBar = !(tabBarHideOnKeyboard && isKeyboardShown);\n\n const visibilityAnimationConfigRef = React.useRef(\n tabBarVisibilityAnimationConfig\n );\n\n React.useEffect(() => {\n visibilityAnimationConfigRef.current = tabBarVisibilityAnimationConfig;\n });\n\n const [isTabBarHidden, setIsTabBarHidden] = React.useState(!shouldShowTabBar);\n\n const [visible] = React.useState(\n () => new Animated.Value(shouldShowTabBar ? 1 : 0)\n );\n\n React.useEffect(() => {\n const visibilityAnimationConfig = visibilityAnimationConfigRef.current;\n\n if (shouldShowTabBar) {\n const animation =\n visibilityAnimationConfig?.show?.animation === 'spring'\n ? Animated.spring\n : Animated.timing;\n\n animation(visible, {\n toValue: 1,\n useNativeDriver,\n duration: 250,\n ...visibilityAnimationConfig?.show?.config,\n }).start(({ finished }) => {\n if (finished) {\n setIsTabBarHidden(false);\n }\n });\n } else {\n setIsTabBarHidden(true);\n\n const animation =\n visibilityAnimationConfig?.hide?.animation === 'spring'\n ? Animated.spring\n : Animated.timing;\n\n animation(visible, {\n toValue: 0,\n useNativeDriver,\n duration: 200,\n ...visibilityAnimationConfig?.hide?.config,\n }).start();\n }\n\n return () => visible.stopAnimation();\n }, [visible, shouldShowTabBar]);\n\n const [layout, setLayout] = React.useState({\n height: 0,\n width: dimensions.width,\n });\n\n const handleLayout = (e: LayoutChangeEvent) => {\n const { height, width } = e.nativeEvent.layout;\n\n onHeightChange?.(height);\n\n setLayout((layout) => {\n if (height === layout.height && width === layout.width) {\n return layout;\n } else {\n return {\n height,\n width,\n };\n }\n });\n };\n\n const { routes } = state;\n\n const paddingBottom = getPaddingBottom(insets);\n const tabBarHeight = getTabBarHeight({\n state,\n descriptors,\n insets,\n dimensions,\n layout,\n style: [tabBarStyle, style],\n });\n\n const hasHorizontalLabels = shouldUseHorizontalLabels({\n state,\n descriptors,\n dimensions,\n layout,\n });\n\n const tabBarBackgroundElement = tabBarBackground?.();\n\n return (\n <Animated.View\n style={[\n styles.tabBar,\n {\n backgroundColor:\n tabBarBackgroundElement != null ? 'transparent' : colors.card,\n borderTopColor: colors.border,\n },\n {\n transform: [\n {\n translateY: visible.interpolate({\n inputRange: [0, 1],\n outputRange: [\n layout.height + paddingBottom + StyleSheet.hairlineWidth,\n 0,\n ],\n }),\n },\n ],\n // Absolutely position the tab bar so that the content is below it\n // This is needed to avoid gap at bottom when the tab bar is hidden\n position: isTabBarHidden ? 'absolute' : (null as any),\n },\n {\n height: tabBarHeight,\n paddingBottom,\n paddingHorizontal: Math.max(insets.left, insets.right),\n },\n tabBarStyle,\n ]}\n pointerEvents={isTabBarHidden ? 'none' : 'auto'}\n onLayout={handleLayout}\n >\n <View pointerEvents=\"none\" style={StyleSheet.absoluteFill}>\n {tabBarBackgroundElement}\n </View>\n <View accessibilityRole=\"tablist\" style={styles.content}>\n {routes.map((route, index) => {\n const focused = index === state.index;\n const { options } = descriptors[route.key];\n\n const onPress = () => {\n const event = navigation.emit({\n type: 'tabPress',\n target: route.key,\n canPreventDefault: true,\n });\n\n if (!focused && !event.defaultPrevented) {\n navigation.dispatch({\n ...CommonActions.navigate({ name: route.name, merge: true }),\n target: state.key,\n });\n }\n };\n\n const onLongPress = () => {\n navigation.emit({\n type: 'tabLongPress',\n target: route.key,\n });\n };\n\n const label =\n options.tabBarLabel !== undefined\n ? options.tabBarLabel\n : options.title !== undefined\n ? options.title\n : route.name;\n\n const accessibilityLabel =\n options.tabBarAccessibilityLabel !== undefined\n ? options.tabBarAccessibilityLabel\n : typeof label === 'string' && Platform.OS === 'ios'\n ? `${label}, tab, ${index + 1} of ${routes.length}`\n : undefined;\n\n return (\n <NavigationContext.Provider\n key={route.key}\n value={descriptors[route.key].navigation}\n >\n <NavigationRouteContext.Provider value={route}>\n <BottomTabItem\n route={route}\n descriptor={descriptors[route.key]}\n focused={focused}\n horizontal={hasHorizontalLabels}\n onPress={onPress}\n onLongPress={onLongPress}\n accessibilityLabel={accessibilityLabel}\n to={buildLink(route.name, route.params)}\n testID={options.tabBarTestID}\n allowFontScaling={options.tabBarAllowFontScaling}\n activeTintColor={tabBarActiveTintColor}\n inactiveTintColor={tabBarInactiveTintColor}\n activeBackgroundColor={tabBarActiveBackgroundColor}\n inactiveBackgroundColor={tabBarInactiveBackgroundColor}\n button={options.tabBarButton}\n icon={\n options.tabBarIcon ??\n (({ color, size }) => (\n <MissingIcon color={color} size={size} />\n ))\n }\n badge={options.tabBarBadge}\n badgeStyle={options.tabBarBadgeStyle}\n label={label}\n showLabel={tabBarShowLabel}\n labelStyle={options.tabBarLabelStyle}\n iconStyle={options.tabBarIconStyle}\n style={options.tabBarItemStyle}\n />\n </NavigationRouteContext.Provider>\n </NavigationContext.Provider>\n );\n })}\n </View>\n </Animated.View>\n );\n}\n\nconst styles = StyleSheet.create({\n tabBar: {\n left: 0,\n right: 0,\n bottom: 0,\n borderTopWidth: StyleSheet.hairlineWidth,\n elevation: 8,\n },\n content: {\n flex: 1,\n flexDirection: 'row',\n },\n});\n"],"mappings":"AAAA,SAASA,WAAT,QAA4B,4BAA5B;AACA,SACEC,aADF,EAEEC,iBAFF,EAGEC,sBAHF,EAMEC,cANF,EAOEC,QAPF,QAQO,0BARP;AASA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SACEC,QADF,EAGEC,QAHF,EAKEC,UALF,EAMEC,IANF,QAQO,cARP;AASA,SAAqBC,gBAArB,QAA6C,gCAA7C;AAGA,OAAOC,iCAAP,MAA8C,4CAA9C;AACA,OAAOC,kBAAP,MAA+B,6BAA/B;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AAMA,MAAMC,qBAAqB,GAAG,EAA9B;AACA,MAAMC,qBAAqB,GAAG,EAA9B;AACA,MAAMC,0BAA0B,GAAG,GAAnC;AAEA,MAAMC,eAAe,GAAGV,QAAQ,CAACW,EAAT,KAAgB,KAAxC;;AASA,MAAMC,yBAAyB,GAAG,QAKnB;EAAA,IALoB;IACjCC,KADiC;IAEjCC,WAFiC;IAGjCC,MAHiC;IAIjCC;EAJiC,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M,EAAE1C,OAAO,CAACqH,YAflB;MAgBE,IAAI,yBACFrH,OAAO,CAACsH,UADN,qEAED;QAAA,IAAC;UAAEC,KAAF;UAASC;QAAT,CAAD;QAAA,oBACC,oBAAC,WAAD;UAAa,KAAK,EAAED,KAApB;UAA2B,IAAI,EAAEC;QAAjC,EADD;MAAA,CAlBL;MAsBE,KAAK,EAAExH,OAAO,CAACyH,WAtBjB;MAuBE,UAAU,EAAEzH,OAAO,CAAC0H,gBAvBtB;MAwBE,KAAK,EAAEf,KAxBT;MAyBE,SAAS,EAAEzE,eAzBb;MA0BE,UAAU,EAAElC,OAAO,CAAC2H,gBA1BtB;MA2BE,SAAS,EAAE3H,OAAO,CAAC4H,eA3BrB;MA4BE,KAAK,EAAE5H,OAAO,CAACM;IA5BjB,EADF,CAJF,CADF;EAuCD,CA/EA,CADH,CArCF,CADF;AA0HD;AAED,MAAMqE,MAAM,GAAG/F,UAAU,CAACiJ,MAAX,CAAkB;EAC/BjD,MAAM,EAAE;IACNa,IAAI,EAAE,CADA;IAENC,KAAK,EAAE,CAFD;IAGN3E,MAAM,EAAE,CAHF;IAIN+G,cAAc,EAAElJ,UAAU,CAAC0G,aAJrB;IAKNyC,SAAS,EAAE;EALL,CADuB;EAQ/BnC,OAAO,EAAE;IACPoC,IAAI,EAAE,CADC;IAEPC,aAAa,EAAE;EAFR;AARsB,CAAlB,CAAf"}
@@ -9,6 +9,7 @@ export default function BottomTabBarItem(_ref) {
9
9
  let {
10
10
  focused,
11
11
  route,
12
+ descriptor,
12
13
  label,
13
14
  icon,
14
15
  badge,
@@ -89,10 +90,15 @@ export default function BottomTabBarItem(_ref) {
89
90
  }, label);
90
91
  }
91
92
 
93
+ const {
94
+ options
95
+ } = descriptor;
96
+ const children = typeof options.tabBarLabel === 'string' ? options.tabBarLabel : options.title !== undefined ? options.title : route.name;
92
97
  return label({
93
98
  focused,
94
99
  color,
95
- position: horizontal ? 'beside-icon' : 'below-icon'
100
+ position: horizontal ? 'beside-icon' : 'below-icon',
101
+ children
96
102
  });
97
103
  };
98
104
 
@@ -1 +1 @@
1
- {"version":3,"names":["Link","useTheme","Color","React","Platform","Pressable","StyleSheet","Text","TabBarIcon","BottomTabBarItem","focused","route","label","icon","badge","badgeStyle","to","button","children","style","onPress","accessibilityRole","rest","OS","styles","e","metaKey","altKey","ctrlKey","shiftKey","preventDefault","accessibilityLabel","testID","onLongPress","horizontal","activeTintColor","customActiveTintColor","inactiveTintColor","customInactiveTintColor","activeBackgroundColor","inactiveBackgroundColor","showLabel","allowFontScaling","labelStyle","iconStyle","colors","undefined","primary","text","mix","card","hex","renderLabel","color","labelBeside","labelBeneath","position","renderIcon","activeOpacity","inactiveOpacity","scene","backgroundColor","select","ios","default","accessibilityState","selected","accessibilityStates","tab","tabLandscape","tabPortrait","create","flex","alignItems","justifyContent","flexDirection","textAlign","fontSize","marginLeft","marginTop","display"],"sources":["BottomTabItem.tsx"],"sourcesContent":["import { Link, Route, useTheme } from '@react-navigation/native';\nimport Color from 'color';\nimport React from 'react';\nimport {\n GestureResponderEvent,\n Platform,\n Pressable,\n StyleProp,\n StyleSheet,\n Text,\n TextStyle,\n ViewStyle,\n} from 'react-native';\n\nimport type { BottomTabBarButtonProps, LabelPosition } from '../types';\nimport TabBarIcon from './TabBarIcon';\n\ntype Props = {\n /**\n * Whether the tab is focused.\n */\n focused: boolean;\n /**\n * The route object which should be specified by the tab.\n */\n route: Route<string>;\n /**\n * The label text of the tab.\n */\n label:\n | string\n | ((props: {\n focused: boolean;\n color: string;\n position: LabelPosition;\n }) => React.ReactNode);\n /**\n * Icon to display for the tab.\n */\n icon: (props: {\n focused: boolean;\n size: number;\n color: string;\n }) => React.ReactNode;\n /**\n * Text to show in a badge on the tab icon.\n */\n badge?: number | string;\n /**\n * Custom style for the badge.\n */\n badgeStyle?: StyleProp<TextStyle>;\n /**\n * URL to use for the link to the tab.\n */\n to?: string;\n /**\n * The button for the tab. Uses a `TouchableWithoutFeedback` by default.\n */\n button?: (props: BottomTabBarButtonProps) => React.ReactNode;\n /**\n * The accessibility label for the tab.\n */\n accessibilityLabel?: string;\n /**\n * An unique ID for testing for the tab.\n */\n testID?: string;\n /**\n * Function to execute on press in React Native.\n * On the web, this will use onClick.\n */\n onPress: (\n e: React.MouseEvent<HTMLElement, MouseEvent> | GestureResponderEvent\n ) => void;\n /**\n * Function to execute on long press.\n */\n onLongPress: (e: GestureResponderEvent) => void;\n /**\n * Whether the label should be aligned with the icon horizontally.\n */\n horizontal: boolean;\n /**\n * Color for the icon and label when the item is active.\n */\n activeTintColor?: string;\n /**\n * Color for the icon and label when the item is inactive.\n */\n inactiveTintColor?: string;\n /**\n * Background color for item when its active.\n */\n activeBackgroundColor?: string;\n /**\n * Background color for item when its inactive.\n */\n inactiveBackgroundColor?: string;\n /**\n * Whether to show the label text for the tab.\n */\n showLabel?: boolean;\n /**\n * Whether to allow scaling the font for the label for accessibility purposes.\n */\n allowFontScaling?: boolean;\n /**\n * Style object for the label element.\n */\n labelStyle?: StyleProp<TextStyle>;\n /**\n * Style object for the icon element.\n */\n iconStyle?: StyleProp<ViewStyle>;\n /**\n * Style object for the wrapper element.\n */\n style?: StyleProp<ViewStyle>;\n};\n\nexport default function BottomTabBarItem({\n focused,\n route,\n label,\n icon,\n badge,\n badgeStyle,\n to,\n button = ({\n children,\n style,\n onPress,\n to,\n accessibilityRole,\n ...rest\n }: BottomTabBarButtonProps) => {\n if (Platform.OS === 'web' && to) {\n // React Native Web doesn't forward `onClick` if we use `TouchableWithoutFeedback`.\n // We need to use `onClick` to be able to prevent default browser handling of links.\n return (\n <Link\n {...rest}\n to={to}\n style={[styles.button, style]}\n onPress={(e: any) => {\n if (\n !(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && // ignore clicks with modifier keys\n (e.button == null || e.button === 0) // ignore everything but left clicks\n ) {\n e.preventDefault();\n onPress?.(e);\n }\n }}\n >\n {children}\n </Link>\n );\n } else {\n return (\n <Pressable\n {...rest}\n accessibilityRole={accessibilityRole}\n onPress={onPress}\n style={style}\n >\n {children}\n </Pressable>\n );\n }\n },\n accessibilityLabel,\n testID,\n onPress,\n onLongPress,\n horizontal,\n activeTintColor: customActiveTintColor,\n inactiveTintColor: customInactiveTintColor,\n activeBackgroundColor = 'transparent',\n inactiveBackgroundColor = 'transparent',\n showLabel = true,\n allowFontScaling,\n labelStyle,\n iconStyle,\n style,\n}: Props) {\n const { colors } = useTheme();\n\n const activeTintColor =\n customActiveTintColor === undefined\n ? colors.primary\n : customActiveTintColor;\n\n const inactiveTintColor =\n customInactiveTintColor === undefined\n ? Color(colors.text).mix(Color(colors.card), 0.5).hex()\n : customInactiveTintColor;\n\n const renderLabel = ({ focused }: { focused: boolean }) => {\n if (showLabel === false) {\n return null;\n }\n\n const color = focused ? activeTintColor : inactiveTintColor;\n\n if (typeof label === 'string') {\n return (\n <Text\n numberOfLines={1}\n style={[\n styles.label,\n { color },\n horizontal ? styles.labelBeside : styles.labelBeneath,\n labelStyle,\n ]}\n allowFontScaling={allowFontScaling}\n >\n {label}\n </Text>\n );\n }\n\n return label({\n focused,\n color,\n position: horizontal ? 'beside-icon' : 'below-icon',\n });\n };\n\n const renderIcon = ({ focused }: { focused: boolean }) => {\n if (icon === undefined) {\n return null;\n }\n\n const activeOpacity = focused ? 1 : 0;\n const inactiveOpacity = focused ? 0 : 1;\n\n return (\n <TabBarIcon\n route={route}\n horizontal={horizontal}\n badge={badge}\n badgeStyle={badgeStyle}\n activeOpacity={activeOpacity}\n inactiveOpacity={inactiveOpacity}\n activeTintColor={activeTintColor}\n inactiveTintColor={inactiveTintColor}\n renderIcon={icon}\n style={iconStyle}\n />\n );\n };\n\n const scene = { route, focused };\n\n const backgroundColor = focused\n ? activeBackgroundColor\n : inactiveBackgroundColor;\n\n return button({\n to,\n onPress,\n onLongPress,\n testID,\n accessibilityLabel,\n // FIXME: accessibilityRole: 'tab' doesn't seem to work as expected on iOS\n accessibilityRole: Platform.select({ ios: 'button', default: 'tab' }),\n accessibilityState: { selected: focused },\n // @ts-expect-error: keep for compatibility with older React Native versions\n accessibilityStates: focused ? ['selected'] : [],\n style: [\n styles.tab,\n { backgroundColor },\n horizontal ? styles.tabLandscape : styles.tabPortrait,\n style,\n ],\n children: (\n <React.Fragment>\n {renderIcon(scene)}\n {renderLabel(scene)}\n </React.Fragment>\n ),\n }) as React.ReactElement;\n}\n\nconst styles = StyleSheet.create({\n tab: {\n flex: 1,\n alignItems: 'center',\n },\n tabPortrait: {\n justifyContent: 'flex-end',\n flexDirection: 'column',\n },\n tabLandscape: {\n justifyContent: 'center',\n flexDirection: 'row',\n },\n label: {\n textAlign: 'center',\n backgroundColor: 'transparent',\n },\n labelBeneath: {\n fontSize: 10,\n },\n labelBeside: {\n fontSize: 13,\n marginLeft: 20,\n marginTop: 3,\n },\n button: {\n display: 'flex',\n },\n});\n"],"mappings":";;AAAA,SAASA,IAAT,EAAsBC,QAAtB,QAAsC,0BAAtC;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAEEC,QAFF,EAGEC,SAHF,EAKEC,UALF,EAMEC,IANF,QASO,cATP;AAYA,OAAOC,UAAP,MAAuB,cAAvB;AA0GA,eAAe,SAASC,gBAAT,OAgEL;EAAA,IAhE+B;IACvCC,OADuC;IAEvCC,KAFuC;IAGvCC,KAHuC;IAIvCC,IAJuC;IAKvCC,KALuC;IAMvCC,UANuC;IAOvCC,EAPuC;IAQvCC,MAAM,GAAG,SAOsB;MAAA,IAPrB;QACRC,QADQ;QAERC,KAFQ;QAGRC,OAHQ;QAIRJ,EAJQ;QAKRK,iBALQ;QAMR,GAAGC;MANK,CAOqB;;MAC7B,IAAIlB,QAAQ,CAACmB,EAAT,KAAgB,KAAhB,IAAyBP,EAA7B,EAAiC;QAC/B;QACA;QACA,oBACE,oBAAC,IAAD,eACMM,IADN;UAEE,EAAE,EAAEN,EAFN;UAGE,KAAK,EAAE,CAACQ,MAAM,CAACP,MAAR,EAAgBE,KAAh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,EAFD;IAGXC,SAAS,EAAE;EAHA,CApBkB;EAyB/B9D,MAAM,EAAE;IACN+D,OAAO,EAAE;EADH;AAzBuB,CAAlB,CAAf"}
1
+ {"version":3,"names":["Link","useTheme","Color","React","Platform","Pressable","StyleSheet","Text","TabBarIcon","BottomTabBarItem","focused","route","descriptor","label","icon","badge","badgeStyle","to","button","children","style","onPress","accessibilityRole","rest","OS","styles","e","metaKey","altKey","ctrlKey","shiftKey","preventDefault","accessibilityLabel","testID","onLongPress","horizontal","activeTintColor","customActiveTintColor","inactiveTintColor","customInactiveTintColor","activeBackgroundColor","inactiveBackgroundColor","showLabel","allowFontScaling","labelStyle","iconStyle","colors","undefined","primary","text","mix","card","hex","renderLabel","color","labelBeside","labelBeneath","options","tabBarLabel","title","name","position","renderIcon","activeOpacity","inactiveOpacity","scene","backgroundColor","select","ios","default","accessibilityState","selected","accessibilityStates","tab","tabLandscape","tabPortrait","create","flex","alignItems","justifyContent","flexDirection","textAlign","fontSize","marginLeft","marginTop","display"],"sources":["BottomTabItem.tsx"],"sourcesContent":["import { Link, Route, useTheme } from '@react-navigation/native';\nimport Color from 'color';\nimport React from 'react';\nimport {\n GestureResponderEvent,\n Platform,\n Pressable,\n StyleProp,\n StyleSheet,\n Text,\n TextStyle,\n ViewStyle,\n} from 'react-native';\n\nimport type {\n BottomTabBarButtonProps,\n BottomTabDescriptor,\n LabelPosition,\n} from '../types';\nimport TabBarIcon from './TabBarIcon';\n\ntype Props = {\n /**\n * Whether the tab is focused.\n */\n focused: boolean;\n /**\n * The route object which should be specified by the tab.\n */\n route: Route<string>;\n /**\n * The descriptor object for the route.\n */\n descriptor: BottomTabDescriptor;\n /**\n * The label text of the tab.\n */\n label:\n | string\n | ((props: {\n focused: boolean;\n color: string;\n position: LabelPosition;\n children: string;\n }) => React.ReactNode);\n /**\n * Icon to display for the tab.\n */\n icon: (props: {\n focused: boolean;\n size: number;\n color: string;\n }) => React.ReactNode;\n /**\n * Text to show in a badge on the tab icon.\n */\n badge?: number | string;\n /**\n * Custom style for the badge.\n */\n badgeStyle?: StyleProp<TextStyle>;\n /**\n * URL to use for the link to the tab.\n */\n to?: string;\n /**\n * The button for the tab. Uses a `TouchableWithoutFeedback` by default.\n */\n button?: (props: BottomTabBarButtonProps) => React.ReactNode;\n /**\n * The accessibility label for the tab.\n */\n accessibilityLabel?: string;\n /**\n * An unique ID for testing for the tab.\n */\n testID?: string;\n /**\n * Function to execute on press in React Native.\n * On the web, this will use onClick.\n */\n onPress: (\n e: React.MouseEvent<HTMLElement, MouseEvent> | GestureResponderEvent\n ) => void;\n /**\n * Function to execute on long press.\n */\n onLongPress: (e: GestureResponderEvent) => void;\n /**\n * Whether the label should be aligned with the icon horizontally.\n */\n horizontal: boolean;\n /**\n * Color for the icon and label when the item is active.\n */\n activeTintColor?: string;\n /**\n * Color for the icon and label when the item is inactive.\n */\n inactiveTintColor?: string;\n /**\n * Background color for item when its active.\n */\n activeBackgroundColor?: string;\n /**\n * Background color for item when its inactive.\n */\n inactiveBackgroundColor?: string;\n /**\n * Whether to show the label text for the tab.\n */\n showLabel?: boolean;\n /**\n * Whether to allow scaling the font for the label for accessibility purposes.\n */\n allowFontScaling?: boolean;\n /**\n * Style object for the label element.\n */\n labelStyle?: StyleProp<TextStyle>;\n /**\n * Style object for the icon element.\n */\n iconStyle?: StyleProp<ViewStyle>;\n /**\n * Style object for the wrapper element.\n */\n style?: StyleProp<ViewStyle>;\n};\n\nexport default function BottomTabBarItem({\n focused,\n route,\n descriptor,\n label,\n icon,\n badge,\n badgeStyle,\n to,\n button = ({\n children,\n style,\n onPress,\n to,\n accessibilityRole,\n ...rest\n }: BottomTabBarButtonProps) => {\n if (Platform.OS === 'web' && to) {\n // React Native Web doesn't forward `onClick` if we use `TouchableWithoutFeedback`.\n // We need to use `onClick` to be able to prevent default browser handling of links.\n return (\n <Link\n {...rest}\n to={to}\n style={[styles.button, style]}\n onPress={(e: any) => {\n if (\n !(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && // ignore clicks with modifier keys\n (e.button == null || e.button === 0) // ignore everything but left clicks\n ) {\n e.preventDefault();\n onPress?.(e);\n }\n }}\n >\n {children}\n </Link>\n );\n } else {\n return (\n <Pressable\n {...rest}\n accessibilityRole={accessibilityRole}\n onPress={onPress}\n style={style}\n >\n {children}\n </Pressable>\n );\n }\n },\n accessibilityLabel,\n testID,\n onPress,\n onLongPress,\n horizontal,\n activeTintColor: customActiveTintColor,\n inactiveTintColor: customInactiveTintColor,\n activeBackgroundColor = 'transparent',\n inactiveBackgroundColor = 'transparent',\n showLabel = true,\n allowFontScaling,\n labelStyle,\n iconStyle,\n style,\n}: Props) {\n const { colors } = useTheme();\n\n const activeTintColor =\n customActiveTintColor === undefined\n ? colors.primary\n : customActiveTintColor;\n\n const inactiveTintColor =\n customInactiveTintColor === undefined\n ? Color(colors.text).mix(Color(colors.card), 0.5).hex()\n : customInactiveTintColor;\n\n const renderLabel = ({ focused }: { focused: boolean }) => {\n if (showLabel === false) {\n return null;\n }\n\n const color = focused ? activeTintColor : inactiveTintColor;\n\n if (typeof label === 'string') {\n return (\n <Text\n numberOfLines={1}\n style={[\n styles.label,\n { color },\n horizontal ? styles.labelBeside : styles.labelBeneath,\n labelStyle,\n ]}\n allowFontScaling={allowFontScaling}\n >\n {label}\n </Text>\n );\n }\n\n const { options } = descriptor;\n const children =\n typeof options.tabBarLabel === 'string'\n ? options.tabBarLabel\n : options.title !== undefined\n ? options.title\n : route.name;\n\n return label({\n focused,\n color,\n position: horizontal ? 'beside-icon' : 'below-icon',\n children,\n });\n };\n\n const renderIcon = ({ focused }: { focused: boolean }) => {\n if (icon === undefined) {\n return null;\n }\n\n const activeOpacity = focused ? 1 : 0;\n const inactiveOpacity = focused ? 0 : 1;\n\n return (\n <TabBarIcon\n route={route}\n horizontal={horizontal}\n badge={badge}\n badgeStyle={badgeStyle}\n activeOpacity={activeOpacity}\n inactiveOpacity={inactiveOpacity}\n activeTintColor={activeTintColor}\n inactiveTintColor={inactiveTintColor}\n renderIcon={icon}\n style={iconStyle}\n />\n );\n };\n\n const scene = { route, focused };\n\n const backgroundColor = focused\n ? activeBackgroundColor\n : inactiveBackgroundColor;\n\n return button({\n to,\n onPress,\n onLongPress,\n testID,\n accessibilityLabel,\n // FIXME: accessibilityRole: 'tab' doesn't seem to work as expected on iOS\n accessibilityRole: Platform.select({ ios: 'button', default: 'tab' }),\n accessibilityState: { selected: focused },\n // @ts-expect-error: keep for compatibility with older React Native versions\n accessibilityStates: focused ? ['selected'] : [],\n style: [\n styles.tab,\n { backgroundColor },\n horizontal ? styles.tabLandscape : styles.tabPortrait,\n style,\n ],\n children: (\n <React.Fragment>\n {renderIcon(scene)}\n {renderLabel(scene)}\n </React.Fragment>\n ),\n }) as React.ReactElement;\n}\n\nconst styles = StyleSheet.create({\n tab: {\n flex: 1,\n alignItems: 'center',\n },\n tabPortrait: {\n justifyContent: 'flex-end',\n flexDirection: 'column',\n },\n tabLandscape: {\n justifyContent: 'center',\n flexDirection: 'row',\n },\n label: {\n textAlign: 'center',\n backgroundColor: 'transparent',\n },\n labelBeneath: {\n fontSize: 10,\n },\n labelBeside: {\n fontSize: 13,\n marginLeft: 20,\n marginTop: 3,\n },\n button: {\n display: 'flex',\n },\n});\n"],"mappings":";;AAAA,SAASA,IAAT,EAAsBC,QAAtB,QAAsC,0BAAtC;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAEEC,QAFF,EAGEC,SAHF,EAKEC,UALF,EAMEC,IANF,QASO,cATP;AAgBA,OAAOC,UAAP,MAAuB,cAAvB;AA+GA,eAAe,SAASC,gBAAT,OAiEL;EAAA,IAjE+B;IACvCC,OADuC;IAEvCC,KAFuC;IAGvCC,UAHuC;IAIvCC,KAJuC;IAKvCC,IALuC;IAMvCC,KANuC;IAOvCC,UAPuC;IAQvCC,EARuC;IASvCC,MAAM,GAAG,SAOsB;MAAA,IAPrB;QACRC,QADQ;QAERC,KAFQ;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lBU,CAAD,CAAb;AAwBD;AAED,MAAMxC,MAAM,GAAGnB,UAAU,CAACsE,MAAX,CAAkB;EAC/BH,GAAG,EAAE;IACHI,IAAI,EAAE,CADH;IAEHC,UAAU,EAAE;EAFT,CAD0B;EAK/BH,WAAW,EAAE;IACXI,cAAc,EAAE,UADL;IAEXC,aAAa,EAAE;EAFJ,CALkB;EAS/BN,YAAY,EAAE;IACZK,cAAc,EAAE,QADJ;IAEZC,aAAa,EAAE;EAFH,CATiB;EAa/BnE,KAAK,EAAE;IACLoE,SAAS,EAAE,QADN;IAELf,eAAe,EAAE;EAFZ,CAbwB;EAiB/BV,YAAY,EAAE;IACZ0B,QAAQ,EAAE;EADE,CAjBiB;EAoB/B3B,WAAW,EAAE;IACX2B,QAAQ,EAAE,EADC;IAEXC,UAAU,EAAE,EAFD;IAGXC,SAAS,EAAE;EAHA,CApBkB;EAyB/BlE,MAAM,EAAE;IACNmE,OAAO,EAAE;EADH;AAzBuB,CAAlB,CAAf"}
@@ -45,7 +45,7 @@ export declare type BottomTabNavigationOptions = HeaderOptions & {
45
45
  title?: string;
46
46
  /**
47
47
  * Title string of a tab displayed in the tab bar
48
- * or a function that given { focused: boolean, color: string, position: 'below-icon' | 'beside-icon' } returns a React.Node to display in tab bar.
48
+ * or a function that given { focused: boolean, color: string, position: 'below-icon' | 'beside-icon', children: string } returns a React.Node to display in tab bar.
49
49
  *
50
50
  * When undefined, scene title is used. Use `tabBarShowLabel` to hide the label.
51
51
  */
@@ -53,6 +53,7 @@ export declare type BottomTabNavigationOptions = HeaderOptions & {
53
53
  focused: boolean;
54
54
  color: string;
55
55
  position: LabelPosition;
56
+ children: string;
56
57
  }) => React.ReactNode);
57
58
  /**
58
59
  * Whether the tab label should be visible. Defaults to `true`.
@@ -1 +1 @@
1
- export default function useFloatingBottomTabBarHeight(): number;
1
+ export default function useBottomTabBarHeight(): number;
@@ -1,7 +1,7 @@
1
1
  import { Route } from '@react-navigation/native';
2
2
  import React from 'react';
3
3
  import { GestureResponderEvent, StyleProp, TextStyle, ViewStyle } from 'react-native';
4
- import type { BottomTabBarButtonProps, LabelPosition } from '../types';
4
+ import type { BottomTabBarButtonProps, BottomTabDescriptor, LabelPosition } from '../types';
5
5
  declare type Props = {
6
6
  /**
7
7
  * Whether the tab is focused.
@@ -11,6 +11,10 @@ declare type Props = {
11
11
  * The route object which should be specified by the tab.
12
12
  */
13
13
  route: Route<string>;
14
+ /**
15
+ * The descriptor object for the route.
16
+ */
17
+ descriptor: BottomTabDescriptor;
14
18
  /**
15
19
  * The label text of the tab.
16
20
  */
@@ -18,6 +22,7 @@ declare type Props = {
18
22
  focused: boolean;
19
23
  color: string;
20
24
  position: LabelPosition;
25
+ children: string;
21
26
  }) => React.ReactNode);
22
27
  /**
23
28
  * Icon to display for the tab.
@@ -101,5 +106,5 @@ declare type Props = {
101
106
  */
102
107
  style?: StyleProp<ViewStyle>;
103
108
  };
104
- export default function BottomTabBarItem({ focused, route, label, icon, badge, badgeStyle, to, button, accessibilityLabel, testID, onPress, onLongPress, horizontal, activeTintColor: customActiveTintColor, inactiveTintColor: customInactiveTintColor, activeBackgroundColor, inactiveBackgroundColor, showLabel, allowFontScaling, labelStyle, iconStyle, style, }: Props): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
109
+ export default function BottomTabBarItem({ focused, route, descriptor, label, icon, badge, badgeStyle, to, button, accessibilityLabel, testID, onPress, onLongPress, horizontal, activeTintColor: customActiveTintColor, inactiveTintColor: customInactiveTintColor, activeBackgroundColor, inactiveBackgroundColor, showLabel, allowFontScaling, labelStyle, iconStyle, style, }: Props): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
105
110
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-navigation/bottom-tabs",
3
3
  "description": "Bottom tab navigator following iOS design guidelines",
4
- "version": "6.4.1",
4
+ "version": "6.5.0",
5
5
  "keywords": [
6
6
  "react-native-component",
7
7
  "react-component",
@@ -36,12 +36,12 @@
36
36
  "clean": "del lib"
37
37
  },
38
38
  "dependencies": {
39
- "@react-navigation/elements": "^1.3.7",
39
+ "@react-navigation/elements": "^1.3.10",
40
40
  "color": "^4.2.3",
41
41
  "warn-once": "^0.1.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@react-navigation/native": "^6.0.14",
44
+ "@react-navigation/native": "^6.1.0",
45
45
  "@testing-library/react-native": "^11.5.0",
46
46
  "@types/color": "^3.0.1",
47
47
  "@types/react": "~18.0.0",
@@ -75,5 +75,5 @@
75
75
  ]
76
76
  ]
77
77
  },
78
- "gitHead": "92f9f265d2627a3ef5b3890042d59405ff38401e"
78
+ "gitHead": "f7a9b1d102e5ff04ce3f726b934019ddbdd0550c"
79
79
  }
package/src/types.tsx CHANGED
@@ -91,7 +91,7 @@ export type BottomTabNavigationOptions = HeaderOptions & {
91
91
 
92
92
  /**
93
93
  * Title string of a tab displayed in the tab bar
94
- * or a function that given { focused: boolean, color: string, position: 'below-icon' | 'beside-icon' } returns a React.Node to display in tab bar.
94
+ * or a function that given { focused: boolean, color: string, position: 'below-icon' | 'beside-icon', children: string } returns a React.Node to display in tab bar.
95
95
  *
96
96
  * When undefined, scene title is used. Use `tabBarShowLabel` to hide the label.
97
97
  */
@@ -101,6 +101,7 @@ export type BottomTabNavigationOptions = HeaderOptions & {
101
101
  focused: boolean;
102
102
  color: string;
103
103
  position: LabelPosition;
104
+ children: string;
104
105
  }) => React.ReactNode);
105
106
 
106
107
  /**
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
 
3
3
  import BottomTabBarHeightContext from './BottomTabBarHeightContext';
4
4
 
5
- export default function useFloatingBottomTabBarHeight() {
5
+ export default function useBottomTabBarHeight() {
6
6
  const height = React.useContext(BottomTabBarHeightContext);
7
7
 
8
8
  if (height === undefined) {
@@ -340,6 +340,7 @@ export default function BottomTabBar({
340
340
  <NavigationRouteContext.Provider value={route}>
341
341
  <BottomTabItem
342
342
  route={route}
343
+ descriptor={descriptors[route.key]}
343
344
  focused={focused}
344
345
  horizontal={hasHorizontalLabels}
345
346
  onPress={onPress}
@@ -12,7 +12,11 @@ import {
12
12
  ViewStyle,
13
13
  } from 'react-native';
14
14
 
15
- import type { BottomTabBarButtonProps, LabelPosition } from '../types';
15
+ import type {
16
+ BottomTabBarButtonProps,
17
+ BottomTabDescriptor,
18
+ LabelPosition,
19
+ } from '../types';
16
20
  import TabBarIcon from './TabBarIcon';
17
21
 
18
22
  type Props = {
@@ -24,6 +28,10 @@ type Props = {
24
28
  * The route object which should be specified by the tab.
25
29
  */
26
30
  route: Route<string>;
31
+ /**
32
+ * The descriptor object for the route.
33
+ */
34
+ descriptor: BottomTabDescriptor;
27
35
  /**
28
36
  * The label text of the tab.
29
37
  */
@@ -33,6 +41,7 @@ type Props = {
33
41
  focused: boolean;
34
42
  color: string;
35
43
  position: LabelPosition;
44
+ children: string;
36
45
  }) => React.ReactNode);
37
46
  /**
38
47
  * Icon to display for the tab.
@@ -122,6 +131,7 @@ type Props = {
122
131
  export default function BottomTabBarItem({
123
132
  focused,
124
133
  route,
134
+ descriptor,
125
135
  label,
126
136
  icon,
127
137
  badge,
@@ -220,10 +230,19 @@ export default function BottomTabBarItem({
220
230
  );
221
231
  }
222
232
 
233
+ const { options } = descriptor;
234
+ const children =
235
+ typeof options.tabBarLabel === 'string'
236
+ ? options.tabBarLabel
237
+ : options.title !== undefined
238
+ ? options.title
239
+ : route.name;
240
+
223
241
  return label({
224
242
  focused,
225
243
  color,
226
244
  position: horizontal ? 'beside-icon' : 'below-icon',
245
+ children,
227
246
  });
228
247
  };
229
248