{"version":3,"sources":["BottomTabBar.tsx"],"names":["DEFAULT_TABBAR_HEIGHT","COMPACT_TABBAR_HEIGHT","DEFAULT_MAX_TAB_ITEM_WIDTH","useNativeDriver","Platform","OS","shouldUseHorizontalLabels","state","layout","dimensions","adaptive","labelPosition","tabStyle","width","maxTabItemWidth","flattenedStyle","StyleSheet","flatten","maxWidth","routes","length","height","getPaddingBottom","insets","Math","max","bottom","select","ios","default","getTabBarHeight","style","rest","customHeight","isLandscape","horizontalLabels","paddingBottom","isPad","BottomTabBar","navigation","descriptors","activeBackgroundColor","activeTintColor","allowFontScaling","inactiveBackgroundColor","inactiveTintColor","keyboardHidesTabBar","labelStyle","iconStyle","safeAreaInsets","showLabel","colors","buildLink","focusedRoute","index","focusedDescriptor","key","focusedOptions","options","isKeyboardShown","onHeightChange","React","useContext","BottomTabBarHeightCallbackContext","shouldShowTabBar","tabBarVisible","visibilityAnimationConfigRef","useRef","tabBarVisibilityAnimationConfig","useEffect","current","isTabBarHidden","setIsTabBarHidden","useState","visible","Animated","Value","visibilityAnimationConfig","animation","show","spring","timing","toValue","duration","config","start","finished","hide","setLayout","handleLayout","e","nativeEvent","topBorderWidth","styles","tabBar","borderTopWidth","defaultInsets","top","right","left","tabBarHeight","hasHorizontalLabels","backgroundColor","card","borderTopColor","border","transform","translateY","interpolate","inputRange","outputRange","hairlineWidth","position","paddingHorizontal","content","map","route","focused","onPress","event","emit","type","target","canPreventDefault","defaultPrevented","dispatch","CommonActions","navigate","name","onLongPress","label","tabBarLabel","undefined","title","accessibilityLabel","tabBarAccessibilityLabel","params","tabBarTestID","tabBarButton","tabBarIcon","tabBarBadge","tabBarBadgeStyle","create","elevation","flex","flexDirection"],"mappings":";;;;;;;;AAAA;;AACA;;AASA;;AASA;;AAEA;;AACA;;AACA;;AACA;;;;AAQA,MAAMA,qBAAqB,GAAG,EAA9B;AACA,MAAMC,qBAAqB,GAAG,EAA9B;AACA,MAAMC,0BAA0B,GAAG,GAAnC;AAEA,MAAMC,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ACNK,IAAAA,IAAI,EAAE,CADA;AAEND,IAAAA,KAAK,EAAE,CAFD;AAGNxE,IAAAA,MAAM,EAAE,CAHF;AAINqE,IAAAA,cAAc,EAAE/E,wBAAW+F,aAJrB;AAKNgC,IAAAA,SAAS,EAAE;AALL,GADuB;AAQ/B7B,EAAAA,OAAO,EAAE;AACP8B,IAAAA,IAAI,EAAE,CADC;AAEPC,IAAAA,aAAa,EAAE;AAFR;AARsB,CAAlB,CAAf","sourcesContent":["import React from 'react';\nimport {\n View,\n Animated,\n StyleSheet,\n Platform,\n LayoutChangeEvent,\n StyleProp,\n ViewStyle,\n} from 'react-native';\nimport {\n NavigationContext,\n NavigationRouteContext,\n TabNavigationState,\n ParamListBase,\n CommonActions,\n useTheme,\n useLinkBuilder,\n} from '@react-navigation/native';\nimport { useSafeArea, EdgeInsets } from 'react-native-safe-area-context';\n\nimport BottomTabItem from './BottomTabItem';\nimport BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';\nimport useWindowDimensions from '../utils/useWindowDimensions';\nimport useIsKeyboardShown from '../utils/useIsKeyboardShown';\nimport type { BottomTabBarProps, LabelPosition } from '../types';\n\ntype Props = BottomTabBarProps & {\n activeTintColor?: string;\n inactiveTintColor?: string;\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;\n layout: { height: number; width: number };\n dimensions: { height: number; width: number };\n tabStyle: StyleProp;\n labelPosition: LabelPosition | undefined;\n adaptive: boolean | undefined;\n};\n\nconst shouldUseHorizontalLabels = ({\n state,\n layout,\n dimensions,\n adaptive = true,\n labelPosition,\n tabStyle,\n}: Options) => {\n if (labelPosition) {\n return labelPosition === 'beside-icon';\n }\n\n if (!adaptive) {\n return false;\n }\n\n if (layout.width >= 768) {\n // Screen size matches a tablet\n let maxTabItemWidth = DEFAULT_MAX_TAB_ITEM_WIDTH;\n\n const flattenedStyle = StyleSheet.flatten(tabStyle);\n\n if (flattenedStyle) {\n if (typeof flattenedStyle.width === 'number') {\n maxTabItemWidth = flattenedStyle.width;\n } else if (typeof flattenedStyle.maxWidth === 'number') {\n maxTabItemWidth = flattenedStyle.maxWidth;\n }\n }\n\n return state.routes.length * maxTabItemWidth <= 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 dimensions,\n insets,\n style,\n ...rest\n}: Options & {\n insets: EdgeInsets;\n style: Animated.WithAnimatedValue>;\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({ dimensions, ...rest });\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 activeBackgroundColor,\n activeTintColor,\n adaptive,\n allowFontScaling,\n inactiveBackgroundColor,\n inactiveTintColor,\n keyboardHidesTabBar = false,\n labelPosition,\n labelStyle,\n iconStyle,\n safeAreaInsets,\n showLabel,\n style,\n tabStyle,\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 dimensions = useWindowDimensions();\n const isKeyboardShown = useIsKeyboardShown();\n\n const onHeightChange = React.useContext(BottomTabBarHeightCallbackContext);\n\n const shouldShowTabBar =\n focusedOptions.tabBarVisible !== false &&\n !(keyboardHidesTabBar && isKeyboardShown);\n\n const visibilityAnimationConfigRef = React.useRef(\n focusedOptions.tabBarVisibilityAnimationConfig\n );\n\n React.useEffect(() => {\n visibilityAnimationConfigRef.current =\n focusedOptions.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 }, [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 const topBorderWidth =\n // @ts-ignore\n StyleSheet.flatten([styles.tabBar, style])?.borderTopWidth;\n\n onHeightChange?.(\n height +\n paddingBottom +\n (typeof topBorderWidth === 'number' ? topBorderWidth : 0)\n );\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 defaultInsets = useSafeArea();\n\n const insets = {\n top: safeAreaInsets?.top ?? defaultInsets.top,\n right: safeAreaInsets?.right ?? defaultInsets.right,\n bottom: safeAreaInsets?.bottom ?? defaultInsets.bottom,\n left: safeAreaInsets?.left ?? defaultInsets.left,\n };\n\n const paddingBottom = getPaddingBottom(insets);\n const tabBarHeight = getTabBarHeight({\n state,\n insets,\n dimensions,\n layout,\n adaptive,\n labelPosition,\n tabStyle,\n style,\n });\n\n const hasHorizontalLabels = shouldUseHorizontalLabels({\n state,\n dimensions,\n layout,\n adaptive,\n labelPosition,\n tabStyle,\n });\n\n return (\n \n \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(route.name),\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'\n ? `${label}, tab, ${index + 1} of ${routes.length}`\n : undefined;\n\n return (\n \n \n \n \n \n );\n })}\n \n \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"]}