@react-navigation/bottom-tabs 6.3.2 → 6.4.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.
@@ -104,6 +104,7 @@ function BottomTabView(props) {
104
104
  }
105
105
 
106
106
  const {
107
+ freezeOnBlur,
107
108
  header = _ref5 => {
108
109
  let {
109
110
  layout,
@@ -113,7 +114,10 @@ function BottomTabView(props) {
113
114
  layout: layout,
114
115
  title: (0, _elements.getHeaderTitle)(options, route.name)
115
116
  }));
116
- }
117
+ },
118
+ headerShown,
119
+ headerStatusBarHeight,
120
+ headerTransparent
117
121
  } = descriptor.options;
118
122
  return /*#__PURE__*/React.createElement(_ScreenFallback.MaybeScreen, {
119
123
  key: route.key,
@@ -121,16 +125,17 @@ function BottomTabView(props) {
121
125
  zIndex: isFocused ? 0 : -1
122
126
  }],
123
127
  visible: isFocused,
124
- enabled: detachInactiveScreens
128
+ enabled: detachInactiveScreens,
129
+ freezeOnBlur: freezeOnBlur
125
130
  }, /*#__PURE__*/React.createElement(_BottomTabBarHeightContext.default.Provider, {
126
131
  value: tabBarHeight
127
132
  }, /*#__PURE__*/React.createElement(_elements.Screen, {
128
133
  focused: isFocused,
129
134
  route: descriptor.route,
130
135
  navigation: descriptor.navigation,
131
- headerShown: descriptor.options.headerShown,
132
- headerTransparent: descriptor.options.headerTransparent,
133
- headerStatusBarHeight: descriptor.options.headerStatusBarHeight,
136
+ headerShown: headerShown,
137
+ headerStatusBarHeight: headerStatusBarHeight,
138
+ headerTransparent: headerTransparent,
134
139
  header: header({
135
140
  layout: dimensions,
136
141
  route: descriptor.route,
@@ -1 +1 @@
1
- {"version":3,"sources":["BottomTabView.tsx"],"names":["BottomTabView","props","tabBar","state","navigation","descriptors","safeAreaInsets","detachInactiveScreens","Platform","OS","sceneContainerStyle","focusedRouteKey","routes","index","key","loaded","setLoaded","React","useState","includes","dimensions","SafeAreaProviderCompat","initialMetrics","frame","tabBarHeight","setTabBarHeight","layout","width","height","insets","style","options","tabBarStyle","renderTabBar","top","right","bottom","left","styles","container","map","route","descriptor","lazy","unmountOnBlur","isFocused","header","name","StyleSheet","absoluteFill","zIndex","headerShown","headerTransparent","headerStatusBarHeight","render","create","flex","overflow"],"mappings":";;;;;;;AAAA;;AAUA;;AACA;;AACA;;AAUA;;AACA;;AACA;;AACA;;;;;;;;;;AAQe,SAASA,aAAT,CAAuBC,KAAvB,EAAqC;AAClD,QAAM;AACJC,IAAAA,MAAM,GAAID,KAAD,iBAA8B,oBAAC,qBAAD,EAAkBA,KAAlB,CADnC;AAEJE,IAAAA,KAFI;AAGJC,IAAAA,UAHI;AAIJC,IAAAA,WAJI;AAKJC,IAAAA,cALI;AAMJC,IAAAA,qBAAqB,GAAGC,sBAASC,EAAT,KAAgB,KAAhB,IACtBD,sBAASC,EAAT,KAAgB,SADM,IAEtBD,sBAASC,EAAT,KAAgB,KARd;AASJC,IAAAA;AATI,MAUFT,KAVJ;AAYA,QAAMU,eAAe,GAAGR,KAAK,CAACS,MAAN,CAAaT,KAAK,CAACU,KAAnB,EAA0BC,GAAlD;AACA,QAAM,CAACC,MAAD,EAASC,SAAT,IAAsBC,KAAK,CAACC,QAAN,CAAe,CAACP,eAAD,CAAf,CAA5B;;AAEA,MAAI,CAACI,MAAM,CAACI,QAAP,CAAgBR,eAAhB,CAAL,EAAuC;AACrCK,IAAAA,SAAS,CAAC,CAAC,GAAGD,MAAJ,EAAYJ,eAAZ,CAAD,CAAT;AACD;;AAED,QAAMS,UAAU,GAAGC,iCAAuBC,cAAvB,CAAsCC,KAAzD;AACA,QAAM,CAACC,YAAD,EAAeC,eAAf,IAAkCR,KAAK,CAACC,QAAN,CAAe,MACrD,mCAAgB;AACdf,IAAAA,KADc;AAEdE,IAAAA,WAFc;AAGde,IAAAA,UAHc;AAIdM,IAAAA,MAAM,EAAE;AAAEC,MAAAA,KAAK,EAAEP,UAAU,CAACO,KAApB;AAA2BC,MAAAA,MAAM,EAAE;AAAnC,KAJM;A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AA3B;AAAoC,MAAA,KAAK,EAAEiB;AAA3C,oBACE,oBAAC,gBAAD;AACE,MAAA,OAAO,EAAEqB,SADX;AAEE,MAAA,KAAK,EAAEH,UAAU,CAACD,KAFpB;AAGE,MAAA,UAAU,EAAEC,UAAU,CAACtC,UAHzB;AAIE,MAAA,WAAW,EAAEsC,UAAU,CAACX,OAAX,CAAmBoB,WAJlC;AAKE,MAAA,iBAAiB,EAAET,UAAU,CAACX,OAAX,CAAmBqB,iBALxC;AAME,MAAA,qBAAqB,EACnBV,UAAU,CAACX,OAAX,CAAmBsB,qBAPvB;AASE,MAAA,MAAM,EAAEP,MAAM,CAAC;AACbpB,QAAAA,MAAM,EAAEN,UADK;AAEbqB,QAAAA,KAAK,EAAEC,UAAU,CAACD,KAFL;AAGbrC,QAAAA,UAAU,EACRsC,UAAU,CAACtC,UAJA;AAKb2B,QAAAA,OAAO,EAAEW,UAAU,CAACX;AALP,OAAD,CAThB;AAgBE,MAAA,KAAK,EAAErB;AAhBT,OAkBGgC,UAAU,CAACY,MAAX,EAlBH,CADF,CANF,CADF;AA+BD,GAvDA,CALH,CADF,eA+DE,oBAAC,0CAAD,CAAmC,QAAnC;AAA4C,IAAA,KAAK,EAAE7B;AAAnD,KACGQ,YAAY,EADf,CA/DF,CADF;AAqED;;AAED,MAAMK,MAAM,GAAGU,wBAAWO,MAAX,CAAkB;AAC/BhB,EAAAA,SAAS,EAAE;AACTiB,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,QAAQ,EAAE;AAFD;AADoB,CAAlB,CAAf","sourcesContent":["import {\n getHeaderTitle,\n Header,\n SafeAreaProviderCompat,\n Screen,\n} from '@react-navigation/elements';\nimport type {\n ParamListBase,\n TabNavigationState,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { Platform, StyleSheet } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nimport type {\n BottomTabBarProps,\n BottomTabDescriptorMap,\n BottomTabHeaderProps,\n BottomTabNavigationConfig,\n BottomTabNavigationHelpers,\n BottomTabNavigationProp,\n} from '../types';\nimport BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';\nimport BottomTabBarHeightContext from '../utils/BottomTabBarHeightContext';\nimport BottomTabBar, { getTabBarHeight } from './BottomTabBar';\nimport { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';\n\ntype Props = BottomTabNavigationConfig & {\n state: TabNavigationState<ParamListBase>;\n navigation: BottomTabNavigationHelpers;\n descriptors: BottomTabDescriptorMap;\n};\n\nexport default function BottomTabView(props: Props) {\n const {\n tabBar = (props: BottomTabBarProps) => <BottomTabBar {...props} />,\n state,\n navigation,\n descriptors,\n safeAreaInsets,\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n sceneContainerStyle,\n } = props;\n\n const focusedRouteKey = state.routes[state.index].key;\n const [loaded, setLoaded] = React.useState([focusedRouteKey]);\n\n if (!loaded.includes(focusedRouteKey)) {\n setLoaded([...loaded, focusedRouteKey]);\n }\n\n const dimensions = SafeAreaProviderCompat.initialMetrics.frame;\n const [tabBarHeight, setTabBarHeight] = React.useState(() =>\n getTabBarHeight({\n state,\n descriptors,\n dimensions,\n layout: { width: dimensions.width, height: 0 },\n insets: {\n ...SafeAreaProviderCompat.initialMetrics.insets,\n ...props.safeAreaInsets,\n },\n style: descriptors[state.routes[state.index].key].options.tabBarStyle,\n })\n );\n\n const renderTabBar = () => {\n return (\n <SafeAreaInsetsContext.Consumer>\n {(insets) =>\n tabBar({\n state: state,\n descriptors: descriptors,\n navigation: navigation,\n insets: {\n top: safeAreaInsets?.top ?? insets?.top ?? 0,\n right: safeAreaInsets?.right ?? insets?.right ?? 0,\n bottom: safeAreaInsets?.bottom ?? insets?.bottom ?? 0,\n left: safeAreaInsets?.left ?? insets?.left ?? 0,\n },\n })\n }\n </SafeAreaInsetsContext.Consumer>\n );\n };\n\n const { routes } = state;\n\n return (\n <SafeAreaProviderCompat>\n <MaybeScreenContainer\n enabled={detachInactiveScreens}\n hasTwoStates\n style={styles.container}\n >\n {routes.map((route, index) => {\n const descriptor = descriptors[route.key];\n const { lazy = true, 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 lazy screen if we've never navigated to it\n return null;\n }\n\n const {\n header = ({ layout, options }: BottomTabHeaderProps) => (\n <Header\n {...options}\n layout={layout}\n title={getHeaderTitle(options, route.name)}\n />\n ),\n } = descriptor.options;\n\n return (\n <MaybeScreen\n key={route.key}\n style={[StyleSheet.absoluteFill, { zIndex: isFocused ? 0 : -1 }]}\n visible={isFocused}\n enabled={detachInactiveScreens}\n >\n <BottomTabBarHeightContext.Provider value={tabBarHeight}>\n <Screen\n focused={isFocused}\n route={descriptor.route}\n navigation={descriptor.navigation}\n headerShown={descriptor.options.headerShown}\n headerTransparent={descriptor.options.headerTransparent}\n headerStatusBarHeight={\n descriptor.options.headerStatusBarHeight\n }\n header={header({\n layout: dimensions,\n route: descriptor.route,\n navigation:\n descriptor.navigation as BottomTabNavigationProp<ParamListBase>,\n options: descriptor.options,\n })}\n style={sceneContainerStyle}\n >\n {descriptor.render()}\n </Screen>\n </BottomTabBarHeightContext.Provider>\n </MaybeScreen>\n );\n })}\n </MaybeScreenContainer>\n <BottomTabBarHeightCallbackContext.Provider value={setTabBarHeight}>\n {renderTabBar()}\n </BottomTabBarHeightCallbackContext.Provider>\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n overflow: 'hidden',\n },\n});\n"]}
1
+ {"version":3,"sources":["BottomTabView.tsx"],"names":["BottomTabView","props","tabBar","state","navigation","descriptors","safeAreaInsets","detachInactiveScreens","Platform","OS","sceneContainerStyle","focusedRouteKey","routes","index","key","loaded","setLoaded","React","useState","includes","dimensions","SafeAreaProviderCompat","initialMetrics","frame","tabBarHeight","setTabBarHeight","layout","width","height","insets","style","options","tabBarStyle","renderTabBar","top","right","bottom","left","styles","container","map","route","descriptor","lazy","unmountOnBlur","isFocused","freezeOnBlur","header","name","headerShown","headerStatusBarHeight","headerTransparent","StyleSheet","absoluteFill","zIndex","render","create","flex","overflow"],"mappings":";;;;;;;AAAA;;AAUA;;AACA;;AACA;;AAUA;;AACA;;AACA;;AACA;;;;;;;;;;AAQe,SAASA,aAAT,CAAuBC,KAAvB,EAAqC;AAClD,QAAM;AACJC,IAAAA,MAAM,GAAID,KAAD,iBAA8B,oBAAC,qBAAD,EAAkBA,KAAlB,CADnC;AAEJE,IAAAA,KAFI;AAGJC,IAAAA,UAHI;AAIJC,IAAAA,WAJI;AAKJC,IAAAA,cALI;AAMJC,IAAAA,qBAAqB,GAAGC,sBAASC,EAAT,KAAgB,KAAhB,IACtBD,sBAASC,EAAT,KAAgB,SADM,IAEtBD,sBAASC,EAAT,KAAgB,KARd;AASJC,IAAAA;AATI,MAUFT,KAVJ;AAYA,QAAMU,eAAe,GAAGR,KAAK,CAACS,MAAN,CAAaT,KAAK,CAACU,KAAnB,EAA0BC,GAAlD;AACA,QAAM,CAACC,MAAD,EAASC,SAAT,IAAsBC,KAAK,CAACC,QAAN,CAAe,CAACP,eAAD,CAAf,CAA5B;;AAEA,MAAI,CAACI,MAAM,CAACI,QAAP,CAAgBR,eAAhB,CAAL,EAAuC;AACrCK,IAAAA,SAAS,CAAC,CAAC,GAAGD,MAAJ,EAAYJ,eAAZ,CAAD,CAAT;AACD;;AAED,QAAMS,UAAU,GAAGC,iCAAuBC,cAAvB,CAAsCC,KAAzD;AACA,QAAM,CAACC,YAAD,EAAeC,eAAf,IAAkCR,KAAK,CAACC,QAAN,CAAe,MACrD,mCAAgB;AACdf,IAAAA,KADc;AAEdE,IAAAA,WAFc;AAGde,IAAAA,UAHc;AAIdM,IAAAA,MAAM,EAAE;AAAEC,MAAAA,KAAK,EAAEP,UAAU,CAACO,KAApB;AAA2BC,MAAAA,MAAM,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,CAFT;AAGE,MAAA,OAAO,EAAEA,SAHX;AAIE,MAAA,OAAO,EAAEtC,qBAJX;AAKE,MAAA,YAAY,EAAEuC;AALhB,oBAOE,oBAAC,kCAAD,CAA2B,QAA3B;AAAoC,MAAA,KAAK,EAAEtB;AAA3C,oBACE,oBAAC,gBAAD;AACE,MAAA,OAAO,EAAEqB,SADX;AAEE,MAAA,KAAK,EAAEH,UAAU,CAACD,KAFpB;AAGE,MAAA,UAAU,EAAEC,UAAU,CAACtC,UAHzB;AAIE,MAAA,WAAW,EAAE6C,WAJf;AAKE,MAAA,qBAAqB,EAAEC,qBALzB;AAME,MAAA,iBAAiB,EAAEC,iBANrB;AAOE,MAAA,MAAM,EAAEJ,MAAM,CAAC;AACbrB,QAAAA,MAAM,EAAEN,UADK;AAEbqB,QAAAA,KAAK,EAAEC,UAAU,CAACD,KAFL;AAGbrC,QAAAA,UAAU,EACRsC,UAAU,CAACtC,UAJA;AAKb2B,QAAAA,OAAO,EAAEW,UAAU,CAACX;AALP,OAAD,CAPhB;AAcE,MAAA,KAAK,EAAErB;AAdT,OAgBGgC,UAAU,CAACa,MAAX,EAhBH,CADF,CAPF,CADF;AA8BD,GA1DA,CALH,CADF,eAkEE,oBAAC,0CAAD,CAAmC,QAAnC;AAA4C,IAAA,KAAK,EAAE9B;AAAnD,KACGQ,YAAY,EADf,CAlEF,CADF;AAwED;;AAED,MAAMK,MAAM,GAAGc,wBAAWI,MAAX,CAAkB;AAC/BjB,EAAAA,SAAS,EAAE;AACTkB,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,QAAQ,EAAE;AAFD;AADoB,CAAlB,CAAf","sourcesContent":["import {\n getHeaderTitle,\n Header,\n SafeAreaProviderCompat,\n Screen,\n} from '@react-navigation/elements';\nimport type {\n ParamListBase,\n TabNavigationState,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { Platform, StyleSheet } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nimport type {\n BottomTabBarProps,\n BottomTabDescriptorMap,\n BottomTabHeaderProps,\n BottomTabNavigationConfig,\n BottomTabNavigationHelpers,\n BottomTabNavigationProp,\n} from '../types';\nimport BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';\nimport BottomTabBarHeightContext from '../utils/BottomTabBarHeightContext';\nimport BottomTabBar, { getTabBarHeight } from './BottomTabBar';\nimport { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';\n\ntype Props = BottomTabNavigationConfig & {\n state: TabNavigationState<ParamListBase>;\n navigation: BottomTabNavigationHelpers;\n descriptors: BottomTabDescriptorMap;\n};\n\nexport default function BottomTabView(props: Props) {\n const {\n tabBar = (props: BottomTabBarProps) => <BottomTabBar {...props} />,\n state,\n navigation,\n descriptors,\n safeAreaInsets,\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n sceneContainerStyle,\n } = props;\n\n const focusedRouteKey = state.routes[state.index].key;\n const [loaded, setLoaded] = React.useState([focusedRouteKey]);\n\n if (!loaded.includes(focusedRouteKey)) {\n setLoaded([...loaded, focusedRouteKey]);\n }\n\n const dimensions = SafeAreaProviderCompat.initialMetrics.frame;\n const [tabBarHeight, setTabBarHeight] = React.useState(() =>\n getTabBarHeight({\n state,\n descriptors,\n dimensions,\n layout: { width: dimensions.width, height: 0 },\n insets: {\n ...SafeAreaProviderCompat.initialMetrics.insets,\n ...props.safeAreaInsets,\n },\n style: descriptors[state.routes[state.index].key].options.tabBarStyle,\n })\n );\n\n const renderTabBar = () => {\n return (\n <SafeAreaInsetsContext.Consumer>\n {(insets) =>\n tabBar({\n state: state,\n descriptors: descriptors,\n navigation: navigation,\n insets: {\n top: safeAreaInsets?.top ?? insets?.top ?? 0,\n right: safeAreaInsets?.right ?? insets?.right ?? 0,\n bottom: safeAreaInsets?.bottom ?? insets?.bottom ?? 0,\n left: safeAreaInsets?.left ?? insets?.left ?? 0,\n },\n })\n }\n </SafeAreaInsetsContext.Consumer>\n );\n };\n\n const { routes } = state;\n\n return (\n <SafeAreaProviderCompat>\n <MaybeScreenContainer\n enabled={detachInactiveScreens}\n hasTwoStates\n style={styles.container}\n >\n {routes.map((route, index) => {\n const descriptor = descriptors[route.key];\n const { lazy = true, 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 lazy screen if we've never navigated to it\n return null;\n }\n\n const {\n freezeOnBlur,\n header = ({ layout, options }: BottomTabHeaderProps) => (\n <Header\n {...options}\n layout={layout}\n title={getHeaderTitle(options, route.name)}\n />\n ),\n headerShown,\n headerStatusBarHeight,\n headerTransparent,\n } = descriptor.options;\n\n return (\n <MaybeScreen\n key={route.key}\n style={[StyleSheet.absoluteFill, { zIndex: isFocused ? 0 : -1 }]}\n visible={isFocused}\n enabled={detachInactiveScreens}\n freezeOnBlur={freezeOnBlur}\n >\n <BottomTabBarHeightContext.Provider value={tabBarHeight}>\n <Screen\n focused={isFocused}\n route={descriptor.route}\n navigation={descriptor.navigation}\n headerShown={headerShown}\n headerStatusBarHeight={headerStatusBarHeight}\n headerTransparent={headerTransparent}\n header={header({\n layout: dimensions,\n route: descriptor.route,\n navigation:\n descriptor.navigation as BottomTabNavigationProp<ParamListBase>,\n options: descriptor.options,\n })}\n style={sceneContainerStyle}\n >\n {descriptor.render()}\n </Screen>\n </BottomTabBarHeightContext.Provider>\n </MaybeScreen>\n );\n })}\n </MaybeScreenContainer>\n <BottomTabBarHeightCallbackContext.Provider value={setTabBarHeight}>\n {renderTabBar()}\n </BottomTabBarHeightCallbackContext.Provider>\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n overflow: 'hidden',\n },\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["ScreenFallback.tsx"],"names":["Screens","require","e","MaybeScreenContainer","enabled","rest","screensEnabled","MaybeScreen","visible","children"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;;;;;;;AASA,IAAIA,OAAJ;;AAEA,IAAI;AACFA,EAAAA,OAAO,GAAGC,OAAO,CAAC,sBAAD,CAAjB;AACD,CAFD,CAEE,OAAOC,CAAP,EAAU,CACV;AACD;;AAEM,MAAMC,oBAAoB,GAAG,QAO9B;AAAA;;AAAA,MAP+B;AACnCC,IAAAA,OADmC;AAEnC,OAAGC;AAFgC,GAO/B;;AACJ,kBAAIL,OAAJ,8DAAI,SAASM,cAAb,kDAAI,oCAAJ,EAAiC;AAC/B,wBAAO,oBAAC,OAAD,CAAS,eAAT;AAAyB,MAAA,OAAO,EAAEF;AAAlC,OAA+CC,IAA/C,EAAP;AACD;;AAED,sBAAO,oBAAC,iBAAD,EAAUA,IAAV,CAAP;AACD,CAbM;;;;AAeA,SAASE,WAAT,QAA4D;AAAA;;AAAA,MAAvC;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,QAAX;AAAqB,OAAGJ;AAAxB,GAAuC;;AACjE,mBAAIL,OAAJ,+DAAI,UAASM,cAAb,kDAAI,qCAAJ,EAAiC;AAC/B,wBACE,oBAAC,OAAD,CAAS,MAAT;AAAgB,MAAA,aAAa,EAAEE,OAAO,GAAG,CAAH,GAAO;AAA7C,OAAoDH,IAApD,GACGI,QADH,CADF;AAKD;;AAED,sBACE,oBAAC,4BAAD;AAAoB,IAAA,OAAO,EAAED;AAA7B,KAA0CH,IAA1C,GACGI,QADH,CADF;AAKD","sourcesContent":["import { ResourceSavingView } from '@react-navigation/elements';\nimport * as React from 'react';\nimport { StyleProp, View, ViewProps, ViewStyle } from 'react-native';\n\ntype Props = {\n visible: boolean;\n children: React.ReactNode;\n enabled: boolean;\n style?: StyleProp<ViewStyle>;\n};\n\nlet Screens: typeof import('react-native-screens') | undefined;\n\ntry {\n Screens = require('react-native-screens');\n} catch (e) {\n // Ignore\n}\n\nexport const MaybeScreenContainer = ({\n enabled,\n ...rest\n}: ViewProps & {\n enabled: boolean;\n hasTwoStates: boolean;\n children: React.ReactNode;\n}) => {\n if (Screens?.screensEnabled?.()) {\n return <Screens.ScreenContainer enabled={enabled} {...rest} />;\n }\n\n return <View {...rest} />;\n};\n\nexport function MaybeScreen({ visible, children, ...rest }: Props) {\n if (Screens?.screensEnabled?.()) {\n return (\n <Screens.Screen activityState={visible ? 2 : 0} {...rest}>\n {children}\n </Screens.Screen>\n );\n }\n\n return (\n <ResourceSavingView visible={visible} {...rest}>\n {children}\n </ResourceSavingView>\n );\n}\n"]}
1
+ {"version":3,"sources":["ScreenFallback.tsx"],"names":["Screens","require","e","MaybeScreenContainer","enabled","rest","screensEnabled","MaybeScreen","visible","children"],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;;;;;;;AAUA,IAAIA,OAAJ;;AAEA,IAAI;AACFA,EAAAA,OAAO,GAAGC,OAAO,CAAC,sBAAD,CAAjB;AACD,CAFD,CAEE,OAAOC,CAAP,EAAU,CACV;AACD;;AAEM,MAAMC,oBAAoB,GAAG,QAO9B;AAAA;;AAAA,MAP+B;AACnCC,IAAAA,OADmC;AAEnC,OAAGC;AAFgC,GAO/B;;AACJ,kBAAIL,OAAJ,8DAAI,SAASM,cAAb,kDAAI,oCAAJ,EAAiC;AAC/B,wBAAO,oBAAC,OAAD,CAAS,eAAT;AAAyB,MAAA,OAAO,EAAEF;AAAlC,OAA+CC,IAA/C,EAAP;AACD;;AAED,sBAAO,oBAAC,iBAAD,EAAUA,IAAV,CAAP;AACD,CAbM;;;;AAeA,SAASE,WAAT,QAA4D;AAAA;;AAAA,MAAvC;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,QAAX;AAAqB,OAAGJ;AAAxB,GAAuC;;AACjE,mBAAIL,OAAJ,+DAAI,UAASM,cAAb,kDAAI,qCAAJ,EAAiC;AAC/B,wBACE,oBAAC,OAAD,CAAS,MAAT;AAAgB,MAAA,aAAa,EAAEE,OAAO,GAAG,CAAH,GAAO;AAA7C,OAAoDH,IAApD,GACGI,QADH,CADF;AAKD;;AAED,sBACE,oBAAC,4BAAD;AAAoB,IAAA,OAAO,EAAED;AAA7B,KAA0CH,IAA1C,GACGI,QADH,CADF;AAKD","sourcesContent":["import { ResourceSavingView } from '@react-navigation/elements';\nimport * as React from 'react';\nimport { StyleProp, View, ViewProps, ViewStyle } from 'react-native';\n\ntype Props = {\n visible: boolean;\n children: React.ReactNode;\n enabled: boolean;\n freezeOnBlur?: boolean;\n style?: StyleProp<ViewStyle>;\n};\n\nlet Screens: typeof import('react-native-screens') | undefined;\n\ntry {\n Screens = require('react-native-screens');\n} catch (e) {\n // Ignore\n}\n\nexport const MaybeScreenContainer = ({\n enabled,\n ...rest\n}: ViewProps & {\n enabled: boolean;\n hasTwoStates: boolean;\n children: React.ReactNode;\n}) => {\n if (Screens?.screensEnabled?.()) {\n return <Screens.ScreenContainer enabled={enabled} {...rest} />;\n }\n\n return <View {...rest} />;\n};\n\nexport function MaybeScreen({ visible, children, ...rest }: Props) {\n if (Screens?.screensEnabled?.()) {\n return (\n <Screens.Screen activityState={visible ? 2 : 0} {...rest}>\n {children}\n </Screens.Screen>\n );\n }\n\n return (\n <ResourceSavingView visible={visible} {...rest}>\n {children}\n </ResourceSavingView>\n );\n}\n"]}
@@ -83,6 +83,7 @@ export default function BottomTabView(props) {
83
83
  }
84
84
 
85
85
  const {
86
+ freezeOnBlur,
86
87
  header = _ref5 => {
87
88
  let {
88
89
  layout,
@@ -92,7 +93,10 @@ export default function BottomTabView(props) {
92
93
  layout: layout,
93
94
  title: getHeaderTitle(options, route.name)
94
95
  }));
95
- }
96
+ },
97
+ headerShown,
98
+ headerStatusBarHeight,
99
+ headerTransparent
96
100
  } = descriptor.options;
97
101
  return /*#__PURE__*/React.createElement(MaybeScreen, {
98
102
  key: route.key,
@@ -100,16 +104,17 @@ export default function BottomTabView(props) {
100
104
  zIndex: isFocused ? 0 : -1
101
105
  }],
102
106
  visible: isFocused,
103
- enabled: detachInactiveScreens
107
+ enabled: detachInactiveScreens,
108
+ freezeOnBlur: freezeOnBlur
104
109
  }, /*#__PURE__*/React.createElement(BottomTabBarHeightContext.Provider, {
105
110
  value: tabBarHeight
106
111
  }, /*#__PURE__*/React.createElement(Screen, {
107
112
  focused: isFocused,
108
113
  route: descriptor.route,
109
114
  navigation: descriptor.navigation,
110
- headerShown: descriptor.options.headerShown,
111
- headerTransparent: descriptor.options.headerTransparent,
112
- headerStatusBarHeight: descriptor.options.headerStatusBarHeight,
115
+ headerShown: headerShown,
116
+ headerStatusBarHeight: headerStatusBarHeight,
117
+ headerTransparent: headerTransparent,
113
118
  header: header({
114
119
  layout: dimensions,
115
120
  route: descriptor.route,
@@ -1 +1 @@
1
- {"version":3,"sources":["BottomTabView.tsx"],"names":["getHeaderTitle","Header","SafeAreaProviderCompat","Screen","React","Platform","StyleSheet","SafeAreaInsetsContext","BottomTabBarHeightCallbackContext","BottomTabBarHeightContext","BottomTabBar","getTabBarHeight","MaybeScreen","MaybeScreenContainer","BottomTabView","props","tabBar","state","navigation","descriptors","safeAreaInsets","detachInactiveScreens","OS","sceneContainerStyle","focusedRouteKey","routes","index","key","loaded","setLoaded","useState","includes","dimensions","initialMetrics","frame","tabBarHeight","setTabBarHeight","layout","width","height","insets","style","options","tabBarStyle","renderTabBar","top","right","bottom","left","styles","container","map","route","descriptor","lazy","unmountOnBlur","isFocused","header","name","absoluteFill","zIndex","headerShown","headerTransparent","headerStatusBarHeight","render","create","flex","overflow"],"mappings":";;AAAA,SACEA,cADF,EAEEC,MAFF,EAGEC,sBAHF,EAIEC,MAJF,QAKO,4BALP;AAUA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAAmBC,UAAnB,QAAqC,cAArC;AACA,SAASC,qBAAT,QAAsC,gCAAtC;AAUA,OAAOC,iCAAP,MAA8C,4CAA9C;AACA,OAAOC,yBAAP,MAAsC,oCAAtC;AACA,OAAOC,YAAP,IAAuBC,eAAvB,QAA8C,gBAA9C;AACA,SAASC,WAAT,EAAsBC,oBAA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MAAA,UAAU,EAAEC,UAAU,CAACnC,UAHzB;AAIE,MAAA,WAAW,EAAEmC,UAAU,CAACX,OAAX,CAAmBmB,WAJlC;AAKE,MAAA,iBAAiB,EAAER,UAAU,CAACX,OAAX,CAAmBoB,iBALxC;AAME,MAAA,qBAAqB,EACnBT,UAAU,CAACX,OAAX,CAAmBqB,qBAPvB;AASE,MAAA,MAAM,EAAEN,MAAM,CAAC;AACbpB,QAAAA,MAAM,EAAEL,UADK;AAEboB,QAAAA,KAAK,EAAEC,UAAU,CAACD,KAFL;AAGblC,QAAAA,UAAU,EACRmC,UAAU,CAACnC,UAJA;AAKbwB,QAAAA,OAAO,EAAEW,UAAU,CAACX;AALP,OAAD,CAThB;AAgBE,MAAA,KAAK,EAAEnB;AAhBT,OAkBG8B,UAAU,CAACW,MAAX,EAlBH,CADF,CANF,CADF;AA+BD,GAvDA,CALH,CADF,eA+DE,oBAAC,iCAAD,CAAmC,QAAnC;AAA4C,IAAA,KAAK,EAAE5B;AAAnD,KACGQ,YAAY,EADf,CA/DF,CADF;AAqED;AAED,MAAMK,MAAM,GAAG3C,UAAU,CAAC2D,MAAX,CAAkB;AAC/Bf,EAAAA,SAAS,EAAE;AACTgB,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,QAAQ,EAAE;AAFD;AADoB,CAAlB,CAAf","sourcesContent":["import {\n getHeaderTitle,\n Header,\n SafeAreaProviderCompat,\n Screen,\n} from '@react-navigation/elements';\nimport type {\n ParamListBase,\n TabNavigationState,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { Platform, StyleSheet } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nimport type {\n BottomTabBarProps,\n BottomTabDescriptorMap,\n BottomTabHeaderProps,\n BottomTabNavigationConfig,\n BottomTabNavigationHelpers,\n BottomTabNavigationProp,\n} from '../types';\nimport BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';\nimport BottomTabBarHeightContext from '../utils/BottomTabBarHeightContext';\nimport BottomTabBar, { getTabBarHeight } from './BottomTabBar';\nimport { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';\n\ntype Props = BottomTabNavigationConfig & {\n state: TabNavigationState<ParamListBase>;\n navigation: BottomTabNavigationHelpers;\n descriptors: BottomTabDescriptorMap;\n};\n\nexport default function BottomTabView(props: Props) {\n const {\n tabBar = (props: BottomTabBarProps) => <BottomTabBar {...props} />,\n state,\n navigation,\n descriptors,\n safeAreaInsets,\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n sceneContainerStyle,\n } = props;\n\n const focusedRouteKey = state.routes[state.index].key;\n const [loaded, setLoaded] = React.useState([focusedRouteKey]);\n\n if (!loaded.includes(focusedRouteKey)) {\n setLoaded([...loaded, focusedRouteKey]);\n }\n\n const dimensions = SafeAreaProviderCompat.initialMetrics.frame;\n const [tabBarHeight, setTabBarHeight] = React.useState(() =>\n getTabBarHeight({\n state,\n descriptors,\n dimensions,\n layout: { width: dimensions.width, height: 0 },\n insets: {\n ...SafeAreaProviderCompat.initialMetrics.insets,\n ...props.safeAreaInsets,\n },\n style: descriptors[state.routes[state.index].key].options.tabBarStyle,\n })\n );\n\n const renderTabBar = () => {\n return (\n <SafeAreaInsetsContext.Consumer>\n {(insets) =>\n tabBar({\n state: state,\n descriptors: descriptors,\n navigation: navigation,\n insets: {\n top: safeAreaInsets?.top ?? insets?.top ?? 0,\n right: safeAreaInsets?.right ?? insets?.right ?? 0,\n bottom: safeAreaInsets?.bottom ?? insets?.bottom ?? 0,\n left: safeAreaInsets?.left ?? insets?.left ?? 0,\n },\n })\n }\n </SafeAreaInsetsContext.Consumer>\n );\n };\n\n const { routes } = state;\n\n return (\n <SafeAreaProviderCompat>\n <MaybeScreenContainer\n enabled={detachInactiveScreens}\n hasTwoStates\n style={styles.container}\n >\n {routes.map((route, index) => {\n const descriptor = descriptors[route.key];\n const { lazy = true, 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 lazy screen if we've never navigated to it\n return null;\n }\n\n const {\n header = ({ layout, options }: BottomTabHeaderProps) => (\n <Header\n {...options}\n layout={layout}\n title={getHeaderTitle(options, route.name)}\n />\n ),\n } = descriptor.options;\n\n return (\n <MaybeScreen\n key={route.key}\n style={[StyleSheet.absoluteFill, { zIndex: isFocused ? 0 : -1 }]}\n visible={isFocused}\n enabled={detachInactiveScreens}\n >\n <BottomTabBarHeightContext.Provider value={tabBarHeight}>\n <Screen\n focused={isFocused}\n route={descriptor.route}\n navigation={descriptor.navigation}\n headerShown={descriptor.options.headerShown}\n headerTransparent={descriptor.options.headerTransparent}\n headerStatusBarHeight={\n descriptor.options.headerStatusBarHeight\n }\n header={header({\n layout: dimensions,\n route: descriptor.route,\n navigation:\n descriptor.navigation as BottomTabNavigationProp<ParamListBase>,\n options: descriptor.options,\n })}\n style={sceneContainerStyle}\n >\n {descriptor.render()}\n </Screen>\n </BottomTabBarHeightContext.Provider>\n </MaybeScreen>\n );\n })}\n </MaybeScreenContainer>\n <BottomTabBarHeightCallbackContext.Provider value={setTabBarHeight}>\n {renderTabBar()}\n </BottomTabBarHeightCallbackContext.Provider>\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n overflow: 'hidden',\n },\n});\n"]}
1
+ {"version":3,"sources":["BottomTabView.tsx"],"names":["getHeaderTitle","Header","SafeAreaProviderCompat","Screen","React","Platform","StyleSheet","SafeAreaInsetsContext","BottomTabBarHeightCallbackContext","BottomTabBarHeightContext","BottomTabBar","getTabBarHeight","MaybeScreen","MaybeScreenContainer","BottomTabView","props","tabBar","state","navigation","descriptors","safeAreaInsets","detachInactiveScreens","OS","sceneContainerStyle","focusedRouteKey","routes","index","key","loaded","setLoaded","useState","includes","dimensions","initialMetrics","frame","tabBarHeight","setTabBarHeight","layout","width","height","insets","style","options","tabBarStyle","renderTabBar","top","right","bottom","left","styles","container","map","route","descriptor","lazy","unmountOnBlur","isFocused","freezeOnBlur","header","name","headerShown","headerStatusBarHeight","headerTransparent","absoluteFill","zIndex","render","create","flex","overflow"],"mappings":";;AAAA,SACEA,cADF,EAEEC,MAFF,EAGEC,sBAHF,EAIEC,MAJF,QAKO,4BALP;AAUA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAAmBC,UAAnB,QAAqC,cAArC;AACA,SAASC,qBAAT,QAAsC,gCAAtC;AAUA,OAAOC,iCAAP,MAA8C,4CAA9C;AACA,OAAOC,yBAAP,MAAsC,oCAAtC;AACA,OAAOC,YAAP,IAAuBC,eAAvB,QAA8C,gBAA9C;AACA,SAASC,WAAT,EAAsBC,oBAAtB,QAAkD,kBAAlD;AAQA,eAAe,SAASC,aAAT,CAAuBC,KAAvB,EAAqC;AAClD,QAAM;AACJC,IAAAA,MAAM,GAAID,KAAD,iBAA8B,oBAAC,YAAD,EAAkBA,KAAlB,CADnC;AAEJE,IAAAA,KAFI;AAGJC,IAAAA,UAHI;AAIJC,IAAAA,WAJI;AAKJC,IAAAA,cALI;AAMJC,IAAAA,qBAAqB,GAAGhB,QAAQ,CAACiB,EAAT,KAAgB,KAAhB,IACtBjB,QAAQ,CAACiB,EAAT,KAAgB,SADM,IAEtBjB,QAAQ,CAACiB,EAAT,KAAgB,KARd;AASJC,IAAAA;AATI,MAUFR,KAVJ;AAYA,QAAMS,eAAe,GAAGP,KAAK,CAACQ,MAAN,CAAaR,KAAK,CAACS,KAAnB,EAA0BC,GAAlD;AACA,QAAM,CAACC,MAAD,EAASC,SAAT,IAAsBzB,KAAK,CAAC0B,QAAN,CAAe,CAACN,eAAD,CAAf,CAA5B;;AAEA,MAAI,CAACI,MAAM,CAACG,QAAP,CAAgBP,eAAhB,CAAL,EAAuC;AACrCK,IAAAA,SAAS,CAAC,CAAC,GAAGD,MAAJ,EAAYJ,eAAZ,CAAD,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AAX,CAAkB;AAC/BhB,EAAAA,SAAS,EAAE;AACTiB,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,QAAQ,EAAE;AAFD;AADoB,CAAlB,CAAf","sourcesContent":["import {\n getHeaderTitle,\n Header,\n SafeAreaProviderCompat,\n Screen,\n} from '@react-navigation/elements';\nimport type {\n ParamListBase,\n TabNavigationState,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { Platform, StyleSheet } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nimport type {\n BottomTabBarProps,\n BottomTabDescriptorMap,\n BottomTabHeaderProps,\n BottomTabNavigationConfig,\n BottomTabNavigationHelpers,\n BottomTabNavigationProp,\n} from '../types';\nimport BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';\nimport BottomTabBarHeightContext from '../utils/BottomTabBarHeightContext';\nimport BottomTabBar, { getTabBarHeight } from './BottomTabBar';\nimport { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';\n\ntype Props = BottomTabNavigationConfig & {\n state: TabNavigationState<ParamListBase>;\n navigation: BottomTabNavigationHelpers;\n descriptors: BottomTabDescriptorMap;\n};\n\nexport default function BottomTabView(props: Props) {\n const {\n tabBar = (props: BottomTabBarProps) => <BottomTabBar {...props} />,\n state,\n navigation,\n descriptors,\n safeAreaInsets,\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n sceneContainerStyle,\n } = props;\n\n const focusedRouteKey = state.routes[state.index].key;\n const [loaded, setLoaded] = React.useState([focusedRouteKey]);\n\n if (!loaded.includes(focusedRouteKey)) {\n setLoaded([...loaded, focusedRouteKey]);\n }\n\n const dimensions = SafeAreaProviderCompat.initialMetrics.frame;\n const [tabBarHeight, setTabBarHeight] = React.useState(() =>\n getTabBarHeight({\n state,\n descriptors,\n dimensions,\n layout: { width: dimensions.width, height: 0 },\n insets: {\n ...SafeAreaProviderCompat.initialMetrics.insets,\n ...props.safeAreaInsets,\n },\n style: descriptors[state.routes[state.index].key].options.tabBarStyle,\n })\n );\n\n const renderTabBar = () => {\n return (\n <SafeAreaInsetsContext.Consumer>\n {(insets) =>\n tabBar({\n state: state,\n descriptors: descriptors,\n navigation: navigation,\n insets: {\n top: safeAreaInsets?.top ?? insets?.top ?? 0,\n right: safeAreaInsets?.right ?? insets?.right ?? 0,\n bottom: safeAreaInsets?.bottom ?? insets?.bottom ?? 0,\n left: safeAreaInsets?.left ?? insets?.left ?? 0,\n },\n })\n }\n </SafeAreaInsetsContext.Consumer>\n );\n };\n\n const { routes } = state;\n\n return (\n <SafeAreaProviderCompat>\n <MaybeScreenContainer\n enabled={detachInactiveScreens}\n hasTwoStates\n style={styles.container}\n >\n {routes.map((route, index) => {\n const descriptor = descriptors[route.key];\n const { lazy = true, 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 lazy screen if we've never navigated to it\n return null;\n }\n\n const {\n freezeOnBlur,\n header = ({ layout, options }: BottomTabHeaderProps) => (\n <Header\n {...options}\n layout={layout}\n title={getHeaderTitle(options, route.name)}\n />\n ),\n headerShown,\n headerStatusBarHeight,\n headerTransparent,\n } = descriptor.options;\n\n return (\n <MaybeScreen\n key={route.key}\n style={[StyleSheet.absoluteFill, { zIndex: isFocused ? 0 : -1 }]}\n visible={isFocused}\n enabled={detachInactiveScreens}\n freezeOnBlur={freezeOnBlur}\n >\n <BottomTabBarHeightContext.Provider value={tabBarHeight}>\n <Screen\n focused={isFocused}\n route={descriptor.route}\n navigation={descriptor.navigation}\n headerShown={headerShown}\n headerStatusBarHeight={headerStatusBarHeight}\n headerTransparent={headerTransparent}\n header={header({\n layout: dimensions,\n route: descriptor.route,\n navigation:\n descriptor.navigation as BottomTabNavigationProp<ParamListBase>,\n options: descriptor.options,\n })}\n style={sceneContainerStyle}\n >\n {descriptor.render()}\n </Screen>\n </BottomTabBarHeightContext.Provider>\n </MaybeScreen>\n );\n })}\n </MaybeScreenContainer>\n <BottomTabBarHeightCallbackContext.Provider value={setTabBarHeight}>\n {renderTabBar()}\n </BottomTabBarHeightCallbackContext.Provider>\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n overflow: 'hidden',\n },\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["ScreenFallback.tsx"],"names":["ResourceSavingView","React","View","Screens","require","e","MaybeScreenContainer","enabled","rest","screensEnabled","MaybeScreen","visible","children"],"mappings":";;AAAA,SAASA,kBAAT,QAAmC,4BAAnC;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAAoBC,IAApB,QAAsD,cAAtD;AASA,IAAIC,OAAJ;;AAEA,IAAI;AACFA,EAAAA,OAAO,GAAGC,OAAO,CAAC,sBAAD,CAAjB;AACD,CAFD,CAEE,OAAOC,CAAP,EAAU,CACV;AACD;;AAED,OAAO,MAAMC,oBAAoB,GAAG,QAO9B;AAAA;;AAAA,MAP+B;AACnCC,IAAAA,OADmC;AAEnC,OAAGC;AAFgC,GAO/B;;AACJ,kBAAIL,OAAJ,8DAAI,SAASM,cAAb,kDAAI,oCAAJ,EAAiC;AAC/B,wBAAO,oBAAC,OAAD,CAAS,eAAT;AAAyB,MAAA,OAAO,EAAEF;AAAlC,OAA+CC,IAA/C,EAAP;AACD;;AAED,sBAAO,oBAAC,IAAD,EAAUA,IAAV,CAAP;AACD,CAbM;AAeP,OAAO,SAASE,WAAT,QAA4D;AAAA;;AAAA,MAAvC;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,QAAX;AAAqB,OAAGJ;AAAxB,GAAuC;;AACjE,mBAAIL,OAAJ,+DAAI,UAASM,cAAb,kDAAI,qCAAJ,EAAiC;AAC/B,wBACE,oBAAC,OAAD,CAAS,MAAT;AAAgB,MAAA,aAAa,EAAEE,OAAO,GAAG,CAAH,GAAO;AAA7C,OAAoDH,IAApD,GACGI,QADH,CADF;AAKD;;AAED,sBACE,oBAAC,kBAAD;AAAoB,IAAA,OAAO,EAAED;AAA7B,KAA0CH,IAA1C,GACGI,QADH,CADF;AAKD","sourcesContent":["import { ResourceSavingView } from '@react-navigation/elements';\nimport * as React from 'react';\nimport { StyleProp, View, ViewProps, ViewStyle } from 'react-native';\n\ntype Props = {\n visible: boolean;\n children: React.ReactNode;\n enabled: boolean;\n style?: StyleProp<ViewStyle>;\n};\n\nlet Screens: typeof import('react-native-screens') | undefined;\n\ntry {\n Screens = require('react-native-screens');\n} catch (e) {\n // Ignore\n}\n\nexport const MaybeScreenContainer = ({\n enabled,\n ...rest\n}: ViewProps & {\n enabled: boolean;\n hasTwoStates: boolean;\n children: React.ReactNode;\n}) => {\n if (Screens?.screensEnabled?.()) {\n return <Screens.ScreenContainer enabled={enabled} {...rest} />;\n }\n\n return <View {...rest} />;\n};\n\nexport function MaybeScreen({ visible, children, ...rest }: Props) {\n if (Screens?.screensEnabled?.()) {\n return (\n <Screens.Screen activityState={visible ? 2 : 0} {...rest}>\n {children}\n </Screens.Screen>\n );\n }\n\n return (\n <ResourceSavingView visible={visible} {...rest}>\n {children}\n </ResourceSavingView>\n );\n}\n"]}
1
+ {"version":3,"sources":["ScreenFallback.tsx"],"names":["ResourceSavingView","React","View","Screens","require","e","MaybeScreenContainer","enabled","rest","screensEnabled","MaybeScreen","visible","children"],"mappings":";;AAAA,SAASA,kBAAT,QAAmC,4BAAnC;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAAoBC,IAApB,QAAsD,cAAtD;AAUA,IAAIC,OAAJ;;AAEA,IAAI;AACFA,EAAAA,OAAO,GAAGC,OAAO,CAAC,sBAAD,CAAjB;AACD,CAFD,CAEE,OAAOC,CAAP,EAAU,CACV;AACD;;AAED,OAAO,MAAMC,oBAAoB,GAAG,QAO9B;AAAA;;AAAA,MAP+B;AACnCC,IAAAA,OADmC;AAEnC,OAAGC;AAFgC,GAO/B;;AACJ,kBAAIL,OAAJ,8DAAI,SAASM,cAAb,kDAAI,oCAAJ,EAAiC;AAC/B,wBAAO,oBAAC,OAAD,CAAS,eAAT;AAAyB,MAAA,OAAO,EAAEF;AAAlC,OAA+CC,IAA/C,EAAP;AACD;;AAED,sBAAO,oBAAC,IAAD,EAAUA,IAAV,CAAP;AACD,CAbM;AAeP,OAAO,SAASE,WAAT,QAA4D;AAAA;;AAAA,MAAvC;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,QAAX;AAAqB,OAAGJ;AAAxB,GAAuC;;AACjE,mBAAIL,OAAJ,+DAAI,UAASM,cAAb,kDAAI,qCAAJ,EAAiC;AAC/B,wBACE,oBAAC,OAAD,CAAS,MAAT;AAAgB,MAAA,aAAa,EAAEE,OAAO,GAAG,CAAH,GAAO;AAA7C,OAAoDH,IAApD,GACGI,QADH,CADF;AAKD;;AAED,sBACE,oBAAC,kBAAD;AAAoB,IAAA,OAAO,EAAED;AAA7B,KAA0CH,IAA1C,GACGI,QADH,CADF;AAKD","sourcesContent":["import { ResourceSavingView } from '@react-navigation/elements';\nimport * as React from 'react';\nimport { StyleProp, View, ViewProps, ViewStyle } from 'react-native';\n\ntype Props = {\n visible: boolean;\n children: React.ReactNode;\n enabled: boolean;\n freezeOnBlur?: boolean;\n style?: StyleProp<ViewStyle>;\n};\n\nlet Screens: typeof import('react-native-screens') | undefined;\n\ntry {\n Screens = require('react-native-screens');\n} catch (e) {\n // Ignore\n}\n\nexport const MaybeScreenContainer = ({\n enabled,\n ...rest\n}: ViewProps & {\n enabled: boolean;\n hasTwoStates: boolean;\n children: React.ReactNode;\n}) => {\n if (Screens?.screensEnabled?.()) {\n return <Screens.ScreenContainer enabled={enabled} {...rest} />;\n }\n\n return <View {...rest} />;\n};\n\nexport function MaybeScreen({ visible, children, ...rest }: Props) {\n if (Screens?.screensEnabled?.()) {\n return (\n <Screens.Screen activityState={visible ? 2 : 0} {...rest}>\n {children}\n </Screens.Screen>\n );\n }\n\n return (\n <ResourceSavingView visible={visible} {...rest}>\n {children}\n </ResourceSavingView>\n );\n}\n"]}
@@ -172,6 +172,14 @@ export declare type BottomTabNavigationOptions = HeaderOptions & {
172
172
  * Defaults to `false`.
173
173
  */
174
174
  unmountOnBlur?: boolean;
175
+ /**
176
+ * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
177
+ * Defaults to `true` when `enableFreeze()` is run at the top of the application.
178
+ * Requires `react-native-screens` version >=3.16.0.
179
+ *
180
+ * Only supported on iOS and Android.
181
+ */
182
+ freezeOnBlur?: boolean;
175
183
  };
176
184
  export declare type BottomTabDescriptor = Descriptor<BottomTabNavigationOptions, BottomTabNavigationProp<ParamListBase>, RouteProp<ParamListBase>>;
177
185
  export declare type BottomTabDescriptorMap = Record<string, BottomTabDescriptor>;
@@ -4,6 +4,7 @@ declare type Props = {
4
4
  visible: boolean;
5
5
  children: React.ReactNode;
6
6
  enabled: boolean;
7
+ freezeOnBlur?: boolean;
7
8
  style?: StyleProp<ViewStyle>;
8
9
  };
9
10
  export declare const MaybeScreenContainer: ({ enabled, ...rest }: ViewProps & {
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.3.2",
4
+ "version": "6.4.0",
5
5
  "keywords": [
6
6
  "react-native-component",
7
7
  "react-component",
@@ -32,26 +32,26 @@
32
32
  "access": "public"
33
33
  },
34
34
  "scripts": {
35
- "prepare": "bob build",
35
+ "prepack": "bob build",
36
36
  "clean": "del lib"
37
37
  },
38
38
  "dependencies": {
39
- "@react-navigation/elements": "^1.3.4",
39
+ "@react-navigation/elements": "^1.3.6",
40
40
  "color": "^4.2.3",
41
41
  "warn-once": "^0.1.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@react-navigation/native": "^6.0.11",
44
+ "@react-navigation/native": "^6.0.13",
45
45
  "@testing-library/react-native": "^7.2.0",
46
46
  "@types/color": "^3.0.1",
47
- "@types/react": "^17.0.47",
48
- "@types/react-native": "~0.68.1",
47
+ "@types/react": "~18.0.0",
48
+ "@types/react-native": "~0.69.1",
49
49
  "del-cli": "^3.0.1",
50
- "react": "17.0.2",
51
- "react-native": "~0.68.2",
50
+ "react": "18.0.0",
51
+ "react-native": "0.69.5",
52
52
  "react-native-builder-bob": "^0.18.1",
53
- "react-native-safe-area-context": "4.2.4",
54
- "react-native-screens": "~3.11.1",
53
+ "react-native-safe-area-context": "4.3.1",
54
+ "react-native-screens": "~3.15.0",
55
55
  "typescript": "^4.7.4"
56
56
  },
57
57
  "peerDependencies": {
@@ -74,5 +74,6 @@
74
74
  }
75
75
  ]
76
76
  ]
77
- }
77
+ },
78
+ "gitHead": "fc4c3a63ab156e17db7ba0cbd32ada319f78714e"
78
79
  }
package/src/types.tsx CHANGED
@@ -244,6 +244,15 @@ export type BottomTabNavigationOptions = HeaderOptions & {
244
244
  * Defaults to `false`.
245
245
  */
246
246
  unmountOnBlur?: boolean;
247
+
248
+ /**
249
+ * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
250
+ * Defaults to `true` when `enableFreeze()` is run at the top of the application.
251
+ * Requires `react-native-screens` version >=3.16.0.
252
+ *
253
+ * Only supported on iOS and Android.
254
+ */
255
+ freezeOnBlur?: boolean;
247
256
  };
248
257
 
249
258
  export type BottomTabDescriptor = Descriptor<
@@ -110,6 +110,7 @@ export default function BottomTabView(props: Props) {
110
110
  }
111
111
 
112
112
  const {
113
+ freezeOnBlur,
113
114
  header = ({ layout, options }: BottomTabHeaderProps) => (
114
115
  <Header
115
116
  {...options}
@@ -117,6 +118,9 @@ export default function BottomTabView(props: Props) {
117
118
  title={getHeaderTitle(options, route.name)}
118
119
  />
119
120
  ),
121
+ headerShown,
122
+ headerStatusBarHeight,
123
+ headerTransparent,
120
124
  } = descriptor.options;
121
125
 
122
126
  return (
@@ -125,17 +129,16 @@ export default function BottomTabView(props: Props) {
125
129
  style={[StyleSheet.absoluteFill, { zIndex: isFocused ? 0 : -1 }]}
126
130
  visible={isFocused}
127
131
  enabled={detachInactiveScreens}
132
+ freezeOnBlur={freezeOnBlur}
128
133
  >
129
134
  <BottomTabBarHeightContext.Provider value={tabBarHeight}>
130
135
  <Screen
131
136
  focused={isFocused}
132
137
  route={descriptor.route}
133
138
  navigation={descriptor.navigation}
134
- headerShown={descriptor.options.headerShown}
135
- headerTransparent={descriptor.options.headerTransparent}
136
- headerStatusBarHeight={
137
- descriptor.options.headerStatusBarHeight
138
- }
139
+ headerShown={headerShown}
140
+ headerStatusBarHeight={headerStatusBarHeight}
141
+ headerTransparent={headerTransparent}
139
142
  header={header({
140
143
  layout: dimensions,
141
144
  route: descriptor.route,
@@ -6,6 +6,7 @@ type Props = {
6
6
  visible: boolean;
7
7
  children: React.ReactNode;
8
8
  enabled: boolean;
9
+ freezeOnBlur?: boolean;
9
10
  style?: StyleProp<ViewStyle>;
10
11
  };
11
12