@react-navigation/drawer 6.1.5
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/LICENSE +21 -0
- package/README.md +5 -0
- package/lib/commonjs/index.js +104 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/navigators/createDrawerNavigator.js +95 -0
- package/lib/commonjs/navigators/createDrawerNavigator.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils/DrawerGestureContext.js +17 -0
- package/lib/commonjs/utils/DrawerGestureContext.js.map +1 -0
- package/lib/commonjs/utils/DrawerPositionContext.js +17 -0
- package/lib/commonjs/utils/DrawerPositionContext.js.map +1 -0
- package/lib/commonjs/utils/DrawerProgressContext.js +17 -0
- package/lib/commonjs/utils/DrawerProgressContext.js.map +1 -0
- package/lib/commonjs/utils/DrawerStatusContext.js +17 -0
- package/lib/commonjs/utils/DrawerStatusContext.js.map +1 -0
- package/lib/commonjs/utils/getDrawerStatusFromState.js +18 -0
- package/lib/commonjs/utils/getDrawerStatusFromState.js.map +1 -0
- package/lib/commonjs/utils/useDrawerProgress.js +27 -0
- package/lib/commonjs/utils/useDrawerProgress.js.map +1 -0
- package/lib/commonjs/utils/useDrawerStatus.js +31 -0
- package/lib/commonjs/utils/useDrawerStatus.js.map +1 -0
- package/lib/commonjs/views/DrawerContent.js +42 -0
- package/lib/commonjs/views/DrawerContent.js.map +1 -0
- package/lib/commonjs/views/DrawerContentScrollView.js +53 -0
- package/lib/commonjs/views/DrawerContentScrollView.js.map +1 -0
- package/lib/commonjs/views/DrawerItem.js +152 -0
- package/lib/commonjs/views/DrawerItem.js.map +1 -0
- package/lib/commonjs/views/DrawerItemList.js +70 -0
- package/lib/commonjs/views/DrawerItemList.js.map +1 -0
- package/lib/commonjs/views/DrawerToggleButton.js +64 -0
- package/lib/commonjs/views/DrawerToggleButton.js.map +1 -0
- package/lib/commonjs/views/DrawerView.js +282 -0
- package/lib/commonjs/views/DrawerView.js.map +1 -0
- package/lib/commonjs/views/GestureHandler.android.js +19 -0
- package/lib/commonjs/views/GestureHandler.android.js.map +1 -0
- package/lib/commonjs/views/GestureHandler.ios.js +19 -0
- package/lib/commonjs/views/GestureHandler.ios.js.map +1 -0
- package/lib/commonjs/views/GestureHandler.js +35 -0
- package/lib/commonjs/views/GestureHandler.js.map +1 -0
- package/lib/commonjs/views/GestureHandlerNative.js +50 -0
- package/lib/commonjs/views/GestureHandlerNative.js.map +1 -0
- package/lib/commonjs/views/ScreenFallback.js +62 -0
- package/lib/commonjs/views/ScreenFallback.js.map +1 -0
- package/lib/commonjs/views/assets/toggle-drawer-icon.png +0 -0
- 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/commonjs/views/assets/toggle-drawer-icon@1x.android.png +0 -0
- package/lib/commonjs/views/assets/toggle-drawer-icon@1x.ios.png +0 -0
- package/lib/commonjs/views/assets/toggle-drawer-icon@2x.android.png +0 -0
- package/lib/commonjs/views/assets/toggle-drawer-icon@2x.ios.png +0 -0
- package/lib/commonjs/views/assets/toggle-drawer-icon@3x.android.png +0 -0
- package/lib/commonjs/views/assets/toggle-drawer-icon@3x.ios.png +0 -0
- package/lib/commonjs/views/assets/toggle-drawer-icon@4x.android.png +0 -0
- package/lib/commonjs/views/assets/toggle-drawer-icon@4x.ios.png +0 -0
- package/lib/commonjs/views/legacy/Drawer.js +455 -0
- package/lib/commonjs/views/legacy/Drawer.js.map +1 -0
- package/lib/commonjs/views/legacy/Overlay.js +79 -0
- package/lib/commonjs/views/legacy/Overlay.js.map +1 -0
- package/lib/commonjs/views/modern/Drawer.js +293 -0
- package/lib/commonjs/views/modern/Drawer.js.map +1 -0
- package/lib/commonjs/views/modern/Overlay.js +65 -0
- package/lib/commonjs/views/modern/Overlay.js.map +1 -0
- package/lib/module/index.js +27 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/navigators/createDrawerNavigator.js +77 -0
- package/lib/module/navigators/createDrawerNavigator.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/DrawerGestureContext.js +3 -0
- package/lib/module/utils/DrawerGestureContext.js.map +1 -0
- package/lib/module/utils/DrawerPositionContext.js +3 -0
- package/lib/module/utils/DrawerPositionContext.js.map +1 -0
- package/lib/module/utils/DrawerProgressContext.js +3 -0
- package/lib/module/utils/DrawerProgressContext.js.map +1 -0
- package/lib/module/utils/DrawerStatusContext.js +4 -0
- package/lib/module/utils/DrawerStatusContext.js.map +1 -0
- package/lib/module/utils/getDrawerStatusFromState.js +11 -0
- package/lib/module/utils/getDrawerStatusFromState.js.map +1 -0
- package/lib/module/utils/useDrawerProgress.js +12 -0
- package/lib/module/utils/useDrawerProgress.js.map +1 -0
- package/lib/module/utils/useDrawerStatus.js +17 -0
- package/lib/module/utils/useDrawerStatus.js.map +1 -0
- package/lib/module/views/DrawerContent.js +26 -0
- package/lib/module/views/DrawerContent.js.map +1 -0
- package/lib/module/views/DrawerContentScrollView.js +34 -0
- package/lib/module/views/DrawerContentScrollView.js.map +1 -0
- package/lib/module/views/DrawerItem.js +132 -0
- package/lib/module/views/DrawerItem.js.map +1 -0
- package/lib/module/views/DrawerItemList.js +55 -0
- package/lib/module/views/DrawerItemList.js.map +1 -0
- package/lib/module/views/DrawerToggleButton.js +48 -0
- package/lib/module/views/DrawerToggleButton.js.map +1 -0
- package/lib/module/views/DrawerView.js +256 -0
- package/lib/module/views/DrawerView.js.map +1 -0
- package/lib/module/views/GestureHandler.android.js +2 -0
- package/lib/module/views/GestureHandler.android.js.map +1 -0
- package/lib/module/views/GestureHandler.ios.js +2 -0
- package/lib/module/views/GestureHandler.ios.js.map +1 -0
- package/lib/module/views/GestureHandler.js +19 -0
- package/lib/module/views/GestureHandler.js.map +1 -0
- package/lib/module/views/GestureHandlerNative.js +11 -0
- package/lib/module/views/GestureHandlerNative.js.map +1 -0
- package/lib/module/views/ScreenFallback.js +44 -0
- package/lib/module/views/ScreenFallback.js.map +1 -0
- package/lib/module/views/assets/toggle-drawer-icon.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/module/views/assets/toggle-drawer-icon@1x.android.png +0 -0
- package/lib/module/views/assets/toggle-drawer-icon@1x.ios.png +0 -0
- package/lib/module/views/assets/toggle-drawer-icon@2x.android.png +0 -0
- package/lib/module/views/assets/toggle-drawer-icon@2x.ios.png +0 -0
- package/lib/module/views/assets/toggle-drawer-icon@3x.android.png +0 -0
- package/lib/module/views/assets/toggle-drawer-icon@3x.ios.png +0 -0
- package/lib/module/views/assets/toggle-drawer-icon@4x.android.png +0 -0
- package/lib/module/views/assets/toggle-drawer-icon@4x.ios.png +0 -0
- package/lib/module/views/legacy/Drawer.js +430 -0
- package/lib/module/views/legacy/Drawer.js.map +1 -0
- package/lib/module/views/legacy/Overlay.js +59 -0
- package/lib/module/views/legacy/Overlay.js.map +1 -0
- package/lib/module/views/modern/Drawer.js +272 -0
- package/lib/module/views/modern/Drawer.js.map +1 -0
- package/lib/module/views/modern/Overlay.js +47 -0
- package/lib/module/views/modern/Overlay.js.map +1 -0
- package/lib/typescript/src/index.d.ts +25 -0
- package/lib/typescript/src/navigators/createDrawerNavigator.d.ts +7 -0
- package/lib/typescript/src/types.d.ts +235 -0
- package/lib/typescript/src/utils/DrawerGestureContext.d.ts +3 -0
- package/lib/typescript/src/utils/DrawerPositionContext.d.ts +3 -0
- package/lib/typescript/src/utils/DrawerProgressContext.d.ts +4 -0
- package/lib/typescript/src/utils/DrawerStatusContext.d.ts +3 -0
- package/lib/typescript/src/utils/getDrawerStatusFromState.d.ts +2 -0
- package/lib/typescript/src/utils/useDrawerProgress.d.ts +2 -0
- package/lib/typescript/src/utils/useDrawerStatus.d.ts +5 -0
- package/lib/typescript/src/views/DrawerContent.d.ts +3 -0
- package/lib/typescript/src/views/DrawerContentScrollView.d.ts +6 -0
- package/lib/typescript/src/views/DrawerItem.d.ts +74 -0
- package/lib/typescript/src/views/DrawerItemList.d.ts +13 -0
- package/lib/typescript/src/views/DrawerToggleButton.d.ts +9 -0
- package/lib/typescript/src/views/DrawerView.d.ts +10 -0
- package/lib/typescript/src/views/GestureHandler.android.d.ts +1 -0
- package/lib/typescript/src/views/GestureHandler.d.ts +14 -0
- package/lib/typescript/src/views/GestureHandler.ios.d.ts +1 -0
- package/lib/typescript/src/views/GestureHandlerNative.d.ts +4 -0
- package/lib/typescript/src/views/ScreenFallback.d.ts +14 -0
- package/lib/typescript/src/views/legacy/Drawer.d.ts +44 -0
- package/lib/typescript/src/views/legacy/Overlay.d.ts +68 -0
- package/lib/typescript/src/views/modern/Drawer.d.ts +3 -0
- package/lib/typescript/src/views/modern/Overlay.d.ts +68 -0
- package/package.json +87 -0
- package/src/index.tsx +34 -0
- package/src/navigators/createDrawerNavigator.tsx +134 -0
- package/src/types.tsx +300 -0
- package/src/utils/DrawerGestureContext.tsx +3 -0
- package/src/utils/DrawerPositionContext.tsx +3 -0
- package/src/utils/DrawerProgressContext.tsx +6 -0
- package/src/utils/DrawerStatusContext.tsx +6 -0
- package/src/utils/getDrawerStatusFromState.tsx +20 -0
- package/src/utils/useDrawerProgress.tsx +18 -0
- package/src/utils/useDrawerStatus.tsx +19 -0
- package/src/views/DrawerContent.tsx +27 -0
- package/src/views/DrawerContentScrollView.tsx +52 -0
- package/src/views/DrawerItem.tsx +227 -0
- package/src/views/DrawerItemList.tsx +80 -0
- package/src/views/DrawerToggleButton.tsx +54 -0
- package/src/views/DrawerView.tsx +313 -0
- package/src/views/GestureHandler.android.tsx +1 -0
- package/src/views/GestureHandler.ios.tsx +1 -0
- package/src/views/GestureHandler.tsx +29 -0
- package/src/views/GestureHandlerNative.tsx +24 -0
- package/src/views/ScreenFallback.tsx +48 -0
- package/src/views/assets/toggle-drawer-icon.png +0 -0
- 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/src/views/assets/toggle-drawer-icon@1x.android.png +0 -0
- package/src/views/assets/toggle-drawer-icon@1x.ios.png +0 -0
- package/src/views/assets/toggle-drawer-icon@2x.android.png +0 -0
- package/src/views/assets/toggle-drawer-icon@2x.ios.png +0 -0
- package/src/views/assets/toggle-drawer-icon@3x.android.png +0 -0
- package/src/views/assets/toggle-drawer-icon@3x.ios.png +0 -0
- package/src/views/assets/toggle-drawer-icon@4x.android.png +0 -0
- package/src/views/assets/toggle-drawer-icon@4x.ios.png +0 -0
- package/src/views/legacy/Drawer.tsx +659 -0
- package/src/views/legacy/Overlay.tsx +74 -0
- package/src/views/modern/Drawer.tsx +385 -0
- package/src/views/modern/Overlay.tsx +56 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = DrawerItem;
|
|
7
|
+
|
|
8
|
+
var _elements = require("@react-navigation/elements");
|
|
9
|
+
|
|
10
|
+
var _native = require("@react-navigation/native");
|
|
11
|
+
|
|
12
|
+
var _color = _interopRequireDefault(require("color"));
|
|
13
|
+
|
|
14
|
+
var React = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _reactNative = require("react-native");
|
|
17
|
+
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
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); }
|
|
25
|
+
|
|
26
|
+
const LinkPressable = ({
|
|
27
|
+
children,
|
|
28
|
+
style,
|
|
29
|
+
onPress,
|
|
30
|
+
onLongPress,
|
|
31
|
+
to,
|
|
32
|
+
accessibilityRole,
|
|
33
|
+
...rest
|
|
34
|
+
}) => {
|
|
35
|
+
if (_reactNative.Platform.OS === 'web' && to) {
|
|
36
|
+
// React Native Web doesn't forward `onClick` if we use `TouchableWithoutFeedback`.
|
|
37
|
+
// We need to use `onClick` to be able to prevent default browser handling of links.
|
|
38
|
+
return /*#__PURE__*/React.createElement(_native.Link, _extends({}, rest, {
|
|
39
|
+
to: to,
|
|
40
|
+
style: [styles.button, style],
|
|
41
|
+
onPress: e => {
|
|
42
|
+
if (!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && ( // ignore clicks with modifier keys
|
|
43
|
+
e.button == null || e.button === 0) // ignore everything but left clicks
|
|
44
|
+
) {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
onPress === null || onPress === void 0 ? void 0 : onPress(e);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
onLongPress: onLongPress !== null && onLongPress !== void 0 ? onLongPress : undefined
|
|
50
|
+
}), children);
|
|
51
|
+
} else {
|
|
52
|
+
return /*#__PURE__*/React.createElement(_elements.PlatformPressable, _extends({}, rest, {
|
|
53
|
+
accessibilityRole: accessibilityRole,
|
|
54
|
+
onPress: onPress
|
|
55
|
+
}), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
56
|
+
style: style
|
|
57
|
+
}, children));
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* A component used to show an action item with an icon and a label in a navigation drawer.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
function DrawerItem(props) {
|
|
66
|
+
const {
|
|
67
|
+
colors
|
|
68
|
+
} = (0, _native.useTheme)();
|
|
69
|
+
const {
|
|
70
|
+
icon,
|
|
71
|
+
label,
|
|
72
|
+
labelStyle,
|
|
73
|
+
to,
|
|
74
|
+
focused = false,
|
|
75
|
+
activeTintColor = colors.primary,
|
|
76
|
+
inactiveTintColor = (0, _color.default)(colors.text).alpha(0.68).rgb().string(),
|
|
77
|
+
activeBackgroundColor = (0, _color.default)(activeTintColor).alpha(0.12).rgb().string(),
|
|
78
|
+
inactiveBackgroundColor = 'transparent',
|
|
79
|
+
style,
|
|
80
|
+
onPress,
|
|
81
|
+
pressColor,
|
|
82
|
+
pressOpacity,
|
|
83
|
+
...rest
|
|
84
|
+
} = props;
|
|
85
|
+
|
|
86
|
+
const {
|
|
87
|
+
borderRadius = 4
|
|
88
|
+
} = _reactNative.StyleSheet.flatten(style || {});
|
|
89
|
+
|
|
90
|
+
const color = focused ? activeTintColor : inactiveTintColor;
|
|
91
|
+
const backgroundColor = focused ? activeBackgroundColor : inactiveBackgroundColor;
|
|
92
|
+
const iconNode = icon ? icon({
|
|
93
|
+
size: 24,
|
|
94
|
+
focused,
|
|
95
|
+
color
|
|
96
|
+
}) : null;
|
|
97
|
+
return /*#__PURE__*/React.createElement(_reactNative.View, _extends({
|
|
98
|
+
collapsable: false
|
|
99
|
+
}, rest, {
|
|
100
|
+
style: [styles.container, {
|
|
101
|
+
borderRadius,
|
|
102
|
+
backgroundColor
|
|
103
|
+
}, style]
|
|
104
|
+
}), /*#__PURE__*/React.createElement(LinkPressable, {
|
|
105
|
+
onPress: onPress,
|
|
106
|
+
style: [styles.wrapper, {
|
|
107
|
+
borderRadius
|
|
108
|
+
}],
|
|
109
|
+
accessibilityRole: "button",
|
|
110
|
+
accessibilityState: {
|
|
111
|
+
selected: focused
|
|
112
|
+
},
|
|
113
|
+
pressColor: pressColor,
|
|
114
|
+
pressOpacity: pressOpacity,
|
|
115
|
+
to: to
|
|
116
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, iconNode, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
117
|
+
style: [styles.label, {
|
|
118
|
+
marginLeft: iconNode ? 32 : 0,
|
|
119
|
+
marginVertical: 5
|
|
120
|
+
}]
|
|
121
|
+
}, typeof label === 'string' ? /*#__PURE__*/React.createElement(_reactNative.Text, {
|
|
122
|
+
numberOfLines: 1,
|
|
123
|
+
style: [{
|
|
124
|
+
color,
|
|
125
|
+
fontWeight: '500'
|
|
126
|
+
}, labelStyle]
|
|
127
|
+
}, label) : label({
|
|
128
|
+
color,
|
|
129
|
+
focused
|
|
130
|
+
})))));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const styles = _reactNative.StyleSheet.create({
|
|
134
|
+
container: {
|
|
135
|
+
marginHorizontal: 10,
|
|
136
|
+
marginVertical: 4,
|
|
137
|
+
overflow: 'hidden'
|
|
138
|
+
},
|
|
139
|
+
wrapper: {
|
|
140
|
+
flexDirection: 'row',
|
|
141
|
+
alignItems: 'center',
|
|
142
|
+
padding: 8
|
|
143
|
+
},
|
|
144
|
+
label: {
|
|
145
|
+
marginRight: 32,
|
|
146
|
+
flex: 1
|
|
147
|
+
},
|
|
148
|
+
button: {
|
|
149
|
+
display: 'flex'
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
//# sourceMappingURL=DrawerItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["DrawerItem.tsx"],"names":["LinkPressable","children","style","onPress","onLongPress","to","accessibilityRole","rest","Platform","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","StyleSheet","flatten","color","backgroundColor","iconNode","size","container","wrapper","selected","marginLeft","marginVertical","fontWeight","create","marginHorizontal","overflow","flexDirection","alignItems","padding","marginRight","flex","display"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AA6EA,MAAMA,aAAa,GAAG,CAAC;AACrBC,EAAAA,QADqB;AAErBC,EAAAA,KAFqB;AAGrBC,EAAAA,OAHqB;AAIrBC,EAAAA,WAJqB;AAKrBC,EAAAA,EALqB;AAMrBC,EAAAA,iBANqB;AAOrB,KAAGC;AAPkB,CAAD,KAchB;AACJ,MAAIC,sBAASC,EAAT,KAAgB,KAAhB,IAAyBJ,EAA7B,EAAiC;AAC/B;AACA;AACA,wBACE,oBAAC,YAAD,eACME,IADN;AAEE,MAAA,EAAE,EAAEF,EAFN;AAGE,MAAA,KAAK,EAAE,CAACK,MAAM,CAACC,MAAR,EAAgBT,KAAhB,CAHT;AAIE,MAAA,OAAO,EAAGU,CAAD,IAAY;AACnB,YACE,EAAEA,CAAC,CAACC,OAAF,IAAaD,CAAC,CAACE,MAAf,IAAyBF,CAAC,CAACG,OAA3B,IAAsCH,CAAC,CAACI,QAA1C,OAAuD;AACtDJ,QAAAA,CAAC,CAACD,MAAF,IAAY,IAAZ,IAAoBC,CAAC,CAACD,MAAF,KAAa,CADlC,CADF,CAEuC;AAFvC,UAGE;AACAC,YAAAA,CAAC,CAACK,cAAF;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KAAF;AAASf,IAAAA;AAAT,GAAD,CApBT,CAFF,CATF,CALF,CADF;AA4CD;;AAED,MAAMf,MAAM,GAAG4B,wBAAWY,MAAX,CAAkB;AAC/BN,EAAAA,SAAS,EAAE;AACTO,IAAAA,gBAAgB,EAAE,EADT;AAETH,IAAAA,cAAc,EAAE,CAFP;AAGTI,IAAAA,QAAQ,EAAE;AAHD,GADoB;AAM/BP,EAAAA,OAAO,EAAE;AACPQ,IAAAA,aAAa,EAAE,KADR;AAEPC,IAAAA,UAAU,EAAE,QAFL;AAGPC,IAAAA,OAAO,EAAE;AAHF,GANsB;AAW/BhC,EAAAA,KAAK,EAAE;AACLiC,IAAAA,WAAW,EAAE,EADR;AAELC,IAAAA,IAAI,EAAE;AAFD,GAXwB;AAe/B9C,EAAAA,MAAM,EAAE;AACN+C,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"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = DrawerItemList;
|
|
7
|
+
|
|
8
|
+
var _native = require("@react-navigation/native");
|
|
9
|
+
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _DrawerItem = _interopRequireDefault(require("./DrawerItem"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Component that renders the navigation list in the drawer.
|
|
22
|
+
*/
|
|
23
|
+
function DrawerItemList({
|
|
24
|
+
state,
|
|
25
|
+
navigation,
|
|
26
|
+
descriptors
|
|
27
|
+
}) {
|
|
28
|
+
const buildLink = (0, _native.useLinkBuilder)();
|
|
29
|
+
const focusedRoute = state.routes[state.index];
|
|
30
|
+
const focusedDescriptor = descriptors[focusedRoute.key];
|
|
31
|
+
const focusedOptions = focusedDescriptor.options;
|
|
32
|
+
const {
|
|
33
|
+
drawerActiveTintColor,
|
|
34
|
+
drawerInactiveTintColor,
|
|
35
|
+
drawerActiveBackgroundColor,
|
|
36
|
+
drawerInactiveBackgroundColor
|
|
37
|
+
} = focusedOptions;
|
|
38
|
+
return state.routes.map((route, i) => {
|
|
39
|
+
const focused = i === state.index;
|
|
40
|
+
const {
|
|
41
|
+
title,
|
|
42
|
+
drawerLabel,
|
|
43
|
+
drawerIcon,
|
|
44
|
+
drawerLabelStyle,
|
|
45
|
+
drawerItemStyle
|
|
46
|
+
} = descriptors[route.key].options;
|
|
47
|
+
return /*#__PURE__*/React.createElement(_DrawerItem.default, {
|
|
48
|
+
key: route.key,
|
|
49
|
+
label: drawerLabel !== undefined ? drawerLabel : title !== undefined ? title : route.name,
|
|
50
|
+
icon: drawerIcon,
|
|
51
|
+
focused: focused,
|
|
52
|
+
activeTintColor: drawerActiveTintColor,
|
|
53
|
+
inactiveTintColor: drawerInactiveTintColor,
|
|
54
|
+
activeBackgroundColor: drawerActiveBackgroundColor,
|
|
55
|
+
inactiveBackgroundColor: drawerInactiveBackgroundColor,
|
|
56
|
+
labelStyle: drawerLabelStyle,
|
|
57
|
+
style: drawerItemStyle,
|
|
58
|
+
to: buildLink(route.name, route.params),
|
|
59
|
+
onPress: () => {
|
|
60
|
+
navigation.dispatch({ ...(focused ? _native.DrawerActions.closeDrawer() : _native.CommonActions.navigate({
|
|
61
|
+
name: route.name,
|
|
62
|
+
merge: true
|
|
63
|
+
})),
|
|
64
|
+
target: state.key
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=DrawerItemList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["DrawerItemList.tsx"],"names":["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","DrawerActions","closeDrawer","CommonActions","navigate","merge","target"],"mappings":";;;;;;;AAAA;;AAOA;;AAGA;;;;;;;;AAQA;AACA;AACA;AACe,SAASA,cAAT,CAAwB;AACrCC,EAAAA,KADqC;AAErCC,EAAAA,UAFqC;AAGrCC,EAAAA;AAHqC,CAAxB,EAIL;AACR,QAAMC,SAAS,GAAG,6BAAlB;AAEA,QAAMC,YAAY,GAAGJ,KAAK,CAACK,MAAN,CAAaL,KAAK,CAACM,KAAnB,CAArB;AACA,QAAMC,iBAAiB,GAAGL,WAAW,CAACE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d;AAAoBO,YAAAA,KAAK,EAAE;AAA3B,WAAvB,CAFJ,CADkB;AAIlBC,UAAAA,MAAM,EAAEjC,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"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = DrawerToggleButton;
|
|
7
|
+
|
|
8
|
+
var _elements = require("@react-navigation/elements");
|
|
9
|
+
|
|
10
|
+
var _native = require("@react-navigation/native");
|
|
11
|
+
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
|
|
14
|
+
var _reactNative = require("react-native");
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
function DrawerToggleButton({
|
|
23
|
+
tintColor,
|
|
24
|
+
...rest
|
|
25
|
+
}) {
|
|
26
|
+
const navigation = (0, _native.useNavigation)();
|
|
27
|
+
return /*#__PURE__*/React.createElement(_elements.PlatformPressable, _extends({}, rest, {
|
|
28
|
+
accessible: true,
|
|
29
|
+
accessibilityRole: "button",
|
|
30
|
+
android_ripple: {
|
|
31
|
+
borderless: true
|
|
32
|
+
},
|
|
33
|
+
onPress: () => navigation.dispatch(_native.DrawerActions.toggleDrawer()),
|
|
34
|
+
style: styles.touchable,
|
|
35
|
+
hitSlop: _reactNative.Platform.select({
|
|
36
|
+
ios: undefined,
|
|
37
|
+
default: {
|
|
38
|
+
top: 16,
|
|
39
|
+
right: 16,
|
|
40
|
+
bottom: 16,
|
|
41
|
+
left: 16
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
}), /*#__PURE__*/React.createElement(_reactNative.Image, {
|
|
45
|
+
style: [styles.icon, tintColor ? {
|
|
46
|
+
tintColor
|
|
47
|
+
} : null],
|
|
48
|
+
source: require('./assets/toggle-drawer-icon.png'),
|
|
49
|
+
fadeDuration: 0
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const styles = _reactNative.StyleSheet.create({
|
|
54
|
+
icon: {
|
|
55
|
+
height: 24,
|
|
56
|
+
width: 24,
|
|
57
|
+
margin: 3,
|
|
58
|
+
resizeMode: 'contain'
|
|
59
|
+
},
|
|
60
|
+
touchable: {
|
|
61
|
+
marginHorizontal: 11
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=DrawerToggleButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["DrawerToggleButton.tsx"],"names":["DrawerToggleButton","tintColor","rest","navigation","borderless","dispatch","DrawerActions","toggleDrawer","styles","touchable","Platform","select","ios","undefined","default","top","right","bottom","left","icon","require","StyleSheet","create","height","width","margin","resizeMode","marginHorizontal"],"mappings":";;;;;;;AAAA;;AACA;;AAKA;;AACA;;;;;;;;AAWe,SA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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"]}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = DrawerView;
|
|
7
|
+
|
|
8
|
+
var _elements = require("@react-navigation/elements");
|
|
9
|
+
|
|
10
|
+
var _native = require("@react-navigation/native");
|
|
11
|
+
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
|
|
14
|
+
var _reactNative = require("react-native");
|
|
15
|
+
|
|
16
|
+
var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated"));
|
|
17
|
+
|
|
18
|
+
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
19
|
+
|
|
20
|
+
var _DrawerPositionContext = _interopRequireDefault(require("../utils/DrawerPositionContext"));
|
|
21
|
+
|
|
22
|
+
var _DrawerStatusContext = _interopRequireDefault(require("../utils/DrawerStatusContext"));
|
|
23
|
+
|
|
24
|
+
var _getDrawerStatusFromState = _interopRequireDefault(require("../utils/getDrawerStatusFromState"));
|
|
25
|
+
|
|
26
|
+
var _DrawerContent = _interopRequireDefault(require("./DrawerContent"));
|
|
27
|
+
|
|
28
|
+
var _DrawerToggleButton = _interopRequireDefault(require("./DrawerToggleButton"));
|
|
29
|
+
|
|
30
|
+
var _GestureHandler = require("./GestureHandler");
|
|
31
|
+
|
|
32
|
+
var _ScreenFallback = require("./ScreenFallback");
|
|
33
|
+
|
|
34
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
|
+
|
|
36
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
|
+
|
|
38
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
|
+
|
|
40
|
+
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); }
|
|
41
|
+
|
|
42
|
+
const getDefaultDrawerWidth = ({
|
|
43
|
+
height,
|
|
44
|
+
width
|
|
45
|
+
}) => {
|
|
46
|
+
/*
|
|
47
|
+
* Default drawer width is screen width - header height
|
|
48
|
+
* with a max width of 280 on mobile and 320 on tablet
|
|
49
|
+
* https://material.io/components/navigation-drawer
|
|
50
|
+
*/
|
|
51
|
+
const smallerAxisSize = Math.min(height, width);
|
|
52
|
+
const isLandscape = width > height;
|
|
53
|
+
const isTablet = smallerAxisSize >= 600;
|
|
54
|
+
const appBarHeight = _reactNative.Platform.OS === 'ios' ? isLandscape ? 32 : 44 : 56;
|
|
55
|
+
const maxWidth = isTablet ? 320 : 280;
|
|
56
|
+
return Math.min(smallerAxisSize - appBarHeight, maxWidth);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const GestureHandlerWrapper = _GestureHandler.GestureHandlerRootView !== null && _GestureHandler.GestureHandlerRootView !== void 0 ? _GestureHandler.GestureHandlerRootView : _reactNative.View;
|
|
60
|
+
|
|
61
|
+
function DrawerViewBase({
|
|
62
|
+
state,
|
|
63
|
+
navigation,
|
|
64
|
+
descriptors,
|
|
65
|
+
drawerContent = props => /*#__PURE__*/React.createElement(_DrawerContent.default, props),
|
|
66
|
+
detachInactiveScreens = _reactNative.Platform.OS === 'web' || _reactNative.Platform.OS === 'android' || _reactNative.Platform.OS === 'ios',
|
|
67
|
+
// Running in chrome debugger
|
|
68
|
+
// @ts-expect-error
|
|
69
|
+
useLegacyImplementation = !global.nativeCallSyncHook || // Reanimated 2 is not configured
|
|
70
|
+
// @ts-expect-error: the type definitions are incomplete
|
|
71
|
+
!(() => {
|
|
72
|
+
var _Animated$isConfigure;
|
|
73
|
+
|
|
74
|
+
return (_Animated$isConfigure = _reactNativeReanimated.default.isConfigured) === null || _Animated$isConfigure === void 0 ? void 0 : _Animated$isConfigure.call(_reactNativeReanimated.default);
|
|
75
|
+
})()
|
|
76
|
+
}) {
|
|
77
|
+
const Drawer = useLegacyImplementation ? require('./legacy/Drawer').default : require('./modern/Drawer').default;
|
|
78
|
+
const focusedRouteKey = state.routes[state.index].key;
|
|
79
|
+
const {
|
|
80
|
+
drawerHideStatusBarOnOpen = false,
|
|
81
|
+
drawerPosition = _reactNative.I18nManager.isRTL ? 'right' : 'left',
|
|
82
|
+
drawerStatusBarAnimation = 'slide',
|
|
83
|
+
drawerStyle,
|
|
84
|
+
drawerType = _reactNative.Platform.select({
|
|
85
|
+
ios: 'slide',
|
|
86
|
+
default: 'front'
|
|
87
|
+
}),
|
|
88
|
+
gestureHandlerProps,
|
|
89
|
+
keyboardDismissMode = 'on-drag',
|
|
90
|
+
overlayColor = 'rgba(0, 0, 0, 0.5)',
|
|
91
|
+
swipeEdgeWidth = 32,
|
|
92
|
+
swipeEnabled = _reactNative.Platform.OS !== 'web' && _reactNative.Platform.OS !== 'windows' && _reactNative.Platform.OS !== 'macos',
|
|
93
|
+
swipeMinDistance = 60
|
|
94
|
+
} = descriptors[focusedRouteKey].options;
|
|
95
|
+
const [loaded, setLoaded] = React.useState([focusedRouteKey]);
|
|
96
|
+
|
|
97
|
+
if (!loaded.includes(focusedRouteKey)) {
|
|
98
|
+
setLoaded([...loaded, focusedRouteKey]);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const dimensions = (0, _reactNativeSafeAreaContext.useSafeAreaFrame)();
|
|
102
|
+
const {
|
|
103
|
+
colors
|
|
104
|
+
} = (0, _native.useTheme)();
|
|
105
|
+
const drawerStatus = (0, _getDrawerStatusFromState.default)(state);
|
|
106
|
+
const handleDrawerOpen = React.useCallback(() => {
|
|
107
|
+
navigation.dispatch({ ..._native.DrawerActions.openDrawer(),
|
|
108
|
+
target: state.key
|
|
109
|
+
});
|
|
110
|
+
}, [navigation, state.key]);
|
|
111
|
+
const handleDrawerClose = React.useCallback(() => {
|
|
112
|
+
navigation.dispatch({ ..._native.DrawerActions.closeDrawer(),
|
|
113
|
+
target: state.key
|
|
114
|
+
});
|
|
115
|
+
}, [navigation, state.key]);
|
|
116
|
+
React.useEffect(() => {
|
|
117
|
+
if (drawerStatus !== 'open' || drawerType === 'permanent') {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const handleClose = () => {
|
|
122
|
+
// We shouldn't handle the back button if the parent screen isn't focused
|
|
123
|
+
// This will avoid the drawer overriding event listeners from a focused screen
|
|
124
|
+
if (!navigation.isFocused()) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
handleDrawerClose();
|
|
129
|
+
return true;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const handleEscape = e => {
|
|
133
|
+
if (e.key === 'Escape') {
|
|
134
|
+
handleClose();
|
|
135
|
+
}
|
|
136
|
+
}; // We only add the listeners when drawer opens
|
|
137
|
+
// This way we can make sure that the listener is added as late as possible
|
|
138
|
+
// This will make sure that our handler will run first when back button is pressed
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
const subscription = _reactNative.BackHandler.addEventListener('hardwareBackPress', handleClose);
|
|
142
|
+
|
|
143
|
+
if (_reactNative.Platform.OS === 'web') {
|
|
144
|
+
var _document, _document$body, _document$body$addEve;
|
|
145
|
+
|
|
146
|
+
(_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : (_document$body$addEve = _document$body.addEventListener) === null || _document$body$addEve === void 0 ? void 0 : _document$body$addEve.call(_document$body, 'keyup', handleEscape);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return () => {
|
|
150
|
+
subscription.remove();
|
|
151
|
+
|
|
152
|
+
if (_reactNative.Platform.OS === 'web') {
|
|
153
|
+
var _document2, _document2$body, _document2$body$remov;
|
|
154
|
+
|
|
155
|
+
(_document2 = document) === null || _document2 === void 0 ? void 0 : (_document2$body = _document2.body) === null || _document2$body === void 0 ? void 0 : (_document2$body$remov = _document2$body.removeEventListener) === null || _document2$body$remov === void 0 ? void 0 : _document2$body$remov.call(_document2$body, 'keyup', handleEscape);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}, [drawerStatus, drawerType, handleDrawerClose, navigation]);
|
|
159
|
+
|
|
160
|
+
const renderDrawerContent = () => {
|
|
161
|
+
return /*#__PURE__*/React.createElement(_DrawerPositionContext.default.Provider, {
|
|
162
|
+
value: drawerPosition
|
|
163
|
+
}, drawerContent({
|
|
164
|
+
state: state,
|
|
165
|
+
navigation: navigation,
|
|
166
|
+
descriptors: descriptors
|
|
167
|
+
}));
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const renderSceneContent = () => {
|
|
171
|
+
return /*#__PURE__*/React.createElement(_ScreenFallback.MaybeScreenContainer, {
|
|
172
|
+
enabled: detachInactiveScreens,
|
|
173
|
+
style: styles.content
|
|
174
|
+
}, state.routes.map((route, index) => {
|
|
175
|
+
const descriptor = descriptors[route.key];
|
|
176
|
+
const {
|
|
177
|
+
lazy = true,
|
|
178
|
+
unmountOnBlur
|
|
179
|
+
} = descriptor.options;
|
|
180
|
+
const isFocused = state.index === index;
|
|
181
|
+
|
|
182
|
+
if (unmountOnBlur && !isFocused) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (lazy && !loaded.includes(route.key) && !isFocused) {
|
|
187
|
+
// Don't render a lazy screen if we've never navigated to it
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const {
|
|
192
|
+
header = ({
|
|
193
|
+
layout,
|
|
194
|
+
options
|
|
195
|
+
}) => {
|
|
196
|
+
var _options$headerLeft;
|
|
197
|
+
|
|
198
|
+
return /*#__PURE__*/React.createElement(_elements.Header, _extends({}, options, {
|
|
199
|
+
layout: layout,
|
|
200
|
+
title: (0, _elements.getHeaderTitle)(options, route.name),
|
|
201
|
+
headerLeft: (_options$headerLeft = options.headerLeft) !== null && _options$headerLeft !== void 0 ? _options$headerLeft : props => /*#__PURE__*/React.createElement(_DrawerToggleButton.default, props)
|
|
202
|
+
}));
|
|
203
|
+
},
|
|
204
|
+
sceneContainerStyle
|
|
205
|
+
} = descriptor.options;
|
|
206
|
+
return /*#__PURE__*/React.createElement(_ScreenFallback.MaybeScreen, {
|
|
207
|
+
key: route.key,
|
|
208
|
+
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
209
|
+
zIndex: isFocused ? 0 : -1
|
|
210
|
+
}],
|
|
211
|
+
visible: isFocused,
|
|
212
|
+
enabled: detachInactiveScreens
|
|
213
|
+
}, /*#__PURE__*/React.createElement(_elements.Screen, {
|
|
214
|
+
focused: isFocused,
|
|
215
|
+
route: descriptor.route,
|
|
216
|
+
navigation: descriptor.navigation,
|
|
217
|
+
headerShown: descriptor.options.headerShown,
|
|
218
|
+
headerTransparent: descriptor.options.headerTransparent,
|
|
219
|
+
headerStatusBarHeight: descriptor.options.headerStatusBarHeight,
|
|
220
|
+
header: header({
|
|
221
|
+
layout: dimensions,
|
|
222
|
+
route: descriptor.route,
|
|
223
|
+
navigation: descriptor.navigation,
|
|
224
|
+
options: descriptor.options
|
|
225
|
+
}),
|
|
226
|
+
style: sceneContainerStyle
|
|
227
|
+
}, descriptor.render()));
|
|
228
|
+
}));
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
return /*#__PURE__*/React.createElement(_DrawerStatusContext.default.Provider, {
|
|
232
|
+
value: drawerStatus
|
|
233
|
+
}, /*#__PURE__*/React.createElement(Drawer, {
|
|
234
|
+
open: drawerStatus !== 'closed',
|
|
235
|
+
onOpen: handleDrawerOpen,
|
|
236
|
+
onClose: handleDrawerClose,
|
|
237
|
+
gestureHandlerProps: gestureHandlerProps,
|
|
238
|
+
swipeEnabled: swipeEnabled,
|
|
239
|
+
swipeEdgeWidth: swipeEdgeWidth,
|
|
240
|
+
swipeVelocityThreshold: 500,
|
|
241
|
+
swipeDistanceThreshold: swipeMinDistance,
|
|
242
|
+
hideStatusBarOnOpen: drawerHideStatusBarOnOpen,
|
|
243
|
+
statusBarAnimation: drawerStatusBarAnimation,
|
|
244
|
+
keyboardDismissMode: keyboardDismissMode,
|
|
245
|
+
drawerType: drawerType,
|
|
246
|
+
drawerPosition: drawerPosition,
|
|
247
|
+
drawerStyle: [{
|
|
248
|
+
width: getDefaultDrawerWidth(dimensions),
|
|
249
|
+
backgroundColor: colors.card
|
|
250
|
+
}, drawerType === 'permanent' && (drawerPosition === 'left' ? {
|
|
251
|
+
borderRightColor: colors.border,
|
|
252
|
+
borderRightWidth: _reactNative.StyleSheet.hairlineWidth
|
|
253
|
+
} : {
|
|
254
|
+
borderLeftColor: colors.border,
|
|
255
|
+
borderLeftWidth: _reactNative.StyleSheet.hairlineWidth
|
|
256
|
+
}), drawerStyle],
|
|
257
|
+
overlayStyle: {
|
|
258
|
+
backgroundColor: overlayColor
|
|
259
|
+
},
|
|
260
|
+
renderDrawerContent: renderDrawerContent,
|
|
261
|
+
renderSceneContent: renderSceneContent,
|
|
262
|
+
dimensions: dimensions
|
|
263
|
+
}));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function DrawerView({
|
|
267
|
+
navigation,
|
|
268
|
+
...rest
|
|
269
|
+
}) {
|
|
270
|
+
return /*#__PURE__*/React.createElement(_elements.SafeAreaProviderCompat, null, /*#__PURE__*/React.createElement(GestureHandlerWrapper, {
|
|
271
|
+
style: styles.content
|
|
272
|
+
}, /*#__PURE__*/React.createElement(DrawerViewBase, _extends({
|
|
273
|
+
navigation: navigation
|
|
274
|
+
}, rest))));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const styles = _reactNative.StyleSheet.create({
|
|
278
|
+
content: {
|
|
279
|
+
flex: 1
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
//# sourceMappingURL=DrawerView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["DrawerView.tsx"],"names":["getDefaultDrawerWidth","height","width","smallerAxisSize","Math","min","isLandscape","isTablet","appBarHeight","Platform","OS","maxWidth","GestureHandlerWrapper","GestureHandlerRootView","View","DrawerViewBase","state","navigation","descriptors","drawerContent","props","detachInactiveScreens","useLegacyImplementation","global","nativeCallSyncHook","Animated","isConfigured","Drawer","require","default","focusedRouteKey","routes","index","key","drawerHideStatusBarOnOpen","drawerPosition","I18nManager","isRTL","drawerStatusBarAnimation","drawerStyle","drawerType","select","ios","gestureHandlerProps","keyboardDismissMode","overlayColor","swipeEdgeWidth","swipeEnabled","swipeMinDistance","options","loaded","setLoaded","React","useState","includes","dimensions","colors","drawerStatus","handleDrawerOpen","useCallback","dispatch","DrawerActions","openDrawer","target","handleDrawerClose","closeDrawer","useEffect","handleClose","isFocused","handleEscape","e","subscription","BackHandler","addEventListener","document","body","remove","removeEventListener","renderDrawerContent","renderSceneContent","styles","content","map","route","descriptor","lazy","unmountOnBlur","header","layout","name","headerLeft","sceneContainerStyle","StyleSheet","absoluteFill","zIndex","headerShown","headerTransparent","headerStatusBarHeight","render","backgroundColor","card","borderRightColor","border","borderRightWidth","hairlineWidth","borderLeftColor","borderLeftWidth","DrawerView","rest","create","flex"],"mappings":";;;;;;;AAAA;;AAMA;;AAMA;;AACA;;AAOA;;AACA;;AAWA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAQA,MAAMA,qBAAqB,GAAG,CAAC;AAC7BC,EAAAA,MAD6B;AAE7BC,EAAAA;AAF6B,CAAD,KAMxB;AACJ;AACF;AACA;AACA;AACA;AACE,QAAMC,eAAe,GAAGC,IAAI,CAACC,GAAL,CAASJ,MAAT,EAAiBC,KAAjB,CAAxB;AACA,QAAMI,WAAW,GAAGJ,KAAK,GAAGD,MAA5B;AACA,QAAMM,QAAQ,GAAGJ,eAAe,IAAI,GAApC;AACA,QAAMK,YAAY,GAAGC,sBAASC,EAAT,KAAgB,KAAhB,GAAyBJ,WAAW,GAAG,EAAH,GAAQ,EAA5C,GAAkD,EAAvE;AACA,QAAMK,QAAQ,GAAGJ,QAAQ,GAAG,GAAH,GAAS,GAAlC;AAEA,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,EAAEL,cAblB;AAcE,IAAA,WAAW,EAAE,CACX;AACEjC,MAAAA,KAAK,EAAEF,qBAAqB,CAACuD,UAAD,CAD9B;AAEE4C,MAAAA,eAAe,EAAE3C,MAAM,CAAC4C;AAF1B,KADW,EAKX5D,UAAU,KAAK,WAAf,KACGL,cAAc,KAAK,MAAnB,GACG;AACEkE,MAAAA,gBAAgB,EAAE7C,MAAM,CAAC8C,MAD3B;AAEEC,MAAAA,gBAAgB,EAAEX,wBAAWY;AAF/B,KADH,GAKG;AACEC,MAAAA,eAAe,EAAEjD,MAAM,CAAC8C,MAD1B;AAEEI,MAAAA,eAAe,EAAEd,wBAAWY;AAF9B,KANN,CALW,EAeXjE,WAfW,CAdf;AA+BE,IAAA,YAAY,EAAE;AAAE4D,MAAAA,eAAe,EAAEtD;AAAnB,KA/BhB;AAgCE,IAAA,mBAAmB,EAAEiC,mBAhCvB;AAiCE,IAAA,kBAAkB,EAAEC,kBAjCtB;AAkCE,IAAA,UAAU,EAAExB;AAlCd,IADF,CADF;AAwCD;;AAEc,SAASoD,UAAT,CAAoB;AAAE1F,EAAAA,UAAF;AAAc,KAAG2F;AAAjB,CAApB,EAAoD;AACjE,sBACE,oBAAC,gCAAD,qBACE,oBAAC,qBAAD;AAAuB,IAAA,KAAK,EAAE5B,MAAM,CAACC;AAArC,kBACE,oBAAC,cAAD;AAAgB,IAAA,UAAU,EAAEhE;AAA5B,KAA4C2F,IAA5C,EADF,CADF,CADF;AAOD;;AAED,MAAM5B,MAAM,GAAGY,wBAAWiB,MAAX,CAAkB;AAC/B5B,EAAAA,OAAO,EAAE;AACP6B,IAAAA,IAAI,EAAE;AADC;AADsB,CAAlB,CAAf","sourcesContent":["import {\n getHeaderTitle,\n Header,\n SafeAreaProviderCompat,\n Screen,\n} from '@react-navigation/elements';\nimport {\n DrawerActions,\n DrawerNavigationState,\n 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 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 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 !== 'open' || drawerType === 'permanent') {\n return;\n }\n\n const handleClose = () => {\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 handleDrawerClose();\n\n return true;\n };\n\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n handleClose();\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 handleClose\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 }, [drawerStatus, drawerType, handleDrawerClose, navigation]);\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"]}
|