{"version":3,"sources":["BottomTabView.tsx"],"names":["React","View","StyleSheet","Dimensions","NavigationHelpersContext","useTheme","ScreenContainer","SafeAreaProviderCompat","initialSafeAreaInsets","ResourceSavingScene","BottomTabBar","getTabBarHeight","BottomTabBarHeightCallbackContext","BottomTabBarHeightContext","SceneContent","isFocused","children","style","colors","styles","content","backgroundColor","background","BottomTabView","Component","getDerivedStateFromProps","nextProps","prevState","focusedRouteKey","state","routes","index","key","loaded","includes","constructor","props","tabBar","tabBarOptions","navigation","descriptors","height","setState","tabBarHeight","dimensions","get","layout","width","insets","adaptive","labelPosition","tabStyle","render","lazy","detachInactiveScreens","sceneContainerStyle","container","pages","map","route","descriptor","unmountOnBlur","options","absoluteFill","handleTabBarHeightChange","renderTabBar","create","flex","overflow"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,IADF,EAEEC,UAFF,EAGEC,UAHF,QAMO,cANP;AAQA,SACEC,wBADF,EAIEC,QAJF,QAKO,0BALP;AAMA,SAASC,eAAT,QAAgC,sBAAhC;AAEA,OAAOC,sBAAP,IACEC,qBADF,QAEO,0BAFP;AAGA,OAAOC,mBAAP,MAAgC,uBAAhC;AACA,OAAOC,YAAP,IAAuBC,eAAvB,QAA8C,gBAA9C;AACA,OAAOC,iCAAP,MAA8C,4CAA9C;AACA,OAAOC,yBAAP,MAAsC,oCAAtC;;AAmBA,SAASC,YAAT,CAAsB;AACpBC,EAAAA,SADoB;AAEpBC,EAAAA,QAFoB;AAGpBC,EAAAA;AAHoB,CAAtB,EAQG;AACD,QAAM;AAAEC,IAAAA;AAAF,MAAab,QAAQ,EAA3B;AAEA,sBACE,oBAAC,IAAD;AACE,IAAA,2BAA2B,EAAE,CAACU,SADhC;AAEE,IAAA,yBAAyB,EAAEA,SAAS,GAAG,MAAH,GAAY,qBAFlD;AAGE,IAAA,KAAK,EAAE,CAACI,MAAM,CAACC,OAAR,EAAiB;AAAEC,MAAAA,eAAe,EAAEH,MAAM,CA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AAI,EAAE;AADc,C;;AAkIxB,MAAMlC,MAAM,GAAGjB,UAAU,CAACgE,MAAX,CAAkB;AAC/BV,EAAAA,SAAS,EAAE;AACTW,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,QAAQ,EAAE;AAFD,GADoB;AAK/BX,EAAAA,KAAK,EAAE;AACLU,IAAAA,IAAI,EAAE;AADD,GALwB;AAQ/B/C,EAAAA,OAAO,EAAE;AACP+C,IAAAA,IAAI,EAAE;AADC;AARsB,CAAlB,CAAf","sourcesContent":["import * as React from 'react';\nimport {\n View,\n StyleSheet,\n Dimensions,\n StyleProp,\n ViewStyle,\n} from 'react-native';\n\nimport {\n NavigationHelpersContext,\n ParamListBase,\n TabNavigationState,\n useTheme,\n} from '@react-navigation/native';\nimport { ScreenContainer } from 'react-native-screens';\n\nimport SafeAreaProviderCompat, {\n initialSafeAreaInsets,\n} from './SafeAreaProviderCompat';\nimport ResourceSavingScene from './ResourceSavingScene';\nimport BottomTabBar, { getTabBarHeight } from './BottomTabBar';\nimport BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';\nimport BottomTabBarHeightContext from '../utils/BottomTabBarHeightContext';\nimport type {\n BottomTabNavigationConfig,\n BottomTabDescriptorMap,\n BottomTabNavigationHelpers,\n BottomTabBarProps,\n} from '../types';\n\ntype Props = BottomTabNavigationConfig & {\n state: TabNavigationState;\n navigation: BottomTabNavigationHelpers;\n descriptors: BottomTabDescriptorMap;\n};\n\ntype State = {\n loaded: string[];\n tabBarHeight: number;\n};\n\nfunction SceneContent({\n isFocused,\n children,\n style,\n}: {\n isFocused: boolean;\n children: React.ReactNode;\n style?: StyleProp;\n}) {\n const { colors } = useTheme();\n\n return (\n \n {children}\n \n );\n}\n\nexport default class BottomTabView extends React.Component {\n static defaultProps = {\n lazy: true,\n };\n\n static getDerivedStateFromProps(nextProps: Props, prevState: State) {\n const focusedRouteKey = nextProps.state.routes[nextProps.state.index].key;\n\n return {\n // Set the current tab to be loaded if it was not loaded before\n loaded: prevState.loaded.includes(focusedRouteKey)\n ? prevState.loaded\n : [...prevState.loaded, focusedRouteKey],\n };\n }\n\n constructor(props: Props) {\n super(props);\n\n const { state, tabBarOptions } = this.props;\n\n const dimensions = Dimensions.get('window');\n const tabBarHeight = getTabBarHeight({\n state,\n dimensions,\n layout: { width: dimensions.width, height: 0 },\n insets: initialSafeAreaInsets,\n adaptive: tabBarOptions?.adaptive,\n labelPosition: tabBarOptions?.labelPosition,\n tabStyle: tabBarOptions?.tabStyle,\n style: tabBarOptions?.style,\n });\n\n this.state = {\n loaded: [state.routes[state.index].key],\n tabBarHeight: tabBarHeight,\n };\n }\n\n private renderTabBar = () => {\n const {\n tabBar = (props: BottomTabBarProps) => ,\n tabBarOptions,\n state,\n navigation,\n descriptors,\n } = this.props;\n return tabBar({\n ...tabBarOptions,\n state: state,\n descriptors: descriptors,\n navigation: navigation,\n });\n };\n\n private handleTabBarHeightChange = (height: number) => {\n this.setState((state) => {\n if (state.tabBarHeight !== height) {\n return { tabBarHeight: height };\n }\n\n return null;\n });\n };\n\n render() {\n const {\n state,\n descriptors,\n navigation,\n lazy,\n detachInactiveScreens = true,\n sceneContainerStyle,\n } = this.props;\n const { routes } = state;\n const { loaded, tabBarHeight } = this.state;\n\n return (\n \n \n \n \n {routes.map((route, index) => {\n const descriptor = descriptors[route.key];\n const { unmountOnBlur } = descriptor.options;\n const isFocused = state.index === index;\n\n if (unmountOnBlur && !isFocused) {\n return null;\n }\n\n if (lazy && !loaded.includes(route.key) && !isFocused) {\n // Don't render a screen if we've never navigated to it\n return null;\n }\n\n return (\n \n \n \n {descriptor.render()}\n \n \n \n );\n })}\n \n \n {this.renderTabBar()}\n \n \n \n \n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n overflow: 'hidden',\n },\n pages: {\n flex: 1,\n },\n content: {\n flex: 1,\n },\n});\n"]}