@react-navigation/drawer 7.0.0-rc.9 → 7.0.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 +10 -10
- package/lib/commonjs/navigators/createDrawerNavigator.js +11 -11
- package/lib/commonjs/navigators/createDrawerNavigator.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/utils/useDrawerStatus.js +1 -1
- package/lib/commonjs/views/DrawerContent.js +12 -12
- package/lib/commonjs/views/DrawerContent.js.map +1 -1
- package/lib/commonjs/views/DrawerContentScrollView.js +7 -5
- package/lib/commonjs/views/DrawerContentScrollView.js.map +1 -1
- package/lib/commonjs/views/DrawerItem.js +45 -37
- package/lib/commonjs/views/DrawerItem.js.map +1 -1
- package/lib/commonjs/views/DrawerItemList.js +4 -4
- package/lib/commonjs/views/DrawerItemList.js.map +1 -1
- package/lib/commonjs/views/DrawerToggleButton.js +14 -13
- package/lib/commonjs/views/DrawerToggleButton.js.map +1 -1
- package/lib/commonjs/views/DrawerView.js +127 -113
- package/lib/commonjs/views/DrawerView.js.map +1 -1
- package/lib/commonjs/views/ScreenFallback.js +18 -11
- package/lib/commonjs/views/ScreenFallback.js.map +1 -1
- package/lib/module/index.js +12 -10
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createDrawerNavigator.js +13 -9
- package/lib/module/navigators/createDrawerNavigator.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/utils/DrawerPositionContext.js +2 -0
- package/lib/module/utils/DrawerPositionContext.js.map +1 -1
- package/lib/module/utils/DrawerStatusContext.js +2 -0
- package/lib/module/utils/DrawerStatusContext.js.map +1 -1
- package/lib/module/utils/addCancelListener.js +2 -0
- package/lib/module/utils/addCancelListener.js.map +1 -1
- package/lib/module/utils/addCancelListener.native.js +2 -0
- package/lib/module/utils/addCancelListener.native.js.map +1 -1
- package/lib/module/utils/getDrawerStatusFromState.js +2 -0
- package/lib/module/utils/getDrawerStatusFromState.js.map +1 -1
- package/lib/module/utils/useDrawerStatus.js +3 -1
- package/lib/module/utils/useDrawerStatus.js.map +1 -1
- package/lib/module/views/DrawerContent.js +14 -10
- package/lib/module/views/DrawerContent.js.map +1 -1
- package/lib/module/views/DrawerContentScrollView.js +9 -5
- package/lib/module/views/DrawerContentScrollView.js.map +1 -1
- package/lib/module/views/DrawerItem.js +47 -37
- package/lib/module/views/DrawerItem.js.map +1 -1
- package/lib/module/views/DrawerItemList.js +6 -4
- package/lib/module/views/DrawerItemList.js.map +1 -1
- package/lib/module/views/DrawerToggleButton.js +15 -11
- package/lib/module/views/DrawerToggleButton.js.map +1 -1
- package/lib/module/views/DrawerView.js +129 -113
- package/lib/module/views/DrawerView.js.map +1 -1
- package/lib/module/views/ScreenFallback.js +20 -11
- package/lib/module/views/ScreenFallback.js.map +1 -1
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/navigators/createDrawerNavigator.d.ts +3 -4
- package/lib/typescript/commonjs/src/navigators/createDrawerNavigator.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/types.d.ts +1 -1
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/DrawerPositionContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/DrawerStatusContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/addCancelListener.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/addCancelListener.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/getDrawerStatusFromState.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/useDrawerStatus.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/views/DrawerContent.d.ts +3 -0
- package/lib/typescript/commonjs/src/views/DrawerContent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/views/DrawerContentScrollView.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/views/DrawerItem.d.ts +1 -1
- package/lib/typescript/commonjs/src/views/DrawerItem.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/views/DrawerItemList.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/views/DrawerToggleButton.d.ts +1 -2
- package/lib/typescript/commonjs/src/views/DrawerToggleButton.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/views/DrawerView.d.ts +1 -2
- package/lib/typescript/commonjs/src/views/DrawerView.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/views/ScreenFallback.d.ts +2 -2
- package/lib/typescript/commonjs/src/views/ScreenFallback.d.ts.map +1 -0
- package/lib/typescript/commonjs/tsconfig.build.tsbuildinfo +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/index.d.ts +25 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/navigators/createDrawerNavigator.d.ts +17 -0
- package/lib/typescript/module/src/navigators/createDrawerNavigator.d.ts.map +1 -0
- package/lib/typescript/module/src/types.d.ts +279 -0
- package/lib/typescript/module/src/types.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/DrawerPositionContext.d.ts +3 -0
- package/lib/typescript/module/src/utils/DrawerPositionContext.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/DrawerStatusContext.d.ts +4 -0
- package/lib/typescript/module/src/utils/DrawerStatusContext.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/addCancelListener.d.ts +2 -0
- package/lib/typescript/module/src/utils/addCancelListener.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/addCancelListener.native.d.ts +2 -0
- package/lib/typescript/module/src/utils/addCancelListener.native.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/getDrawerStatusFromState.d.ts +3 -0
- package/lib/typescript/module/src/utils/getDrawerStatusFromState.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/useDrawerStatus.d.ts +7 -0
- package/lib/typescript/module/src/utils/useDrawerStatus.d.ts.map +1 -0
- package/lib/typescript/module/src/views/DrawerContent.d.ts +3 -0
- package/lib/typescript/module/src/views/DrawerContent.d.ts.map +1 -0
- package/lib/typescript/module/src/views/DrawerContentScrollView.d.ts +6 -0
- package/lib/typescript/module/src/views/DrawerContentScrollView.d.ts.map +1 -0
- package/lib/typescript/module/src/views/DrawerItem.d.ts +92 -0
- package/lib/typescript/module/src/views/DrawerItem.d.ts.map +1 -0
- package/lib/typescript/module/src/views/DrawerItemList.d.ts +14 -0
- package/lib/typescript/module/src/views/DrawerItemList.d.ts.map +1 -0
- package/lib/typescript/module/src/views/DrawerToggleButton.d.ts +9 -0
- package/lib/typescript/module/src/views/DrawerToggleButton.d.ts.map +1 -0
- package/lib/typescript/module/src/views/DrawerView.d.ts +11 -0
- package/lib/typescript/module/src/views/DrawerView.d.ts.map +1 -0
- package/lib/typescript/module/src/views/ScreenFallback.d.ts +17 -0
- package/lib/typescript/module/src/views/ScreenFallback.d.ts.map +1 -0
- package/lib/typescript/module/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +43 -19
- package/src/navigators/createDrawerNavigator.tsx +4 -5
- package/src/types.tsx +1 -1
- package/src/views/DrawerContent.tsx +0 -2
- package/src/views/DrawerItem.tsx +3 -0
- package/src/views/DrawerToggleButton.tsx +2 -2
- package/src/views/DrawerView.tsx +7 -5
- package/lib/commonjs/views/assets/toggle-drawer-icon@1.5x.android.png +0 -0
- package/lib/commonjs/views/assets/toggle-drawer-icon@1.5x.ios.png +0 -0
- package/lib/module/views/assets/toggle-drawer-icon@1.5x.android.png +0 -0
- package/lib/module/views/assets/toggle-drawer-icon@1.5x.ios.png +0 -0
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/navigators/createDrawerNavigator.d.ts.map +0 -1
- package/lib/typescript/src/types.d.ts.map +0 -1
- package/lib/typescript/src/utils/DrawerPositionContext.d.ts.map +0 -1
- package/lib/typescript/src/utils/DrawerStatusContext.d.ts.map +0 -1
- package/lib/typescript/src/utils/addCancelListener.d.ts.map +0 -1
- package/lib/typescript/src/utils/addCancelListener.native.d.ts.map +0 -1
- package/lib/typescript/src/utils/getDrawerStatusFromState.d.ts.map +0 -1
- package/lib/typescript/src/utils/useDrawerStatus.d.ts.map +0 -1
- package/lib/typescript/src/views/DrawerContent.d.ts +0 -4
- package/lib/typescript/src/views/DrawerContent.d.ts.map +0 -1
- package/lib/typescript/src/views/DrawerContentScrollView.d.ts.map +0 -1
- package/lib/typescript/src/views/DrawerItem.d.ts.map +0 -1
- package/lib/typescript/src/views/DrawerItemList.d.ts.map +0 -1
- package/lib/typescript/src/views/DrawerToggleButton.d.ts.map +0 -1
- package/lib/typescript/src/views/DrawerView.d.ts.map +0 -1
- package/lib/typescript/src/views/ScreenFallback.d.ts.map +0 -1
- package/src/views/assets/toggle-drawer-icon@1.5x.android.png +0 -0
- package/src/views/assets/toggle-drawer-icon@1.5x.ios.png +0 -0
- /package/lib/typescript/{src → commonjs/src}/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/DrawerPositionContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/DrawerStatusContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/addCancelListener.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/addCancelListener.native.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/getDrawerStatusFromState.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/useDrawerStatus.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/views/DrawerContentScrollView.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/views/DrawerItemList.d.ts +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { DrawerContentScrollView } from
|
|
4
|
-
import { DrawerItemList } from
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { DrawerContentScrollView } from "./DrawerContentScrollView.js";
|
|
4
|
+
import { DrawerItemList } from "./DrawerItemList.js";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
6
|
export function DrawerContent({
|
|
6
7
|
descriptors,
|
|
7
8
|
state,
|
|
@@ -14,12 +15,15 @@ export function DrawerContent({
|
|
|
14
15
|
drawerContentStyle,
|
|
15
16
|
drawerContentContainerStyle
|
|
16
17
|
} = focusedOptions;
|
|
17
|
-
return /*#__PURE__*/
|
|
18
|
+
return /*#__PURE__*/_jsx(DrawerContentScrollView, {
|
|
19
|
+
...rest,
|
|
18
20
|
contentContainerStyle: drawerContentContainerStyle,
|
|
19
|
-
style: drawerContentStyle
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
style: drawerContentStyle,
|
|
22
|
+
children: /*#__PURE__*/_jsx(DrawerItemList, {
|
|
23
|
+
descriptors: descriptors,
|
|
24
|
+
state: state,
|
|
25
|
+
...rest
|
|
26
|
+
})
|
|
27
|
+
});
|
|
24
28
|
}
|
|
25
29
|
//# sourceMappingURL=DrawerContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["DrawerContentScrollView","DrawerItemList","jsx","_jsx","DrawerContent","descriptors","state","rest","focusedRoute","routes","index","focusedDescriptor","key","focusedOptions","options","drawerContentStyle","drawerContentContainerStyle","contentContainerStyle","style","children"],"sourceRoot":"../../../src","sources":["views/DrawerContent.tsx"],"mappings":";;AACA,SAASA,uBAAuB,QAAQ,8BAA2B;AACnE,SAASC,cAAc,QAAQ,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElD,OAAO,SAASC,aAAaA,CAAC;EAC5BC,WAAW;EACXC,KAAK;EACL,GAAGC;AACwB,CAAC,EAAE;EAC9B,MAAMC,YAAY,GAAGF,KAAK,CAACG,MAAM,CAACH,KAAK,CAACI,KAAK,CAAC;EAC9C,MAAMC,iBAAiB,GAAGN,WAAW,CAACG,YAAY,CAACI,GAAG,CAAC;EACvD,MAAMC,cAAc,GAAGF,iBAAiB,CAACG,OAAO;EAEhD,MAAM;IAAEC,kBAAkB;IAAEC;EAA4B,CAAC,GAAGH,cAAc;EAE1E,oBACEV,IAAA,CAACH,uBAAuB;IAAA,GAClBO,IAAI;IACRU,qBAAqB,EAAED,2BAA4B;IACnDE,KAAK,EAAEH,kBAAmB;IAAAI,QAAA,eAE1BhB,IAAA,CAACF,cAAc;MAACI,WAAW,EAAEA,WAAY;MAACC,KAAK,EAAEA,KAAM;MAAA,GAAKC;IAAI,CAAG;EAAC,CAC7C,CAAC;AAE9B","ignoreList":[]}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
2
3
|
import { useLocale } from '@react-navigation/native';
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
import { ScrollView, StyleSheet } from 'react-native';
|
|
5
6
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
|
-
import { DrawerPositionContext } from
|
|
7
|
+
import { DrawerPositionContext } from "../utils/DrawerPositionContext.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
9
|
const SPACING = 12;
|
|
8
10
|
function DrawerContentScrollViewInner({
|
|
9
11
|
contentContainerStyle,
|
|
@@ -17,7 +19,8 @@ function DrawerContentScrollViewInner({
|
|
|
17
19
|
direction
|
|
18
20
|
} = useLocale();
|
|
19
21
|
const isRight = direction === 'rtl' ? drawerPosition === 'left' : drawerPosition === 'right';
|
|
20
|
-
return /*#__PURE__*/
|
|
22
|
+
return /*#__PURE__*/_jsx(ScrollView, {
|
|
23
|
+
...rest,
|
|
21
24
|
ref: ref,
|
|
22
25
|
contentContainerStyle: [{
|
|
23
26
|
paddingTop: SPACING + insets.top,
|
|
@@ -25,8 +28,9 @@ function DrawerContentScrollViewInner({
|
|
|
25
28
|
paddingStart: SPACING + (!isRight ? insets.left : 0),
|
|
26
29
|
paddingEnd: SPACING + (isRight ? insets.right : 0)
|
|
27
30
|
}, contentContainerStyle],
|
|
28
|
-
style: [styles.container, style]
|
|
29
|
-
|
|
31
|
+
style: [styles.container, style],
|
|
32
|
+
children: children
|
|
33
|
+
});
|
|
30
34
|
}
|
|
31
35
|
export const DrawerContentScrollView = /*#__PURE__*/React.forwardRef(DrawerContentScrollViewInner);
|
|
32
36
|
const styles = StyleSheet.create({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useLocale","React","ScrollView","StyleSheet","useSafeAreaInsets","DrawerPositionContext","SPACING","DrawerContentScrollViewInner","contentContainerStyle","style","children","rest","ref","drawerPosition","useContext","insets","direction","isRight","
|
|
1
|
+
{"version":3,"names":["useLocale","React","ScrollView","StyleSheet","useSafeAreaInsets","DrawerPositionContext","jsx","_jsx","SPACING","DrawerContentScrollViewInner","contentContainerStyle","style","children","rest","ref","drawerPosition","useContext","insets","direction","isRight","paddingTop","top","paddingBottom","bottom","paddingStart","left","paddingEnd","right","styles","container","DrawerContentScrollView","forwardRef","create","flex"],"sourceRoot":"../../../src","sources":["views/DrawerContentScrollView.tsx"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,0BAA0B;AACpD,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,UAAU,EAAwBC,UAAU,QAAQ,cAAc;AAC3E,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,qBAAqB,QAAQ,mCAAgC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMvE,MAAMC,OAAO,GAAG,EAAE;AAElB,SAASC,4BAA4BA,CACnC;EAAEC,qBAAqB;EAAEC,KAAK;EAAEC,QAAQ;EAAE,GAAGC;AAAY,CAAC,EAC1DC,GAA2B,EAC3B;EACA,MAAMC,cAAc,GAAGd,KAAK,CAACe,UAAU,CAACX,qBAAqB,CAAC;EAC9D,MAAMY,MAAM,GAAGb,iBAAiB,CAAC,CAAC;EAClC,MAAM;IAAEc;EAAU,CAAC,GAAGlB,SAAS,CAAC,CAAC;EAEjC,MAAMmB,OAAO,GACXD,SAAS,KAAK,KAAK,GACfH,cAAc,KAAK,MAAM,GACzBA,cAAc,KAAK,OAAO;EAEhC,oBACER,IAAA,CAACL,UAAU;IAAA,GACLW,IAAI;IACRC,GAAG,EAAEA,GAAI;IACTJ,qBAAqB,EAAE,CACrB;MACEU,UAAU,EAAEZ,OAAO,GAAGS,MAAM,CAACI,GAAG;MAChCC,aAAa,EAAEd,OAAO,GAAGS,MAAM,CAACM,MAAM;MACtCC,YAAY,EAAEhB,OAAO,IAAI,CAACW,OAAO,GAAGF,MAAM,CAACQ,IAAI,GAAG,CAAC,CAAC;MACpDC,UAAU,EAAElB,OAAO,IAAIW,OAAO,GAAGF,MAAM,CAACU,KAAK,GAAG,CAAC;IACnD,CAAC,EACDjB,qBAAqB,CACrB;IACFC,KAAK,EAAE,CAACiB,MAAM,CAACC,SAAS,EAAElB,KAAK,CAAE;IAAAC,QAAA,EAEhCA;EAAQ,CACC,CAAC;AAEjB;AAEA,OAAO,MAAMkB,uBAAuB,gBAAG7B,KAAK,CAAC8B,UAAU,CACrDtB,4BACF,CAAC;AAED,MAAMmB,MAAM,GAAGzB,UAAU,CAAC6B,MAAM,CAAC;EAC/BH,SAAS,EAAE;IACTI,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
2
3
|
import { PlatformPressable, Text } from '@react-navigation/elements';
|
|
3
4
|
import { useTheme } from '@react-navigation/native';
|
|
4
5
|
import Color from 'color';
|
|
5
6
|
import * as React from 'react';
|
|
6
7
|
import { StyleSheet, View } from 'react-native';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
9
|
/**
|
|
8
10
|
* A component used to show an action item with an icon and a label in a navigation drawer.
|
|
9
11
|
*/
|
|
@@ -19,8 +21,11 @@ export function DrawerItem(props) {
|
|
|
19
21
|
labelStyle,
|
|
20
22
|
focused = false,
|
|
21
23
|
allowFontScaling,
|
|
24
|
+
// eslint-disable-next-line @eslint-react/no-unstable-default-props
|
|
22
25
|
activeTintColor = colors.primary,
|
|
26
|
+
// eslint-disable-next-line @eslint-react/no-unstable-default-props
|
|
23
27
|
inactiveTintColor = Color(colors.text).alpha(0.68).rgb().string(),
|
|
28
|
+
// eslint-disable-next-line @eslint-react/no-unstable-default-props
|
|
24
29
|
activeBackgroundColor = Color(activeTintColor).alpha(0.12).rgb().string(),
|
|
25
30
|
inactiveBackgroundColor = 'transparent',
|
|
26
31
|
style,
|
|
@@ -41,45 +46,50 @@ export function DrawerItem(props) {
|
|
|
41
46
|
focused,
|
|
42
47
|
color
|
|
43
48
|
}) : null;
|
|
44
|
-
return /*#__PURE__*/
|
|
45
|
-
collapsable: false
|
|
46
|
-
|
|
49
|
+
return /*#__PURE__*/_jsx(View, {
|
|
50
|
+
collapsable: false,
|
|
51
|
+
...rest,
|
|
47
52
|
style: [styles.container, {
|
|
48
53
|
borderRadius,
|
|
49
54
|
backgroundColor
|
|
50
|
-
}, style]
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
55
|
+
}, style],
|
|
56
|
+
children: /*#__PURE__*/_jsx(PlatformPressable, {
|
|
57
|
+
testID: testID,
|
|
58
|
+
onPress: onPress,
|
|
59
|
+
accessibilityLabel: accessibilityLabel,
|
|
60
|
+
accessibilityRole: "button",
|
|
61
|
+
accessibilityState: {
|
|
62
|
+
selected: focused
|
|
63
|
+
},
|
|
64
|
+
pressColor: pressColor,
|
|
65
|
+
pressOpacity: pressOpacity,
|
|
66
|
+
hoverEffect: {
|
|
67
|
+
color
|
|
68
|
+
},
|
|
69
|
+
href: href,
|
|
70
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
71
|
+
style: [styles.wrapper, {
|
|
72
|
+
borderRadius
|
|
73
|
+
}],
|
|
74
|
+
children: [iconNode, /*#__PURE__*/_jsx(View, {
|
|
75
|
+
style: [styles.label, {
|
|
76
|
+
marginStart: iconNode ? 12 : 0
|
|
77
|
+
}],
|
|
78
|
+
children: typeof label === 'string' ? /*#__PURE__*/_jsx(Text, {
|
|
79
|
+
numberOfLines: 1,
|
|
80
|
+
allowFontScaling: allowFontScaling,
|
|
81
|
+
style: [styles.labelText, {
|
|
82
|
+
color
|
|
83
|
+
}, fonts.medium, labelStyle],
|
|
84
|
+
children: label
|
|
85
|
+
}) : label({
|
|
86
|
+
color,
|
|
87
|
+
focused
|
|
88
|
+
})
|
|
89
|
+
})]
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
});
|
|
83
93
|
}
|
|
84
94
|
const styles = StyleSheet.create({
|
|
85
95
|
container: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PlatformPressable","Text","useTheme","Color","React","StyleSheet","View","DrawerItem","props","colors","fonts","href","icon","label","labelStyle","focused","allowFontScaling","activeTintColor","primary","inactiveTintColor","text","alpha","rgb","string","activeBackgroundColor","inactiveBackgroundColor","style","onPress","pressColor","pressOpacity","testID","accessibilityLabel","rest","borderRadius","flatten","color","backgroundColor","iconNode","size","
|
|
1
|
+
{"version":3,"names":["PlatformPressable","Text","useTheme","Color","React","StyleSheet","View","jsx","_jsx","jsxs","_jsxs","DrawerItem","props","colors","fonts","href","icon","label","labelStyle","focused","allowFontScaling","activeTintColor","primary","inactiveTintColor","text","alpha","rgb","string","activeBackgroundColor","inactiveBackgroundColor","style","onPress","pressColor","pressOpacity","testID","accessibilityLabel","rest","borderRadius","flatten","color","backgroundColor","iconNode","size","collapsable","styles","container","children","accessibilityRole","accessibilityState","selected","hoverEffect","wrapper","marginStart","numberOfLines","labelText","medium","create","overflow","flexDirection","alignItems","paddingVertical","paddingStart","paddingEnd","marginEnd","marginVertical","flex","lineHeight","textAlignVertical"],"sourceRoot":"../../../src","sources":["views/DrawerItem.tsx"],"mappings":";;AAAA,SAASA,iBAAiB,EAAEC,IAAI,QAAQ,4BAA4B;AACpE,SAAqBC,QAAQ,QAAQ,0BAA0B;AAC/D,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAEEC,UAAU,EAEVC,IAAI,QAEC,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAsFtB;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAACC,KAAY,EAAE;EACvC,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAGZ,QAAQ,CAAC,CAAC;EAEpC,MAAM;IACJa,IAAI;IACJC,IAAI;IACJC,KAAK;IACLC,UAAU;IACVC,OAAO,GAAG,KAAK;IACfC,gBAAgB;IAChB;IACAC,eAAe,GAAGR,MAAM,CAACS,OAAO;IAChC;IACAC,iBAAiB,GAAGpB,KAAK,CAACU,MAAM,CAACW,IAAI,CAAC,CAACC,KAAK,CAAC,IAAI,CAAC,CAACC,GAAG,CAAC,CAAC,CAACC,MAAM,CAAC,CAAC;IACjE;IACAC,qBAAqB,GAAGzB,KAAK,CAACkB,eAAe,CAAC,CAACI,KAAK,CAAC,IAAI,CAAC,CAACC,GAAG,CAAC,CAAC,CAACC,MAAM,CAAC,CAAC;IACzEE,uBAAuB,GAAG,aAAa;IACvCC,KAAK;IACLC,OAAO;IACPC,UAAU;IACVC,YAAY,GAAG,CAAC;IAChBC,MAAM;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;UAAAK,QAAA,EAC7D,OAAO7B,KAAK,KAAK,QAAQ,gBACxBT,IAAA,CAACP,IAAI;YACHoD,aAAa,EAAE,CAAE;YACjBjC,gBAAgB,EAAEA,gBAAiB;YACnCU,KAAK,EAAE,CAACc,MAAM,CAACU,SAAS,EAAE;cAAEf;YAAM,CAAC,EAAEzB,KAAK,CAACyC,MAAM,EAAErC,UAAU,CAAE;YAAA4B,QAAA,EAE9D7B;UAAK,CACF,CAAC,GAEPA,KAAK,CAAC;YAAEsB,KAAK;YAAEpB;UAAQ,CAAC;QACzB,CACG,CAAC;MAAA,CACH;IAAC,CACU;EAAC,CAChB,CAAC;AAEX;AAEA,MAAMyB,MAAM,GAAGvC,UAAU,CAACmD,MAAM,CAAC;EAC/BX,SAAS,EAAE;IACTY,QAAQ,EAAE;EACZ,CAAC;EACDN,OAAO,EAAE;IACPO,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,eAAe,EAAE,EAAE;IACnBC,YAAY,EAAE,EAAE;IAChBC,UAAU,EAAE;EACd,CAAC;EACD7C,KAAK,EAAE;IACL8C,SAAS,EAAE,EAAE;IACbC,cAAc,EAAE,CAAC;IACjBC,IAAI,EAAE;EACR,CAAC;EACDX,SAAS,EAAE;IACTY,UAAU,EAAE,EAAE;IACdC,iBAAiB,EAAE;EACrB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import { CommonActions, DrawerActions, useLinkBuilder } from '@react-navigation/native';
|
|
2
4
|
import * as React from 'react';
|
|
3
|
-
import { DrawerItem } from
|
|
5
|
+
import { DrawerItem } from "./DrawerItem.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
7
|
/**
|
|
5
8
|
* Component that renders the navigation list in the drawer.
|
|
6
9
|
*/
|
|
@@ -44,8 +47,7 @@ export function DrawerItemList({
|
|
|
44
47
|
drawerItemStyle,
|
|
45
48
|
drawerAllowFontScaling
|
|
46
49
|
} = descriptors[route.key].options;
|
|
47
|
-
return /*#__PURE__*/
|
|
48
|
-
key: route.key,
|
|
50
|
+
return /*#__PURE__*/_jsx(DrawerItem, {
|
|
49
51
|
route: route,
|
|
50
52
|
href: buildHref(route.name, route.params),
|
|
51
53
|
label: drawerLabel !== undefined ? drawerLabel : title !== undefined ? title : route.name,
|
|
@@ -59,7 +61,7 @@ export function DrawerItemList({
|
|
|
59
61
|
labelStyle: drawerLabelStyle,
|
|
60
62
|
style: drawerItemStyle,
|
|
61
63
|
onPress: onPress
|
|
62
|
-
});
|
|
64
|
+
}, route.key);
|
|
63
65
|
});
|
|
64
66
|
}
|
|
65
67
|
//# sourceMappingURL=DrawerItemList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CommonActions","DrawerActions","useLinkBuilder","React","DrawerItem","DrawerItemList","state","navigation","descriptors","buildHref","focusedRoute","routes","index","focusedDescriptor","key","focusedOptions","options","drawerActiveTintColor","drawerInactiveTintColor","drawerActiveBackgroundColor","drawerInactiveBackgroundColor","map","route","i","focused","onPress","event","emit","type","target","canPreventDefault","defaultPrevented","dispatch","closeDrawer","navigate","title","drawerLabel","drawerIcon","drawerLabelStyle","drawerItemStyle","drawerAllowFontScaling","
|
|
1
|
+
{"version":3,"names":["CommonActions","DrawerActions","useLinkBuilder","React","DrawerItem","jsx","_jsx","DrawerItemList","state","navigation","descriptors","buildHref","focusedRoute","routes","index","focusedDescriptor","key","focusedOptions","options","drawerActiveTintColor","drawerInactiveTintColor","drawerActiveBackgroundColor","drawerInactiveBackgroundColor","map","route","i","focused","onPress","event","emit","type","target","canPreventDefault","defaultPrevented","dispatch","closeDrawer","navigate","title","drawerLabel","drawerIcon","drawerLabelStyle","drawerItemStyle","drawerAllowFontScaling","href","name","params","label","undefined","icon","activeTintColor","inactiveTintColor","activeBackgroundColor","inactiveBackgroundColor","allowFontScaling","labelStyle","style"],"sourceRoot":"../../../src","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AC;IAED,MAAM;MACJqB,KAAK;MACLC,WAAW;MACXC,UAAU;MACVC,gBAAgB;MAChBC,eAAe;MACfC;IACF,CAAC,GAAGhC,WAAW,CAACc,KAAK,CAACR,GAAG,CAAC,CAACE,OAAO;IAElC,oBACEZ,IAAA,CAACF,UAAU;MAEToB,KAAK,EAAEA,KAAM;MACbmB,IAAI,EAAEhC,SAAS,CAACa,KAAK,CAACoB,IAAI,EAAEpB,KAAK,CAACqB,MAAM,CAAE;MAC1CC,KAAK,EACHR,WAAW,KAAKS,SAAS,GACrBT,WAAW,GACXD,KAAK,KAAKU,SAAS,GACjBV,KAAK,GACLb,KAAK,CAACoB,IACb;MACDI,IAAI,EAAET,UAAW;MACjBb,OAAO,EAAEA,OAAQ;MACjBuB,eAAe,EAAE9B,qBAAsB;MACvC+B,iBAAiB,EAAE9B,uBAAwB;MAC3C+B,qBAAqB,EAAE9B,2BAA4B;MACnD+B,uBAAuB,EAAE9B,6BAA8B;MACvD+B,gBAAgB,EAAEX,sBAAuB;MACzCY,UAAU,EAAEd,gBAAiB;MAC7Be,KAAK,EAAEd,eAAgB;MACvBd,OAAO,EAAEA;IAAQ,GAnBZH,KAAK,CAACR,GAoBZ,CAAC;EAEN,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
2
3
|
import { PlatformPressable } from '@react-navigation/elements';
|
|
3
4
|
import { DrawerActions, useNavigation } from '@react-navigation/native';
|
|
4
|
-
import * as React from 'react';
|
|
5
5
|
import { Image, Platform, StyleSheet } from 'react-native';
|
|
6
|
+
import toggleDrawerIcon from './assets/toggle-drawer-icon.png';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
8
|
export function DrawerToggleButton({
|
|
7
9
|
tintColor,
|
|
8
10
|
...rest
|
|
9
11
|
}) {
|
|
10
12
|
const navigation = useNavigation();
|
|
11
|
-
return /*#__PURE__*/
|
|
13
|
+
return /*#__PURE__*/_jsx(PlatformPressable, {
|
|
14
|
+
...rest,
|
|
12
15
|
android_ripple: {
|
|
13
16
|
borderless: true
|
|
14
17
|
},
|
|
@@ -22,15 +25,16 @@ export function DrawerToggleButton({
|
|
|
22
25
|
bottom: 16,
|
|
23
26
|
left: 16
|
|
24
27
|
}
|
|
28
|
+
}),
|
|
29
|
+
children: /*#__PURE__*/_jsx(Image, {
|
|
30
|
+
style: [styles.icon, tintColor ? {
|
|
31
|
+
tintColor
|
|
32
|
+
} : null],
|
|
33
|
+
resizeMode: "contain",
|
|
34
|
+
source: toggleDrawerIcon,
|
|
35
|
+
fadeDuration: 0
|
|
25
36
|
})
|
|
26
|
-
})
|
|
27
|
-
style: [styles.icon, tintColor ? {
|
|
28
|
-
tintColor
|
|
29
|
-
} : null],
|
|
30
|
-
resizeMode: "contain",
|
|
31
|
-
source: require('./assets/toggle-drawer-icon.png'),
|
|
32
|
-
fadeDuration: 0
|
|
33
|
-
}));
|
|
37
|
+
});
|
|
34
38
|
}
|
|
35
39
|
const styles = StyleSheet.create({
|
|
36
40
|
icon: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PlatformPressable","DrawerActions","useNavigation","
|
|
1
|
+
{"version":3,"names":["PlatformPressable","DrawerActions","useNavigation","Image","Platform","StyleSheet","toggleDrawerIcon","jsx","_jsx","DrawerToggleButton","tintColor","rest","navigation","android_ripple","borderless","onPress","dispatch","toggleDrawer","style","styles","touchable","hitSlop","select","ios","undefined","default","top","right","bottom","left","children","icon","resizeMode","source","fadeDuration","create","height","width","marginVertical","marginHorizontal","borderRadius"],"sourceRoot":"../../../src","sources":["views/DrawerToggleButton.tsx"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,4BAA4B;AAC9D,SACEC,aAAa,EAEbC,aAAa,QACR,0BAA0B;AACjC,SAASC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAG1D,OAAOC,gBAAgB,MAAM,i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, Header, SafeAreaProviderCompat, Screen } from '@react-navigation/elements';
|
|
3
4
|
import { DrawerActions, StackActions, useLocale, useTheme } from '@react-navigation/native';
|
|
4
5
|
import * as React from 'react';
|
|
@@ -7,19 +8,23 @@ import { Drawer } from 'react-native-drawer-layout';
|
|
|
7
8
|
import { useSafeAreaFrame } from 'react-native-safe-area-context';
|
|
8
9
|
import useLatestCallback from 'use-latest-callback';
|
|
9
10
|
import { addCancelListener } from '../utils/addCancelListener';
|
|
10
|
-
import { DrawerPositionContext } from
|
|
11
|
-
import { DrawerStatusContext } from
|
|
12
|
-
import { getDrawerStatusFromState } from
|
|
13
|
-
import { DrawerContent } from
|
|
14
|
-
import { DrawerToggleButton } from
|
|
15
|
-
import { MaybeScreen, MaybeScreenContainer } from
|
|
11
|
+
import { DrawerPositionContext } from "../utils/DrawerPositionContext.js";
|
|
12
|
+
import { DrawerStatusContext } from "../utils/DrawerStatusContext.js";
|
|
13
|
+
import { getDrawerStatusFromState } from "../utils/getDrawerStatusFromState.js";
|
|
14
|
+
import { DrawerContent } from "./DrawerContent.js";
|
|
15
|
+
import { DrawerToggleButton } from "./DrawerToggleButton.js";
|
|
16
|
+
import { MaybeScreen, MaybeScreenContainer } from "./ScreenFallback.js";
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
18
|
const DRAWER_BORDER_RADIUS = 16;
|
|
19
|
+
const renderDrawerContentDefault = props => /*#__PURE__*/_jsx(DrawerContent, {
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
17
22
|
function DrawerViewBase({
|
|
18
23
|
state,
|
|
19
24
|
navigation,
|
|
20
25
|
descriptors,
|
|
21
26
|
defaultStatus,
|
|
22
|
-
drawerContent =
|
|
27
|
+
drawerContent = renderDrawerContentDefault,
|
|
23
28
|
detachInactiveScreens = Platform.OS === 'web' || Platform.OS === 'android' || Platform.OS === 'ios'
|
|
24
29
|
}) {
|
|
25
30
|
const {
|
|
@@ -138,121 +143,132 @@ function DrawerViewBase({
|
|
|
138
143
|
return addCancelListener(handleHardwareBack);
|
|
139
144
|
}, [defaultStatus, drawerStatus, drawerType, handleDrawerClose, handleDrawerOpen, navigation]);
|
|
140
145
|
const renderDrawerContent = () => {
|
|
141
|
-
return /*#__PURE__*/
|
|
142
|
-
value: drawerPosition
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
return /*#__PURE__*/_jsx(DrawerPositionContext.Provider, {
|
|
147
|
+
value: drawerPosition,
|
|
148
|
+
children: drawerContent({
|
|
149
|
+
state: state,
|
|
150
|
+
navigation: navigation,
|
|
151
|
+
descriptors: descriptors
|
|
152
|
+
})
|
|
153
|
+
});
|
|
148
154
|
};
|
|
149
155
|
const renderSceneContent = () => {
|
|
150
|
-
return /*#__PURE__*/
|
|
156
|
+
return /*#__PURE__*/_jsx(MaybeScreenContainer, {
|
|
151
157
|
enabled: detachInactiveScreens,
|
|
152
158
|
hasTwoStates: true,
|
|
153
|
-
style: styles.content
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
159
|
+
style: styles.content,
|
|
160
|
+
children: state.routes.map((route, index) => {
|
|
161
|
+
const descriptor = descriptors[route.key];
|
|
162
|
+
const {
|
|
163
|
+
lazy = true
|
|
164
|
+
} = descriptor.options;
|
|
165
|
+
const isFocused = state.index === index;
|
|
166
|
+
if (lazy && !loaded.includes(route.key) && !isFocused && !state.preloadedRouteKeys.includes(route.key)) {
|
|
167
|
+
// Don't render a lazy screen if we've never navigated to it or it wasn't preloaded
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
const {
|
|
171
|
+
freezeOnBlur,
|
|
172
|
+
header = ({
|
|
173
|
+
layout,
|
|
174
|
+
options
|
|
175
|
+
}) => /*#__PURE__*/_jsx(Header, {
|
|
176
|
+
...options,
|
|
177
|
+
layout: layout,
|
|
178
|
+
title: getHeaderTitle(options, route.name),
|
|
179
|
+
headerLeft: options.headerLeft ?? (props => /*#__PURE__*/_jsx(DrawerToggleButton, {
|
|
180
|
+
...props
|
|
181
|
+
}))
|
|
182
|
+
}),
|
|
183
|
+
headerShown,
|
|
184
|
+
headerStatusBarHeight,
|
|
185
|
+
headerTransparent,
|
|
186
|
+
sceneStyle
|
|
187
|
+
} = descriptor.options;
|
|
188
|
+
return /*#__PURE__*/_jsx(MaybeScreen, {
|
|
189
|
+
style: [StyleSheet.absoluteFill, {
|
|
190
|
+
zIndex: isFocused ? 0 : -1
|
|
191
|
+
}],
|
|
192
|
+
visible: isFocused,
|
|
193
|
+
enabled: detachInactiveScreens,
|
|
194
|
+
freezeOnBlur: freezeOnBlur,
|
|
195
|
+
children: /*#__PURE__*/_jsx(Screen, {
|
|
196
|
+
focused: isFocused,
|
|
197
|
+
route: descriptor.route,
|
|
198
|
+
navigation: descriptor.navigation,
|
|
199
|
+
headerShown: headerShown,
|
|
200
|
+
headerStatusBarHeight: headerStatusBarHeight,
|
|
201
|
+
headerTransparent: headerTransparent,
|
|
202
|
+
header: header({
|
|
203
|
+
layout: dimensions,
|
|
204
|
+
route: descriptor.route,
|
|
205
|
+
navigation: descriptor.navigation,
|
|
206
|
+
options: descriptor.options
|
|
207
|
+
}),
|
|
208
|
+
style: sceneStyle,
|
|
209
|
+
children: descriptor.render()
|
|
210
|
+
})
|
|
211
|
+
}, route.key);
|
|
212
|
+
})
|
|
213
|
+
});
|
|
203
214
|
};
|
|
204
|
-
return /*#__PURE__*/
|
|
205
|
-
value: drawerStatus
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
215
|
+
return /*#__PURE__*/_jsx(DrawerStatusContext.Provider, {
|
|
216
|
+
value: drawerStatus,
|
|
217
|
+
children: /*#__PURE__*/_jsx(Drawer, {
|
|
218
|
+
open: drawerStatus !== 'closed',
|
|
219
|
+
onOpen: handleDrawerOpen,
|
|
220
|
+
onClose: handleDrawerClose,
|
|
221
|
+
onGestureStart: handleGestureStart,
|
|
222
|
+
onGestureEnd: handleGestureEnd,
|
|
223
|
+
onGestureCancel: handleGestureCancel,
|
|
224
|
+
onTransitionStart: handleTransitionStart,
|
|
225
|
+
onTransitionEnd: handleTransitionEnd,
|
|
226
|
+
layout: dimensions,
|
|
227
|
+
direction: direction,
|
|
228
|
+
configureGestureHandler: configureGestureHandler,
|
|
229
|
+
swipeEnabled: swipeEnabled,
|
|
230
|
+
swipeEdgeWidth: swipeEdgeWidth,
|
|
231
|
+
swipeMinDistance: swipeMinDistance,
|
|
232
|
+
hideStatusBarOnOpen: drawerHideStatusBarOnOpen,
|
|
233
|
+
statusBarAnimation: drawerStatusBarAnimation,
|
|
234
|
+
keyboardDismissMode: keyboardDismissMode,
|
|
235
|
+
drawerType: drawerType,
|
|
236
|
+
overlayAccessibilityLabel: overlayAccessibilityLabel,
|
|
237
|
+
drawerPosition: drawerPosition,
|
|
238
|
+
drawerStyle: [{
|
|
239
|
+
backgroundColor: colors.card,
|
|
240
|
+
width: getDefaultSidebarWidth(dimensions)
|
|
241
|
+
}, drawerType === 'permanent' && ((Platform.OS === 'web' ? drawerPosition === 'right' : direction === 'rtl' && drawerPosition !== 'right' || direction !== 'rtl' && drawerPosition === 'right') ? {
|
|
242
|
+
borderLeftColor: colors.border,
|
|
243
|
+
borderLeftWidth: StyleSheet.hairlineWidth
|
|
244
|
+
} : {
|
|
245
|
+
borderRightColor: colors.border,
|
|
246
|
+
borderRightWidth: StyleSheet.hairlineWidth
|
|
247
|
+
}), drawerType === 'front' && (drawerPosition === 'left' ? {
|
|
248
|
+
borderTopRightRadius: DRAWER_BORDER_RADIUS,
|
|
249
|
+
borderBottomRightRadius: DRAWER_BORDER_RADIUS
|
|
250
|
+
} : {
|
|
251
|
+
borderTopLeftRadius: DRAWER_BORDER_RADIUS,
|
|
252
|
+
borderBottomLeftRadius: DRAWER_BORDER_RADIUS
|
|
253
|
+
}), drawerStyle],
|
|
254
|
+
overlayStyle: {
|
|
255
|
+
backgroundColor: overlayColor
|
|
256
|
+
},
|
|
257
|
+
renderDrawerContent: renderDrawerContent,
|
|
258
|
+
children: renderSceneContent()
|
|
259
|
+
})
|
|
260
|
+
});
|
|
248
261
|
}
|
|
249
262
|
export function DrawerView({
|
|
250
263
|
navigation,
|
|
251
264
|
...rest
|
|
252
265
|
}) {
|
|
253
|
-
return /*#__PURE__*/
|
|
254
|
-
|
|
255
|
-
|
|
266
|
+
return /*#__PURE__*/_jsx(SafeAreaProviderCompat, {
|
|
267
|
+
children: /*#__PURE__*/_jsx(DrawerViewBase, {
|
|
268
|
+
navigation: navigation,
|
|
269
|
+
...rest
|
|
270
|
+
})
|
|
271
|
+
});
|
|
256
272
|
}
|
|
257
273
|
const styles = StyleSheet.create({
|
|
258
274
|
content: {
|