@rific/drawer 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +41 -35
- package/dist/index.mjs +39 -33
- package/package.json +4 -2
- package/src/Drawer.tsx +81 -27
- package/src/DrawerConfig.tsx +8 -22
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, JSX, ComponentType } from 'react';
|
|
3
3
|
import { SharedValue } from 'react-native-reanimated';
|
|
4
|
+
import * as _rific_core from '@rific/core';
|
|
4
5
|
import { LayoutChangeEvent, StyleProp, ViewStyle } from 'react-native';
|
|
5
6
|
|
|
6
7
|
type DrawerSide = 'left' | 'right' | 'top' | 'bottom';
|
|
@@ -95,12 +96,12 @@ type DrawerConfig = {
|
|
|
95
96
|
/** Injects @rific/auto-paper so Drawer's panel renders a real frosted-glass backdrop via BlurView/useBlur instead of its solid-fill fallback. Pass `import * as AutoPaper from '@rific/auto-paper'`; omit to keep the solid fallback. */
|
|
96
97
|
autoPaper?: AutoPaperModule;
|
|
97
98
|
};
|
|
98
|
-
declare const configureDrawer: (next: DrawerConfig) => void;
|
|
99
|
+
declare const configureDrawer: (next: Partial<DrawerConfig>) => void;
|
|
99
100
|
declare const getDrawerConfig: () => DrawerConfig;
|
|
101
|
+
declare const DrawerProvider: (props: _rific_core.ModuleConfigProviderProps<DrawerConfig>) => React.JSX.Element;
|
|
100
102
|
type DrawerProviderProps = DrawerConfig & {
|
|
101
103
|
children: ReactNode;
|
|
102
104
|
};
|
|
103
|
-
declare const DrawerProvider: ({ autoPaper, children }: DrawerProviderProps) => react.JSX.Element;
|
|
104
105
|
|
|
105
106
|
type DrawerEdgeSwipeProps = {
|
|
106
107
|
edgeInset?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, JSX, ComponentType } from 'react';
|
|
3
3
|
import { SharedValue } from 'react-native-reanimated';
|
|
4
|
+
import * as _rific_core from '@rific/core';
|
|
4
5
|
import { LayoutChangeEvent, StyleProp, ViewStyle } from 'react-native';
|
|
5
6
|
|
|
6
7
|
type DrawerSide = 'left' | 'right' | 'top' | 'bottom';
|
|
@@ -95,12 +96,12 @@ type DrawerConfig = {
|
|
|
95
96
|
/** Injects @rific/auto-paper so Drawer's panel renders a real frosted-glass backdrop via BlurView/useBlur instead of its solid-fill fallback. Pass `import * as AutoPaper from '@rific/auto-paper'`; omit to keep the solid fallback. */
|
|
96
97
|
autoPaper?: AutoPaperModule;
|
|
97
98
|
};
|
|
98
|
-
declare const configureDrawer: (next: DrawerConfig) => void;
|
|
99
|
+
declare const configureDrawer: (next: Partial<DrawerConfig>) => void;
|
|
99
100
|
declare const getDrawerConfig: () => DrawerConfig;
|
|
101
|
+
declare const DrawerProvider: (props: _rific_core.ModuleConfigProviderProps<DrawerConfig>) => React.JSX.Element;
|
|
100
102
|
type DrawerProviderProps = DrawerConfig & {
|
|
101
103
|
children: ReactNode;
|
|
102
104
|
};
|
|
103
|
-
declare const DrawerProvider: ({ autoPaper, children }: DrawerProviderProps) => react.JSX.Element;
|
|
104
105
|
|
|
105
106
|
type DrawerEdgeSwipeProps = {
|
|
106
107
|
edgeInset?: number;
|
package/dist/index.js
CHANGED
|
@@ -53,16 +53,11 @@ var import_react_native_paper = require("react-native-paper");
|
|
|
53
53
|
var import_react_native_reanimated = __toESM(require("react-native-reanimated"));
|
|
54
54
|
|
|
55
55
|
// src/DrawerConfig.tsx
|
|
56
|
-
var
|
|
57
|
-
var
|
|
58
|
-
var configureDrawer =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var getDrawerConfig = () => config;
|
|
62
|
-
var DrawerProvider = ({ autoPaper, children }) => {
|
|
63
|
-
configureDrawer({ autoPaper });
|
|
64
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
65
|
-
};
|
|
56
|
+
var import_core = require("@rific/core");
|
|
57
|
+
var drawerConfig = (0, import_core.createModuleConfig)();
|
|
58
|
+
var configureDrawer = drawerConfig.configure;
|
|
59
|
+
var getDrawerConfig = drawerConfig.getConfig;
|
|
60
|
+
var DrawerProvider = drawerConfig.Provider;
|
|
66
61
|
|
|
67
62
|
// src/geometry.ts
|
|
68
63
|
function isVerticalSide(side) {
|
|
@@ -92,7 +87,7 @@ function useDrawerSize(side, size, maxSize, edgeInset = 0) {
|
|
|
92
87
|
}
|
|
93
88
|
|
|
94
89
|
// src/Drawer.tsx
|
|
95
|
-
var
|
|
90
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
96
91
|
var SPRING = { damping: 45, stiffness: 500, overshootClamping: true, restDisplacementThreshold: 0.5, restSpeedThreshold: 10 };
|
|
97
92
|
var VELOCITY_THRESHOLD = 500;
|
|
98
93
|
var useBlurFallback = (override) => override ?? false;
|
|
@@ -137,7 +132,8 @@ var Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur, children,
|
|
|
137
132
|
const drawerStyle = (0, import_react_native_reanimated.useAnimatedStyle)(() => ({ transform: [vertical ? { translateY: translateOffset.value } : { translateX: translateOffset.value }] }));
|
|
138
133
|
const backdropStyle = (0, import_react_native_reanimated.useAnimatedStyle)(() => ({ opacity: maxEffectiveSize > 0 ? (1 - Math.abs(translateOffset.value) / maxEffectiveSize) * backdropOpacity : 0 }));
|
|
139
134
|
const animatedSizeStyle = (0, import_react_native_reanimated.useAnimatedStyle)(() => vertical ? { height: animatedSize.value } : { width: animatedSize.value });
|
|
140
|
-
const backdropInteractionStyle = { zIndex, pointerEvents: open && blockingBackdrop ? "
|
|
135
|
+
const backdropInteractionStyle = { zIndex, pointerEvents: open && blockingBackdrop ? "box-none" : "none" };
|
|
136
|
+
const backdropTapAreaStyle = side === "left" ? { left: maxEffectiveSize } : side === "right" ? { right: maxEffectiveSize } : side === "top" ? { top: maxEffectiveSize } : { bottom: maxEffectiveSize };
|
|
141
137
|
const positionStyle = side === "left" ? styles.anchorLeft : side === "right" ? styles.anchorRight : side === "top" ? styles.anchorTop : styles.anchorBottom;
|
|
142
138
|
const sizeStyle = vertical ? { height: maxEffectiveSize } : { width: maxEffectiveSize };
|
|
143
139
|
const handleLayout = (event) => {
|
|
@@ -148,13 +144,13 @@ var Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur, children,
|
|
|
148
144
|
onMeasure?.(measured);
|
|
149
145
|
};
|
|
150
146
|
const fillStyle = import_react_native2.StyleSheet.absoluteFill;
|
|
151
|
-
const fill = resolvedBlur && autoPaper ? contentSize ? /* @__PURE__ */ (0,
|
|
152
|
-
/* @__PURE__ */ (0,
|
|
153
|
-
/* @__PURE__ */ (0,
|
|
154
|
-
] }) : /* @__PURE__ */ (0,
|
|
155
|
-
/* @__PURE__ */ (0,
|
|
156
|
-
/* @__PURE__ */ (0,
|
|
157
|
-
] }) : /* @__PURE__ */ (0,
|
|
147
|
+
const fill = resolvedBlur && autoPaper ? contentSize ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
148
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(autoPaper.BlurView, { style: fillStyle }),
|
|
149
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.View, { onLayout: handleLayout, children })
|
|
150
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(autoPaper.BlurView, { style: fillStyle, children }) : contentSize ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
151
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.View, { style: [fillStyle, { backgroundColor: colors.surface }] }),
|
|
152
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.View, { onLayout: handleLayout, children })
|
|
153
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.View, { style: [fillStyle, { backgroundColor: colors.surface }], children });
|
|
158
154
|
const drawerOuterStyle = contentSize ? [styles.drawer, positionStyle, drawerStyle, animatedSizeStyle, { zIndex: zIndex + 1 }] : [styles.drawer, positionStyle, sizeStyle, drawerStyle, { zIndex: zIndex + 1 }];
|
|
159
155
|
const contentClipStyle = [fillStyle, styles.clip, { flexDirection: vertical ? "column" : "row" }];
|
|
160
156
|
const clampMin = Math.min(0, closedOffset);
|
|
@@ -209,16 +205,16 @@ var Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur, children,
|
|
|
209
205
|
const visibleSize = maxEffectiveSize - translateOffset.value * closeDirection;
|
|
210
206
|
return { opacity: Math.min(1, Math.max(0, visibleSize / panelShadowFadeDistance)) };
|
|
211
207
|
});
|
|
212
|
-
return /* @__PURE__ */ (0,
|
|
213
|
-
/* @__PURE__ */ (0,
|
|
214
|
-
/* @__PURE__ */ (0,
|
|
215
|
-
/* @__PURE__ */ (0,
|
|
208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
209
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native_reanimated.default.View, { style: [styles.backdropPosition, backdropInteractionStyle], children: [
|
|
210
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native_reanimated.default.View, { style: [styles.backdropTint, backdropStyle], pointerEvents: "none" }),
|
|
211
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native_gesture_handler.GestureDetector, { gesture: backdropTapGesture, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native_reanimated.default.View, { collapsable: false, style: [import_react_native2.StyleSheet.absoluteFill, backdropTapAreaStyle] }) })
|
|
216
212
|
] }),
|
|
217
|
-
/* @__PURE__ */ (0,
|
|
218
|
-
resolvedPanelShadow && /* @__PURE__ */ (0,
|
|
219
|
-
contentSize ? /* @__PURE__ */ (0,
|
|
220
|
-
dismissible && /* @__PURE__ */ (0,
|
|
221
|
-
] })
|
|
213
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.View, { pointerEvents: "box-none", style: styles.panelClip, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native_reanimated.default.View, { style: drawerOuterStyle, children: [
|
|
214
|
+
resolvedPanelShadow && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native_reanimated.default.View, { pointerEvents: "none", style: [import_react_native2.StyleSheet.absoluteFill, panelShadowStyle, panelShadowVisibilityStyle] }),
|
|
215
|
+
contentSize ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.View, { style: contentClipStyle, children: fill }) : fill,
|
|
216
|
+
dismissible && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native_gesture_handler.GestureDetector, { gesture: handleGesture, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native_reanimated.default.View, { style: [styles.handleStrip, handleStripSizeStyle, handleStripEdgeStyle, handleStripPaddingStyle, webCursorStyle2, handleVisibilityStyle, handleStripInteractionStyle], children: showHandle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.View, { style: [styles.handlePill, handlePillStyle, { backgroundColor: colors.surface }] }) }) })
|
|
217
|
+
] }) })
|
|
222
218
|
] });
|
|
223
219
|
};
|
|
224
220
|
var styles = import_react_native2.StyleSheet.create({
|
|
@@ -270,6 +266,16 @@ var styles = import_react_native2.StyleSheet.create({
|
|
|
270
266
|
alignItems: "center",
|
|
271
267
|
justifyContent: "center",
|
|
272
268
|
position: "absolute"
|
|
269
|
+
},
|
|
270
|
+
// See the comment above <View style={styles.panelClip}> in the render — the unconditional clip
|
|
271
|
+
// ancestor that keeps a translated-off-screen "closed" panel from inflating page scroll extent.
|
|
272
|
+
panelClip: {
|
|
273
|
+
bottom: 0,
|
|
274
|
+
left: 0,
|
|
275
|
+
overflow: "hidden",
|
|
276
|
+
position: "absolute",
|
|
277
|
+
right: 0,
|
|
278
|
+
top: 0
|
|
273
279
|
}
|
|
274
280
|
});
|
|
275
281
|
|
|
@@ -277,7 +283,7 @@ var styles = import_react_native2.StyleSheet.create({
|
|
|
277
283
|
var import_react_native3 = require("react-native");
|
|
278
284
|
var import_react_native_gesture_handler2 = require("react-native-gesture-handler");
|
|
279
285
|
var import_react_native_reanimated2 = require("react-native-reanimated");
|
|
280
|
-
var
|
|
286
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
281
287
|
var EDGE_WIDTH = 24;
|
|
282
288
|
var SPRING2 = { damping: 45, overshootClamping: true, stiffness: 500, restDisplacementThreshold: 0.5, restSpeedThreshold: 10 };
|
|
283
289
|
var VELOCITY_THRESHOLD2 = 500;
|
|
@@ -305,7 +311,7 @@ var DrawerEdgeSwipe = ({ edgeInset = 0, enabled = true, height = 300, insetBotto
|
|
|
305
311
|
}
|
|
306
312
|
});
|
|
307
313
|
const edgeStyle = vertical ? [styles2.edgeHorizontal, side === "top" ? styles2.top : styles2.bottom, { left: insetLeft, right: insetRight }] : [styles2.edgeVertical, side === "left" ? styles2.left : styles2.right, { bottom: insetBottom, top: insetTop }];
|
|
308
|
-
return /* @__PURE__ */ (0,
|
|
314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native_gesture_handler2.GestureDetector, { gesture, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.View, { style: [...edgeStyle, webCursorStyle, enabled ? styles2.interactive : styles2.nonInteractive] }) });
|
|
309
315
|
};
|
|
310
316
|
var webCursorStyle = { cursor: import_react_native3.Platform.OS === "web" ? "pointer" : void 0 };
|
|
311
317
|
var styles2 = import_react_native3.StyleSheet.create({
|
|
@@ -334,7 +340,7 @@ var styles2 = import_react_native3.StyleSheet.create({
|
|
|
334
340
|
});
|
|
335
341
|
|
|
336
342
|
// src/createDrawer.tsx
|
|
337
|
-
var
|
|
343
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
338
344
|
var noop = () => {
|
|
339
345
|
};
|
|
340
346
|
var createDrawer = ({ backdropOpacity: factoryBackdropOpacity, blockingBackdrop: factoryBlockingBackdrop, blur: factoryBlur, closeOnBackPress: factoryCloseOnBackPress, contentSize: factoryContentSize, dismissible: factoryDismissible, edgeInset = 0, height = 300, maxHeight, maxWidth, showHandle: factoryShowHandle, side = "left", width = 300, zIndex: factoryZIndex } = {}) => {
|
|
@@ -387,17 +393,17 @@ var createDrawer = ({ backdropOpacity: factoryBackdropOpacity, blockingBackdrop:
|
|
|
387
393
|
});
|
|
388
394
|
return () => subscription.remove();
|
|
389
395
|
}, [isOpen, closeOnBackPress]);
|
|
390
|
-
return /* @__PURE__ */ (0,
|
|
396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(DrawerActionsContext.Provider, { value: actions, children: [
|
|
391
397
|
children,
|
|
392
|
-
/* @__PURE__ */ (0,
|
|
393
|
-
/* @__PURE__ */ (0,
|
|
398
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DrawerEdgeSwipe, { edgeInset, enabled: enabled && !isOpen, height: vertical ? effectiveSize : height, maxHeight, maxWidth, onOpen: open, side, translateOffset, width: vertical ? width : effectiveSize }),
|
|
399
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Drawer, { backdropOpacity, blockingBackdrop, blur, contentSize, dismissible, edgeInset, height: vertical ? effectiveSize : height, maxHeight, maxWidth, onClose: () => setIsOpen(false), onClosed: () => setIsVisible(false), onMeasure: setMeasuredSize, open: isOpen, showHandle, side, translateOffset, width: vertical ? width : effectiveSize, zIndex, children: content })
|
|
394
400
|
] });
|
|
395
401
|
};
|
|
396
402
|
const useDrawer = () => (0, import_react2.useContext)(DrawerActionsContext);
|
|
397
403
|
return { DrawerInstanceProvider, useDrawer };
|
|
398
404
|
};
|
|
399
405
|
var combineDrawerProviders = (...entries) => {
|
|
400
|
-
const CombinedDrawerProviders = ({ children }) => entries.reduceRight((acc, [Provider, props]) => /* @__PURE__ */ (0,
|
|
406
|
+
const CombinedDrawerProviders = ({ children }) => entries.reduceRight((acc, [Provider, props]) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Provider, { ...props, children: acc }), children);
|
|
401
407
|
return CombinedDrawerProviders;
|
|
402
408
|
};
|
|
403
409
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -11,16 +11,11 @@ import { useTheme } from "react-native-paper";
|
|
|
11
11
|
import Animated, { runOnJS, useAnimatedStyle, useSharedValue, withSpring, withTiming } from "react-native-reanimated";
|
|
12
12
|
|
|
13
13
|
// src/DrawerConfig.tsx
|
|
14
|
-
import {
|
|
15
|
-
var
|
|
16
|
-
var configureDrawer =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var getDrawerConfig = () => config;
|
|
20
|
-
var DrawerProvider = ({ autoPaper, children }) => {
|
|
21
|
-
configureDrawer({ autoPaper });
|
|
22
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
23
|
-
};
|
|
14
|
+
import { createModuleConfig } from "@rific/core";
|
|
15
|
+
var drawerConfig = createModuleConfig();
|
|
16
|
+
var configureDrawer = drawerConfig.configure;
|
|
17
|
+
var getDrawerConfig = drawerConfig.getConfig;
|
|
18
|
+
var DrawerProvider = drawerConfig.Provider;
|
|
24
19
|
|
|
25
20
|
// src/geometry.ts
|
|
26
21
|
function isVerticalSide(side) {
|
|
@@ -50,7 +45,7 @@ function useDrawerSize(side, size, maxSize, edgeInset = 0) {
|
|
|
50
45
|
}
|
|
51
46
|
|
|
52
47
|
// src/Drawer.tsx
|
|
53
|
-
import { Fragment
|
|
48
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
54
49
|
var SPRING = { damping: 45, stiffness: 500, overshootClamping: true, restDisplacementThreshold: 0.5, restSpeedThreshold: 10 };
|
|
55
50
|
var VELOCITY_THRESHOLD = 500;
|
|
56
51
|
var useBlurFallback = (override) => override ?? false;
|
|
@@ -95,7 +90,8 @@ var Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur, children,
|
|
|
95
90
|
const drawerStyle = useAnimatedStyle(() => ({ transform: [vertical ? { translateY: translateOffset.value } : { translateX: translateOffset.value }] }));
|
|
96
91
|
const backdropStyle = useAnimatedStyle(() => ({ opacity: maxEffectiveSize > 0 ? (1 - Math.abs(translateOffset.value) / maxEffectiveSize) * backdropOpacity : 0 }));
|
|
97
92
|
const animatedSizeStyle = useAnimatedStyle(() => vertical ? { height: animatedSize.value } : { width: animatedSize.value });
|
|
98
|
-
const backdropInteractionStyle = { zIndex, pointerEvents: open && blockingBackdrop ? "
|
|
93
|
+
const backdropInteractionStyle = { zIndex, pointerEvents: open && blockingBackdrop ? "box-none" : "none" };
|
|
94
|
+
const backdropTapAreaStyle = side === "left" ? { left: maxEffectiveSize } : side === "right" ? { right: maxEffectiveSize } : side === "top" ? { top: maxEffectiveSize } : { bottom: maxEffectiveSize };
|
|
99
95
|
const positionStyle = side === "left" ? styles.anchorLeft : side === "right" ? styles.anchorRight : side === "top" ? styles.anchorTop : styles.anchorBottom;
|
|
100
96
|
const sizeStyle = vertical ? { height: maxEffectiveSize } : { width: maxEffectiveSize };
|
|
101
97
|
const handleLayout = (event) => {
|
|
@@ -106,13 +102,13 @@ var Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur, children,
|
|
|
106
102
|
onMeasure?.(measured);
|
|
107
103
|
};
|
|
108
104
|
const fillStyle = StyleSheet.absoluteFill;
|
|
109
|
-
const fill = resolvedBlur && autoPaper ? contentSize ? /* @__PURE__ */ jsxs(
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
] }) : /* @__PURE__ */
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
/* @__PURE__ */
|
|
115
|
-
] }) : /* @__PURE__ */
|
|
105
|
+
const fill = resolvedBlur && autoPaper ? contentSize ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
106
|
+
/* @__PURE__ */ jsx(autoPaper.BlurView, { style: fillStyle }),
|
|
107
|
+
/* @__PURE__ */ jsx(View, { onLayout: handleLayout, children })
|
|
108
|
+
] }) : /* @__PURE__ */ jsx(autoPaper.BlurView, { style: fillStyle, children }) : contentSize ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
109
|
+
/* @__PURE__ */ jsx(View, { style: [fillStyle, { backgroundColor: colors.surface }] }),
|
|
110
|
+
/* @__PURE__ */ jsx(View, { onLayout: handleLayout, children })
|
|
111
|
+
] }) : /* @__PURE__ */ jsx(View, { style: [fillStyle, { backgroundColor: colors.surface }], children });
|
|
116
112
|
const drawerOuterStyle = contentSize ? [styles.drawer, positionStyle, drawerStyle, animatedSizeStyle, { zIndex: zIndex + 1 }] : [styles.drawer, positionStyle, sizeStyle, drawerStyle, { zIndex: zIndex + 1 }];
|
|
117
113
|
const contentClipStyle = [fillStyle, styles.clip, { flexDirection: vertical ? "column" : "row" }];
|
|
118
114
|
const clampMin = Math.min(0, closedOffset);
|
|
@@ -167,16 +163,16 @@ var Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur, children,
|
|
|
167
163
|
const visibleSize = maxEffectiveSize - translateOffset.value * closeDirection;
|
|
168
164
|
return { opacity: Math.min(1, Math.max(0, visibleSize / panelShadowFadeDistance)) };
|
|
169
165
|
});
|
|
170
|
-
return /* @__PURE__ */ jsxs(
|
|
166
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
171
167
|
/* @__PURE__ */ jsxs(Animated.View, { style: [styles.backdropPosition, backdropInteractionStyle], children: [
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ jsx(Animated.View, { style: [styles.backdropTint, backdropStyle], pointerEvents: "none" }),
|
|
169
|
+
/* @__PURE__ */ jsx(GestureDetector, { gesture: backdropTapGesture, children: /* @__PURE__ */ jsx(Animated.View, { collapsable: false, style: [StyleSheet.absoluteFill, backdropTapAreaStyle] }) })
|
|
174
170
|
] }),
|
|
175
|
-
/* @__PURE__ */ jsxs(Animated.View, { style: drawerOuterStyle, children: [
|
|
176
|
-
resolvedPanelShadow && /* @__PURE__ */
|
|
177
|
-
contentSize ? /* @__PURE__ */
|
|
178
|
-
dismissible && /* @__PURE__ */
|
|
179
|
-
] })
|
|
171
|
+
/* @__PURE__ */ jsx(View, { pointerEvents: "box-none", style: styles.panelClip, children: /* @__PURE__ */ jsxs(Animated.View, { style: drawerOuterStyle, children: [
|
|
172
|
+
resolvedPanelShadow && /* @__PURE__ */ jsx(Animated.View, { pointerEvents: "none", style: [StyleSheet.absoluteFill, panelShadowStyle, panelShadowVisibilityStyle] }),
|
|
173
|
+
contentSize ? /* @__PURE__ */ jsx(View, { style: contentClipStyle, children: fill }) : fill,
|
|
174
|
+
dismissible && /* @__PURE__ */ jsx(GestureDetector, { gesture: handleGesture, children: /* @__PURE__ */ jsx(Animated.View, { style: [styles.handleStrip, handleStripSizeStyle, handleStripEdgeStyle, handleStripPaddingStyle, webCursorStyle2, handleVisibilityStyle, handleStripInteractionStyle], children: showHandle && /* @__PURE__ */ jsx(View, { style: [styles.handlePill, handlePillStyle, { backgroundColor: colors.surface }] }) }) })
|
|
175
|
+
] }) })
|
|
180
176
|
] });
|
|
181
177
|
};
|
|
182
178
|
var styles = StyleSheet.create({
|
|
@@ -228,6 +224,16 @@ var styles = StyleSheet.create({
|
|
|
228
224
|
alignItems: "center",
|
|
229
225
|
justifyContent: "center",
|
|
230
226
|
position: "absolute"
|
|
227
|
+
},
|
|
228
|
+
// See the comment above <View style={styles.panelClip}> in the render — the unconditional clip
|
|
229
|
+
// ancestor that keeps a translated-off-screen "closed" panel from inflating page scroll extent.
|
|
230
|
+
panelClip: {
|
|
231
|
+
bottom: 0,
|
|
232
|
+
left: 0,
|
|
233
|
+
overflow: "hidden",
|
|
234
|
+
position: "absolute",
|
|
235
|
+
right: 0,
|
|
236
|
+
top: 0
|
|
231
237
|
}
|
|
232
238
|
});
|
|
233
239
|
|
|
@@ -235,7 +241,7 @@ var styles = StyleSheet.create({
|
|
|
235
241
|
import { Platform as Platform2, StyleSheet as StyleSheet2, View as View2 } from "react-native";
|
|
236
242
|
import { Gesture as Gesture2, GestureDetector as GestureDetector2 } from "react-native-gesture-handler";
|
|
237
243
|
import { runOnJS as runOnJS2, withSpring as withSpring2 } from "react-native-reanimated";
|
|
238
|
-
import { jsx as
|
|
244
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
239
245
|
var EDGE_WIDTH = 24;
|
|
240
246
|
var SPRING2 = { damping: 45, overshootClamping: true, stiffness: 500, restDisplacementThreshold: 0.5, restSpeedThreshold: 10 };
|
|
241
247
|
var VELOCITY_THRESHOLD2 = 500;
|
|
@@ -263,7 +269,7 @@ var DrawerEdgeSwipe = ({ edgeInset = 0, enabled = true, height = 300, insetBotto
|
|
|
263
269
|
}
|
|
264
270
|
});
|
|
265
271
|
const edgeStyle = vertical ? [styles2.edgeHorizontal, side === "top" ? styles2.top : styles2.bottom, { left: insetLeft, right: insetRight }] : [styles2.edgeVertical, side === "left" ? styles2.left : styles2.right, { bottom: insetBottom, top: insetTop }];
|
|
266
|
-
return /* @__PURE__ */
|
|
272
|
+
return /* @__PURE__ */ jsx2(GestureDetector2, { gesture, children: /* @__PURE__ */ jsx2(View2, { style: [...edgeStyle, webCursorStyle, enabled ? styles2.interactive : styles2.nonInteractive] }) });
|
|
267
273
|
};
|
|
268
274
|
var webCursorStyle = { cursor: Platform2.OS === "web" ? "pointer" : void 0 };
|
|
269
275
|
var styles2 = StyleSheet2.create({
|
|
@@ -292,7 +298,7 @@ var styles2 = StyleSheet2.create({
|
|
|
292
298
|
});
|
|
293
299
|
|
|
294
300
|
// src/createDrawer.tsx
|
|
295
|
-
import { jsx as
|
|
301
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
296
302
|
var noop = () => {
|
|
297
303
|
};
|
|
298
304
|
var createDrawer = ({ backdropOpacity: factoryBackdropOpacity, blockingBackdrop: factoryBlockingBackdrop, blur: factoryBlur, closeOnBackPress: factoryCloseOnBackPress, contentSize: factoryContentSize, dismissible: factoryDismissible, edgeInset = 0, height = 300, maxHeight, maxWidth, showHandle: factoryShowHandle, side = "left", width = 300, zIndex: factoryZIndex } = {}) => {
|
|
@@ -347,15 +353,15 @@ var createDrawer = ({ backdropOpacity: factoryBackdropOpacity, blockingBackdrop:
|
|
|
347
353
|
}, [isOpen, closeOnBackPress]);
|
|
348
354
|
return /* @__PURE__ */ jsxs2(DrawerActionsContext.Provider, { value: actions, children: [
|
|
349
355
|
children,
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
/* @__PURE__ */
|
|
356
|
+
/* @__PURE__ */ jsx3(DrawerEdgeSwipe, { edgeInset, enabled: enabled && !isOpen, height: vertical ? effectiveSize : height, maxHeight, maxWidth, onOpen: open, side, translateOffset, width: vertical ? width : effectiveSize }),
|
|
357
|
+
/* @__PURE__ */ jsx3(Drawer, { backdropOpacity, blockingBackdrop, blur, contentSize, dismissible, edgeInset, height: vertical ? effectiveSize : height, maxHeight, maxWidth, onClose: () => setIsOpen(false), onClosed: () => setIsVisible(false), onMeasure: setMeasuredSize, open: isOpen, showHandle, side, translateOffset, width: vertical ? width : effectiveSize, zIndex, children: content })
|
|
352
358
|
] });
|
|
353
359
|
};
|
|
354
360
|
const useDrawer = () => useContext(DrawerActionsContext);
|
|
355
361
|
return { DrawerInstanceProvider, useDrawer };
|
|
356
362
|
};
|
|
357
363
|
var combineDrawerProviders = (...entries) => {
|
|
358
|
-
const CombinedDrawerProviders = ({ children }) => entries.reduceRight((acc, [Provider, props]) => /* @__PURE__ */
|
|
364
|
+
const CombinedDrawerProviders = ({ children }) => entries.reduceRight((acc, [Provider, props]) => /* @__PURE__ */ jsx3(Provider, { ...props, children: acc }), children);
|
|
359
365
|
return CombinedDrawerProviders;
|
|
360
366
|
};
|
|
361
367
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rific/drawer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Left/right sliding drawer with edge-swipe gestures for React Native: spring-animated, theme-aware, one factory call per drawer instance",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -65,7 +65,8 @@
|
|
|
65
65
|
"@infinitetoken/eslint-config": "0.2.0",
|
|
66
66
|
"@infinitetoken/jest-config": "^0.3.0",
|
|
67
67
|
"@infinitetoken/tsconfig": "^0.4.1",
|
|
68
|
-
"@rific/auto-paper": "^0.
|
|
68
|
+
"@rific/auto-paper": "^0.11.0",
|
|
69
|
+
"@rific/core": "^0.1.1",
|
|
69
70
|
"@testing-library/dom": "^10.4.1",
|
|
70
71
|
"@testing-library/react": "^16.3.2",
|
|
71
72
|
"@types/jest": "^30.0.0",
|
|
@@ -89,6 +90,7 @@
|
|
|
89
90
|
},
|
|
90
91
|
"peerDependencies": {
|
|
91
92
|
"@rific/auto-paper": ">=0.7.0",
|
|
93
|
+
"@rific/core": ">=0.1.1",
|
|
92
94
|
"react": ">=19.0.0",
|
|
93
95
|
"react-native": ">=0.83.0",
|
|
94
96
|
"react-native-gesture-handler": ">=2.20.0 <3.0.0",
|
package/src/Drawer.tsx
CHANGED
|
@@ -212,7 +212,27 @@ export const Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur,
|
|
|
212
212
|
// transparent, matching "closed," since a not-yet-sized panel isn't meaningfully open yet either.
|
|
213
213
|
const backdropStyle = useAnimatedStyle(() => ({ opacity: maxEffectiveSize > 0 ? (1 - Math.abs(translateOffset.value) / maxEffectiveSize) * backdropOpacity : 0 }))
|
|
214
214
|
const animatedSizeStyle = useAnimatedStyle(() => (vertical ? { height: animatedSize.value } : { width: animatedSize.value }))
|
|
215
|
-
|
|
215
|
+
// 'box-none' (not 'auto'): this wrapper is just a positioning shell around the dimming tint and
|
|
216
|
+
// the actual tap-catching view below — on react-native-web, an ancestor's own explicit zIndex
|
|
217
|
+
// wins hit-testing over a plain-DOM-order sibling's z-index:auto descendants (panelClip, wrapping
|
|
218
|
+
// the panel, never sets its own zIndex — only ITS child does), so this wrapper being 'auto' made
|
|
219
|
+
// its own full-screen box outrank the panel for every click anywhere on screen, even where the
|
|
220
|
+
// panel visually covers it — a tap on real panel content (e.g. a settings toggle) would land on
|
|
221
|
+
// this inert wrapper instead and silently do nothing. 'box-none' keeps the wrapper itself out of
|
|
222
|
+
// hit-testing while still letting its own children (the tap-catcher below) receive touches within
|
|
223
|
+
// their own (now-shrunk, see backdropTapAreaStyle) bounds — exactly the "auto" behavior this was
|
|
224
|
+
// meant to have, minus the container falsely claiming space it doesn't actually own.
|
|
225
|
+
const backdropInteractionStyle: ViewStyle = { zIndex, pointerEvents: open && blockingBackdrop ? 'box-none' : 'none' }
|
|
226
|
+
// react-native-gesture-handler's web backend resolves a Gesture.Tap's hit region from this
|
|
227
|
+
// view's own measured bounds, not from real DOM occlusion/z-index the way native UIKit/Android
|
|
228
|
+
// hit-testing does — so on web, a tap landing anywhere on the (opaque, higher-zIndex) panel on
|
|
229
|
+
// top of this backdrop was still satisfying the backdrop's OWN Tap gesture underneath it,
|
|
230
|
+
// closing the drawer out from under a perfectly normal tap on its content (e.g. a toggle inside
|
|
231
|
+
// a settings panel). Native is unaffected (its real view hierarchy already occludes correctly),
|
|
232
|
+
// but shrinking this view's own bounds to exclude the panel's footprint is correct on every
|
|
233
|
+
// platform regardless — that region was always hidden behind the opaque panel anyway, so this
|
|
234
|
+
// changes nothing observable, it just stops the gesture from being reachable there at all.
|
|
235
|
+
const backdropTapAreaStyle: ViewStyle = side === 'left' ? { left: maxEffectiveSize } : side === 'right' ? { right: maxEffectiveSize } : side === 'top' ? { top: maxEffectiveSize } : { bottom: maxEffectiveSize }
|
|
216
236
|
|
|
217
237
|
const positionStyle = side === 'left' ? styles.anchorLeft : side === 'right' ? styles.anchorRight : side === 'top' ? styles.anchorTop : styles.anchorBottom
|
|
218
238
|
// maxEffectiveSize, not the raw height/width prop: the box must be big enough to show the panel
|
|
@@ -464,34 +484,58 @@ export const Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur,
|
|
|
464
484
|
{/* collapsable={false}: this view has no paint properties of its own (no background,
|
|
465
485
|
no animated style), exactly the shape React Native's view-flattening optimizer removes
|
|
466
486
|
from the native tree on native platforms — leaving the GestureDetector above with no real
|
|
467
|
-
view left to attach its tap recognizer to, so it would silently never receive a touch.
|
|
468
|
-
|
|
487
|
+
view left to attach its tap recognizer to, so it would silently never receive a touch.
|
|
488
|
+
backdropTapAreaStyle shrinks this view's own bounds to exclude the panel's footprint —
|
|
489
|
+
see its own comment above for why that matters specifically on web. */}
|
|
490
|
+
<Animated.View collapsable={false} style={[StyleSheet.absoluteFill, backdropTapAreaStyle]} />
|
|
469
491
|
</GestureDetector>
|
|
470
492
|
</Animated.View>
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
493
|
+
{/* panelClip is a NEW, unconditional clipping ancestor around the panel — NOT the same box as
|
|
494
|
+
drawerOuterStyle/styles.drawer, and deliberately not itself transformed. drawerOuterStyle
|
|
495
|
+
carries the open/closed translate (drawerStyle) and is anchored flush to its edge at its
|
|
496
|
+
FULL maxEffectiveSize (sizeStyle) — so a "closed" panel is never actually removed from the
|
|
497
|
+
tree, only slid to closedOffset, which for side='right'/'bottom' lands at a POSITIVE
|
|
498
|
+
coordinate just past the visible edge (see geometry.ts's getClosedOffset — left/top land at
|
|
499
|
+
NEGATIVE coordinates instead, which ordinary page scroll can't reach, which is why this only
|
|
500
|
+
ever showed up on right/bottom drawers). With nothing upstream constraining that positive
|
|
501
|
+
offset, react-native-web's host page treats the translated-but-still-full-size panel as real
|
|
502
|
+
document content sitting just outside the viewport, which grows the page's scrollable area —
|
|
503
|
+
scrolling into it reveals a fully rendered "closed" panel. Adding overflow:'hidden' directly
|
|
504
|
+
to styles.drawer itself is NOT the fix: that's the same box the transform moves, so its own
|
|
505
|
+
clip region would travel with it and cut off the handle strip below, which is deliberately
|
|
506
|
+
positioned outside drawerOuterStyle's bounds (see its own comment). panelClip instead fills
|
|
507
|
+
the drawer's whole mount area (never itself transformed) and clips ITS bounds, which stay
|
|
508
|
+
fixed regardless of where the translated panel inside it currently sits — so the handle strip
|
|
509
|
+
(well within panelClip's much larger box) is unaffected, while a closed panel translated past
|
|
510
|
+
panelClip's edge is clipped from paint and stops contributing to page scroll extent.
|
|
511
|
+
pointerEvents='box-none': this wrapper spans the full mount area purely to establish the clip
|
|
512
|
+
boundary — it must never itself catch a touch, only its real content underneath should. */}
|
|
513
|
+
<View pointerEvents='box-none' style={styles.panelClip}>
|
|
514
|
+
<Animated.View style={drawerOuterStyle}>
|
|
515
|
+
{/* pointerEvents='none': purely decorative, drawn outside the panel's own box (a directional
|
|
516
|
+
box-shadow never paints over the box's own content area), so it has no business
|
|
517
|
+
intercepting anything even at full opacity. Absolutely filled to the panel's own current
|
|
518
|
+
bounds, contentSize included, rather than a fixed size, so it tracks that animation too. */}
|
|
519
|
+
{resolvedPanelShadow && <Animated.View pointerEvents='none' style={[StyleSheet.absoluteFill, panelShadowStyle, panelShadowVisibilityStyle]} />}
|
|
520
|
+
{contentSize ? <View style={contentClipStyle}>{fill}</View> : fill}
|
|
521
|
+
{dismissible && (
|
|
522
|
+
<GestureDetector gesture={handleGesture}>
|
|
523
|
+
{/* pointerEvents mirrors handleGesture's own .enabled(open) above, the same way the
|
|
524
|
+
backdrop's tap-catcher mirrors backdropTapGesture's .enabled(open && blockingBackdrop)
|
|
525
|
+
just above — handleVisibilityStyle's opacity already fades this strip out once the
|
|
526
|
+
panel's closed, but opacity alone doesn't stop hit-testing on web/Android (unlike iOS,
|
|
527
|
+
which excludes opacity-0 views from hit-testing regardless of pointerEvents — see the
|
|
528
|
+
backdrop tint's own comment on that asymmetry). Left at 'auto' while closed, this
|
|
529
|
+
48px-wide strip sits at zIndex+2 flush against the screen edge closest to `side` —
|
|
530
|
+
easy to land a consumer's own edge-anchored chrome (an app bar icon, say) in that same
|
|
531
|
+
band — and swallows taps meant for whatever's underneath it despite being invisible
|
|
532
|
+
AND, since the gesture itself is disabled here too, unable to do anything with them
|
|
533
|
+
either. */}
|
|
534
|
+
<Animated.View style={[styles.handleStrip, handleStripSizeStyle, handleStripEdgeStyle, handleStripPaddingStyle, webCursorStyle, handleVisibilityStyle, handleStripInteractionStyle]}>{showHandle && <View style={[styles.handlePill, handlePillStyle, { backgroundColor: colors.surface }]} />}</Animated.View>
|
|
535
|
+
</GestureDetector>
|
|
536
|
+
)}
|
|
537
|
+
</Animated.View>
|
|
538
|
+
</View>
|
|
495
539
|
</>
|
|
496
540
|
)
|
|
497
541
|
}
|
|
@@ -545,5 +589,15 @@ const styles = StyleSheet.create({
|
|
|
545
589
|
alignItems: 'center',
|
|
546
590
|
justifyContent: 'center',
|
|
547
591
|
position: 'absolute'
|
|
592
|
+
},
|
|
593
|
+
// See the comment above <View style={styles.panelClip}> in the render — the unconditional clip
|
|
594
|
+
// ancestor that keeps a translated-off-screen "closed" panel from inflating page scroll extent.
|
|
595
|
+
panelClip: {
|
|
596
|
+
bottom: 0,
|
|
597
|
+
left: 0,
|
|
598
|
+
overflow: 'hidden',
|
|
599
|
+
position: 'absolute',
|
|
600
|
+
right: 0,
|
|
601
|
+
top: 0
|
|
548
602
|
}
|
|
549
603
|
})
|
package/src/DrawerConfig.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createModuleConfig } from '@rific/core'
|
|
1
2
|
import { type ComponentType, type ReactNode } from 'react'
|
|
2
3
|
import type { LayoutChangeEvent, StyleProp, ViewStyle } from 'react-native'
|
|
3
4
|
|
|
@@ -17,32 +18,17 @@ export type DrawerConfig = {
|
|
|
17
18
|
autoPaper?: AutoPaperModule
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
//
|
|
23
|
-
// this app have @rific/auto-paper?"), not per-render reactive state, so a Provider that has
|
|
24
|
-
// to exist just to thread a value through the tree is more ceremony than the problem needs.
|
|
25
|
-
// Call this directly, or mount <DrawerProvider> once near your app root (it just calls this
|
|
26
|
-
// for you). Not reactive: calling it again after components have already rendered won't
|
|
27
|
-
// retroactively update them, fine for one-time startup config, not for runtime toggling.
|
|
21
|
+
// @rific/core's createModuleConfig() supplies the module-level config singleton (configure/
|
|
22
|
+
// getConfig/Provider) every @rific package wires up the same way - see its own doc comment for
|
|
23
|
+
// why this is plain module state rather than React Context.
|
|
28
24
|
//
|
|
29
25
|
// Not to be confused with the per-instance provider createDrawer() returns
|
|
30
26
|
// (DrawerInstanceProvider): this one is app-wide, mounted once, for optional peer config;
|
|
31
27
|
// that one is per-drawer, mounted once per createDrawer() call, for that drawer's own state.
|
|
32
|
-
|
|
33
|
-
config = { ...config, ...next }
|
|
34
|
-
}
|
|
28
|
+
const drawerConfig = createModuleConfig<DrawerConfig>()
|
|
35
29
|
|
|
36
|
-
export const
|
|
30
|
+
export const configureDrawer = drawerConfig.configure
|
|
31
|
+
export const getDrawerConfig = drawerConfig.getConfig
|
|
32
|
+
export const DrawerProvider = drawerConfig.Provider
|
|
37
33
|
|
|
38
34
|
export type DrawerProviderProps = DrawerConfig & { children: ReactNode }
|
|
39
|
-
|
|
40
|
-
// Thin wrapper around configureDrawer() for consumers who'd rather mount a Provider than call
|
|
41
|
-
// a setup function directly: every @rific package wires up the same way this way. Calls
|
|
42
|
-
// configureDrawer() synchronously during render (not in an effect), so the config is already
|
|
43
|
-
// set by the time any descendant <Drawer> renders. Effects run bottom-up after children have
|
|
44
|
-
// already rendered once, which would be one render too late here.
|
|
45
|
-
export const DrawerProvider = ({ autoPaper, children }: DrawerProviderProps) => {
|
|
46
|
-
configureDrawer({ autoPaper })
|
|
47
|
-
return <>{children}</>
|
|
48
|
-
}
|