@react-navigation/drawer 6.1.8 → 6.2.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.
- package/lib/commonjs/index.js +14 -14
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/navigators/createDrawerNavigator.js +10 -9
- package/lib/commonjs/navigators/createDrawerNavigator.js.map +1 -1
- package/lib/commonjs/utils/DrawerStatusContext.js.map +1 -1
- package/lib/commonjs/utils/useDrawerStatus.js.map +1 -1
- package/lib/commonjs/views/DrawerContent.js +6 -5
- package/lib/commonjs/views/DrawerContent.js.map +1 -1
- package/lib/commonjs/views/DrawerContentScrollView.js +7 -6
- package/lib/commonjs/views/DrawerContentScrollView.js.map +1 -1
- package/lib/commonjs/views/DrawerItem.js +13 -10
- package/lib/commonjs/views/DrawerItem.js.map +1 -1
- package/lib/commonjs/views/DrawerItemList.js +6 -5
- package/lib/commonjs/views/DrawerItemList.js.map +1 -1
- package/lib/commonjs/views/DrawerToggleButton.js +5 -4
- package/lib/commonjs/views/DrawerToggleButton.js.map +1 -1
- package/lib/commonjs/views/DrawerView.js +32 -29
- package/lib/commonjs/views/DrawerView.js.map +1 -1
- package/lib/commonjs/views/GestureHandler.js +7 -4
- package/lib/commonjs/views/GestureHandler.js.map +1 -1
- package/lib/commonjs/views/GestureHandlerNative.js +1 -1
- package/lib/commonjs/views/ScreenFallback.js +13 -9
- package/lib/commonjs/views/ScreenFallback.js.map +1 -1
- package/lib/commonjs/views/legacy/Drawer.js +17 -12
- package/lib/commonjs/views/legacy/Drawer.js.map +1 -1
- package/lib/commonjs/views/legacy/Overlay.js +8 -6
- package/lib/commonjs/views/legacy/Overlay.js.map +1 -1
- package/lib/commonjs/views/modern/Drawer.js +28 -30
- package/lib/commonjs/views/modern/Drawer.js.map +1 -1
- package/lib/commonjs/views/modern/Overlay.js +7 -6
- package/lib/commonjs/views/modern/Overlay.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createDrawerNavigator.js +10 -9
- package/lib/module/navigators/createDrawerNavigator.js.map +1 -1
- package/lib/module/utils/DrawerStatusContext.js.map +1 -1
- package/lib/module/utils/useDrawerStatus.js.map +1 -1
- package/lib/module/views/DrawerContent.js +6 -5
- package/lib/module/views/DrawerContent.js.map +1 -1
- package/lib/module/views/DrawerContentScrollView.js +7 -6
- package/lib/module/views/DrawerContentScrollView.js.map +1 -1
- package/lib/module/views/DrawerItem.js +13 -10
- package/lib/module/views/DrawerItem.js.map +1 -1
- package/lib/module/views/DrawerItemList.js +6 -5
- package/lib/module/views/DrawerItemList.js.map +1 -1
- package/lib/module/views/DrawerToggleButton.js +5 -4
- package/lib/module/views/DrawerToggleButton.js.map +1 -1
- package/lib/module/views/DrawerView.js +31 -28
- package/lib/module/views/DrawerView.js.map +1 -1
- package/lib/module/views/GestureHandler.js +6 -3
- package/lib/module/views/GestureHandler.js.map +1 -1
- package/lib/module/views/ScreenFallback.js +13 -9
- package/lib/module/views/ScreenFallback.js.map +1 -1
- package/lib/module/views/legacy/Drawer.js +17 -12
- package/lib/module/views/legacy/Drawer.js.map +1 -1
- package/lib/module/views/legacy/Overlay.js +8 -6
- package/lib/module/views/legacy/Overlay.js.map +1 -1
- package/lib/module/views/modern/Drawer.js +28 -30
- package/lib/module/views/modern/Drawer.js.map +1 -1
- package/lib/module/views/modern/Overlay.js +7 -6
- package/lib/module/views/modern/Overlay.js.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/utils/useDrawerStatus.d.ts +2 -1
- package/lib/typescript/src/views/legacy/Overlay.d.ts +4 -0
- package/lib/typescript/src/views/modern/Overlay.d.ts +4 -0
- package/package.json +10 -10
- package/src/index.tsx +1 -0
- package/src/utils/DrawerStatusContext.tsx +3 -2
- package/src/utils/useDrawerStatus.tsx +2 -1
- package/src/views/legacy/Drawer.tsx +17 -9
- package/src/views/legacy/Overlay.tsx +1 -0
- package/src/views/modern/Drawer.tsx +25 -23
|
@@ -18,12 +18,13 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
18
18
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
19
|
|
|
20
20
|
const PROGRESS_EPSILON = 0.05;
|
|
21
|
-
const Overlay = /*#__PURE__*/React.forwardRef(function Overlay({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
const Overlay = /*#__PURE__*/React.forwardRef(function Overlay(_ref, ref) {
|
|
22
|
+
let {
|
|
23
|
+
progress,
|
|
24
|
+
onPress,
|
|
25
|
+
style,
|
|
26
|
+
...props
|
|
27
|
+
} = _ref;
|
|
27
28
|
const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
28
29
|
return {
|
|
29
30
|
opacity: progress.value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Overlay.tsx"],"names":["PROGRESS_EPSILON","Overlay","React","forwardRef","progress","onPress","style","props","
|
|
1
|
+
{"version":3,"sources":["Overlay.tsx"],"names":["PROGRESS_EPSILON","Overlay","React","forwardRef","ref","progress","onPress","style","props","animatedStyle","opacity","value","zIndex","animatedProps","active","pointerEvents","accessibilityElementsHidden","importantForAccessibility","styles","overlay","overlayStyle","pressable","Platform","select","web","WebkitTapHighlightColor","default","StyleSheet","create","absoluteFillObject","backgroundColor","flex"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;AAKA,MAAMA,gBAAgB,GAAG,IAAzB;AAOA,MAAMC,OAAO,gBAAGC,KAAK,CAACC,UAAN,CAAiB,SAASF,OAAT,OAE/BG,GAF+B,EAG/B;AAAA,MAFA;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,OAAZ;AAAqBC,IAAAA,KAArB;AAA4B,OAAG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AACTU,IAAAA,IAAI,EAAE;AADG;AALoB,CAAlB,CAAf;;eAUe9B,O","sourcesContent":["import * as React from 'react';\nimport { Platform, Pressable, StyleSheet } from 'react-native';\nimport Animated, {\n useAnimatedProps,\n useAnimatedStyle,\n} from 'react-native-reanimated';\n\nconst PROGRESS_EPSILON = 0.05;\n\ntype Props = React.ComponentProps<typeof Animated.View> & {\n progress: Animated.SharedValue<number>;\n onPress: () => void;\n};\n\nconst Overlay = React.forwardRef(function Overlay(\n { progress, onPress, style, ...props }: Props,\n ref: React.Ref<Animated.View>\n) {\n const animatedStyle = useAnimatedStyle(() => {\n return {\n opacity: progress.value,\n // We don't want the user to be able to press through the overlay when drawer is open\n // We can send the overlay behind the screen to avoid it\n zIndex: progress.value > PROGRESS_EPSILON ? 0 : -1,\n };\n });\n\n const animatedProps = useAnimatedProps(() => {\n const active = progress.value > PROGRESS_EPSILON;\n\n return {\n pointerEvents: active ? 'auto' : 'none',\n accessibilityElementsHidden: !active,\n importantForAccessibility: active ? 'auto' : 'no-hide-descendants',\n } as const;\n });\n\n return (\n <Animated.View\n {...props}\n ref={ref}\n style={[styles.overlay, overlayStyle, animatedStyle, style]}\n animatedProps={animatedProps}\n >\n <Pressable onPress={onPress} style={styles.pressable} />\n </Animated.View>\n );\n});\n\nconst overlayStyle = Platform.select<Record<string, string>>({\n web: {\n // Disable touch highlight on mobile Safari.\n // WebkitTapHighlightColor must be used outside of StyleSheet.create because react-native-web will omit the property.\n WebkitTapHighlightColor: 'transparent',\n },\n default: {},\n});\n\nconst styles = StyleSheet.create({\n overlay: {\n ...StyleSheet.absoluteFillObject,\n backgroundColor: 'rgba(0, 0, 0, 0.5)',\n },\n pressable: {\n flex: 1,\n },\n});\n\nexport default Overlay;\n"]}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["default","createDrawerNavigator","DrawerContent","DrawerContentScrollView","DrawerItem","DrawerItemList","DrawerToggleButton","DrawerView","DrawerGestureContext","DrawerProgressContext","getDrawerStatusFromState","useDrawerProgress","useDrawerStatus"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,IAAIC,qBAApB,QAAiD,oCAAjD;AAEA;AACA;AACA;;AACA,SAASD,OAAO,IAAIE,aAApB,QAAyC,uBAAzC;AACA,SAASF,OAAO,IAAIG,uBAApB,QAAmD,iCAAnD;AACA,SAASH,OAAO,IAAII,UAApB,QAAsC,oBAAtC;AACA,SAASJ,OAAO,IAAIK,cAApB,QAA0C,wBAA1C;AACA,SAASL,OAAO,IAAIM,kBAApB,QAA8C,4BAA9C;AACA,SAASN,OAAO,IAAIO,UAApB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,SAASP,OAAO,IAAIQ,oBAApB,QAAgD,8BAAhD;AACA,SAASR,OAAO,IAAIS,qBAApB,QAAiD,+BAAjD;AACA,SAAST,OAAO,IAAIU,wBAApB,QAAoD,kCAApD;AACA,SAASV,OAAO,IAAIW,iBAApB,QAA6C,2BAA7C;AACA,SAASX,OAAO,IAAIY,eAApB,QAA2C,yBAA3C;AAEA;AACA;AACA","sourcesContent":["/**\n * Navigators\n */\nexport { default as createDrawerNavigator } from './navigators/createDrawerNavigator';\n\n/**\n * Views\n */\nexport { default as DrawerContent } from './views/DrawerContent';\nexport { default as DrawerContentScrollView } from './views/DrawerContentScrollView';\nexport { default as DrawerItem } from './views/DrawerItem';\nexport { default as DrawerItemList } from './views/DrawerItemList';\nexport { default as DrawerToggleButton } from './views/DrawerToggleButton';\nexport { default as DrawerView } from './views/DrawerView';\n\n/**\n * Utilities\n */\nexport { default as DrawerGestureContext } from './utils/DrawerGestureContext';\nexport { default as DrawerProgressContext } from './utils/DrawerProgressContext';\nexport { default as getDrawerStatusFromState } from './utils/getDrawerStatusFromState';\nexport { default as useDrawerProgress } from './utils/useDrawerProgress';\nexport { default as useDrawerStatus } from './utils/useDrawerStatus';\n\n/**\n * Types\n */\nexport type {\n DrawerContentComponentProps,\n DrawerHeaderProps,\n DrawerNavigationOptions,\n DrawerNavigationProp,\n DrawerScreenProps,\n} from './types';\n"]}
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["default","createDrawerNavigator","DrawerContent","DrawerContentScrollView","DrawerItem","DrawerItemList","DrawerToggleButton","DrawerView","DrawerGestureContext","DrawerProgressContext","getDrawerStatusFromState","useDrawerProgress","useDrawerStatus"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,IAAIC,qBAApB,QAAiD,oCAAjD;AAEA;AACA;AACA;;AACA,SAASD,OAAO,IAAIE,aAApB,QAAyC,uBAAzC;AACA,SAASF,OAAO,IAAIG,uBAApB,QAAmD,iCAAnD;AACA,SAASH,OAAO,IAAII,UAApB,QAAsC,oBAAtC;AACA,SAASJ,OAAO,IAAIK,cAApB,QAA0C,wBAA1C;AACA,SAASL,OAAO,IAAIM,kBAApB,QAA8C,4BAA9C;AACA,SAASN,OAAO,IAAIO,UAApB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,SAASP,OAAO,IAAIQ,oBAApB,QAAgD,8BAAhD;AACA,SAASR,OAAO,IAAIS,qBAApB,QAAiD,+BAAjD;AACA,SAAST,OAAO,IAAIU,wBAApB,QAAoD,kCAApD;AACA,SAASV,OAAO,IAAIW,iBAApB,QAA6C,2BAA7C;AACA,SAASX,OAAO,IAAIY,eAApB,QAA2C,yBAA3C;AAEA;AACA;AACA","sourcesContent":["/**\n * Navigators\n */\nexport { default as createDrawerNavigator } from './navigators/createDrawerNavigator';\n\n/**\n * Views\n */\nexport { default as DrawerContent } from './views/DrawerContent';\nexport { default as DrawerContentScrollView } from './views/DrawerContentScrollView';\nexport { default as DrawerItem } from './views/DrawerItem';\nexport { default as DrawerItemList } from './views/DrawerItemList';\nexport { default as DrawerToggleButton } from './views/DrawerToggleButton';\nexport { default as DrawerView } from './views/DrawerView';\n\n/**\n * Utilities\n */\nexport { default as DrawerGestureContext } from './utils/DrawerGestureContext';\nexport { default as DrawerProgressContext } from './utils/DrawerProgressContext';\nexport { default as getDrawerStatusFromState } from './utils/getDrawerStatusFromState';\nexport { default as useDrawerProgress } from './utils/useDrawerProgress';\nexport { default as useDrawerStatus } from './utils/useDrawerStatus';\n\n/**\n * Types\n */\nexport type {\n DrawerContentComponentProps,\n DrawerHeaderProps,\n DrawerNavigationEventMap,\n DrawerNavigationOptions,\n DrawerNavigationProp,\n DrawerScreenProps,\n} from './types';\n"]}
|
|
@@ -5,15 +5,16 @@ import * as React from 'react';
|
|
|
5
5
|
import warnOnce from 'warn-once';
|
|
6
6
|
import DrawerView from '../views/DrawerView';
|
|
7
7
|
|
|
8
|
-
function DrawerNavigator({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
function DrawerNavigator(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
initialRouteName,
|
|
11
|
+
defaultStatus: customDefaultStatus,
|
|
12
|
+
backBehavior,
|
|
13
|
+
children,
|
|
14
|
+
screenListeners,
|
|
15
|
+
screenOptions,
|
|
16
|
+
...restWithDeprecated
|
|
17
|
+
} = _ref;
|
|
17
18
|
const {
|
|
18
19
|
// @ts-expect-error: openByDefault is deprecated
|
|
19
20
|
openByDefault,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["createDrawerNavigator.tsx"],"names":["createNavigatorFactory","DrawerRouter","useNavigationBuilder","React","warnOnce","DrawerView","DrawerNavigator","initialRouteName","defaultStatus","customDefaultStatus","backBehavior","children","screenListeners","screenOptions","restWithDeprecated","openByDefault","lazy","drawerContentOptions","rest","defaultScreenOptions","Object","assign","drawerPosition","drawerType","swipeEdgeWidth","edgeWidth","drawerHideStatusBarOnOpen","hideStatusBar","keyboardDismissMode","swipeMinDistance","minSwipeDistance","overlayColor","drawerStatusBarAnimation","statusBarAnimation","gestureHandlerProps","keys","forEach","key","undefined","JSON","stringify","state","descriptors","navigation","NavigationContent"],"mappings":";;AAAA,SACEA,sBADF,EAKEC,YALF,EASEC,oBATF,QAUO,0BAVP;AAWA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,QAAP,MAAqB,WAArB;AAOA,OAAOC,UAAP,MAAuB,qBAAvB;;AAWA,SAASC,eAAT,
|
|
1
|
+
{"version":3,"sources":["createDrawerNavigator.tsx"],"names":["createNavigatorFactory","DrawerRouter","useNavigationBuilder","React","warnOnce","DrawerView","DrawerNavigator","initialRouteName","defaultStatus","customDefaultStatus","backBehavior","children","screenListeners","screenOptions","restWithDeprecated","openByDefault","lazy","drawerContentOptions","rest","defaultScreenOptions","Object","assign","drawerPosition","drawerType","swipeEdgeWidth","edgeWidth","drawerHideStatusBarOnOpen","hideStatusBar","keyboardDismissMode","swipeMinDistance","minSwipeDistance","overlayColor","drawerStatusBarAnimation","statusBarAnimation","gestureHandlerProps","keys","forEach","key","undefined","JSON","stringify","state","descriptors","navigation","NavigationContent"],"mappings":";;AAAA,SACEA,sBADF,EAKEC,YALF,EASEC,oBATF,QAUO,0BAVP;AAWA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,QAAP,MAAqB,WAArB;AAOA,OAAOC,UAAP,MAAuB,qBAAvB;;AAWA,SAASC,eAAT,OAQU;AAAA,MARe;AACvBC,IAAAA,gBADuB;AAEvBC,IAAAA,aAAa,EAAEC,mBAFQ;AAGvBC,IAAAA,YAHuB;AAIvBC,IAAAA,QAJuB;AAKvBC,IAAAA,eALuB;AAMvBC,IAAAA,aANuB;AAOvB,OAAGC;AAPoB,GAQf;AACR,QAAM;AACJ;AACAC,IAAAA,aAFI;AAGJ;AACAC,IAAAA,IAJI;AAKJ;AACAC,IAAAA,oBANI;AAOJ,OAAGC;AAPC,MAQFJ,kBARJ;AAUA,MAAIK,oBAA6C,GAAG,EAApD;;AAEA,MAAIF,oBAAJ,EAA0B;AACxBG,IAAAA,MAAM,CAACC,MAAP,CAAcF,oBAAd,EAAoC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AAsBC,IAAAA,UAAtB;AAAkCC,IAAAA;AAAlC,MACJ1C,oBAAoB,CAMlBD,YANkB,EAMJ;AACdM,IAAAA,gBADc;AAEdC,IAAAA,aAFc;AAGdE,IAAAA,YAHc;AAIdC,IAAAA,QAJc;AAKdC,IAAAA,eALc;AAMdC,IAAAA,aANc;AAOdM,IAAAA;AAPc,GANI,CADtB;AAiBA,sBACE,oBAAC,iBAAD,qBACE,oBAAC,UAAD,eACMD,IADN;AAEE,IAAA,aAAa,EAAEV,aAFjB;AAGE,IAAA,KAAK,EAAEiC,KAHT;AAIE,IAAA,WAAW,EAAEC,WAJf;AAKE,IAAA,UAAU,EAAEC;AALd,KADF,CADF;AAWD;;AAED,eAAe3C,sBAAsB,CAKnCM,eALmC,CAArC","sourcesContent":["import {\n createNavigatorFactory,\n DefaultNavigatorOptions,\n DrawerActionHelpers,\n DrawerNavigationState,\n DrawerRouter,\n DrawerRouterOptions,\n DrawerStatus,\n ParamListBase,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport warnOnce from 'warn-once';\n\nimport type {\n DrawerNavigationConfig,\n DrawerNavigationEventMap,\n DrawerNavigationOptions,\n} from '../types';\nimport DrawerView from '../views/DrawerView';\n\ntype Props = DefaultNavigatorOptions<\n ParamListBase,\n DrawerNavigationState<ParamListBase>,\n DrawerNavigationOptions,\n DrawerNavigationEventMap\n> &\n DrawerRouterOptions &\n DrawerNavigationConfig;\n\nfunction DrawerNavigator({\n initialRouteName,\n defaultStatus: customDefaultStatus,\n backBehavior,\n children,\n screenListeners,\n screenOptions,\n ...restWithDeprecated\n}: Props) {\n const {\n // @ts-expect-error: openByDefault is deprecated\n openByDefault,\n // @ts-expect-error: lazy is deprecated\n lazy,\n // @ts-expect-error: drawerContentOptions is deprecated\n drawerContentOptions,\n ...rest\n } = restWithDeprecated;\n\n let defaultScreenOptions: DrawerNavigationOptions = {};\n\n if (drawerContentOptions) {\n Object.assign(defaultScreenOptions, {\n drawerPosition: drawerContentOptions.drawerPosition,\n drawerType: drawerContentOptions.drawerType,\n swipeEdgeWidth: drawerContentOptions.edgeWidth,\n drawerHideStatusBarOnOpen: drawerContentOptions.hideStatusBar,\n keyboardDismissMode: drawerContentOptions.keyboardDismissMode,\n swipeMinDistance: drawerContentOptions.minSwipeDistance,\n overlayColor: drawerContentOptions.overlayColor,\n drawerStatusBarAnimation: drawerContentOptions.statusBarAnimation,\n gestureHandlerProps: drawerContentOptions.gestureHandlerProps,\n });\n\n (\n Object.keys(defaultScreenOptions) as (keyof DrawerNavigationOptions)[]\n ).forEach((key) => {\n if (defaultScreenOptions[key] === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete defaultScreenOptions[key];\n }\n });\n\n warnOnce(\n drawerContentOptions,\n `Drawer Navigator: 'drawerContentOptions' is deprecated. Migrate the options to 'screenOptions' instead.\\n\\nPlace the following in 'screenOptions' in your code to keep current behavior:\\n\\n${JSON.stringify(\n defaultScreenOptions,\n null,\n 2\n )}\\n\\nSee https://reactnavigation.org/docs/drawer-navigator#options for more details.`\n );\n }\n\n if (typeof lazy === 'boolean') {\n defaultScreenOptions.lazy = lazy;\n\n warnOnce(\n true,\n `Drawer Navigator: 'lazy' in props is deprecated. Move it to 'screenOptions' instead.\\n\\nSee https://reactnavigation.org/docs/drawer-navigator/#lazy for more details.`\n );\n }\n\n if (typeof openByDefault === 'boolean') {\n warnOnce(\n true,\n `Drawer Navigator: 'openByDefault' is deprecated. Use 'defaultStatus' and set it to 'open' or 'closed' instead.\\n\\nSee https://reactnavigation.org/docs/drawer-navigator/#defaultstatus for more details.`\n );\n }\n\n const defaultStatus: DrawerStatus =\n customDefaultStatus !== undefined\n ? customDefaultStatus\n : openByDefault\n ? 'open'\n : 'closed';\n\n const { state, descriptors, navigation, NavigationContent } =\n useNavigationBuilder<\n DrawerNavigationState<ParamListBase>,\n DrawerRouterOptions,\n DrawerActionHelpers<ParamListBase>,\n DrawerNavigationOptions,\n DrawerNavigationEventMap\n >(DrawerRouter, {\n initialRouteName,\n defaultStatus,\n backBehavior,\n children,\n screenListeners,\n screenOptions,\n defaultScreenOptions,\n });\n\n return (\n <NavigationContent>\n <DrawerView\n {...rest}\n defaultStatus={defaultStatus}\n state={state}\n descriptors={descriptors}\n navigation={navigation}\n />\n </NavigationContent>\n );\n}\n\nexport default createNavigatorFactory<\n DrawerNavigationState<ParamListBase>,\n DrawerNavigationOptions,\n DrawerNavigationEventMap,\n typeof DrawerNavigator\n>(DrawerNavigator);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DrawerStatusContext.tsx"],"names":["React","DrawerStatusContext","createContext","undefined"],"mappings":"AACA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,MAAMC,mBAAmB,
|
|
1
|
+
{"version":3,"sources":["DrawerStatusContext.tsx"],"names":["React","DrawerStatusContext","createContext","undefined"],"mappings":"AACA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,MAAMC,mBAAmB,gBAAGD,KAAK,CAACE,aAAN,CAC1BC,SAD0B,CAA5B;AAIA,eAAeF,mBAAf","sourcesContent":["import type { DrawerStatus } from '@react-navigation/native';\nimport * as React from 'react';\n\nconst DrawerStatusContext = React.createContext<DrawerStatus | undefined>(\n undefined\n);\n\nexport default DrawerStatusContext;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDrawerStatus.tsx"],"names":["React","DrawerStatusContext","useDrawerStatus","drawerStatus","useContext","undefined","Error"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["useDrawerStatus.tsx"],"names":["React","DrawerStatusContext","useDrawerStatus","drawerStatus","useContext","undefined","Error"],"mappings":"AACA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,OAAOC,mBAAP,MAAgC,uBAAhC;AAEA;AACA;AACA;AACA;;AACA,eAAe,SAASC,eAAT,GAAyC;AACtD,QAAMC,YAAY,GAAGH,KAAK,CAACI,UAAN,CAAiBH,mBAAjB,CAArB;;AAEA,MAAIE,YAAY,KAAKE,SAArB,EAAgC;AAC9B,UAAM,IAAIC,KAAJ,CACJ,sEADI,CAAN;AAGD;;AAED,SAAOH,YAAP;AACD","sourcesContent":["import type { DrawerStatus } from '@react-navigation/native';\nimport * as React from 'react';\n\nimport DrawerStatusContext from './DrawerStatusContext';\n\n/**\n * Hook to detect if the drawer's status in a parent navigator.\n * Returns 'open' if the drawer is open, 'closed' if the drawer is closed.\n */\nexport default function useDrawerStatus(): DrawerStatus {\n const drawerStatus = React.useContext(DrawerStatusContext);\n\n if (drawerStatus === undefined) {\n throw new Error(\n \"Couldn't find a drawer. Is your component inside a drawer navigator?\"\n );\n }\n\n return drawerStatus;\n}\n"]}
|
|
@@ -3,11 +3,12 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import DrawerContentScrollView from './DrawerContentScrollView';
|
|
5
5
|
import DrawerItemList from './DrawerItemList';
|
|
6
|
-
export default function DrawerContent({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
export default function DrawerContent(_ref) {
|
|
7
|
+
let {
|
|
8
|
+
descriptors,
|
|
9
|
+
state,
|
|
10
|
+
...rest
|
|
11
|
+
} = _ref;
|
|
11
12
|
const focusedRoute = state.routes[state.index];
|
|
12
13
|
const focusedDescriptor = descriptors[focusedRoute.key];
|
|
13
14
|
const focusedOptions = focusedDescriptor.options;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DrawerContent.tsx"],"names":["React","DrawerContentScrollView","DrawerItemList","DrawerContent","descriptors","state","rest","focusedRoute","routes","index","focusedDescriptor","key","focusedOptions","options","drawerContentStyle","drawerContentContainerStyle"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAGA,OAAOC,uBAAP,MAAoC,2BAApC;AACA,OAAOC,cAAP,MAA2B,kBAA3B;AAEA,eAAe,SAASC,aAAT,
|
|
1
|
+
{"version":3,"sources":["DrawerContent.tsx"],"names":["React","DrawerContentScrollView","DrawerItemList","DrawerContent","descriptors","state","rest","focusedRoute","routes","index","focusedDescriptor","key","focusedOptions","options","drawerContentStyle","drawerContentContainerStyle"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAGA,OAAOC,uBAAP,MAAoC,2BAApC;AACA,OAAOC,cAAP,MAA2B,kBAA3B;AAEA,eAAe,SAASC,aAAT,OAIiB;AAAA,MAJM;AACpCC,IAAAA,WADoC;AAEpCC,IAAAA,KAFoC;AAGpC,OAAGC;AAHiC,GAIN;AAC9B,QAAMC,YAAY,GAAGF,KAAK,CAACG,MAAN,CAAaH,KAAK,CAACI,KAAnB,CAArB;AACA,QAAMC,iBAAiB,GAAGN,WAAW,CAACG,YAAY,CAACI,GAAd,CAArC;AACA,QAAMC,cAAc,GAAGF,iBAAiB,CAACG,OAAzC;AAEA,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MAAsDH,cAA5D;AAEA,sBACE,oBAAC,uBAAD,eACMN,IADN;AAEE,IAAA,qBAAqB,EAAES,2BAFzB;AAGE,IAAA,KAAK,EAAED;AAHT,mBAKE,oBAAC,cAAD;AAAgB,IAAA,WAAW,EAAEV,WAA7B;AAA0C,IAAA,KAAK,EAAEC;AAAjD,KAA4DC,IAA5D,EALF,CADF;AASD","sourcesContent":["import * as React from 'react';\n\nimport type { DrawerContentComponentProps } from '../types';\nimport DrawerContentScrollView from './DrawerContentScrollView';\nimport DrawerItemList from './DrawerItemList';\n\nexport default function DrawerContent({\n descriptors,\n state,\n ...rest\n}: DrawerContentComponentProps) {\n const focusedRoute = state.routes[state.index];\n const focusedDescriptor = descriptors[focusedRoute.key];\n const focusedOptions = focusedDescriptor.options;\n\n const { drawerContentStyle, drawerContentContainerStyle } = focusedOptions;\n\n return (\n <DrawerContentScrollView\n {...rest}\n contentContainerStyle={drawerContentContainerStyle}\n style={drawerContentStyle}\n >\n <DrawerItemList descriptors={descriptors} state={state} {...rest} />\n </DrawerContentScrollView>\n );\n}\n"]}
|
|
@@ -5,12 +5,13 @@ import { I18nManager, ScrollView, StyleSheet } from 'react-native';
|
|
|
5
5
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
6
|
import DrawerPositionContext from '../utils/DrawerPositionContext';
|
|
7
7
|
|
|
8
|
-
function DrawerContentScrollView({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
function DrawerContentScrollView(_ref, ref) {
|
|
9
|
+
let {
|
|
10
|
+
contentContainerStyle,
|
|
11
|
+
style,
|
|
12
|
+
children,
|
|
13
|
+
...rest
|
|
14
|
+
} = _ref;
|
|
14
15
|
const drawerPosition = React.useContext(DrawerPositionContext);
|
|
15
16
|
const insets = useSafeAreaInsets();
|
|
16
17
|
const isRight = I18nManager.isRTL ? drawerPosition === 'left' : drawerPosition === 'right';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DrawerContentScrollView.tsx"],"names":["React","I18nManager","ScrollView","StyleSheet","useSafeAreaInsets","DrawerPositionContext","DrawerContentScrollView","contentContainerStyle","style","children","rest","
|
|
1
|
+
{"version":3,"sources":["DrawerContentScrollView.tsx"],"names":["React","I18nManager","ScrollView","StyleSheet","useSafeAreaInsets","DrawerPositionContext","DrawerContentScrollView","ref","contentContainerStyle","style","children","rest","drawerPosition","useContext","insets","isRight","isRTL","paddingTop","top","paddingStart","left","paddingEnd","right","styles","container","forwardRef","create","flex"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,WADF,EAEEC,UAFF,EAIEC,UAJF,QAKO,cALP;AAMA,SAASC,iBAAT,QAAkC,gCAAlC;AAEA,OAAOC,qBAAP,MAAkC,gCAAlC;;AAMA,SAASC,uBAAT,OAEEC,GAFF,EAGE;AAAA,MAFA;AAAEC,IAAAA,qBAAF;AAAyBC,IAAAA,KAAzB;AAAgCC,IAAAA,QAAhC;AAA0C,OAAGC;AAA7C,GAEA;AACA,QAAMC,cAAc,GAAGZ,KAAK,CAACa,UAAN,CAAiBR,qBAAjB,CAAvB;AACA,QAAMS,MAAM,GAAGV,iBAAiB,EAAhC;AAEA,QAAMW,OAAO,GAAGd,WAAW,CAACe,KAAZ,GACZJ,cAAc,KAAK,MADP,GAEZA,cAAc,KAAK,OAFvB;AAIA,sBACE,oBAAC,UAAD,eACMD,IADN;AAEE,IAAA,GAAG,EAAEJ,GAFP;AAGE,IAAA,qBAAqB,EAAE,CACrB;AACEU,MAAAA,UAAU,EAAEH,MAAM,CAACI,GAAP,GAAa,CAD3B;AAEEC,MAAAA,YAAY,EAAE,CAACJ,OAAD,GAAWD,MAAM,CAACM,IAAlB,GAAyB,CAFzC;AAGEC,MAAAA,UAAU,EAAEN,OAAO,GAAGD,MAAM,CAACQ,KAAV,GAAkB;AAHvC,KADqB,EAMrBd,qBANqB,CAHzB;AAWE,IAAA,KAAK,EAAE,CAACe,MAAM,CAACC,SAAR,EAAmBf,KAAnB;AAXT,MAaGC,QAbH,CADF;AAiBD;;AAED,4BAAeV,KAAK,CAACyB,UAAN,CAAiBnB,uBAAjB,CAAf;AAEA,MAAMiB,MAAM,GAAGpB,UAAU,CAACuB,MAAX,CAAkB;AAC/BF,EAAAA,SAAS,EAAE;AACTG,IAAAA,IAAI,EAAE;AADG;AADoB,CAAlB,CAAf","sourcesContent":["import * as React from 'react';\nimport {\n I18nManager,\n ScrollView,\n ScrollViewProps,\n StyleSheet,\n} from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport DrawerPositionContext from '../utils/DrawerPositionContext';\n\ntype Props = ScrollViewProps & {\n children: React.ReactNode;\n};\n\nfunction DrawerContentScrollView(\n { contentContainerStyle, style, children, ...rest }: Props,\n ref?: React.Ref<ScrollView>\n) {\n const drawerPosition = React.useContext(DrawerPositionContext);\n const insets = useSafeAreaInsets();\n\n const isRight = I18nManager.isRTL\n ? drawerPosition === 'left'\n : drawerPosition === 'right';\n\n return (\n <ScrollView\n {...rest}\n ref={ref}\n contentContainerStyle={[\n {\n paddingTop: insets.top + 4,\n paddingStart: !isRight ? insets.left : 0,\n paddingEnd: isRight ? insets.right : 0,\n },\n contentContainerStyle,\n ]}\n style={[styles.container, style]}\n >\n {children}\n </ScrollView>\n );\n}\n\nexport default React.forwardRef(DrawerContentScrollView);\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"]}
|
|
@@ -6,15 +6,17 @@ import Color from 'color';
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { Platform, StyleSheet, Text, View } from 'react-native';
|
|
8
8
|
|
|
9
|
-
const LinkPressable =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
const LinkPressable = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
children,
|
|
12
|
+
style,
|
|
13
|
+
onPress,
|
|
14
|
+
onLongPress,
|
|
15
|
+
to,
|
|
16
|
+
accessibilityRole,
|
|
17
|
+
...rest
|
|
18
|
+
} = _ref;
|
|
19
|
+
|
|
18
20
|
if (Platform.OS === 'web' && to) {
|
|
19
21
|
// React Native Web doesn't forward `onClick` if we use `TouchableWithoutFeedback`.
|
|
20
22
|
// We need to use `onClick` to be able to prevent default browser handling of links.
|
|
@@ -22,7 +24,8 @@ const LinkPressable = ({
|
|
|
22
24
|
to: to,
|
|
23
25
|
style: [styles.button, style],
|
|
24
26
|
onPress: e => {
|
|
25
|
-
if (!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && (
|
|
27
|
+
if (!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && ( // ignore clicks with modifier keys
|
|
28
|
+
e.button == null || e.button === 0) // ignore everything but left clicks
|
|
26
29
|
) {
|
|
27
30
|
e.preventDefault();
|
|
28
31
|
onPress === null || onPress === void 0 ? void 0 : onPress(e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DrawerItem.tsx"],"names":["PlatformPressable","Link","useTheme","Color","React","Platform","StyleSheet","Text","View","LinkPressable","children","style","onPress","onLongPress","to","accessibilityRole","rest","OS","styles","button","e","metaKey","altKey","ctrlKey","shiftKey","preventDefault","undefined","DrawerItem","props","colors","icon","label","labelStyle","focused","activeTintColor","primary","inactiveTintColor","text","alpha","rgb","string","activeBackgroundColor","inactiveBackgroundColor","pressColor","pressOpacity","borderRadius","flatten","color","backgroundColor","iconNode","size","container","wrapper","selected","marginLeft","marginVertical","fontWeight","create","marginHorizontal","overflow","flexDirection","alignItems","padding","marginRight","flex","display"],"mappings":";;AAAA,SAASA,iBAAT,QAAkC,4BAAlC;AACA,SAASC,IAAT,EAAeC,QAAf,QAA+B,0BAA/B;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SACEC,QADF,EAGEC,UAHF,EAIEC,IAJF,EAMEC,IANF,QAQO,cARP;;AA6EA,MAAMC,aAAa,GAAG,
|
|
1
|
+
{"version":3,"sources":["DrawerItem.tsx"],"names":["PlatformPressable","Link","useTheme","Color","React","Platform","StyleSheet","Text","View","LinkPressable","children","style","onPress","onLongPress","to","accessibilityRole","rest","OS","styles","button","e","metaKey","altKey","ctrlKey","shiftKey","preventDefault","undefined","DrawerItem","props","colors","icon","label","labelStyle","focused","activeTintColor","primary","inactiveTintColor","text","alpha","rgb","string","activeBackgroundColor","inactiveBackgroundColor","pressColor","pressOpacity","borderRadius","flatten","color","backgroundColor","iconNode","size","container","wrapper","selected","marginLeft","marginVertical","fontWeight","create","marginHorizontal","overflow","flexDirection","alignItems","padding","marginRight","flex","display"],"mappings":";;AAAA,SAASA,iBAAT,QAAkC,4BAAlC;AACA,SAASC,IAAT,EAAeC,QAAf,QAA+B,0BAA/B;AACA,OAAOC,KAAP,MAAkB,OAAlB;AAC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AAAA,OAAO,EAAE;AAHF,GANsB;AAW/B/B,EAAAA,KAAK,EAAE;AACLgC,IAAAA,WAAW,EAAE,EADR;AAELC,IAAAA,IAAI,EAAE;AAFD,GAXwB;AAe/B7C,EAAAA,MAAM,EAAE;AACN8C,IAAAA,OAAO,EAAE;AADH;AAfuB,CAAlB,CAAf","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements';\nimport { Link, useTheme } from '@react-navigation/native';\nimport Color from 'color';\nimport * as React from 'react';\nimport {\n Platform,\n StyleProp,\n StyleSheet,\n Text,\n TextStyle,\n View,\n ViewStyle,\n} from 'react-native';\n\ntype Props = {\n /**\n * The label text of the item.\n */\n label:\n | string\n | ((props: { focused: boolean; color: string }) => React.ReactNode);\n /**\n * Icon to display for the `DrawerItem`.\n */\n icon?: (props: {\n focused: boolean;\n size: number;\n color: string;\n }) => React.ReactNode;\n /**\n * URL to use for the link to the tab.\n */\n to?: string;\n /**\n * Whether to highlight the drawer item as active.\n */\n focused?: boolean;\n /**\n * Function to execute on press.\n */\n onPress: () => void;\n /**\n * Color for the icon and label when the item is active.\n */\n activeTintColor?: string;\n /**\n * Color for the icon and label when the item is inactive.\n */\n inactiveTintColor?: string;\n /**\n * Background color for item when its active.\n */\n activeBackgroundColor?: string;\n /**\n * Background color for item when its inactive.\n */\n inactiveBackgroundColor?: string;\n /**\n * Color of the touchable effect on press.\n * Only supported on Android.\n *\n * @platform android\n */\n pressColor?: string;\n /**\n * Opacity of the touchable effect on press.\n * Only supported on iOS.\n *\n * @platform ios\n */\n pressOpacity?: number;\n /**\n * Style object for the label element.\n */\n labelStyle?: StyleProp<TextStyle>;\n /**\n * Style object for the wrapper element.\n */\n style?: StyleProp<ViewStyle>;\n};\n\nconst LinkPressable = ({\n children,\n style,\n onPress,\n onLongPress,\n to,\n accessibilityRole,\n ...rest\n}: Omit<React.ComponentProps<typeof PlatformPressable>, 'style'> & {\n style: StyleProp<ViewStyle>;\n} & {\n to?: string;\n children: React.ReactNode;\n onPress?: () => void;\n}) => {\n if (Platform.OS === 'web' && to) {\n // React Native Web doesn't forward `onClick` if we use `TouchableWithoutFeedback`.\n // We need to use `onClick` to be able to prevent default browser handling of links.\n return (\n <Link\n {...rest}\n to={to}\n style={[styles.button, style]}\n onPress={(e: any) => {\n if (\n !(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && // ignore clicks with modifier keys\n (e.button == null || e.button === 0) // ignore everything but left clicks\n ) {\n e.preventDefault();\n onPress?.(e);\n }\n }}\n onLongPress={onLongPress ?? undefined}\n >\n {children}\n </Link>\n );\n } else {\n return (\n <PlatformPressable\n {...rest}\n accessibilityRole={accessibilityRole}\n onPress={onPress}\n >\n <View style={style}>{children}</View>\n </PlatformPressable>\n );\n }\n};\n\n/**\n * A component used to show an action item with an icon and a label in a navigation drawer.\n */\nexport default function DrawerItem(props: Props) {\n const { colors } = useTheme();\n\n const {\n icon,\n label,\n labelStyle,\n to,\n focused = false,\n activeTintColor = colors.primary,\n inactiveTintColor = Color(colors.text).alpha(0.68).rgb().string(),\n activeBackgroundColor = Color(activeTintColor).alpha(0.12).rgb().string(),\n inactiveBackgroundColor = 'transparent',\n style,\n onPress,\n pressColor,\n pressOpacity,\n ...rest\n } = props;\n\n const { borderRadius = 4 } = StyleSheet.flatten(style || {});\n const color = focused ? activeTintColor : inactiveTintColor;\n const backgroundColor = focused\n ? activeBackgroundColor\n : inactiveBackgroundColor;\n\n const iconNode = icon ? icon({ size: 24, focused, color }) : null;\n\n return (\n <View\n collapsable={false}\n {...rest}\n style={[styles.container, { borderRadius, backgroundColor }, style]}\n >\n <LinkPressable\n onPress={onPress}\n style={[styles.wrapper, { borderRadius }]}\n accessibilityRole=\"button\"\n accessibilityState={{ selected: focused }}\n pressColor={pressColor}\n pressOpacity={pressOpacity}\n to={to}\n >\n <React.Fragment>\n {iconNode}\n <View\n style={[\n styles.label,\n { marginLeft: iconNode ? 32 : 0, marginVertical: 5 },\n ]}\n >\n {typeof label === 'string' ? (\n <Text\n numberOfLines={1}\n style={[\n {\n color,\n fontWeight: '500',\n },\n labelStyle,\n ]}\n >\n {label}\n </Text>\n ) : (\n label({ color, focused })\n )}\n </View>\n </React.Fragment>\n </LinkPressable>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n marginHorizontal: 10,\n marginVertical: 4,\n overflow: 'hidden',\n },\n wrapper: {\n flexDirection: 'row',\n alignItems: 'center',\n padding: 8,\n },\n label: {\n marginRight: 32,\n flex: 1,\n },\n button: {\n display: 'flex',\n },\n});\n"]}
|
|
@@ -5,11 +5,12 @@ import DrawerItem from './DrawerItem';
|
|
|
5
5
|
/**
|
|
6
6
|
* Component that renders the navigation list in the drawer.
|
|
7
7
|
*/
|
|
8
|
-
export default function DrawerItemList({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export default function DrawerItemList(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
state,
|
|
11
|
+
navigation,
|
|
12
|
+
descriptors
|
|
13
|
+
} = _ref;
|
|
13
14
|
const buildLink = useLinkBuilder();
|
|
14
15
|
const focusedRoute = state.routes[state.index];
|
|
15
16
|
const focusedDescriptor = descriptors[focusedRoute.key];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DrawerItemList.tsx"],"names":["CommonActions","DrawerActions","useLinkBuilder","React","DrawerItem","DrawerItemList","state","navigation","descriptors","buildLink","focusedRoute","routes","index","focusedDescriptor","key","focusedOptions","options","drawerActiveTintColor","drawerInactiveTintColor","drawerActiveBackgroundColor","drawerInactiveBackgroundColor","map","route","i","focused","title","drawerLabel","drawerIcon","drawerLabelStyle","drawerItemStyle","undefined","name","params","dispatch","closeDrawer","navigate","merge","target"],"mappings":"AAAA,SACEA,aADF,EAEEC,aAFF,EAKEC,cALF,QAMO,0BANP;AAOA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAGA,OAAOC,UAAP,MAAuB,cAAvB;;AAQA;AACA;AACA;AACA,eAAe,SAASC,cAAT,
|
|
1
|
+
{"version":3,"sources":["DrawerItemList.tsx"],"names":["CommonActions","DrawerActions","useLinkBuilder","React","DrawerItem","DrawerItemList","state","navigation","descriptors","buildLink","focusedRoute","routes","index","focusedDescriptor","key","focusedOptions","options","drawerActiveTintColor","drawerInactiveTintColor","drawerActiveBackgroundColor","drawerInactiveBackgroundColor","map","route","i","focused","title","drawerLabel","drawerIcon","drawerLabelStyle","drawerItemStyle","undefined","name","params","dispatch","closeDrawer","navigate","merge","target"],"mappings":"AAAA,SACEA,aADF,EAEEC,aAFF,EAKEC,cALF,QAMO,0BANP;AAOA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAGA,OAAOC,UAAP,MAAuB,cAAvB;;AAQA;AACA;AACA;AACA,eAAe,SAASC,cAAT,OAIL;AAAA,MAJ6B;AACrCC,IAAAA,KADqC;AAErCC,IAAAA,UAFqC;AAGrCC,IAAAA;AAHqC,GAI7B;AACR,QAAMC,SAAS,GAAGP,cAAc,EAAhC;AAEA,QAAMQ,YAAY,GAAGJ,KAAK,CAACK,MAAN,CAAaL,KAAK,CAACM,KAAnB,CAArB;AACA,QAAMC,iBAAiB,GAAGL,WAAW,CAACE,YAAY,CAACI,GAAd,CAArC;AACA,QAAMC,cAAc,GAAGF,iBAAiB,CAACG,OAAzC;AAEA,QAAM;AACJC,IAAAA,qBADI;AAEJC,IAAAA,uBAFI;AAGJC,IAAAA,2BAHI;AAIJC,IAAAA;AAJI,MAKFL,cALJ;AAOA,SAAOT,KAAK,CAACK,MAAN,CAAaU,GAAb,CAAiB,CAACC,KAAD,EAAQC,CAAR,KAAc;AACpC,UAAMC,OAAO,GAAGD,CAAC,KAAKjB,KAAK,CAACM,KAA5B;AACA,UAAM;AACJa,MAAAA,KADI;AAEJC,MAAAA,WAFI;AAGJC,MAAAA,UAHI;AAIJC,MAAAA,gBAJI;AAKJC,MAAAA;AALI,QAMFrB,WAAW,CAACc,KAAK,CAACR,GAAP,CAAX,CAAuBE,OAN3B;AAQA,wBACE,oBAAC,UAAD;AACE,MAAA,GAAG,EAAEM,KAAK,CAACR,GADb;AAEE,MAAA,KAAK,EACHY,WAAW,KAAKI,SAAhB,GACIJ,WADJ,GAEID,KAAK,KAAKK,SAAV,GACAL,KADA,GAEAH,KAAK,CAACS,IAPd;AASE,MAAA,IAAI,EAAEJ,UATR;AAUE,MAAA,OAAO,EAAEH,OAVX;AAWE,MAAA,eAAe,EAAEP,qBAXnB;AAYE,MAAA,iBAAiB,EAAEC,uBAZrB;AAaE,MAAA,qBAAqB,EAAEC,2BAbzB;AAcE,MAAA,uBAAuB,EAAEC,6BAd3B;AAeE,MAAA,UAAU,EAAEQ,gBAfd;AAgBE,MAAA,KAAK,EAAEC,eAhBT;AAiBE,MAAA,EAAE,EAAEpB,SAAS,CAACa,KAAK,CAACS,IAAP,EAAaT,KAAK,CAACU,MAAnB,CAjBf;AAkBE,MAAA,OAAO,EAAE,MAAM;AACbzB,QAAAA,UAAU,CAAC0B,QAAX,CAAoB,EAClB,IAAIT,OAAO,GACPvB,aAAa,CAACiC,WAAd,EADO,GAEPlC,aAAa,CAACmC,QAAd,CAAuB;AAAEJ,YAAAA,IAAI,EAAET,KAAK,CAACS,IAAd;AAAoBK,YAAAA,KAAK,EAAE;AAA3B,WAAvB,CAFJ,CADkB;AAIlBC,UAAAA,MAAM,EAAE/B,KAAK,CAACQ;AAJI,SAApB;AAMD;AAzBH,MADF;AA6BD,GAvCM,CAAP;AAwCD","sourcesContent":["import {\n CommonActions,\n DrawerActions,\n DrawerNavigationState,\n ParamListBase,\n useLinkBuilder,\n} from '@react-navigation/native';\nimport * as React from 'react';\n\nimport type { DrawerDescriptorMap, DrawerNavigationHelpers } from '../types';\nimport DrawerItem from './DrawerItem';\n\ntype Props = {\n state: DrawerNavigationState<ParamListBase>;\n navigation: DrawerNavigationHelpers;\n descriptors: DrawerDescriptorMap;\n};\n\n/**\n * Component that renders the navigation list in the drawer.\n */\nexport default function DrawerItemList({\n state,\n navigation,\n descriptors,\n}: Props) {\n const buildLink = useLinkBuilder();\n\n const focusedRoute = state.routes[state.index];\n const focusedDescriptor = descriptors[focusedRoute.key];\n const focusedOptions = focusedDescriptor.options;\n\n const {\n drawerActiveTintColor,\n drawerInactiveTintColor,\n drawerActiveBackgroundColor,\n drawerInactiveBackgroundColor,\n } = focusedOptions;\n\n return state.routes.map((route, i) => {\n const focused = i === state.index;\n const {\n title,\n drawerLabel,\n drawerIcon,\n drawerLabelStyle,\n drawerItemStyle,\n } = descriptors[route.key].options;\n\n return (\n <DrawerItem\n key={route.key}\n label={\n drawerLabel !== undefined\n ? drawerLabel\n : title !== undefined\n ? title\n : route.name\n }\n icon={drawerIcon}\n focused={focused}\n activeTintColor={drawerActiveTintColor}\n inactiveTintColor={drawerInactiveTintColor}\n activeBackgroundColor={drawerActiveBackgroundColor}\n inactiveBackgroundColor={drawerInactiveBackgroundColor}\n labelStyle={drawerLabelStyle}\n style={drawerItemStyle}\n to={buildLink(route.name, route.params)}\n onPress={() => {\n navigation.dispatch({\n ...(focused\n ? DrawerActions.closeDrawer()\n : CommonActions.navigate({ name: route.name, merge: true })),\n target: state.key,\n });\n }}\n />\n );\n }) as React.ReactNode as React.ReactElement;\n}\n"]}
|
|
@@ -4,10 +4,11 @@ import { PlatformPressable } from '@react-navigation/elements';
|
|
|
4
4
|
import { DrawerActions, useNavigation } from '@react-navigation/native';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { Image, Platform, StyleSheet } from 'react-native';
|
|
7
|
-
export default function DrawerToggleButton({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export default function DrawerToggleButton(_ref) {
|
|
8
|
+
let {
|
|
9
|
+
tintColor,
|
|
10
|
+
...rest
|
|
11
|
+
} = _ref;
|
|
11
12
|
const navigation = useNavigation();
|
|
12
13
|
return /*#__PURE__*/React.createElement(PlatformPressable, _extends({}, rest, {
|
|
13
14
|
accessible: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DrawerToggleButton.tsx"],"names":["PlatformPressable","DrawerActions","useNavigation","React","Image","Platform","StyleSheet","DrawerToggleButton","tintColor","rest","navigation","borderless","dispatch","toggleDrawer","styles","touchable","select","ios","undefined","default","top","right","bottom","left","icon","require","create","height","width","margin","resizeMode","marginHorizontal"],"mappings":";;AAAA,SAASA,iBAAT,QAAkC,4BAAlC;AACA,SACEC,aADF,EAGEC,aAHF,QAIO,0BAJP;AAKA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,KAAT,EAAgBC,QAAhB,EAA0BC,UAA1B,QAA4C,cAA5C;AAWA,eAAe,SAASC,kBAAT,
|
|
1
|
+
{"version":3,"sources":["DrawerToggleButton.tsx"],"names":["PlatformPressable","DrawerActions","useNavigation","React","Image","Platform","StyleSheet","DrawerToggleButton","tintColor","rest","navigation","borderless","dispatch","toggleDrawer","styles","touchable","select","ios","undefined","default","top","right","bottom","left","icon","require","create","height","width","margin","resizeMode","marginHorizontal"],"mappings":";;AAAA,SAASA,iBAAT,QAAkC,4BAAlC;AACA,SACEC,aADF,EAGEC,aAHF,QAIO,0BAJP;AAKA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,KAAT,EAAgBC,QAAhB,EAA0BC,UAA1B,QAA4C,cAA5C;AAWA,eAAe,SAASC,kBAAT,OAA2D;AAAA,MAA/B;AAAEC,IAAAA,SAAF;AAAa,OAAGC;AAAhB,GAA+B;AACxE,QAAMC,UAAU,GAAGR,aAAa,EAAhC;AAEA,sBACE,oBAAC,iBAAD,eACMO,IADN;AAEE,IAAA,UAAU,MAFZ;AAGE,IAAA,iBAAiB,EAAC,QAHpB;AAIE,IAAA,cAAc,EAAE;AAAEE,MAAAA,UAAU,EAAE;AAAd,KAJlB;AAKE,IAAA,OAAO,EAAE,MAAMD,UAAU,CAACE,QAAX,CAAoBX,aAAa,CAACY,YAAd,EAApB,CALjB;AAME,IAAA,KAAK,EAAEC,MAAM,CAACC,SANhB;AAOE,IAAA,OAAO,EAAEV,QAAQ,CAACW,MAAT,CAAgB;AACvBC,MAAAA,GAAG,EAAEC,SADkB;AAEvBC,MAAAA,OAAO,EAAE;AAAEC,QAAAA,GAAG,EAAE,EAAP;AAAWC,QAAAA,KAAK,EAAE,EAAlB;AAAsBC,QAAAA,MAAM,EAAE,EAA9B;AAAkCC,QAAAA,IAAI,EAAE;AAAxC;AAFc,KAAhB;AAPX,mBAYE,oBAAC,KAAD;AACE,IAAA,KAAK,EAAE,CAACT,MAAM,CAACU,IAAR,EAAchB,SAAS,GAAG;AAAEA,MAAAA;AAAF,KAAH,GAAmB,IAA1C,CADT;AAEE,IAAA,MAAM,EAAEiB,OAAO,CAAC,iCAAD,CAFjB;AAGE,IAAA,YAAY,EAAE;AAHhB,IAZF,CADF;AAoBD;AAED,MAAMX,MAAM,GAAGR,UAAU,CAACoB,MAAX,CAAkB;AAC/BF,EAAAA,IAAI,EAAE;AACJG,IAAAA,MAAM,EAAE,EADJ;AAEJC,IAAAA,KAAK,EAAE,EAFH;AAGJC,IAAAA,MAAM,EAAE,CAHJ;AAIJC,IAAAA,UAAU,EAAE;AAJR,GADyB;AAO/Bf,EAAAA,SAAS,EAAE;AACTgB,IAAAA,gBAAgB,EAAE;AADT;AAPoB,CAAlB,CAAf","sourcesContent":["import { PlatformPressable } from '@react-navigation/elements';\nimport {\n DrawerActions,\n ParamListBase,\n useNavigation,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { Image, Platform, StyleSheet } from 'react-native';\n\nimport type { DrawerNavigationProp } from '../types';\n\ntype Props = {\n accessibilityLabel?: string;\n pressColor?: string;\n pressOpacity?: number;\n tintColor?: string;\n};\n\nexport default function DrawerToggleButton({ tintColor, ...rest }: Props) {\n const navigation = useNavigation<DrawerNavigationProp<ParamListBase>>();\n\n return (\n <PlatformPressable\n {...rest}\n accessible\n accessibilityRole=\"button\"\n android_ripple={{ borderless: true }}\n onPress={() => navigation.dispatch(DrawerActions.toggleDrawer())}\n style={styles.touchable}\n hitSlop={Platform.select({\n ios: undefined,\n default: { top: 16, right: 16, bottom: 16, left: 16 },\n })}\n >\n <Image\n style={[styles.icon, tintColor ? { tintColor } : null]}\n source={require('./assets/toggle-drawer-icon.png')}\n fadeDuration={0}\n />\n </PlatformPressable>\n );\n}\n\nconst styles = StyleSheet.create({\n icon: {\n height: 24,\n width: 24,\n margin: 3,\n resizeMode: 'contain',\n },\n touchable: {\n marginHorizontal: 11,\n },\n});\n"]}
|
|
@@ -14,10 +14,12 @@ import DrawerToggleButton from './DrawerToggleButton';
|
|
|
14
14
|
import { GestureHandlerRootView } from './GestureHandler';
|
|
15
15
|
import { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';
|
|
16
16
|
|
|
17
|
-
const getDefaultDrawerWidth =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const getDefaultDrawerWidth = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
height,
|
|
20
|
+
width
|
|
21
|
+
} = _ref;
|
|
22
|
+
|
|
21
23
|
/*
|
|
22
24
|
* Default drawer width is screen width - header height
|
|
23
25
|
* with a max width of 280 on mobile and 320 on tablet
|
|
@@ -33,23 +35,22 @@ const getDefaultDrawerWidth = ({
|
|
|
33
35
|
|
|
34
36
|
const GestureHandlerWrapper = GestureHandlerRootView !== null && GestureHandlerRootView !== void 0 ? GestureHandlerRootView : View;
|
|
35
37
|
|
|
36
|
-
function DrawerViewBase({
|
|
37
|
-
|
|
38
|
-
navigation,
|
|
39
|
-
descriptors,
|
|
40
|
-
defaultStatus,
|
|
41
|
-
drawerContent = props => /*#__PURE__*/React.createElement(DrawerContent, props),
|
|
42
|
-
detachInactiveScreens = Platform.OS === 'web' || Platform.OS === 'android' || Platform.OS === 'ios',
|
|
43
|
-
// Running in chrome debugger
|
|
44
|
-
// @ts-expect-error
|
|
45
|
-
useLegacyImplementation = !global.nativeCallSyncHook || // Reanimated 2 is not configured
|
|
46
|
-
// @ts-expect-error: the type definitions are incomplete
|
|
47
|
-
!(() => {
|
|
48
|
-
var _Animated$isConfigure;
|
|
38
|
+
function DrawerViewBase(_ref2) {
|
|
39
|
+
var _Animated$isConfigure;
|
|
49
40
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
let {
|
|
42
|
+
state,
|
|
43
|
+
navigation,
|
|
44
|
+
descriptors,
|
|
45
|
+
defaultStatus,
|
|
46
|
+
drawerContent = props => /*#__PURE__*/React.createElement(DrawerContent, props),
|
|
47
|
+
detachInactiveScreens = Platform.OS === 'web' || Platform.OS === 'android' || Platform.OS === 'ios',
|
|
48
|
+
// Running in chrome debugger
|
|
49
|
+
// @ts-expect-error
|
|
50
|
+
useLegacyImplementation = !global.nativeCallSyncHook || // Reanimated 2 is not configured
|
|
51
|
+
// @ts-expect-error: the type definitions are incomplete
|
|
52
|
+
!((_Animated$isConfigure = Animated.isConfigured) !== null && _Animated$isConfigure !== void 0 && _Animated$isConfigure.call(Animated))
|
|
53
|
+
} = _ref2;
|
|
53
54
|
const Drawer = useLegacyImplementation ? require('./legacy/Drawer').default : require('./modern/Drawer').default;
|
|
54
55
|
const focusedRouteKey = state.routes[state.index].key;
|
|
55
56
|
const {
|
|
@@ -170,12 +171,13 @@ function DrawerViewBase({
|
|
|
170
171
|
}
|
|
171
172
|
|
|
172
173
|
const {
|
|
173
|
-
header =
|
|
174
|
-
layout,
|
|
175
|
-
options
|
|
176
|
-
}) => {
|
|
174
|
+
header = _ref3 => {
|
|
177
175
|
var _options$headerLeft;
|
|
178
176
|
|
|
177
|
+
let {
|
|
178
|
+
layout,
|
|
179
|
+
options
|
|
180
|
+
} = _ref3;
|
|
179
181
|
return /*#__PURE__*/React.createElement(Header, _extends({}, options, {
|
|
180
182
|
layout: layout,
|
|
181
183
|
title: getHeaderTitle(options, route.name),
|
|
@@ -244,10 +246,11 @@ function DrawerViewBase({
|
|
|
244
246
|
}));
|
|
245
247
|
}
|
|
246
248
|
|
|
247
|
-
export default function DrawerView({
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
249
|
+
export default function DrawerView(_ref4) {
|
|
250
|
+
let {
|
|
251
|
+
navigation,
|
|
252
|
+
...rest
|
|
253
|
+
} = _ref4;
|
|
251
254
|
return /*#__PURE__*/React.createElement(SafeAreaProviderCompat, null, /*#__PURE__*/React.createElement(GestureHandlerWrapper, {
|
|
252
255
|
style: styles.content
|
|
253
256
|
}, /*#__PURE__*/React.createElement(DrawerViewBase, _extends({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DrawerView.tsx"],"names":["getHeaderTitle","Header","SafeAreaProviderCompat","Screen","DrawerActions","useTheme","React","BackHandler","I18nManager","Platform","StyleSheet","View","Animated","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","global","nativeCallSyncHook","isConfigured","Drawer","require","default","focusedRouteKey","routes","index","key","drawerHideStatusBarOnOpen","drawerPosition","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","Dr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reaProviderCompat,\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 Animated 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 // Running in chrome debugger\n // @ts-expect-error\n useLegacyImplementation = !global.nativeCallSyncHook ||\n // Reanimated 2 is not configured\n // @ts-expect-error: the type definitions are incomplete\n !Animated.isConfigured?.(),\n}: Props) {\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.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 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","Animated","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","global","nativeCallSyncHook","isConfigured","Drawer","require","default","focusedRouteKey","routes","index","key","drawerHideStatusBarOnOpen","drawerPosition","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,OAAOC,QAAP,MAAqB,yBAArB;AACA,SAASC,gBAAT,QAAiC,gCAAjC;AAWA,OAAOC,qBAAP,MAAkC,gCAAlC;AACA,OAAOC,mBAAP,MAAgC,8BAAhC;AACA,OAAOC,wBAAP,MAAqC,mCAArC;AACA,OAAOC,aAAP,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C4G;AAF/B,KADH,GAKG;AACEC,MAAAA,eAAe,EAAE9C,MAAM,CAAC2C,MAD1B;AAEEI,MAAAA,eAAe,EAAE9G,UAAU,CAAC4G;AAF9B,KANN,CALW,EAeX7D,WAfW,CAdf;AA+BE,IAAA,YAAY,EAAE;AAAEwD,MAAAA,eAAe,EAAElD;AAAnB,KA/BhB;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;AAAErF,IAAAA,UAAF;AAAc,OAAGsF;AAAjB,GAAgC;AACjE,sBACE,oBAAC,sBAAD,qBACE,oBAAC,qBAAD;AAAuB,IAAA,KAAK,EAAE3B,MAAM,CAACC;AAArC,kBACE,oBAAC,cAAD;AAAgB,IAAA,UAAU,EAAE5D;AAA5B,KAA4CsF,IAA5C,EADF,CADF,CADF;AAOD;AAED,MAAM3B,MAAM,GAAGrF,UAAU,CAACiH,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 Animated 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 // Running in chrome debugger\n // @ts-expect-error\n useLegacyImplementation = !global.nativeCallSyncHook ||\n // Reanimated 2 is not configured\n // @ts-expect-error: the type definitions are incomplete\n !Animated.isConfigured?.(),\n}: Props) {\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.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 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,9 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
const Dummy =
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const Dummy = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
children
|
|
7
|
+
} = _ref;
|
|
8
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
9
|
+
};
|
|
7
10
|
|
|
8
11
|
export const PanGestureHandler = Dummy;
|
|
9
12
|
export const TapGestureHandler = Dummy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["GestureHandler.tsx"],"names":["React","View","Dummy","children","PanGestureHandler","TapGestureHandler","GestureHandlerRootView","GestureState","UNDETERMINED","FAILED","BEGAN","CANCELLED","ACTIVE","END"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,QAAqB,cAArB;;AAMA,MAAMC,KAAU,GAAG,
|
|
1
|
+
{"version":3,"sources":["GestureHandler.tsx"],"names":["React","View","Dummy","children","PanGestureHandler","TapGestureHandler","GestureHandlerRootView","GestureState","UNDETERMINED","FAILED","BEGAN","CANCELLED","ACTIVE","END"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,QAAqB,cAArB;;AAMA,MAAMC,KAAU,GAAG;AAAA,MAAC;AAAEC,IAAAA;AAAF,GAAD;AAAA,sBACjB,0CAAGA,QAAH,CADiB;AAAA,CAAnB;;AAIA,OAAO,MAAMC,iBAAiB,GAC5BF,KADK;AAGP,OAAO,MAAMG,iBAAiB,GAC5BH,KADK;AAGP,OAAO,MAAMI,sBAAsB,GAAGL,IAA/B;AAEP,OAAO,MAAMM,YAAY,GAAG;AAC1BC,EAAAA,YAAY,EAAE,CADY;AAE1BC,EAAAA,MAAM,EAAE,CAFkB;AAG1BC,EAAAA,KAAK,EAAE,CAHmB;AAI1BC,EAAAA,SAAS,EAAE,CAJe;AAK1BC,EAAAA,MAAM,EAAE,CALkB;AAM1BC,EAAAA,GAAG,EAAE;AANqB,CAArB","sourcesContent":["import * as React from 'react';\nimport { View } from 'react-native';\nimport type {\n PanGestureHandlerProperties,\n TapGestureHandlerProperties,\n} from 'react-native-gesture-handler';\n\nconst Dummy: any = ({ children }: { children: React.ReactNode }) => (\n <>{children}</>\n);\n\nexport const PanGestureHandler =\n Dummy as React.ComponentType<PanGestureHandlerProperties>;\n\nexport const TapGestureHandler =\n Dummy as React.ComponentType<TapGestureHandlerProperties>;\n\nexport const GestureHandlerRootView = View;\n\nexport const GestureState = {\n UNDETERMINED: 0,\n FAILED: 1,\n BEGAN: 2,\n CANCELLED: 3,\n ACTIVE: 4,\n END: 5,\n};\n\nexport type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';\n"]}
|