@react-navigation/drawer 6.4.4 → 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.
@@ -202,6 +202,7 @@ function DrawerViewBase(_ref2) {
202
202
  }
203
203
 
204
204
  const {
205
+ freezeOnBlur,
205
206
  header = _ref3 => {
206
207
  var _options$headerLeft;
207
208
 
@@ -215,6 +216,9 @@ function DrawerViewBase(_ref2) {
215
216
  headerLeft: (_options$headerLeft = options.headerLeft) !== null && _options$headerLeft !== void 0 ? _options$headerLeft : props => /*#__PURE__*/React.createElement(_DrawerToggleButton.default, props)
216
217
  }));
217
218
  },
219
+ headerShown,
220
+ headerStatusBarHeight,
221
+ headerTransparent,
218
222
  sceneContainerStyle
219
223
  } = descriptor.options;
220
224
  return /*#__PURE__*/React.createElement(_ScreenFallback.MaybeScreen, {
@@ -223,14 +227,15 @@ function DrawerViewBase(_ref2) {
223
227
  zIndex: isFocused ? 0 : -1
224
228
  }],
225
229
  visible: isFocused,
226
- enabled: detachInactiveScreens
230
+ enabled: detachInactiveScreens,
231
+ freezeOnBlur: freezeOnBlur
227
232
  }, /*#__PURE__*/React.createElement(_elements.Screen, {
228
233
  focused: isFocused,
229
234
  route: descriptor.route,
230
235
  navigation: descriptor.navigation,
231
- headerShown: descriptor.options.headerShown,
232
- headerTransparent: descriptor.options.headerTransparent,
233
- headerStatusBarHeight: descriptor.options.headerStatusBarHeight,
236
+ headerShown: headerShown,
237
+ headerStatusBarHeight: headerStatusBarHeight,
238
+ headerTransparent: headerTransparent,
234
239
  header: header({
235
240
  layout: dimensions,
236
241
  route: descriptor.route,
@@ -1 +1 @@
1
- {"version":3,"sources":["DrawerView.tsx"],"names":["getDefaultDrawerWidth","height","width","smallerAxisSize","Math","min","isLandscape","isTablet","appBarHeight","Platform","OS","maxWidth","GestureHandlerWrapper","GestureHandlerRootView","View","DrawerViewBase","state","navigation","descriptors","defaultStatus","drawerContent","props","detachInactiveScreens","useLegacyImplementation","Reanimated","isConfigured","legacyImplemenationNotAvailable","require","abs","undefined","Error","Drawer","default","focusedRouteKey","routes","index","key","drawerHideStatusBarOnOpen","drawerPosition","I18nManager","getConstants","isRTL","drawerStatusBarAnimation","drawerStyle","drawerType","select","ios","gestureHandlerProps","keyboardDismissMode","overlayColor","swipeEdgeWidth","swipeEnabled","swipeMinDistance","options","loaded","setLoaded","React","useState","includes","dimensions","colors","drawerStatus","handleDrawerOpen","useCallback","dispatch","DrawerActions","openDrawer","target","handleDrawerClose","closeDrawer","useEffect","handleHardwareBack","isFocused","handleEscape","e","subscription","BackHandler","addEventListener","document","body","remove","removeEventListener","renderDrawerContent","renderSceneContent","styles","content","map","route","descriptor","lazy","unmountOnBlur","header","layout","name","headerLeft","sceneContainerStyle","StyleSheet","absoluteFill","zIndex","headerShown","headerTransparent","headerStatusBarHeight","render","backgroundColor","card","borderRightColor","border","borderRightWidth","hairlineWidth","borderLeftColor","borderLeftWidth","DrawerView","rest","create","flex"],"mappings":";;;;;;;AAAA;;AAMA;;AAOA;;AACA;;AAOA;;AACA;;AAWA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AASA,MAAMA,qBAAqB,GAAG,QAMxB;AAAA,MANyB;AAC7BC,IAAAA,MAD6B;AAE7BC,IAAAA;AAF6B,GAMzB;;AACJ;AACF;AACA;AACA;AACA;AACE,QAAMC,eAAe,GAAGC,IAAI,CAACC,GAAL,CAASJ,MAAT,EAAiBC,KAAjB,CAAxB;AACA,QAAMI,WAAW,GAAGJ,KAAK,GAAGD,MAA5B;AACA,QAAMM,QAAQ,GAAGJ,eAAe,IAAI,GAApC;AACA,QAAMK,YAAY,GAAGC,sBAASC,EAAT,KAAgB,KAAhB,GAAyBJ,WAAW,GAAG,EAAH,GAAQ,EAA5C,GAAkD,EAAvE;AACA,QAAMK,QAAQ,GAAGJ,QAAQ,GAAG,GAAH,GAAS,GAAlC;AAEA,SAAOH,IAAI,CAACC,GAAL,CAASF,eAAe,GA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ED,MAAM5B,MAAM,GAAGY,wBAAWiB,MAAX,CAAkB;AAC/B5B,EAAAA,OAAO,EAAE;AACP6B,IAAAA,IAAI,EAAE;AADC;AADsB,CAAlB,CAAf","sourcesContent":["import {\n getHeaderTitle,\n Header,\n SafeAreaProviderCompat,\n Screen,\n} from '@react-navigation/elements';\nimport {\n DrawerActions,\n DrawerNavigationState,\n DrawerStatus,\n ParamListBase,\n useTheme,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport {\n BackHandler,\n I18nManager,\n Platform,\n StyleSheet,\n View,\n} from 'react-native';\nimport * as Reanimated from 'react-native-reanimated';\nimport { useSafeAreaFrame } from 'react-native-safe-area-context';\n\nimport type {\n DrawerContentComponentProps,\n DrawerDescriptorMap,\n DrawerHeaderProps,\n DrawerNavigationConfig,\n DrawerNavigationHelpers,\n DrawerNavigationProp,\n DrawerProps,\n} from '../types';\nimport DrawerPositionContext from '../utils/DrawerPositionContext';\nimport DrawerStatusContext from '../utils/DrawerStatusContext';\nimport getDrawerStatusFromState from '../utils/getDrawerStatusFromState';\nimport DrawerContent from './DrawerContent';\nimport DrawerToggleButton from './DrawerToggleButton';\nimport { GestureHandlerRootView } from './GestureHandler';\nimport { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';\n\ntype Props = DrawerNavigationConfig & {\n defaultStatus: DrawerStatus;\n state: DrawerNavigationState<ParamListBase>;\n navigation: DrawerNavigationHelpers;\n descriptors: DrawerDescriptorMap;\n};\n\nconst getDefaultDrawerWidth = ({\n height,\n width,\n}: {\n height: number;\n width: number;\n}) => {\n /*\n * Default drawer width is screen width - header height\n * with a max width of 280 on mobile and 320 on tablet\n * https://material.io/components/navigation-drawer\n */\n const smallerAxisSize = Math.min(height, width);\n const isLandscape = width > height;\n const isTablet = smallerAxisSize >= 600;\n const appBarHeight = Platform.OS === 'ios' ? (isLandscape ? 32 : 44) : 56;\n const maxWidth = isTablet ? 320 : 280;\n\n return Math.min(smallerAxisSize - appBarHeight, maxWidth);\n};\n\nconst GestureHandlerWrapper = GestureHandlerRootView ?? View;\n\nfunction DrawerViewBase({\n state,\n navigation,\n descriptors,\n defaultStatus,\n drawerContent = (props: DrawerContentComponentProps) => (\n <DrawerContent {...props} />\n ),\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n // Reanimated 2 is not configured\n // @ts-expect-error: the type definitions are incomplete\n useLegacyImplementation = !Reanimated.isConfigured?.(),\n}: Props) {\n // Reanimated v3 dropped legacy v1 syntax\n const legacyImplemenationNotAvailable =\n require('react-native-reanimated').abs === undefined;\n\n if (useLegacyImplementation && legacyImplemenationNotAvailable) {\n throw new Error(\n 'The `useLegacyImplementation` prop is not available with Reanimated 3 as it no longer includes support for Reanimated 1 legacy API. Remove the `useLegacyImplementation` prop from `Drawer.Navigator` to be able to use it.'\n );\n }\n\n const Drawer: React.ComponentType<DrawerProps> = useLegacyImplementation\n ? require('./legacy/Drawer').default\n : require('./modern/Drawer').default;\n\n const focusedRouteKey = state.routes[state.index].key;\n const {\n drawerHideStatusBarOnOpen = false,\n drawerPosition = I18nManager.getConstants().isRTL ? 'right' : 'left',\n drawerStatusBarAnimation = 'slide',\n drawerStyle,\n drawerType = Platform.select({ ios: 'slide', default: 'front' }),\n gestureHandlerProps,\n keyboardDismissMode = 'on-drag',\n overlayColor = 'rgba(0, 0, 0, 0.5)',\n swipeEdgeWidth = 32,\n swipeEnabled = Platform.OS !== 'web' &&\n Platform.OS !== 'windows' &&\n Platform.OS !== 'macos',\n swipeMinDistance = 60,\n } = descriptors[focusedRouteKey].options;\n\n const [loaded, setLoaded] = React.useState([focusedRouteKey]);\n\n if (!loaded.includes(focusedRouteKey)) {\n setLoaded([...loaded, focusedRouteKey]);\n }\n\n const dimensions = useSafeAreaFrame();\n\n const { colors } = useTheme();\n\n const drawerStatus = getDrawerStatusFromState(state);\n\n const handleDrawerOpen = React.useCallback(() => {\n navigation.dispatch({\n ...DrawerActions.openDrawer(),\n target: state.key,\n });\n }, [navigation, state.key]);\n\n const handleDrawerClose = React.useCallback(() => {\n navigation.dispatch({\n ...DrawerActions.closeDrawer(),\n target: state.key,\n });\n }, [navigation, state.key]);\n\n React.useEffect(() => {\n if (drawerStatus === defaultStatus || drawerType === 'permanent') {\n return;\n }\n\n const handleHardwareBack = () => {\n // We shouldn't handle the back button if the parent screen isn't focused\n // This will avoid the drawer overriding event listeners from a focused screen\n if (!navigation.isFocused()) {\n return false;\n }\n\n if (defaultStatus === 'open') {\n handleDrawerOpen();\n } else {\n handleDrawerClose();\n }\n\n return true;\n };\n\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n handleHardwareBack();\n }\n };\n\n // We only add the listeners when drawer opens\n // This way we can make sure that the listener is added as late as possible\n // This will make sure that our handler will run first when back button is pressed\n const subscription = BackHandler.addEventListener(\n 'hardwareBackPress',\n handleHardwareBack\n );\n\n if (Platform.OS === 'web') {\n document?.body?.addEventListener?.('keyup', handleEscape);\n }\n\n return () => {\n subscription.remove();\n\n if (Platform.OS === 'web') {\n document?.body?.removeEventListener?.('keyup', handleEscape);\n }\n };\n }, [\n defaultStatus,\n drawerStatus,\n drawerType,\n handleDrawerClose,\n handleDrawerOpen,\n navigation,\n ]);\n\n const renderDrawerContent = () => {\n return (\n <DrawerPositionContext.Provider value={drawerPosition}>\n {drawerContent({\n state: state,\n navigation: navigation,\n descriptors: descriptors,\n })}\n </DrawerPositionContext.Provider>\n );\n };\n\n const renderSceneContent = () => {\n return (\n <MaybeScreenContainer\n enabled={detachInactiveScreens}\n hasTwoStates\n style={styles.content}\n >\n {state.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 }: DrawerHeaderProps) => (\n <Header\n {...options}\n layout={layout}\n title={getHeaderTitle(options, route.name)}\n headerLeft={\n options.headerLeft ??\n ((props) => <DrawerToggleButton {...props} />)\n }\n />\n ),\n sceneContainerStyle,\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 <Screen\n focused={isFocused}\n route={descriptor.route}\n navigation={descriptor.navigation}\n headerShown={descriptor.options.headerShown}\n headerTransparent={descriptor.options.headerTransparent}\n headerStatusBarHeight={descriptor.options.headerStatusBarHeight}\n header={header({\n layout: dimensions,\n route: descriptor.route,\n navigation:\n descriptor.navigation as DrawerNavigationProp<ParamListBase>,\n options: descriptor.options,\n })}\n style={sceneContainerStyle}\n >\n {descriptor.render()}\n </Screen>\n </MaybeScreen>\n );\n })}\n </MaybeScreenContainer>\n );\n };\n\n return (\n <DrawerStatusContext.Provider value={drawerStatus}>\n <Drawer\n open={drawerStatus !== 'closed'}\n onOpen={handleDrawerOpen}\n onClose={handleDrawerClose}\n gestureHandlerProps={gestureHandlerProps}\n swipeEnabled={swipeEnabled}\n swipeEdgeWidth={swipeEdgeWidth}\n swipeVelocityThreshold={500}\n swipeDistanceThreshold={swipeMinDistance}\n hideStatusBarOnOpen={drawerHideStatusBarOnOpen}\n statusBarAnimation={drawerStatusBarAnimation}\n keyboardDismissMode={keyboardDismissMode}\n drawerType={drawerType}\n drawerPosition={drawerPosition}\n drawerStyle={[\n {\n width: getDefaultDrawerWidth(dimensions),\n backgroundColor: colors.card,\n },\n drawerType === 'permanent' &&\n (drawerPosition === 'left'\n ? {\n borderRightColor: colors.border,\n borderRightWidth: StyleSheet.hairlineWidth,\n }\n : {\n borderLeftColor: colors.border,\n borderLeftWidth: StyleSheet.hairlineWidth,\n }),\n drawerStyle,\n ]}\n overlayStyle={{ backgroundColor: overlayColor }}\n renderDrawerContent={renderDrawerContent}\n renderSceneContent={renderSceneContent}\n dimensions={dimensions}\n />\n </DrawerStatusContext.Provider>\n );\n}\n\nexport default function DrawerView({ navigation, ...rest }: Props) {\n return (\n <SafeAreaProviderCompat>\n <GestureHandlerWrapper style={styles.content}>\n <DrawerViewBase navigation={navigation} {...rest} />\n </GestureHandlerWrapper>\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n content: {\n flex: 1,\n },\n});\n"]}
1
+ {"version":3,"sources":["DrawerView.tsx"],"names":["getDefaultDrawerWidth","height","width","smallerAxisSize","Math","min","isLandscape","isTablet","appBarHeight","Platform","OS","maxWidth","GestureHandlerWrapper","GestureHandlerRootView","View","DrawerViewBase","state","navigation","descriptors","defaultStatus","drawerContent","props","detachInactiveScreens","useLegacyImplementation","Reanimated","isConfigured","legacyImplemenationNotAvailable","require","abs","undefined","Error","Drawer","default","focusedRouteKey","routes","index","key","drawerHideStatusBarOnOpen","drawerPosition","I18nManager","getConstants","isRTL","drawerStatusBarAnimation","drawerStyle","drawerType","select","ios","gestureHandlerProps","keyboardDismissMode","overlayColor","swipeEdgeWidth","swipeEnabled","swipeMinDistance","options","loaded","setLoaded","React","useState","includes","dimensions","colors","drawerStatus","handleDrawerOpen","useCallback","dispatch","DrawerActions","openDrawer","target","handleDrawerClose","closeDrawer","useEffect","handleHardwareBack","isFocused","handleEscape","e","subscription","BackHandler","addEventListener","document","body","remove","removeEventListener","renderDrawerContent","renderSceneContent","styles","content","map","route","descriptor","lazy","unmountOnBlur","freezeOnBlur","header","layout","name","headerLeft","headerShown","headerStatusBarHeight","headerTransparent","sceneContainerStyle","StyleSheet","absoluteFill","zIndex","render","backgroundColor","card","borderRightColor","border","borderRightWidth","hairlineWidth","borderLeftColor","borderLeftWidth","DrawerView","rest","create","flex"],"mappings":";;;;;;;AAAA;;AAMA;;AAOA;;AACA;;AAOA;;AACA;;AAWA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AASA,MAAMA,qBAAqB,GAAG,QAMxB;AAAA,MANyB;AAC7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XlE,WAfW,CAdf;AA+BE,IAAA,YAAY,EAAE;AAAE6D,MAAAA,eAAe,EAAEvD;AAAnB,KA/BhB;AAgCE,IAAA,mBAAmB,EAAEiC,mBAhCvB;AAiCE,IAAA,kBAAkB,EAAEC,kBAjCtB;AAkCE,IAAA,UAAU,EAAExB;AAlCd,IADF,CADF;AAwCD;;AAEc,SAASqD,UAAT,QAAoD;AAAA,MAAhC;AAAE/F,IAAAA,UAAF;AAAc,OAAGgG;AAAjB,GAAgC;AACjE,sBACE,oBAAC,gCAAD,qBACE,oBAAC,qBAAD;AAAuB,IAAA,KAAK,EAAE7B,MAAM,CAACC;AAArC,kBACE,oBAAC,cAAD;AAAgB,IAAA,UAAU,EAAEpE;AAA5B,KAA4CgG,IAA5C,EADF,CADF,CADF;AAOD;;AAED,MAAM7B,MAAM,GAAGgB,wBAAWc,MAAX,CAAkB;AAC/B7B,EAAAA,OAAO,EAAE;AACP8B,IAAAA,IAAI,EAAE;AADC;AADsB,CAAlB,CAAf","sourcesContent":["import {\n getHeaderTitle,\n Header,\n SafeAreaProviderCompat,\n Screen,\n} from '@react-navigation/elements';\nimport {\n DrawerActions,\n DrawerNavigationState,\n DrawerStatus,\n ParamListBase,\n useTheme,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport {\n BackHandler,\n I18nManager,\n Platform,\n StyleSheet,\n View,\n} from 'react-native';\nimport * as Reanimated from 'react-native-reanimated';\nimport { useSafeAreaFrame } from 'react-native-safe-area-context';\n\nimport type {\n DrawerContentComponentProps,\n DrawerDescriptorMap,\n DrawerHeaderProps,\n DrawerNavigationConfig,\n DrawerNavigationHelpers,\n DrawerNavigationProp,\n DrawerProps,\n} from '../types';\nimport DrawerPositionContext from '../utils/DrawerPositionContext';\nimport DrawerStatusContext from '../utils/DrawerStatusContext';\nimport getDrawerStatusFromState from '../utils/getDrawerStatusFromState';\nimport DrawerContent from './DrawerContent';\nimport DrawerToggleButton from './DrawerToggleButton';\nimport { GestureHandlerRootView } from './GestureHandler';\nimport { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';\n\ntype Props = DrawerNavigationConfig & {\n defaultStatus: DrawerStatus;\n state: DrawerNavigationState<ParamListBase>;\n navigation: DrawerNavigationHelpers;\n descriptors: DrawerDescriptorMap;\n};\n\nconst getDefaultDrawerWidth = ({\n height,\n width,\n}: {\n height: number;\n width: number;\n}) => {\n /*\n * Default drawer width is screen width - header height\n * with a max width of 280 on mobile and 320 on tablet\n * https://material.io/components/navigation-drawer\n */\n const smallerAxisSize = Math.min(height, width);\n const isLandscape = width > height;\n const isTablet = smallerAxisSize >= 600;\n const appBarHeight = Platform.OS === 'ios' ? (isLandscape ? 32 : 44) : 56;\n const maxWidth = isTablet ? 320 : 280;\n\n return Math.min(smallerAxisSize - appBarHeight, maxWidth);\n};\n\nconst GestureHandlerWrapper = GestureHandlerRootView ?? View;\n\nfunction DrawerViewBase({\n state,\n navigation,\n descriptors,\n defaultStatus,\n drawerContent = (props: DrawerContentComponentProps) => (\n <DrawerContent {...props} />\n ),\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n // Reanimated 2 is not configured\n // @ts-expect-error: the type definitions are incomplete\n useLegacyImplementation = !Reanimated.isConfigured?.(),\n}: Props) {\n // Reanimated v3 dropped legacy v1 syntax\n const legacyImplemenationNotAvailable =\n require('react-native-reanimated').abs === undefined;\n\n if (useLegacyImplementation && legacyImplemenationNotAvailable) {\n throw new Error(\n 'The `useLegacyImplementation` prop is not available with Reanimated 3 as it no longer includes support for Reanimated 1 legacy API. Remove the `useLegacyImplementation` prop from `Drawer.Navigator` to be able to use it.'\n );\n }\n\n const Drawer: React.ComponentType<DrawerProps> = useLegacyImplementation\n ? require('./legacy/Drawer').default\n : require('./modern/Drawer').default;\n\n const focusedRouteKey = state.routes[state.index].key;\n const {\n drawerHideStatusBarOnOpen = false,\n drawerPosition = I18nManager.getConstants().isRTL ? 'right' : 'left',\n drawerStatusBarAnimation = 'slide',\n drawerStyle,\n drawerType = Platform.select({ ios: 'slide', default: 'front' }),\n gestureHandlerProps,\n keyboardDismissMode = 'on-drag',\n overlayColor = 'rgba(0, 0, 0, 0.5)',\n swipeEdgeWidth = 32,\n swipeEnabled = Platform.OS !== 'web' &&\n Platform.OS !== 'windows' &&\n Platform.OS !== 'macos',\n swipeMinDistance = 60,\n } = descriptors[focusedRouteKey].options;\n\n const [loaded, setLoaded] = React.useState([focusedRouteKey]);\n\n if (!loaded.includes(focusedRouteKey)) {\n setLoaded([...loaded, focusedRouteKey]);\n }\n\n const dimensions = useSafeAreaFrame();\n\n const { colors } = useTheme();\n\n const drawerStatus = getDrawerStatusFromState(state);\n\n const handleDrawerOpen = React.useCallback(() => {\n navigation.dispatch({\n ...DrawerActions.openDrawer(),\n target: state.key,\n });\n }, [navigation, state.key]);\n\n const handleDrawerClose = React.useCallback(() => {\n navigation.dispatch({\n ...DrawerActions.closeDrawer(),\n target: state.key,\n });\n }, [navigation, state.key]);\n\n React.useEffect(() => {\n if (drawerStatus === defaultStatus || drawerType === 'permanent') {\n return;\n }\n\n const handleHardwareBack = () => {\n // We shouldn't handle the back button if the parent screen isn't focused\n // This will avoid the drawer overriding event listeners from a focused screen\n if (!navigation.isFocused()) {\n return false;\n }\n\n if (defaultStatus === 'open') {\n handleDrawerOpen();\n } else {\n handleDrawerClose();\n }\n\n return true;\n };\n\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n handleHardwareBack();\n }\n };\n\n // We only add the listeners when drawer opens\n // This way we can make sure that the listener is added as late as possible\n // This will make sure that our handler will run first when back button is pressed\n const subscription = BackHandler.addEventListener(\n 'hardwareBackPress',\n handleHardwareBack\n );\n\n if (Platform.OS === 'web') {\n document?.body?.addEventListener?.('keyup', handleEscape);\n }\n\n return () => {\n subscription.remove();\n\n if (Platform.OS === 'web') {\n document?.body?.removeEventListener?.('keyup', handleEscape);\n }\n };\n }, [\n defaultStatus,\n drawerStatus,\n drawerType,\n handleDrawerClose,\n handleDrawerOpen,\n navigation,\n ]);\n\n const renderDrawerContent = () => {\n return (\n <DrawerPositionContext.Provider value={drawerPosition}>\n {drawerContent({\n state: state,\n navigation: navigation,\n descriptors: descriptors,\n })}\n </DrawerPositionContext.Provider>\n );\n };\n\n const renderSceneContent = () => {\n return (\n <MaybeScreenContainer\n enabled={detachInactiveScreens}\n hasTwoStates\n style={styles.content}\n >\n {state.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 }: DrawerHeaderProps) => (\n <Header\n {...options}\n layout={layout}\n title={getHeaderTitle(options, route.name)}\n headerLeft={\n options.headerLeft ??\n ((props) => <DrawerToggleButton {...props} />)\n }\n />\n ),\n headerShown,\n headerStatusBarHeight,\n headerTransparent,\n sceneContainerStyle,\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 <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 DrawerNavigationProp<ParamListBase>,\n options: descriptor.options,\n })}\n style={sceneContainerStyle}\n >\n {descriptor.render()}\n </Screen>\n </MaybeScreen>\n );\n })}\n </MaybeScreenContainer>\n );\n };\n\n return (\n <DrawerStatusContext.Provider value={drawerStatus}>\n <Drawer\n open={drawerStatus !== 'closed'}\n onOpen={handleDrawerOpen}\n onClose={handleDrawerClose}\n gestureHandlerProps={gestureHandlerProps}\n swipeEnabled={swipeEnabled}\n swipeEdgeWidth={swipeEdgeWidth}\n swipeVelocityThreshold={500}\n swipeDistanceThreshold={swipeMinDistance}\n hideStatusBarOnOpen={drawerHideStatusBarOnOpen}\n statusBarAnimation={drawerStatusBarAnimation}\n keyboardDismissMode={keyboardDismissMode}\n drawerType={drawerType}\n drawerPosition={drawerPosition}\n drawerStyle={[\n {\n width: getDefaultDrawerWidth(dimensions),\n backgroundColor: colors.card,\n },\n drawerType === 'permanent' &&\n (drawerPosition === 'left'\n ? {\n borderRightColor: colors.border,\n borderRightWidth: StyleSheet.hairlineWidth,\n }\n : {\n borderLeftColor: colors.border,\n borderLeftWidth: StyleSheet.hairlineWidth,\n }),\n drawerStyle,\n ]}\n overlayStyle={{ backgroundColor: overlayColor }}\n renderDrawerContent={renderDrawerContent}\n renderSceneContent={renderSceneContent}\n dimensions={dimensions}\n />\n </DrawerStatusContext.Provider>\n );\n}\n\nexport default function DrawerView({ navigation, ...rest }: Props) {\n return (\n <SafeAreaProviderCompat>\n <GestureHandlerWrapper style={styles.content}>\n <DrawerViewBase navigation={navigation} {...rest} />\n </GestureHandlerWrapper>\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n content: {\n flex: 1,\n },\n});\n"]}
@@ -16,12 +16,6 @@ Object.defineProperty(exports, "GestureState", {
16
16
  }
17
17
  });
18
18
  exports.PanGestureHandler = PanGestureHandler;
19
- Object.defineProperty(exports, "PanGestureHandlerGestureEvent", {
20
- enumerable: true,
21
- get: function () {
22
- return _reactNativeGestureHandler.PanGestureHandlerGestureEvent;
23
- }
24
- });
25
19
  Object.defineProperty(exports, "TapGestureHandler", {
26
20
  enumerable: true,
27
21
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"sources":["GestureHandlerNative.tsx"],"names":["PanGestureHandler","props","gestureRef","React","useRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAKA;;;;;;;;AAEO,SAASA,iBAAT,CAA2BC,KAA3B,EAA+D;AACpE,QAAMC,UAAU,GAAGC,KAAK,CAACC,MAAN,CAAsC,IAAtC,CAAnB;AAEA,sBACE,oBAAC,6BAAD,CAAsB,QAAtB;AAA+B,IAAA,KAAK,EAAEF;AAAtC,kBACE,oBAAC,4CAAD,EAA6BD,KAA7B,CADF,CADF;AAKD","sourcesContent":["import * as React from 'react';\nimport {\n PanGestureHandler as PanGestureHandlerNative,\n PanGestureHandlerProperties,\n} from 'react-native-gesture-handler';\n\nimport DrawerGestureContext from '../utils/DrawerGestureContext';\n\nexport function PanGestureHandler(props: PanGestureHandlerProperties) {\n const gestureRef = React.useRef<PanGestureHandlerNative>(null);\n\n return (\n <DrawerGestureContext.Provider value={gestureRef}>\n <PanGestureHandlerNative {...props} />\n </DrawerGestureContext.Provider>\n );\n}\n\nexport {\n GestureHandlerRootView,\n State as GestureState,\n PanGestureHandlerGestureEvent,\n TapGestureHandler,\n} from 'react-native-gesture-handler';\n"]}
1
+ {"version":3,"sources":["GestureHandlerNative.tsx"],"names":["PanGestureHandler","props","gestureRef","React","useRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAKA;;;;;;;;AAEO,SAASA,iBAAT,CAA2BC,KAA3B,EAA+D;AACpE,QAAMC,UAAU,GAAGC,KAAK,CAACC,MAAN,CAAsC,IAAtC,CAAnB;AAEA,sBACE,oBAAC,6BAAD,CAAsB,QAAtB;AAA+B,IAAA,KAAK,EAAEF;AAAtC,kBACE,oBAAC,4CAAD,EAA6BD,KAA7B,CADF,CADF;AAKD","sourcesContent":["import * as React from 'react';\nimport {\n PanGestureHandler as PanGestureHandlerNative,\n PanGestureHandlerProperties,\n} from 'react-native-gesture-handler';\n\nimport DrawerGestureContext from '../utils/DrawerGestureContext';\n\nexport function PanGestureHandler(props: PanGestureHandlerProperties) {\n const gestureRef = React.useRef<PanGestureHandlerNative>(null);\n\n return (\n <DrawerGestureContext.Provider value={gestureRef}>\n <PanGestureHandlerNative {...props} />\n </DrawerGestureContext.Provider>\n );\n}\n\nexport type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';\nexport {\n GestureHandlerRootView,\n State as GestureState,\n TapGestureHandler,\n} from 'react-native-gesture-handler';\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"]}
@@ -177,6 +177,7 @@ function DrawerViewBase(_ref2) {
177
177
  }
178
178
 
179
179
  const {
180
+ freezeOnBlur,
180
181
  header = _ref3 => {
181
182
  var _options$headerLeft;
182
183
 
@@ -190,6 +191,9 @@ function DrawerViewBase(_ref2) {
190
191
  headerLeft: (_options$headerLeft = options.headerLeft) !== null && _options$headerLeft !== void 0 ? _options$headerLeft : props => /*#__PURE__*/React.createElement(DrawerToggleButton, props)
191
192
  }));
192
193
  },
194
+ headerShown,
195
+ headerStatusBarHeight,
196
+ headerTransparent,
193
197
  sceneContainerStyle
194
198
  } = descriptor.options;
195
199
  return /*#__PURE__*/React.createElement(MaybeScreen, {
@@ -198,14 +202,15 @@ function DrawerViewBase(_ref2) {
198
202
  zIndex: isFocused ? 0 : -1
199
203
  }],
200
204
  visible: isFocused,
201
- enabled: detachInactiveScreens
205
+ enabled: detachInactiveScreens,
206
+ freezeOnBlur: freezeOnBlur
202
207
  }, /*#__PURE__*/React.createElement(Screen, {
203
208
  focused: isFocused,
204
209
  route: descriptor.route,
205
210
  navigation: descriptor.navigation,
206
- headerShown: descriptor.options.headerShown,
207
- headerTransparent: descriptor.options.headerTransparent,
208
- headerStatusBarHeight: descriptor.options.headerStatusBarHeight,
211
+ headerShown: headerShown,
212
+ headerStatusBarHeight: headerStatusBarHeight,
213
+ headerTransparent: headerTransparent,
209
214
  header: header({
210
215
  layout: dimensions,
211
216
  route: descriptor.route,
@@ -1 +1 @@
1
- {"version":3,"sources":["DrawerView.tsx"],"names":["getHeaderTitle","Header","SafeAreaProviderCompat","Screen","DrawerActions","useTheme","React","BackHandler","I18nManager","Platform","StyleSheet","View","Reanimated","useSafeAreaFrame","DrawerPositionContext","DrawerStatusContext","getDrawerStatusFromState","DrawerContent","DrawerToggleButton","GestureHandlerRootView","MaybeScreen","MaybeScreenContainer","getDefaultDrawerWidth","height","width","smallerAxisSize","Math","min","isLandscape","isTablet","appBarHeight","OS","maxWidth","GestureHandlerWrapper","DrawerViewBase","state","navigation","descriptors","defaultStatus","drawerContent","props","detachInactiveScreens","useLegacyImplementation","isConfigured","legacyImplemenationNotAvailable","require","abs","undefined","Error","Drawer","default","focusedRouteKey","routes","index","key","drawerHideStatusBarOnOpen","drawerPosition","getConstants","isRTL","drawerStatusBarAnimation","drawerStyle","drawerType","select","ios","gestureHandlerProps","keyboardDismissMode","overlayColor","swipeEdgeWidth","swipeEnabled","swipeMinDistance","options","loaded","setLoaded","useState","includes","dimensions","colors","drawerStatus","handleDrawerOpen","useCallback","dispatch","openDrawer","target","handleDrawerClose","closeDrawer","useEffect","handleHardwareBack","isFocused","handleEscape","e","subscription","addEventListener","document","body","remove","removeEventListener","renderDrawerContent","renderSceneContent","styles","content","map","route","descriptor","lazy","unmountOnBlur","header","layout","name","headerLeft","sceneContainerStyle","absoluteFill","zIndex","headerShown","headerTransparent","headerStatusBarHeight","render","backgroundColor","card","borderRightColor","border","borderRightWidth","hairlineWidth","borderLeftColor","borderLeftWidth","DrawerView","rest","create","flex"],"mappings":";;AAAA,SACEA,cADF,EAEEC,MAFF,EAGEC,sBAHF,EAIEC,MAJF,QAKO,4BALP;AAMA,SACEC,aADF,EAKEC,QALF,QAMO,0BANP;AAOA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SACEC,WADF,EAEEC,WAFF,EAGEC,QAHF,EAIEC,UAJF,EAKEC,IALF,QAMO,cANP;AAOA,OAAO,KAAKC,UAAZ,MAA4B,yBAA5B;AACA,SAASC,gBAAT,QAAiC,gCAAjC;AAWA,OAAOC,qBAAP,MAAkC,gCAAlC;AACA,OAAOC,mBAAP,MAAgC,8BAAhC;AACA,OAAOC,wBAAP,MAAqC,mCAArC;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,kBAAP,MAA+B,sBAA/B;AACA,SAASC,sBAAT,QAAuC,kBAAvC;AACA,SAASC,WAAT,EAAsBC,oBAAtB,QAAkD,kBAAlD;;AASA,MAAMC,qBAAqB,GAAG,QAMxB;AAAA,MANyB;AAC7BC,IAAAA,MAD6B;AAE7BC,IAAAA;AAF6B,GAMzB;;AACJ;AACF;AACA;AACA;AACA;AACE,QAAMC,eAAe,GAAGC,IAAI,CAACC,GAAL,CAASJ,MAAT,EAAiBC,KAAjB,CAAxB;AACA,QAAMI,WAAW,GAAGJ,KAAK,GAAGD,MAA5B;AACA,Q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hB;AAgCE,IAAA,mBAAmB,EAAE8B,mBAhCvB;AAiCE,IAAA,kBAAkB,EAAEC,kBAjCtB;AAkCE,IAAA,UAAU,EAAEtB;AAlCd,IADF,CADF;AAwCD;;AAED,eAAe,SAASiD,UAAT,QAAoD;AAAA,MAAhC;AAAExF,IAAAA,UAAF;AAAc,OAAGyF;AAAjB,GAAgC;AACjE,sBACE,oBAAC,sBAAD,qBACE,oBAAC,qBAAD;AAAuB,IAAA,KAAK,EAAE3B,MAAM,CAACC;AAArC,kBACE,oBAAC,cAAD;AAAgB,IAAA,UAAU,EAAE/D;AAA5B,KAA4CyF,IAA5C,EADF,CADF,CADF;AAOD;AAED,MAAM3B,MAAM,GAAGxF,UAAU,CAACoH,MAAX,CAAkB;AAC/B3B,EAAAA,OAAO,EAAE;AACP4B,IAAAA,IAAI,EAAE;AADC;AADsB,CAAlB,CAAf","sourcesContent":["import {\n getHeaderTitle,\n Header,\n SafeAreaProviderCompat,\n Screen,\n} from '@react-navigation/elements';\nimport {\n DrawerActions,\n DrawerNavigationState,\n DrawerStatus,\n ParamListBase,\n useTheme,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport {\n BackHandler,\n I18nManager,\n Platform,\n StyleSheet,\n View,\n} from 'react-native';\nimport * as Reanimated from 'react-native-reanimated';\nimport { useSafeAreaFrame } from 'react-native-safe-area-context';\n\nimport type {\n DrawerContentComponentProps,\n DrawerDescriptorMap,\n DrawerHeaderProps,\n DrawerNavigationConfig,\n DrawerNavigationHelpers,\n DrawerNavigationProp,\n DrawerProps,\n} from '../types';\nimport DrawerPositionContext from '../utils/DrawerPositionContext';\nimport DrawerStatusContext from '../utils/DrawerStatusContext';\nimport getDrawerStatusFromState from '../utils/getDrawerStatusFromState';\nimport DrawerContent from './DrawerContent';\nimport DrawerToggleButton from './DrawerToggleButton';\nimport { GestureHandlerRootView } from './GestureHandler';\nimport { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';\n\ntype Props = DrawerNavigationConfig & {\n defaultStatus: DrawerStatus;\n state: DrawerNavigationState<ParamListBase>;\n navigation: DrawerNavigationHelpers;\n descriptors: DrawerDescriptorMap;\n};\n\nconst getDefaultDrawerWidth = ({\n height,\n width,\n}: {\n height: number;\n width: number;\n}) => {\n /*\n * Default drawer width is screen width - header height\n * with a max width of 280 on mobile and 320 on tablet\n * https://material.io/components/navigation-drawer\n */\n const smallerAxisSize = Math.min(height, width);\n const isLandscape = width > height;\n const isTablet = smallerAxisSize >= 600;\n const appBarHeight = Platform.OS === 'ios' ? (isLandscape ? 32 : 44) : 56;\n const maxWidth = isTablet ? 320 : 280;\n\n return Math.min(smallerAxisSize - appBarHeight, maxWidth);\n};\n\nconst GestureHandlerWrapper = GestureHandlerRootView ?? View;\n\nfunction DrawerViewBase({\n state,\n navigation,\n descriptors,\n defaultStatus,\n drawerContent = (props: DrawerContentComponentProps) => (\n <DrawerContent {...props} />\n ),\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n // Reanimated 2 is not configured\n // @ts-expect-error: the type definitions are incomplete\n useLegacyImplementation = !Reanimated.isConfigured?.(),\n}: Props) {\n // Reanimated v3 dropped legacy v1 syntax\n const legacyImplemenationNotAvailable =\n require('react-native-reanimated').abs === undefined;\n\n if (useLegacyImplementation && legacyImplemenationNotAvailable) {\n throw new Error(\n 'The `useLegacyImplementation` prop is not available with Reanimated 3 as it no longer includes support for Reanimated 1 legacy API. Remove the `useLegacyImplementation` prop from `Drawer.Navigator` to be able to use it.'\n );\n }\n\n const Drawer: React.ComponentType<DrawerProps> = useLegacyImplementation\n ? require('./legacy/Drawer').default\n : require('./modern/Drawer').default;\n\n const focusedRouteKey = state.routes[state.index].key;\n const {\n drawerHideStatusBarOnOpen = false,\n drawerPosition = I18nManager.getConstants().isRTL ? 'right' : 'left',\n drawerStatusBarAnimation = 'slide',\n drawerStyle,\n drawerType = Platform.select({ ios: 'slide', default: 'front' }),\n gestureHandlerProps,\n keyboardDismissMode = 'on-drag',\n overlayColor = 'rgba(0, 0, 0, 0.5)',\n swipeEdgeWidth = 32,\n swipeEnabled = Platform.OS !== 'web' &&\n Platform.OS !== 'windows' &&\n Platform.OS !== 'macos',\n swipeMinDistance = 60,\n } = descriptors[focusedRouteKey].options;\n\n const [loaded, setLoaded] = React.useState([focusedRouteKey]);\n\n if (!loaded.includes(focusedRouteKey)) {\n setLoaded([...loaded, focusedRouteKey]);\n }\n\n const dimensions = useSafeAreaFrame();\n\n const { colors } = useTheme();\n\n const drawerStatus = getDrawerStatusFromState(state);\n\n const handleDrawerOpen = React.useCallback(() => {\n navigation.dispatch({\n ...DrawerActions.openDrawer(),\n target: state.key,\n });\n }, [navigation, state.key]);\n\n const handleDrawerClose = React.useCallback(() => {\n navigation.dispatch({\n ...DrawerActions.closeDrawer(),\n target: state.key,\n });\n }, [navigation, state.key]);\n\n React.useEffect(() => {\n if (drawerStatus === defaultStatus || drawerType === 'permanent') {\n return;\n }\n\n const handleHardwareBack = () => {\n // We shouldn't handle the back button if the parent screen isn't focused\n // This will avoid the drawer overriding event listeners from a focused screen\n if (!navigation.isFocused()) {\n return false;\n }\n\n if (defaultStatus === 'open') {\n handleDrawerOpen();\n } else {\n handleDrawerClose();\n }\n\n return true;\n };\n\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n handleHardwareBack();\n }\n };\n\n // We only add the listeners when drawer opens\n // This way we can make sure that the listener is added as late as possible\n // This will make sure that our handler will run first when back button is pressed\n const subscription = BackHandler.addEventListener(\n 'hardwareBackPress',\n handleHardwareBack\n );\n\n if (Platform.OS === 'web') {\n document?.body?.addEventListener?.('keyup', handleEscape);\n }\n\n return () => {\n subscription.remove();\n\n if (Platform.OS === 'web') {\n document?.body?.removeEventListener?.('keyup', handleEscape);\n }\n };\n }, [\n defaultStatus,\n drawerStatus,\n drawerType,\n handleDrawerClose,\n handleDrawerOpen,\n navigation,\n ]);\n\n const renderDrawerContent = () => {\n return (\n <DrawerPositionContext.Provider value={drawerPosition}>\n {drawerContent({\n state: state,\n navigation: navigation,\n descriptors: descriptors,\n })}\n </DrawerPositionContext.Provider>\n );\n };\n\n const renderSceneContent = () => {\n return (\n <MaybeScreenContainer\n enabled={detachInactiveScreens}\n hasTwoStates\n style={styles.content}\n >\n {state.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 }: DrawerHeaderProps) => (\n <Header\n {...options}\n layout={layout}\n title={getHeaderTitle(options, route.name)}\n headerLeft={\n options.headerLeft ??\n ((props) => <DrawerToggleButton {...props} />)\n }\n />\n ),\n sceneContainerStyle,\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 <Screen\n focused={isFocused}\n route={descriptor.route}\n navigation={descriptor.navigation}\n headerShown={descriptor.options.headerShown}\n headerTransparent={descriptor.options.headerTransparent}\n headerStatusBarHeight={descriptor.options.headerStatusBarHeight}\n header={header({\n layout: dimensions,\n route: descriptor.route,\n navigation:\n descriptor.navigation as DrawerNavigationProp<ParamListBase>,\n options: descriptor.options,\n })}\n style={sceneContainerStyle}\n >\n {descriptor.render()}\n </Screen>\n </MaybeScreen>\n );\n })}\n </MaybeScreenContainer>\n );\n };\n\n return (\n <DrawerStatusContext.Provider value={drawerStatus}>\n <Drawer\n open={drawerStatus !== 'closed'}\n onOpen={handleDrawerOpen}\n onClose={handleDrawerClose}\n gestureHandlerProps={gestureHandlerProps}\n swipeEnabled={swipeEnabled}\n swipeEdgeWidth={swipeEdgeWidth}\n swipeVelocityThreshold={500}\n swipeDistanceThreshold={swipeMinDistance}\n hideStatusBarOnOpen={drawerHideStatusBarOnOpen}\n statusBarAnimation={drawerStatusBarAnimation}\n keyboardDismissMode={keyboardDismissMode}\n drawerType={drawerType}\n drawerPosition={drawerPosition}\n drawerStyle={[\n {\n width: getDefaultDrawerWidth(dimensions),\n backgroundColor: colors.card,\n },\n drawerType === 'permanent' &&\n (drawerPosition === 'left'\n ? {\n borderRightColor: colors.border,\n borderRightWidth: StyleSheet.hairlineWidth,\n }\n : {\n borderLeftColor: colors.border,\n borderLeftWidth: StyleSheet.hairlineWidth,\n }),\n drawerStyle,\n ]}\n overlayStyle={{ backgroundColor: overlayColor }}\n renderDrawerContent={renderDrawerContent}\n renderSceneContent={renderSceneContent}\n dimensions={dimensions}\n />\n </DrawerStatusContext.Provider>\n );\n}\n\nexport default function DrawerView({ navigation, ...rest }: Props) {\n return (\n <SafeAreaProviderCompat>\n <GestureHandlerWrapper style={styles.content}>\n <DrawerViewBase navigation={navigation} {...rest} />\n </GestureHandlerWrapper>\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n content: {\n flex: 1,\n },\n});\n"]}
1
+ {"version":3,"sources":["DrawerView.tsx"],"names":["getHeaderTitle","Header","SafeAreaProviderCompat","Screen","DrawerActions","useTheme","React","BackHandler","I18nManager","Platform","StyleSheet","View","Reanimated","useSafeAreaFrame","DrawerPositionContext","DrawerStatusContext","getDrawerStatusFromState","DrawerContent","DrawerToggleButton","GestureHandlerRootView","MaybeScreen","MaybeScreenContainer","getDefaultDrawerWidth","height","width","smallerAxisSize","Math","min","isLandscape","isTablet","appBarHeight","OS","maxWidth","GestureHandlerWrapper","DrawerViewBase","state","navigation","descriptors","defaultStatus","drawerContent","props","detachInactiveScreens","useLegacyImplementation","isConfigured","legacyImplemenationNotAvailable","require","abs","undefined","Error","Drawer","default","focusedRouteKey","routes","index","key","drawerHideStatusBarOnOpen","drawerPosition","getConstants","isRTL","drawerStatusBarAnimation","drawerStyle","drawerType","select","ios","gestureHandlerProps","keyboardDismissMode","overlayColor","swipeEdgeWidth","swipeEnabled","swipeMinDistance","options","loaded","setLoaded","useState","includes","dimensions","colors","drawerStatus","handleDrawerOpen","useCallback","dispatch","openDrawer","target","handleDrawerClose","closeDrawer","useEffect","handleHardwareBack","isFocused","handleEscape","e","subscription","addEventListener","document","body","remove","removeEventListener","renderDrawerContent","renderSceneContent","styles","content","map","route","descriptor","lazy","unmountOnBlur","freezeOnBlur","header","layout","name","headerLeft","headerShown","headerStatusBarHeight","headerTransparent","sceneContainerStyle","absoluteFill","zIndex","render","backgroundColor","card","borderRightColor","border","borderRightWidth","hairlineWidth","borderLeftColor","borderLeftWidth","DrawerView","rest","create","flex"],"mappings":";;AAAA,SACEA,cADF,EAEEC,MAFF,EAGEC,sBAHF,EAIEC,MAJF,QAKO,4BALP;AAMA,SACEC,aADF,EAKEC,QALF,QAMO,0BANP;AAOA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SACEC,WADF,EAEEC,WAFF,EAGEC,QAHF,EAIEC,UAJF,EAKEC,IALF,QAMO,cANP;AAOA,OAAO,KAAKC,UAAZ,MAA4B,yBAA5B;AACA,SAASC,gBAAT,QAAiC,gCAAjC;AAWA,OAAOC,qBAAP,MAAkC,gCAAlC;AACA,OAAOC,mBAAP,MAAgC,8BAAhC;AACA,OAAOC,wBAAP,MAAqC,mCAArC;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,kBAAP,MAA+B,sBAA/B;AACA,SAASC,sBAAT,QAAuC,kBAAvC;AACA,SAASC,WAAT,EAAsBC,oBAAtB,QAAkD,kBAAlD;;AASA,MAAMC,qBAAqB,GAAG,QAMxB;AAAA,MANyB;AAC7BC,IAAAA,MAD6B;AAE7BC,IAAAA;AAF6B,GAMzB;;AACJ;AACF;AACA;AACA;AACA;AACE,QAAMC,eAAe,GAAGC,IAAI,CAACC,GAAL,CAASJ,MAAT,EAAiBC,KAAjB,CAAxB;AACA,QAAMI,WAAW,GAAGJ,KAAK,GAAGD,MAA5B;AACA,QAAMM,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AAAA,eAAe,EAAEnD;AAAnB,KA/BhB;AAgCE,IAAA,mBAAmB,EAAE8B,mBAhCvB;AAiCE,IAAA,kBAAkB,EAAEC,kBAjCtB;AAkCE,IAAA,UAAU,EAAEtB;AAlCd,IADF,CADF;AAwCD;;AAED,eAAe,SAASkD,UAAT,QAAoD;AAAA,MAAhC;AAAEzF,IAAAA,UAAF;AAAc,OAAG0F;AAAjB,GAAgC;AACjE,sBACE,oBAAC,sBAAD,qBACE,oBAAC,qBAAD;AAAuB,IAAA,KAAK,EAAE5B,MAAM,CAACC;AAArC,kBACE,oBAAC,cAAD;AAAgB,IAAA,UAAU,EAAE/D;AAA5B,KAA4C0F,IAA5C,EADF,CADF,CADF;AAOD;AAED,MAAM5B,MAAM,GAAGxF,UAAU,CAACqH,MAAX,CAAkB;AAC/B5B,EAAAA,OAAO,EAAE;AACP6B,IAAAA,IAAI,EAAE;AADC;AADsB,CAAlB,CAAf","sourcesContent":["import {\n getHeaderTitle,\n Header,\n SafeAreaProviderCompat,\n Screen,\n} from '@react-navigation/elements';\nimport {\n DrawerActions,\n DrawerNavigationState,\n DrawerStatus,\n ParamListBase,\n useTheme,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport {\n BackHandler,\n I18nManager,\n Platform,\n StyleSheet,\n View,\n} from 'react-native';\nimport * as Reanimated from 'react-native-reanimated';\nimport { useSafeAreaFrame } from 'react-native-safe-area-context';\n\nimport type {\n DrawerContentComponentProps,\n DrawerDescriptorMap,\n DrawerHeaderProps,\n DrawerNavigationConfig,\n DrawerNavigationHelpers,\n DrawerNavigationProp,\n DrawerProps,\n} from '../types';\nimport DrawerPositionContext from '../utils/DrawerPositionContext';\nimport DrawerStatusContext from '../utils/DrawerStatusContext';\nimport getDrawerStatusFromState from '../utils/getDrawerStatusFromState';\nimport DrawerContent from './DrawerContent';\nimport DrawerToggleButton from './DrawerToggleButton';\nimport { GestureHandlerRootView } from './GestureHandler';\nimport { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';\n\ntype Props = DrawerNavigationConfig & {\n defaultStatus: DrawerStatus;\n state: DrawerNavigationState<ParamListBase>;\n navigation: DrawerNavigationHelpers;\n descriptors: DrawerDescriptorMap;\n};\n\nconst getDefaultDrawerWidth = ({\n height,\n width,\n}: {\n height: number;\n width: number;\n}) => {\n /*\n * Default drawer width is screen width - header height\n * with a max width of 280 on mobile and 320 on tablet\n * https://material.io/components/navigation-drawer\n */\n const smallerAxisSize = Math.min(height, width);\n const isLandscape = width > height;\n const isTablet = smallerAxisSize >= 600;\n const appBarHeight = Platform.OS === 'ios' ? (isLandscape ? 32 : 44) : 56;\n const maxWidth = isTablet ? 320 : 280;\n\n return Math.min(smallerAxisSize - appBarHeight, maxWidth);\n};\n\nconst GestureHandlerWrapper = GestureHandlerRootView ?? View;\n\nfunction DrawerViewBase({\n state,\n navigation,\n descriptors,\n defaultStatus,\n drawerContent = (props: DrawerContentComponentProps) => (\n <DrawerContent {...props} />\n ),\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n // Reanimated 2 is not configured\n // @ts-expect-error: the type definitions are incomplete\n useLegacyImplementation = !Reanimated.isConfigured?.(),\n}: Props) {\n // Reanimated v3 dropped legacy v1 syntax\n const legacyImplemenationNotAvailable =\n require('react-native-reanimated').abs === undefined;\n\n if (useLegacyImplementation && legacyImplemenationNotAvailable) {\n throw new Error(\n 'The `useLegacyImplementation` prop is not available with Reanimated 3 as it no longer includes support for Reanimated 1 legacy API. Remove the `useLegacyImplementation` prop from `Drawer.Navigator` to be able to use it.'\n );\n }\n\n const Drawer: React.ComponentType<DrawerProps> = useLegacyImplementation\n ? require('./legacy/Drawer').default\n : require('./modern/Drawer').default;\n\n const focusedRouteKey = state.routes[state.index].key;\n const {\n drawerHideStatusBarOnOpen = false,\n drawerPosition = I18nManager.getConstants().isRTL ? 'right' : 'left',\n drawerStatusBarAnimation = 'slide',\n drawerStyle,\n drawerType = Platform.select({ ios: 'slide', default: 'front' }),\n gestureHandlerProps,\n keyboardDismissMode = 'on-drag',\n overlayColor = 'rgba(0, 0, 0, 0.5)',\n swipeEdgeWidth = 32,\n swipeEnabled = Platform.OS !== 'web' &&\n Platform.OS !== 'windows' &&\n Platform.OS !== 'macos',\n swipeMinDistance = 60,\n } = descriptors[focusedRouteKey].options;\n\n const [loaded, setLoaded] = React.useState([focusedRouteKey]);\n\n if (!loaded.includes(focusedRouteKey)) {\n setLoaded([...loaded, focusedRouteKey]);\n }\n\n const dimensions = useSafeAreaFrame();\n\n const { colors } = useTheme();\n\n const drawerStatus = getDrawerStatusFromState(state);\n\n const handleDrawerOpen = React.useCallback(() => {\n navigation.dispatch({\n ...DrawerActions.openDrawer(),\n target: state.key,\n });\n }, [navigation, state.key]);\n\n const handleDrawerClose = React.useCallback(() => {\n navigation.dispatch({\n ...DrawerActions.closeDrawer(),\n target: state.key,\n });\n }, [navigation, state.key]);\n\n React.useEffect(() => {\n if (drawerStatus === defaultStatus || drawerType === 'permanent') {\n return;\n }\n\n const handleHardwareBack = () => {\n // We shouldn't handle the back button if the parent screen isn't focused\n // This will avoid the drawer overriding event listeners from a focused screen\n if (!navigation.isFocused()) {\n return false;\n }\n\n if (defaultStatus === 'open') {\n handleDrawerOpen();\n } else {\n handleDrawerClose();\n }\n\n return true;\n };\n\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n handleHardwareBack();\n }\n };\n\n // We only add the listeners when drawer opens\n // This way we can make sure that the listener is added as late as possible\n // This will make sure that our handler will run first when back button is pressed\n const subscription = BackHandler.addEventListener(\n 'hardwareBackPress',\n handleHardwareBack\n );\n\n if (Platform.OS === 'web') {\n document?.body?.addEventListener?.('keyup', handleEscape);\n }\n\n return () => {\n subscription.remove();\n\n if (Platform.OS === 'web') {\n document?.body?.removeEventListener?.('keyup', handleEscape);\n }\n };\n }, [\n defaultStatus,\n drawerStatus,\n drawerType,\n handleDrawerClose,\n handleDrawerOpen,\n navigation,\n ]);\n\n const renderDrawerContent = () => {\n return (\n <DrawerPositionContext.Provider value={drawerPosition}>\n {drawerContent({\n state: state,\n navigation: navigation,\n descriptors: descriptors,\n })}\n </DrawerPositionContext.Provider>\n );\n };\n\n const renderSceneContent = () => {\n return (\n <MaybeScreenContainer\n enabled={detachInactiveScreens}\n hasTwoStates\n style={styles.content}\n >\n {state.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 }: DrawerHeaderProps) => (\n <Header\n {...options}\n layout={layout}\n title={getHeaderTitle(options, route.name)}\n headerLeft={\n options.headerLeft ??\n ((props) => <DrawerToggleButton {...props} />)\n }\n />\n ),\n headerShown,\n headerStatusBarHeight,\n headerTransparent,\n sceneContainerStyle,\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 <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 DrawerNavigationProp<ParamListBase>,\n options: descriptor.options,\n })}\n style={sceneContainerStyle}\n >\n {descriptor.render()}\n </Screen>\n </MaybeScreen>\n );\n })}\n </MaybeScreenContainer>\n );\n };\n\n return (\n <DrawerStatusContext.Provider value={drawerStatus}>\n <Drawer\n open={drawerStatus !== 'closed'}\n onOpen={handleDrawerOpen}\n onClose={handleDrawerClose}\n gestureHandlerProps={gestureHandlerProps}\n swipeEnabled={swipeEnabled}\n swipeEdgeWidth={swipeEdgeWidth}\n swipeVelocityThreshold={500}\n swipeDistanceThreshold={swipeMinDistance}\n hideStatusBarOnOpen={drawerHideStatusBarOnOpen}\n statusBarAnimation={drawerStatusBarAnimation}\n keyboardDismissMode={keyboardDismissMode}\n drawerType={drawerType}\n drawerPosition={drawerPosition}\n drawerStyle={[\n {\n width: getDefaultDrawerWidth(dimensions),\n backgroundColor: colors.card,\n },\n drawerType === 'permanent' &&\n (drawerPosition === 'left'\n ? {\n borderRightColor: colors.border,\n borderRightWidth: StyleSheet.hairlineWidth,\n }\n : {\n borderLeftColor: colors.border,\n borderLeftWidth: StyleSheet.hairlineWidth,\n }),\n drawerStyle,\n ]}\n overlayStyle={{ backgroundColor: overlayColor }}\n renderDrawerContent={renderDrawerContent}\n renderSceneContent={renderSceneContent}\n dimensions={dimensions}\n />\n </DrawerStatusContext.Provider>\n );\n}\n\nexport default function DrawerView({ navigation, ...rest }: Props) {\n return (\n <SafeAreaProviderCompat>\n <GestureHandlerWrapper style={styles.content}>\n <DrawerViewBase navigation={navigation} {...rest} />\n </GestureHandlerWrapper>\n </SafeAreaProviderCompat>\n );\n}\n\nconst styles = StyleSheet.create({\n content: {\n flex: 1,\n },\n});\n"]}
@@ -7,5 +7,5 @@ export function PanGestureHandler(props) {
7
7
  value: gestureRef
8
8
  }, /*#__PURE__*/React.createElement(PanGestureHandlerNative, props));
9
9
  }
10
- export { GestureHandlerRootView, State as GestureState, PanGestureHandlerGestureEvent, TapGestureHandler } from 'react-native-gesture-handler';
10
+ export { GestureHandlerRootView, State as GestureState, TapGestureHandler } from 'react-native-gesture-handler';
11
11
  //# sourceMappingURL=GestureHandlerNative.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["GestureHandlerNative.tsx"],"names":["React","PanGestureHandler","PanGestureHandlerNative","DrawerGestureContext","props","gestureRef","useRef","GestureHandlerRootView","State","GestureState","PanGestureHandlerGestureEvent","TapGestureHandler"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,iBAAiB,IAAIC,uBADvB,QAGO,8BAHP;AAKA,OAAOC,oBAAP,MAAiC,+BAAjC;AAEA,OAAO,SAASF,iBAAT,CAA2BG,KAA3B,EAA+D;AACpE,QAAMC,UAAU,GAAGL,KAAK,CAACM,MAAN,CAAsC,IAAtC,CAAnB;AAEA,sBACE,oBAAC,oBAAD,CAAsB,QAAtB;AAA+B,IAAA,KAAK,EAAED;AAAtC,kBACE,oBAAC,uBAAD,EAA6BD,KAA7B,CADF,CADF;AAKD;AAED,SACEG,sBADF,EAEEC,KAAK,IAAIC,YAFX,EAGEC,6BAHF,EAIEC,iBAJF,QAKO,8BALP","sourcesContent":["import * as React from 'react';\nimport {\n PanGestureHandler as PanGestureHandlerNative,\n PanGestureHandlerProperties,\n} from 'react-native-gesture-handler';\n\nimport DrawerGestureContext from '../utils/DrawerGestureContext';\n\nexport function PanGestureHandler(props: PanGestureHandlerProperties) {\n const gestureRef = React.useRef<PanGestureHandlerNative>(null);\n\n return (\n <DrawerGestureContext.Provider value={gestureRef}>\n <PanGestureHandlerNative {...props} />\n </DrawerGestureContext.Provider>\n );\n}\n\nexport {\n GestureHandlerRootView,\n State as GestureState,\n PanGestureHandlerGestureEvent,\n TapGestureHandler,\n} from 'react-native-gesture-handler';\n"]}
1
+ {"version":3,"sources":["GestureHandlerNative.tsx"],"names":["React","PanGestureHandler","PanGestureHandlerNative","DrawerGestureContext","props","gestureRef","useRef","GestureHandlerRootView","State","GestureState","TapGestureHandler"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,iBAAiB,IAAIC,uBADvB,QAGO,8BAHP;AAKA,OAAOC,oBAAP,MAAiC,+BAAjC;AAEA,OAAO,SAASF,iBAAT,CAA2BG,KAA3B,EAA+D;AACpE,QAAMC,UAAU,GAAGL,KAAK,CAACM,MAAN,CAAsC,IAAtC,CAAnB;AAEA,sBACE,oBAAC,oBAAD,CAAsB,QAAtB;AAA+B,IAAA,KAAK,EAAED;AAAtC,kBACE,oBAAC,uBAAD,EAA6BD,KAA7B,CADF,CADF;AAKD;AAGD,SACEG,sBADF,EAEEC,KAAK,IAAIC,YAFX,EAGEC,iBAHF,QAIO,8BAJP","sourcesContent":["import * as React from 'react';\nimport {\n PanGestureHandler as PanGestureHandlerNative,\n PanGestureHandlerProperties,\n} from 'react-native-gesture-handler';\n\nimport DrawerGestureContext from '../utils/DrawerGestureContext';\n\nexport function PanGestureHandler(props: PanGestureHandlerProperties) {\n const gestureRef = React.useRef<PanGestureHandlerNative>(null);\n\n return (\n <DrawerGestureContext.Provider value={gestureRef}>\n <PanGestureHandlerNative {...props} />\n </DrawerGestureContext.Provider>\n );\n}\n\nexport type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';\nexport {\n GestureHandlerRootView,\n State as GestureState,\n TapGestureHandler,\n} from 'react-native-gesture-handler';\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"]}
@@ -173,6 +173,14 @@ export declare type DrawerNavigationOptions = HeaderOptions & {
173
173
  * Defaults to `false`.
174
174
  */
175
175
  unmountOnBlur?: boolean;
176
+ /**
177
+ * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
178
+ * Defaults to `true` when `enableFreeze()` is run at the top of the application.
179
+ * Requires `react-native-screens` version >=3.16.0.
180
+ *
181
+ * Only supported on iOS and Android.
182
+ */
183
+ freezeOnBlur?: boolean;
176
184
  };
177
185
  export declare type DrawerContentComponentProps = {
178
186
  state: DrawerNavigationState<ParamListBase>;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { PanGestureHandlerProperties } from 'react-native-gesture-handler';
3
3
  export declare function PanGestureHandler(props: PanGestureHandlerProperties): JSX.Element;
4
- export { GestureHandlerRootView, State as GestureState, PanGestureHandlerGestureEvent, TapGestureHandler, } from 'react-native-gesture-handler';
4
+ export type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';
5
+ export { GestureHandlerRootView, State as GestureState, TapGestureHandler, } from 'react-native-gesture-handler';
@@ -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 & {
@@ -2,11 +2,10 @@ import * as React from 'react';
2
2
  import Animated from 'react-native-reanimated';
3
3
  declare const Overlay: React.ForwardRefExoticComponent<{
4
4
  children?: React.ReactNode | Animated.Node<React.ReactNode>;
5
+ removeClippedSubviews?: boolean | Animated.Node<boolean | undefined> | undefined;
5
6
  hitSlop?: import("react-native").Insets | Animated.Node<import("react-native").Insets | undefined> | undefined;
6
7
  onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | Animated.Node<((event: import("react-native").LayoutChangeEvent) => void) | undefined> | undefined;
7
8
  pointerEvents?: "none" | "auto" | "box-none" | "box-only" | Animated.Node<"none" | "auto" | "box-none" | "box-only" | undefined> | undefined;
8
- removeClippedSubviews?: boolean | Animated.Node<boolean | undefined> | undefined;
9
- style?: import("react-native").StyleProp<import("react-native").ViewStyle> | Animated.Node<import("react-native").StyleProp<import("react-native").ViewStyle>>;
10
9
  testID?: string | Animated.Node<string | undefined> | undefined;
11
10
  nativeID?: string | Animated.Node<string | undefined> | undefined;
12
11
  collapsable?: boolean | Animated.Node<boolean | undefined> | undefined;
@@ -2,11 +2,10 @@ import * as React from 'react';
2
2
  import Animated from 'react-native-reanimated';
3
3
  declare const Overlay: React.ForwardRefExoticComponent<{
4
4
  children?: React.ReactNode | Animated.Node<React.ReactNode>;
5
+ removeClippedSubviews?: boolean | Animated.Node<boolean | undefined> | undefined;
5
6
  hitSlop?: import("react-native").Insets | Animated.Node<import("react-native").Insets | undefined> | undefined;
6
7
  onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | Animated.Node<((event: import("react-native").LayoutChangeEvent) => void) | undefined> | undefined;
7
8
  pointerEvents?: "none" | "auto" | "box-none" | "box-only" | Animated.Node<"none" | "auto" | "box-none" | "box-only" | undefined> | undefined;
8
- removeClippedSubviews?: boolean | Animated.Node<boolean | undefined> | undefined;
9
- style?: import("react-native").StyleProp<import("react-native").ViewStyle> | Animated.Node<import("react-native").StyleProp<import("react-native").ViewStyle>>;
10
9
  testID?: string | Animated.Node<string | undefined> | undefined;
11
10
  nativeID?: string | Animated.Node<string | undefined> | undefined;
12
11
  collapsable?: boolean | Animated.Node<boolean | undefined> | undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-navigation/drawer",
3
3
  "description": "Drawer navigator component with animated transitions and gesturess",
4
- "version": "6.4.4",
4
+ "version": "6.5.0",
5
5
  "keywords": [
6
6
  "react-native-component",
7
7
  "react-component",
@@ -41,23 +41,23 @@
41
41
  "clean": "del lib"
42
42
  },
43
43
  "dependencies": {
44
- "@react-navigation/elements": "^1.3.5",
44
+ "@react-navigation/elements": "^1.3.6",
45
45
  "color": "^4.2.3",
46
46
  "warn-once": "^0.1.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@react-navigation/native": "^6.0.12",
49
+ "@react-navigation/native": "^6.0.13",
50
50
  "@testing-library/react-native": "^7.2.0",
51
- "@types/react": "^17.0.47",
52
- "@types/react-native": "~0.68.1",
51
+ "@types/react": "~18.0.0",
52
+ "@types/react-native": "~0.69.1",
53
53
  "del-cli": "^3.0.1",
54
- "react": "17.0.2",
55
- "react-native": "~0.68.2",
54
+ "react": "18.0.0",
55
+ "react-native": "0.69.5",
56
56
  "react-native-builder-bob": "^0.18.1",
57
- "react-native-gesture-handler": "~2.2.1",
58
- "react-native-reanimated": "~2.8.0",
59
- "react-native-safe-area-context": "4.2.4",
60
- "react-native-screens": "~3.11.1",
57
+ "react-native-gesture-handler": "~2.5.0",
58
+ "react-native-reanimated": "~2.9.1",
59
+ "react-native-safe-area-context": "4.3.1",
60
+ "react-native-screens": "~3.15.0",
61
61
  "typescript": "^4.7.4"
62
62
  },
63
63
  "peerDependencies": {
@@ -83,5 +83,5 @@
83
83
  ]
84
84
  ]
85
85
  },
86
- "gitHead": "83aa392f1e13796d609c9df0afa44699ce4bacae"
86
+ "gitHead": "fc4c3a63ab156e17db7ba0cbd32ada319f78714e"
87
87
  }
package/src/types.tsx CHANGED
@@ -211,6 +211,15 @@ export type DrawerNavigationOptions = HeaderOptions & {
211
211
  * Defaults to `false`.
212
212
  */
213
213
  unmountOnBlur?: boolean;
214
+
215
+ /**
216
+ * Whether inactive screens should be suspended from re-rendering. Defaults to `false`.
217
+ * Defaults to `true` when `enableFreeze()` is run at the top of the application.
218
+ * Requires `react-native-screens` version >=3.16.0.
219
+ *
220
+ * Only supported on iOS and Android.
221
+ */
222
+ freezeOnBlur?: boolean;
214
223
  };
215
224
 
216
225
  export type DrawerContentComponentProps = {
@@ -230,6 +230,7 @@ function DrawerViewBase({
230
230
  }
231
231
 
232
232
  const {
233
+ freezeOnBlur,
233
234
  header = ({ layout, options }: DrawerHeaderProps) => (
234
235
  <Header
235
236
  {...options}
@@ -241,6 +242,9 @@ function DrawerViewBase({
241
242
  }
242
243
  />
243
244
  ),
245
+ headerShown,
246
+ headerStatusBarHeight,
247
+ headerTransparent,
244
248
  sceneContainerStyle,
245
249
  } = descriptor.options;
246
250
 
@@ -250,14 +254,15 @@ function DrawerViewBase({
250
254
  style={[StyleSheet.absoluteFill, { zIndex: isFocused ? 0 : -1 }]}
251
255
  visible={isFocused}
252
256
  enabled={detachInactiveScreens}
257
+ freezeOnBlur={freezeOnBlur}
253
258
  >
254
259
  <Screen
255
260
  focused={isFocused}
256
261
  route={descriptor.route}
257
262
  navigation={descriptor.navigation}
258
- headerShown={descriptor.options.headerShown}
259
- headerTransparent={descriptor.options.headerTransparent}
260
- headerStatusBarHeight={descriptor.options.headerStatusBarHeight}
263
+ headerShown={headerShown}
264
+ headerStatusBarHeight={headerStatusBarHeight}
265
+ headerTransparent={headerTransparent}
261
266
  header={header({
262
267
  layout: dimensions,
263
268
  route: descriptor.route,
@@ -16,9 +16,9 @@ export function PanGestureHandler(props: PanGestureHandlerProperties) {
16
16
  );
17
17
  }
18
18
 
19
+ export type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';
19
20
  export {
20
21
  GestureHandlerRootView,
21
22
  State as GestureState,
22
- PanGestureHandlerGestureEvent,
23
23
  TapGestureHandler,
24
24
  } from 'react-native-gesture-handler';
@@ -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