{"version":3,"sources":["BottomTabView.tsx"],"names":["SceneContent","isFocused","children","style","colors","styles","content","backgroundColor","background","BottomTabView","React","Component","getDerivedStateFromProps","nextProps","prevState","focusedRouteKey","state","routes","index","key","loaded","includes","constructor","props","tabBar","tabBarOptions","navigation","descriptors","height","setState","tabBarHeight","dimensions","Dimensions","get","layout","width","insets","initialSafeAreaInsets","adaptive","labelPosition","tabStyle","render","lazy","detachInactiveScreens","sceneContainerStyle","container","pages","map","route","descriptor","unmountOnBlur","options","StyleSheet","absoluteFill","handleTabBarHeightChange","renderTabBar","create","flex","overflow"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;AAMA;;AAEA;;AAGA;;AACA;;AACA;;AACA;;;;;;;;;;AAmBA,SAASA,YAAT,CAAsB;AACpBC,EAAAA,SADoB;AAEpBC,EAAAA,QAFoB;AAGpBC,EAAAA;AAHoB,CAAtB,EAQG;AACD,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAnB;AAEA,sBACE,oBAAC,iBAAD;AACE,IAAA,2BAA2B,EAAE,CAACH,SADhC;AAEE,IAAA,yBAAyB,EAAEA,SAAS,GAAG,MAAH,GAAY,qBAFlD;AAGE,IAAA,KAAK,EAAE,CAACI,MAAM,CAACC,OAAR,EAAiB;AAAEC,MAAAA,eAAe,EAAEH,MAAM,CAACI;AAA1B,KAAjB,EAAyDL,KAAzD;AAHT,KAKGD,QALH,CADF;AASD;;AAEc,MAAMO,aAAN,SAA4BC,KAAK,CAACC,SAAlC,CAA0D;AAKvE,SAAOC,wBAAP,CAAgCC,SAAhC,EAAkDC,SAAlD,EAAoE;AAClE,UAAMC,eAAe,GAAGF,SAAS,CAACG,KAAV,CAAgBC,MAAhB,CAAuBJ,SAAS,CAACG,KAAV,CAAgBE,KAAvC,EAA8CC,GAAtE;AAEA,WAAO;AACL;AACAC,MAAAA,MAAM,EAAEN,SAAS,CAACM,MAAV,CAAiBC,QAAjB,CAA0BN,eAA1B,IACJD,SAAS,CAACM,MADN,GAEJ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AAlC;;AAEA,UAAIgC,aAAa,IAAI,CAACjD,SAAtB,EAAiC;AAC/B,eAAO,IAAP;AACD;;AAED,UAAIyC,IAAI,IAAI,CAACtB,MAAM,CAACC,QAAP,CAAgB2B,KAAK,CAAC7B,GAAtB,CAAT,IAAuC,CAAClB,SAA5C,EAAuD;AACrD;AACA,eAAO,IAAP;AACD;;AAED,0BACE,oBAAC,4BAAD;AACE,QAAA,GAAG,EAAE+C,KAAK,CAAC7B,GADb;AAEE,QAAA,KAAK,EAAEiC,wBAAWC,YAFpB;AAGE,QAAA,SAAS,EAAEpD,SAHb;AAIE,QAAA,OAAO,EAAE0C;AAJX,sBAME,oBAAC,YAAD;AACE,QAAA,SAAS,EAAE1C,SADb;AAEE,QAAA,KAAK,EAAE2C;AAFT,sBAIE,oBAAC,kCAAD,CAA2B,QAA3B;AAAoC,QAAA,KAAK,EAAEd;AAA3C,SACGmB,UAAU,CAACR,MAAX,EADH,CAJF,CANF,CADF;AAiBD,KA/BA,CALH,CADF,eAuCE,oBAAC,0CAAD,CAAmC,QAAnC;AACE,MAAA,KAAK,EAAE,KAAKa;AADd,OAGG,KAAKC,YAAL,EAHH,CAvCF,CADF,CADF,CADF;AAmDD;;AAhIsE;;;;gBAApD9C,a,kBACG;AACpBiC,EAAAA,IAAI,EAAE;AADc,C;;AAkIxB,MAAMrC,MAAM,GAAG+C,wBAAWI,MAAX,CAAkB;AAC/BX,EAAAA,SAAS,EAAE;AACTY,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,QAAQ,EAAE;AAFD,GADoB;AAK/BZ,EAAAA,KAAK,EAAE;AACLW,IAAAA,IAAI,EAAE;AADD,GALwB;AAQ/BnD,EAAAA,OAAO,EAAE;AACPmD,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"]}