react-native-drawer-layout 2.0.0 → 3.1.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.
Files changed (109) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +235 -35
  3. package/lib/commonjs/constants.js +15 -0
  4. package/lib/commonjs/constants.js.map +1 -0
  5. package/lib/commonjs/index.js +35 -0
  6. package/lib/commonjs/index.js.map +1 -0
  7. package/lib/commonjs/types.js +6 -0
  8. package/lib/commonjs/types.js.map +1 -0
  9. package/lib/commonjs/utils/DrawerGestureContext.js +12 -0
  10. package/lib/commonjs/utils/DrawerGestureContext.js.map +1 -0
  11. package/lib/commonjs/utils/DrawerProgressContext.js +12 -0
  12. package/lib/commonjs/utils/DrawerProgressContext.js.map +1 -0
  13. package/lib/commonjs/utils/useDrawerProgress.js +19 -0
  14. package/lib/commonjs/utils/useDrawerProgress.js.map +1 -0
  15. package/lib/commonjs/views/Drawer.js +89 -0
  16. package/lib/commonjs/views/Drawer.js.map +1 -0
  17. package/lib/commonjs/views/GestureHandler.android.js +17 -0
  18. package/lib/commonjs/views/GestureHandler.android.js.map +1 -0
  19. package/lib/commonjs/views/GestureHandler.ios.js +17 -0
  20. package/lib/commonjs/views/GestureHandler.ios.js.map +1 -0
  21. package/lib/commonjs/views/GestureHandler.js +33 -0
  22. package/lib/commonjs/views/GestureHandler.js.map +1 -0
  23. package/lib/commonjs/views/GestureHandlerNative.js +37 -0
  24. package/lib/commonjs/views/GestureHandlerNative.js.map +1 -0
  25. package/lib/commonjs/views/legacy/Drawer.js +419 -0
  26. package/lib/commonjs/views/legacy/Drawer.js.map +1 -0
  27. package/lib/commonjs/views/legacy/Overlay.js +74 -0
  28. package/lib/commonjs/views/legacy/Overlay.js.map +1 -0
  29. package/lib/commonjs/views/modern/Drawer.js +285 -0
  30. package/lib/commonjs/views/modern/Drawer.js.map +1 -0
  31. package/lib/commonjs/views/modern/Overlay.js +69 -0
  32. package/lib/commonjs/views/modern/Overlay.js.map +1 -0
  33. package/lib/module/constants.js +5 -0
  34. package/lib/module/constants.js.map +1 -0
  35. package/lib/module/index.js +5 -0
  36. package/lib/module/index.js.map +1 -0
  37. package/lib/module/types.js +2 -0
  38. package/lib/module/types.js.map +1 -0
  39. package/lib/module/utils/DrawerGestureContext.js +3 -0
  40. package/lib/module/utils/DrawerGestureContext.js.map +1 -0
  41. package/lib/module/utils/DrawerProgressContext.js +3 -0
  42. package/lib/module/utils/DrawerProgressContext.js.map +1 -0
  43. package/lib/module/utils/useDrawerProgress.js +10 -0
  44. package/lib/module/utils/useDrawerProgress.js.map +1 -0
  45. package/lib/module/views/Drawer.js +81 -0
  46. package/lib/module/views/Drawer.js.map +1 -0
  47. package/lib/module/views/GestureHandler.android.js +2 -0
  48. package/lib/module/views/GestureHandler.android.js.map +1 -0
  49. package/lib/module/views/GestureHandler.ios.js +2 -0
  50. package/lib/module/views/GestureHandler.ios.js.map +1 -0
  51. package/lib/module/views/GestureHandler.js +21 -0
  52. package/lib/module/views/GestureHandler.js.map +1 -0
  53. package/lib/module/views/GestureHandlerNative.js +11 -0
  54. package/lib/module/views/GestureHandlerNative.js.map +1 -0
  55. package/lib/module/views/legacy/Drawer.js +409 -0
  56. package/lib/module/views/legacy/Drawer.js.map +1 -0
  57. package/lib/module/views/legacy/Overlay.js +64 -0
  58. package/lib/module/views/legacy/Overlay.js.map +1 -0
  59. package/lib/module/views/modern/Drawer.js +276 -0
  60. package/lib/module/views/modern/Drawer.js.map +1 -0
  61. package/lib/module/views/modern/Overlay.js +60 -0
  62. package/lib/module/views/modern/Overlay.js.map +1 -0
  63. package/lib/typescript/src/constants.d.ts +5 -0
  64. package/lib/typescript/src/constants.d.ts.map +1 -0
  65. package/lib/typescript/src/index.d.ts +5 -0
  66. package/lib/typescript/src/index.d.ts.map +1 -0
  67. package/lib/typescript/src/types.d.ts +110 -0
  68. package/lib/typescript/src/types.d.ts.map +1 -0
  69. package/lib/typescript/src/utils/DrawerGestureContext.d.ts +4 -0
  70. package/lib/typescript/src/utils/DrawerGestureContext.d.ts.map +1 -0
  71. package/lib/typescript/src/utils/DrawerProgressContext.d.ts +5 -0
  72. package/lib/typescript/src/utils/DrawerProgressContext.d.ts.map +1 -0
  73. package/lib/typescript/src/utils/useDrawerProgress.d.ts +3 -0
  74. package/lib/typescript/src/utils/useDrawerProgress.d.ts.map +1 -0
  75. package/lib/typescript/src/views/Drawer.d.ts +20 -0
  76. package/lib/typescript/src/views/Drawer.d.ts.map +1 -0
  77. package/lib/typescript/src/views/GestureHandler.android.d.ts +2 -0
  78. package/lib/typescript/src/views/GestureHandler.android.d.ts.map +1 -0
  79. package/lib/typescript/src/views/GestureHandler.d.ts +15 -0
  80. package/lib/typescript/src/views/GestureHandler.d.ts.map +1 -0
  81. package/lib/typescript/src/views/GestureHandler.ios.d.ts +2 -0
  82. package/lib/typescript/src/views/GestureHandler.ios.d.ts.map +1 -0
  83. package/lib/typescript/src/views/GestureHandlerNative.d.ts +6 -0
  84. package/lib/typescript/src/views/GestureHandlerNative.d.ts.map +1 -0
  85. package/lib/typescript/src/views/legacy/Drawer.d.ts +51 -0
  86. package/lib/typescript/src/views/legacy/Drawer.d.ts.map +1 -0
  87. package/lib/typescript/src/views/legacy/Overlay.d.ts +89 -0
  88. package/lib/typescript/src/views/legacy/Overlay.d.ts.map +1 -0
  89. package/lib/typescript/src/views/modern/Drawer.d.ts +10 -0
  90. package/lib/typescript/src/views/modern/Drawer.d.ts.map +1 -0
  91. package/lib/typescript/src/views/modern/Overlay.d.ts +89 -0
  92. package/lib/typescript/src/views/modern/Overlay.d.ts.map +1 -0
  93. package/package.json +54 -94
  94. package/src/constants.tsx +4 -0
  95. package/src/index.tsx +4 -0
  96. package/src/types.tsx +122 -0
  97. package/src/utils/DrawerGestureContext.tsx +3 -0
  98. package/src/utils/DrawerProgressContext.tsx +6 -0
  99. package/src/utils/useDrawerProgress.tsx +18 -0
  100. package/src/views/Drawer.tsx +122 -0
  101. package/src/views/GestureHandler.android.tsx +1 -0
  102. package/src/views/GestureHandler.ios.tsx +1 -0
  103. package/src/views/GestureHandler.tsx +29 -0
  104. package/src/views/GestureHandlerNative.tsx +24 -0
  105. package/src/views/legacy/Drawer.tsx +682 -0
  106. package/src/views/legacy/Overlay.tsx +87 -0
  107. package/src/views/modern/Drawer.tsx +413 -0
  108. package/src/views/modern/Overlay.tsx +82 -0
  109. package/dist/DrawerLayout.js +0 -430
@@ -0,0 +1,276 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
+ import * as React from 'react';
3
+ import { I18nManager, InteractionManager, Keyboard, Platform, StatusBar, StyleSheet, View } from 'react-native';
4
+ import Animated, { interpolate, runOnJS, useAnimatedGestureHandler, useAnimatedStyle, useDerivedValue, useSharedValue, withSpring } from 'react-native-reanimated';
5
+ import { DEFAULT_DRAWER_WIDTH, SWIPE_MIN_DISTANCE, SWIPE_MIN_OFFSET, SWIPE_MIN_VELOCITY } from '../../constants';
6
+ import DrawerProgressContext from '../../utils/DrawerProgressContext';
7
+ import { GestureState, PanGestureHandler } from '../GestureHandler';
8
+ import Overlay from './Overlay';
9
+ const minmax = (value, start, end) => {
10
+ 'worklet';
11
+
12
+ return Math.min(Math.max(value, start), end);
13
+ };
14
+ export default function Drawer(_ref) {
15
+ let {
16
+ layout,
17
+ drawerPosition,
18
+ drawerStyle,
19
+ drawerType,
20
+ gestureHandlerProps,
21
+ hideStatusBarOnOpen,
22
+ keyboardDismissMode,
23
+ onClose,
24
+ onOpen,
25
+ open,
26
+ overlayStyle,
27
+ overlayAccessibilityLabel,
28
+ statusBarAnimation,
29
+ swipeEnabled,
30
+ swipeEdgeWidth,
31
+ swipeMinDistance = SWIPE_MIN_DISTANCE,
32
+ swipeMinVelocity = SWIPE_MIN_VELOCITY,
33
+ renderDrawerContent,
34
+ children
35
+ } = _ref;
36
+ const getDrawerWidth = () => {
37
+ const {
38
+ width = DEFAULT_DRAWER_WIDTH
39
+ } = StyleSheet.flatten(drawerStyle) || {};
40
+ if (typeof width === 'string' && width.endsWith('%')) {
41
+ // Try to calculate width if a percentage is given
42
+ const percentage = Number(width.replace(/%$/, ''));
43
+ if (Number.isFinite(percentage)) {
44
+ return layout.width * (percentage / 100);
45
+ }
46
+ }
47
+ return typeof width === 'number' ? width : 0;
48
+ };
49
+ const drawerWidth = getDrawerWidth();
50
+ const isOpen = drawerType === 'permanent' ? true : open;
51
+ const isRight = drawerPosition === 'right';
52
+ const getDrawerTranslationX = React.useCallback(open => {
53
+ 'worklet';
54
+
55
+ if (drawerPosition === 'left') {
56
+ return open ? 0 : -drawerWidth;
57
+ }
58
+ return open ? 0 : drawerWidth;
59
+ }, [drawerPosition, drawerWidth]);
60
+ const hideStatusBar = React.useCallback(hide => {
61
+ if (hideStatusBarOnOpen) {
62
+ StatusBar.setHidden(hide, statusBarAnimation);
63
+ }
64
+ }, [hideStatusBarOnOpen, statusBarAnimation]);
65
+ React.useEffect(() => {
66
+ hideStatusBar(isOpen);
67
+ return () => hideStatusBar(false);
68
+ }, [isOpen, hideStatusBarOnOpen, statusBarAnimation, hideStatusBar]);
69
+ const interactionHandleRef = React.useRef(null);
70
+ const startInteraction = () => {
71
+ interactionHandleRef.current = InteractionManager.createInteractionHandle();
72
+ };
73
+ const endInteraction = () => {
74
+ if (interactionHandleRef.current != null) {
75
+ InteractionManager.clearInteractionHandle(interactionHandleRef.current);
76
+ interactionHandleRef.current = null;
77
+ }
78
+ };
79
+ const hideKeyboard = () => {
80
+ if (keyboardDismissMode === 'on-drag') {
81
+ Keyboard.dismiss();
82
+ }
83
+ };
84
+ const onGestureStart = () => {
85
+ startInteraction();
86
+ hideKeyboard();
87
+ hideStatusBar(true);
88
+ };
89
+ const onGestureFinish = () => {
90
+ endInteraction();
91
+ };
92
+
93
+ // FIXME: Currently hitSlop is broken when on Android when drawer is on right
94
+ // https://github.com/software-mansion/react-native-gesture-handler/issues/569
95
+ const hitSlop = isRight ?
96
+ // Extend hitSlop to the side of the screen when drawer is closed
97
+ // This lets the user drag the drawer from the side of the screen
98
+ {
99
+ right: 0,
100
+ width: isOpen ? undefined : swipeEdgeWidth
101
+ } : {
102
+ left: 0,
103
+ width: isOpen ? undefined : swipeEdgeWidth
104
+ };
105
+ const touchStartX = useSharedValue(0);
106
+ const touchX = useSharedValue(0);
107
+ const translationX = useSharedValue(getDrawerTranslationX(open));
108
+ const gestureState = useSharedValue(GestureState.UNDETERMINED);
109
+ const toggleDrawer = React.useCallback((open, velocity) => {
110
+ 'worklet';
111
+
112
+ const translateX = getDrawerTranslationX(open);
113
+ touchStartX.value = 0;
114
+ touchX.value = 0;
115
+ translationX.value = withSpring(translateX, {
116
+ velocity,
117
+ stiffness: 1000,
118
+ damping: 500,
119
+ mass: 3,
120
+ overshootClamping: true,
121
+ restDisplacementThreshold: 0.01,
122
+ restSpeedThreshold: 0.01
123
+ });
124
+ if (open) {
125
+ runOnJS(onOpen)();
126
+ } else {
127
+ runOnJS(onClose)();
128
+ }
129
+ }, [getDrawerTranslationX, onClose, onOpen, touchStartX, touchX, translationX]);
130
+ React.useEffect(() => toggleDrawer(open), [open, toggleDrawer]);
131
+ const onGestureEvent = useAnimatedGestureHandler({
132
+ onStart: (event, ctx) => {
133
+ ctx.hasCalledOnStart = false;
134
+ ctx.startX = translationX.value;
135
+ gestureState.value = event.state;
136
+ touchStartX.value = event.x;
137
+ },
138
+ onActive: (event, ctx) => {
139
+ touchX.value = event.x;
140
+ translationX.value = ctx.startX + event.translationX;
141
+ gestureState.value = event.state;
142
+
143
+ // onStart will _always_ be called, even when the activation
144
+ // criteria isn't met yet. This makes sure onGestureStart is only
145
+ // called when the criteria is really met.
146
+ if (!ctx.hasCalledOnStart) {
147
+ ctx.hasCalledOnStart = true;
148
+ runOnJS(onGestureStart)();
149
+ }
150
+ },
151
+ onEnd: event => {
152
+ gestureState.value = event.state;
153
+ const nextOpen = Math.abs(event.translationX) > SWIPE_MIN_OFFSET && Math.abs(event.translationX) > swipeMinVelocity || Math.abs(event.translationX) > swipeMinDistance ? drawerPosition === 'left' ?
154
+ // If swiped to right, open the drawer, otherwise close it
155
+ (event.velocityX === 0 ? event.translationX : event.velocityX) > 0 :
156
+ // If swiped to left, open the drawer, otherwise close it
157
+ (event.velocityX === 0 ? event.translationX : event.velocityX) < 0 : open;
158
+ toggleDrawer(nextOpen, event.velocityX);
159
+ },
160
+ onFinish: () => {
161
+ runOnJS(onGestureFinish)();
162
+ }
163
+ });
164
+ const translateX = useDerivedValue(() => {
165
+ // Comment stolen from react-native-gesture-handler/DrawerLayout
166
+ //
167
+ // While closing the drawer when user starts gesture outside of its area (in greyed
168
+ // out part of the window), we want the drawer to follow only once finger reaches the
169
+ // edge of the drawer.
170
+ // E.g. on the diagram below drawer is illustrate by X signs and the greyed out area by
171
+ // dots. The touch gesture starts at '*' and moves left, touch path is indicated by
172
+ // an arrow pointing left
173
+ // 1) +---------------+ 2) +---------------+ 3) +---------------+ 4) +---------------+
174
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
175
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
176
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
177
+ // |XXXXXXXX|......| |XXXXXXXX|.<-*..| |XXXXXXXX|<--*..| |XXXXX|<-----*..|
178
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
179
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
180
+ // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|
181
+ // +---------------+ +---------------+ +---------------+ +---------------+
182
+ //
183
+ // For the above to work properly we define animated value that will keep start position
184
+ // of the gesture. Then we use that value to calculate how much we need to subtract from
185
+ // the translationX. If the gesture started on the greyed out area we take the distance from the
186
+ // edge of the drawer to the start position. Otherwise we don't subtract at all and the
187
+ // drawer be pulled back as soon as you start the pan.
188
+ //
189
+ // This is used only when drawerType is "front"
190
+ const touchDistance = drawerType === 'front' && gestureState.value === GestureState.ACTIVE ? minmax(drawerPosition === 'left' ? touchStartX.value - drawerWidth : layout.width - drawerWidth - touchStartX.value, 0, layout.width) : 0;
191
+ const translateX = drawerPosition === 'left' ? minmax(translationX.value + touchDistance, -drawerWidth, 0) : minmax(translationX.value - touchDistance, 0, drawerWidth);
192
+ return translateX;
193
+ });
194
+ const isRTL = I18nManager.getConstants().isRTL;
195
+ const drawerAnimatedStyle = useAnimatedStyle(() => {
196
+ const distanceFromEdge = layout.width - drawerWidth;
197
+ return {
198
+ transform: drawerType === 'permanent' ?
199
+ // Reanimated needs the property to be present, but it results in Browser bug
200
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=20574
201
+ [] : [{
202
+ translateX:
203
+ // The drawer stays in place when `drawerType` is `back`
204
+ (drawerType === 'back' ? 0 : translateX.value) + (drawerPosition === 'left' ? isRTL ? -distanceFromEdge : 0 : isRTL ? 0 : distanceFromEdge)
205
+ }]
206
+ };
207
+ });
208
+ const contentAnimatedStyle = useAnimatedStyle(() => {
209
+ return {
210
+ transform: drawerType === 'permanent' ?
211
+ // Reanimated needs the property to be present, but it results in Browser bug
212
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=20574
213
+ [] : [{
214
+ translateX:
215
+ // The screen content stays in place when `drawerType` is `front`
216
+ drawerType === 'front' ? 0 : translateX.value + drawerWidth * (drawerPosition === 'left' ? 1 : -1)
217
+ }]
218
+ };
219
+ });
220
+ const progress = useDerivedValue(() => {
221
+ return drawerType === 'permanent' ? 1 : interpolate(translateX.value, [getDrawerTranslationX(false), getDrawerTranslationX(true)], [0, 1]);
222
+ });
223
+ return /*#__PURE__*/React.createElement(DrawerProgressContext.Provider, {
224
+ value: progress
225
+ }, /*#__PURE__*/React.createElement(PanGestureHandler, _extends({
226
+ activeOffsetX: [-SWIPE_MIN_OFFSET, SWIPE_MIN_OFFSET],
227
+ failOffsetY: [-SWIPE_MIN_OFFSET, SWIPE_MIN_OFFSET],
228
+ hitSlop: hitSlop,
229
+ enabled: drawerType !== 'permanent' && swipeEnabled,
230
+ onGestureEvent: onGestureEvent
231
+ }, gestureHandlerProps), /*#__PURE__*/React.createElement(Animated.View, {
232
+ style: [styles.main, {
233
+ flexDirection: drawerType === 'permanent' && !isRight ? 'row-reverse' : 'row'
234
+ }]
235
+ }, /*#__PURE__*/React.createElement(Animated.View, {
236
+ style: [styles.content, contentAnimatedStyle]
237
+ }, /*#__PURE__*/React.createElement(View, {
238
+ accessibilityElementsHidden: isOpen && drawerType !== 'permanent',
239
+ importantForAccessibility: isOpen && drawerType !== 'permanent' ? 'no-hide-descendants' : 'auto',
240
+ style: styles.content
241
+ }, children), drawerType !== 'permanent' ? /*#__PURE__*/React.createElement(Overlay, {
242
+ progress: progress,
243
+ onPress: () => toggleDrawer(false),
244
+ style: overlayStyle,
245
+ accessibilityLabel: overlayAccessibilityLabel
246
+ }) : null), /*#__PURE__*/React.createElement(Animated.View, {
247
+ removeClippedSubviews: Platform.OS !== 'ios',
248
+ style: [styles.container, {
249
+ position: drawerType === 'permanent' ? 'relative' : 'absolute',
250
+ zIndex: drawerType === 'back' ? -1 : 0
251
+ }, drawerAnimatedStyle, drawerStyle]
252
+ }, renderDrawerContent()))));
253
+ }
254
+ const styles = StyleSheet.create({
255
+ container: {
256
+ top: 0,
257
+ bottom: 0,
258
+ maxWidth: '100%',
259
+ width: DEFAULT_DRAWER_WIDTH
260
+ },
261
+ content: {
262
+ flex: 1
263
+ },
264
+ main: {
265
+ flex: 1,
266
+ ...Platform.select({
267
+ // FIXME: We need to hide `overflowX` on Web so the translated content doesn't show offscreen.
268
+ // But adding `overflowX: 'hidden'` prevents content from collapsing the URL bar.
269
+ web: null,
270
+ default: {
271
+ overflow: 'hidden'
272
+ }
273
+ })
274
+ }
275
+ });
276
+ //# sourceMappingURL=Drawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","I18nManager","InteractionManager","Keyboard","Platform","StatusBar","StyleSheet","View","Animated","interpolate","runOnJS","useAnimatedGestureHandler","useAnimatedStyle","useDerivedValue","useSharedValue","withSpring","DEFAULT_DRAWER_WIDTH","SWIPE_MIN_DISTANCE","SWIPE_MIN_OFFSET","SWIPE_MIN_VELOCITY","DrawerProgressContext","GestureState","PanGestureHandler","Overlay","minmax","value","start","end","Math","min","max","Drawer","layout","drawerPosition","drawerStyle","drawerType","gestureHandlerProps","hideStatusBarOnOpen","keyboardDismissMode","onClose","onOpen","open","overlayStyle","overlayAccessibilityLabel","statusBarAnimation","swipeEnabled","swipeEdgeWidth","swipeMinDistance","swipeMinVelocity","renderDrawerContent","children","getDrawerWidth","width","flatten","endsWith","percentage","Number","replace","isFinite","drawerWidth","isOpen","isRight","getDrawerTranslationX","useCallback","hideStatusBar","hide","setHidden","useEffect","interactionHandleRef","useRef","startInteraction","current","createInteractionHandle","endInteraction","clearInteractionHandle","hideKeyboard","dismiss","onGestureStart","onGestureFinish","hitSlop","right","undefined","left","touchStartX","touchX","translationX","gestureState","UNDETERMINED","toggleDrawer","velocity","translateX","stiffness","damping","mass","overshootClamping","restDisplacementThreshold","restSpeedThreshold","onGestureEvent","onStart","event","ctx","hasCalledOnStart","startX","state","x","onActive","onEnd","nextOpen","abs","velocityX","onFinish","touchDistance","ACTIVE","isRTL","getConstants","drawerAnimatedStyle","distanceFromEdge","transform","contentAnimatedStyle","progress","styles","main","flexDirection","content","OS","container","position","zIndex","create","top","bottom","maxWidth","flex","select","web","default","overflow"],"sourceRoot":"../../src","sources":["Drawer.tsx"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,WAAW,EACXC,kBAAkB,EAClBC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACTC,UAA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C,YAAa;IACpB,kBAAkB,EAAEC;EAA0B,EAC9C,GACA,IAAI,CACM,eAChB,oBAAC,QAAQ,CAAC,IAAI;IACZ,qBAAqB,EAAEvC,QAAQ,CAACwH,EAAE,KAAK,KAAM;IAC7C,KAAK,EAAE,CACLJ,MAAM,CAACK,SAAS,EAChB;MACEC,QAAQ,EAAE3F,UAAU,KAAK,WAAW,GAAG,UAAU,GAAG,UAAU;MAC9D4F,MAAM,EAAE5F,UAAU,KAAK,MAAM,GAAG,CAAC,CAAC,GAAG;IACvC,CAAC,EACDgF,mBAAmB,EACnBjF,WAAW;EACX,GAEDe,mBAAmB,EAAE,CACR,CACF,CACE,CACW;AAErC;AAEA,MAAMuE,MAAM,GAAGlH,UAAU,CAAC0H,MAAM,CAAC;EAC/BH,SAAS,EAAE;IACTI,GAAG,EAAE,CAAC;IACNC,MAAM,EAAE,CAAC;IACTC,QAAQ,EAAE,MAAM;IAChB/E,KAAK,EAAEpC;EACT,CAAC;EACD2G,OAAO,EAAE;IACPS,IAAI,EAAE;EACR,CAAC;EACDX,IAAI,EAAE;IACJW,IAAI,EAAE,CAAC;IACP,GAAGhI,QAAQ,CAACiI,MAAM,CAAC;MACjB;MACA;MACAC,GAAG,EAAE,IAAI;MACTC,OAAO,EAAE;QAAEC,QAAQ,EAAE;MAAS;IAChC,CAAC;EACH;AACF,CAAC,CAAC"}
@@ -0,0 +1,60 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
+ import * as React from 'react';
3
+ import { Platform, Pressable, StyleSheet } from 'react-native';
4
+ import Animated, { useAnimatedProps, useAnimatedStyle } from 'react-native-reanimated';
5
+ const PROGRESS_EPSILON = 0.05;
6
+ const Overlay = /*#__PURE__*/React.forwardRef(function Overlay(_ref, ref) {
7
+ let {
8
+ progress,
9
+ onPress,
10
+ style,
11
+ accessibilityLabel = 'Close drawer',
12
+ ...props
13
+ } = _ref;
14
+ const animatedStyle = useAnimatedStyle(() => {
15
+ return {
16
+ opacity: progress.value,
17
+ // We don't want the user to be able to press through the overlay when drawer is open
18
+ // We can send the overlay behind the screen to avoid it
19
+ zIndex: progress.value > PROGRESS_EPSILON ? 0 : -1
20
+ };
21
+ });
22
+ const animatedProps = useAnimatedProps(() => {
23
+ const active = progress.value > PROGRESS_EPSILON;
24
+ return {
25
+ pointerEvents: active ? 'auto' : 'none',
26
+ accessibilityElementsHidden: !active,
27
+ importantForAccessibility: active ? 'auto' : 'no-hide-descendants'
28
+ };
29
+ });
30
+ return /*#__PURE__*/React.createElement(Animated.View, _extends({}, props, {
31
+ ref: ref,
32
+ style: [styles.overlay, overlayStyle, animatedStyle, style],
33
+ animatedProps: animatedProps
34
+ }), /*#__PURE__*/React.createElement(Pressable, {
35
+ onPress: onPress,
36
+ style: styles.pressable,
37
+ accessibilityRole: "button",
38
+ accessibilityLabel: accessibilityLabel
39
+ }));
40
+ });
41
+ const overlayStyle = Platform.select({
42
+ web: {
43
+ // Disable touch highlight on mobile Safari.
44
+ // WebkitTapHighlightColor must be used outside of StyleSheet.create because react-native-web will omit the property.
45
+ WebkitTapHighlightColor: 'transparent'
46
+ },
47
+ default: {}
48
+ });
49
+ const styles = StyleSheet.create({
50
+ overlay: {
51
+ ...StyleSheet.absoluteFillObject,
52
+ backgroundColor: 'rgba(0, 0, 0, 0.5)'
53
+ },
54
+ pressable: {
55
+ flex: 1,
56
+ pointerEvents: 'auto'
57
+ }
58
+ });
59
+ export default Overlay;
60
+ //# sourceMappingURL=Overlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","Platform","Pressable","StyleSheet","Animated","useAnimatedProps","useAnimatedStyle","PROGRESS_EPSILON","Overlay","forwardRef","ref","progress","onPress","style","accessibilityLabel","props","animatedStyle","opacity","value","zIndex","animatedProps","active","pointerEvents","accessibilityElementsHidden","importantForAccessibility","styles","overlay","overlayStyle","pressable","select","web","WebkitTapHighlightColor","default","create","absoluteFillObject","backgroundColor","flex"],"sourceRoot":"../../src","sources":["Overlay.tsx"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,EAAEC,SAAS,EAAEC,UAAU,QAAQ,cAAc;AAC9D,OAAOC,QAAQ,IACbC,gBAAgB,EAChBC,gBAAgB,QACX,yBAAyB;AAEhC,MAAMC,gBAAgB,GAAG,IAAI;AAQ7B,MAAMC,OAAO,gBAAGR,KAAK,CAACS,UAAU,CAAC,SAASD,OAAO,OAQ/CE,GAA6B,EAC7B;EAAA,IARA;IACEC,QAAQ;IACRC,OAAO;IACPC,KAAK;IACLC,kBAAkB,GAAG,cAAc;IACnC,GAAGC;EACE,CAAC;EAGR,MAAMC,aAAa,GAAGV,gBAAgB,CAAC,MAAM;IAC3C,OAAO;MACLW,OAAO,EAAEN,QAAQ,CAACO,KAAK;MACvB;MACA;MACAC,MAAM,EAAER,QAAQ,CAACO,KAAK,GAAGX,gBAAgB,GAAG,CAAC,GAAG,CAAC;IACnD,CAAC;EACH,CAAC,CAAC;EAEF,MAAMa,aAAa,GAAGf,gBAAgB,CAAC,MAAM;IAC3C,MAAMgB,MAAM,GAAGV,QAAQ,CAACO,KAAK,GAAGX,gBAAgB;IAEhD,OAAO;MACLe,aAAa,EAAED,MAAM,GAAG,MAAM,GAAG,MAAM;MACvCE,2BAA2B,EAAE,CAACF,MAAM;MACpCG,yBAAyB,EAAEH,MAAM,GAAG,MAAM,GAAG;IAC/C,CAAC;EACH,CAAC,CAAC;EAEF,oBACE,oBAAC,QAAQ,CAAC,IAAI,eACRN,KAAK;IACT,GAAG,EAAEL,GAAI;IACT,KAAK,EAAE,CAACe,MAAM,CAACC,OAAO,EAAEC,YAAY,EAAEX,aAAa,EAAEH,KAAK,CAAE;IAC5D,aAAa,EAAEO;EAAc,iBAE7B,oBAAC,SAAS;IACR,OAAO,EAAER,OAAQ;IACjB,KAAK,EAAEa,MAAM,CAACG,SAAU;IACxB,iBAAiB,EAAC,QAAQ;IAC1B,kBAAkB,EAAEd;EAAmB,EACvC,CACY;AAEpB,CAAC,CAAC;AAEF,MAAMa,YAAY,GAAG1B,QAAQ,CAAC4B,MAAM,CAAyB;EAC3DC,GAAG,EAAE;IACH;IACA;IACAC,uBAAuB,EAAE;EAC3B,CAAC;EACDC,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,MAAMP,MAAM,GAAGtB,UAAU,CAAC8B,MAAM,CAAC;EAC/BP,OAAO,EAAE;IACP,GAAGvB,UAAU,CAAC+B,kBAAkB;IAChCC,eAAe,EAAE;EACnB,CAAC;EACDP,SAAS,EAAE;IACTQ,IAAI,EAAE,CAAC;IACPd,aAAa,EAAE;EACjB;AACF,CAAC,CAAC;AAEF,eAAed,OAAO"}
@@ -0,0 +1,5 @@
1
+ export declare const SWIPE_MIN_OFFSET = 5;
2
+ export declare const SWIPE_MIN_DISTANCE = 60;
3
+ export declare const SWIPE_MIN_VELOCITY = 500;
4
+ export declare const DEFAULT_DRAWER_WIDTH = "80%";
5
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/constants.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAClC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,oBAAoB,QAAQ,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { default as DrawerGestureContext } from './utils/DrawerGestureContext';
2
+ export { default as DrawerProgressContext } from './utils/DrawerProgressContext';
3
+ export { default as useDrawerProgress } from './utils/useDrawerProgress';
4
+ export { default as Drawer } from './views/Drawer';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,110 @@
1
+ /// <reference types="react" />
2
+ import type { StyleProp, ViewStyle } from 'react-native';
3
+ import type { PanGestureHandler } from 'react-native-gesture-handler';
4
+ export type Layout = {
5
+ width: number;
6
+ height: number;
7
+ };
8
+ export type DrawerProps = {
9
+ /**
10
+ * Whether the drawer is open or not.
11
+ */
12
+ open: boolean;
13
+ /**
14
+ * Callback which is called when the drawer is opened.
15
+ */
16
+ onOpen: () => void;
17
+ /**
18
+ * Callback which is called when the drawer is closed.
19
+ */
20
+ onClose: () => void;
21
+ /**
22
+ * Callback which returns a react element to render as the content of the drawer.
23
+ */
24
+ renderDrawerContent: () => React.ReactNode;
25
+ /**
26
+ * Object containing the layout of the container.
27
+ * Defaults to the dimensions of the application's window.
28
+ */
29
+ layout?: {
30
+ width: number;
31
+ height: number;
32
+ };
33
+ /**
34
+ * Position of the drawer on the screen.
35
+ * Defaults to `right` in RTL mode, otherwise `left`.
36
+ */
37
+ drawerPosition?: 'left' | 'right';
38
+ /**
39
+ * Type of the drawer. It determines how the drawer looks and animates.
40
+ * - `front`: Traditional drawer which covers the screen with a overlay behind it.
41
+ * - `back`: The drawer is revealed behind the screen on swipe.
42
+ * - `slide`: Both the screen and the drawer slide on swipe to reveal the drawer.
43
+ * - `permanent`: A permanent drawer is shown as a sidebar.
44
+ *
45
+ * Defaults to `slide` on iOS and `front` on other platforms.
46
+ */
47
+ drawerType?: 'front' | 'back' | 'slide' | 'permanent';
48
+ /**
49
+ * Style object for the drawer component.
50
+ * You can pass a custom background color for drawer or a custom width here.
51
+ */
52
+ drawerStyle?: StyleProp<ViewStyle>;
53
+ /**
54
+ * Style object for the drawer overlay.
55
+ */
56
+ overlayStyle?: StyleProp<ViewStyle>;
57
+ /**
58
+ * Accessibility label for the overlay. This is read by the screen reader when the user taps the overlay.
59
+ * Defaults to "Close drawer".
60
+ */
61
+ overlayAccessibilityLabel?: string;
62
+ /**
63
+ * Whether the keyboard should be dismissed when the swipe gesture begins.
64
+ * Defaults to `'on-drag'`. Set to `'none'` to disable keyboard handling.
65
+ */
66
+ keyboardDismissMode?: 'none' | 'on-drag';
67
+ /**
68
+ * Whether the statusbar should be hidden when the drawer is pulled or opens.
69
+ * Defaults to `false`.
70
+ */
71
+ hideStatusBarOnOpen?: boolean;
72
+ /**
73
+ * Animation of the statusbar when hiding it. Use in combination with `hideStatusBarOnOpen`.
74
+ */
75
+ statusBarAnimation?: 'slide' | 'fade' | 'none';
76
+ /**
77
+ * Whether you can use swipe gestures to open or close the drawer.
78
+ * Defaults to `true`.
79
+ * This is not supported on Web.
80
+ */
81
+ swipeEnabled?: boolean;
82
+ /**
83
+ * How far from the edge of the screen the swipe gesture should activate.
84
+ * Defaults to `32`.
85
+ * This is not supported on Web.
86
+ */
87
+ swipeEdgeWidth?: number;
88
+ /**
89
+ * Minimum swipe distance that should activate opening the drawer.
90
+ * Defaults to `60`.
91
+ * This is not supported on Web.
92
+ */
93
+ swipeMinDistance?: number;
94
+ /**
95
+ * Minimum swipe velocity that should activate opening the drawer.
96
+ * Defaults to `500`.
97
+ * This is not supported on Web.
98
+ */
99
+ swipeMinVelocity?: number;
100
+ /**
101
+ * Props to pass to the underlying pan gesture handler.
102
+ * This is not supported on Web.
103
+ */
104
+ gestureHandlerProps?: React.ComponentProps<typeof PanGestureHandler>;
105
+ /**
106
+ * Content that the drawer should wrap.
107
+ */
108
+ children: React.ReactNode;
109
+ };
110
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.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Ac,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAErE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ declare const _default: React.Context<React.RefObject<any> | null>;
3
+ export default _default;
4
+ //# sourceMappingURL=DrawerGestureContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DrawerGestureContext.d.ts","sourceRoot":"","sources":["../../../../src/utils/DrawerGestureContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;;AAE/B,wBAAsE"}
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import type Animated from 'react-native-reanimated';
3
+ declare const _default: React.Context<Readonly<Animated.SharedValue<number>> | Animated.Node<number> | undefined>;
4
+ export default _default;
5
+ //# sourceMappingURL=DrawerProgressContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DrawerProgressContext.d.ts","sourceRoot":"","sources":["../../../../src/utils/DrawerProgressContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;;AAEpD,wBAEa"}
@@ -0,0 +1,3 @@
1
+ import type Animated from 'react-native-reanimated';
2
+ export default function useDrawerProgress(): Readonly<Animated.SharedValue<number>> | Animated.Node<number>;
3
+ //# sourceMappingURL=useDrawerProgress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDrawerProgress.d.ts","sourceRoot":"","sources":["../../../../src/utils/useDrawerProgress.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAIpD,MAAM,CAAC,OAAO,UAAU,iBAAiB,IACrC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,GACtC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAUxB"}
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ import type { DrawerProps } from '../types';
4
+ type Props = DrawerProps & {
5
+ /**
6
+ * Whether to use the legacy implementation of the drawer.
7
+ * The legacy implementation uses v1 of Reanimated.
8
+ * The modern implementation uses v2 of Reanimated.
9
+ *
10
+ * By default, the appropriate implementation is used based on whether Reanimated v2 is configured.
11
+ */
12
+ useLegacyImplementation?: boolean;
13
+ /**
14
+ * Style object for the wrapper view.
15
+ */
16
+ style?: StyleProp<ViewStyle>;
17
+ };
18
+ export default function Drawer({ useLegacyImplementation, layout: customLayout, drawerType, drawerPosition, drawerStyle, swipeEnabled, swipeEdgeWidth, swipeMinDistance, swipeMinVelocity, keyboardDismissMode, hideStatusBarOnOpen, statusBarAnimation, style, ...rest }: Props): JSX.Element;
19
+ export {};
20
+ //# sourceMappingURL=Drawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../../src/views/Drawer.tsx"],"names":[],"mappings":";AACA,OAAO,EAGL,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,KAAK,KAAK,GAAG,WAAW,GAAG;IACzB;;;;;;OAMG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAuBF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAG7B,uBAAsD,EACtD,MAAM,EAAE,YAAY,EACpB,UAAgE,EAChE,cAAoE,EACpE,WAAW,EACX,YAEyB,EACzB,cAAmB,EACnB,gBAAqC,EACrC,gBAAqC,EACrC,mBAA+B,EAC/B,mBAA2B,EAC3B,kBAA4B,EAC5B,KAAK,EACL,GAAG,IAAI,EACR,EAAE,KAAK,eAyCP"}
@@ -0,0 +1,2 @@
1
+ export * from './GestureHandlerNative';
2
+ //# sourceMappingURL=GestureHandler.android.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GestureHandler.android.d.ts","sourceRoot":"","sources":["../../../../src/views/GestureHandler.android.tsx"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import { View } from 'react-native';
3
+ export declare const PanGestureHandler: React.ComponentType<import("react-native-gesture-handler").PanGestureHandlerProps>;
4
+ export declare const TapGestureHandler: React.ComponentType<import("react-native-gesture-handler").TapGestureHandlerProps>;
5
+ export declare const GestureHandlerRootView: typeof View;
6
+ export declare const enum GestureState {
7
+ UNDETERMINED = 0,
8
+ FAILED = 1,
9
+ BEGAN = 2,
10
+ CANCELLED = 3,
11
+ ACTIVE = 4,
12
+ END = 5
13
+ }
14
+ export type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';
15
+ //# sourceMappingURL=GestureHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GestureHandler.d.ts","sourceRoot":"","sources":["../../../../src/views/GestureHandler.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAUpC,eAAO,MAAM,iBAAiB,oFAC6B,CAAC;AAE5D,eAAO,MAAM,iBAAiB,oFAC6B,CAAC;AAE5D,eAAO,MAAM,sBAAsB,aAAO,CAAC;AAE3C,0BAAkB,YAAY;IAC5B,YAAY,IAAI;IAChB,MAAM,IAAI;IACV,KAAK,IAAI;IACT,SAAS,IAAI;IACb,MAAM,IAAI;IACV,GAAG,IAAI;CACR;AAED,YAAY,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './GestureHandlerNative';
2
+ //# sourceMappingURL=GestureHandler.ios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GestureHandler.ios.d.ts","sourceRoot":"","sources":["../../../../src/views/GestureHandler.ios.tsx"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { PanGestureHandlerProperties } from 'react-native-gesture-handler';
3
+ export declare function PanGestureHandler(props: PanGestureHandlerProperties): JSX.Element;
4
+ export type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';
5
+ export { GestureHandlerRootView, State as GestureState, TapGestureHandler, } from 'react-native-gesture-handler';
6
+ //# sourceMappingURL=GestureHandlerNative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GestureHandlerNative.d.ts","sourceRoot":"","sources":["../../../../src/views/GestureHandlerNative.tsx"],"names":[],"mappings":";AACA,OAAO,EAEL,2BAA2B,EAC5B,MAAM,8BAA8B,CAAC;AAItC,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,2BAA2B,eAQnE;AAED,YAAY,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EACL,sBAAsB,EACtB,KAAK,IAAI,YAAY,EACrB,iBAAiB,GAClB,MAAM,8BAA8B,CAAC"}