@rific/drawer 0.6.0 → 0.6.2

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.js CHANGED
@@ -132,7 +132,7 @@ var Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur, children,
132
132
  const drawerStyle = (0, import_react_native_reanimated.useAnimatedStyle)(() => ({ transform: [vertical ? { translateY: translateOffset.value } : { translateX: translateOffset.value }] }));
133
133
  const backdropStyle = (0, import_react_native_reanimated.useAnimatedStyle)(() => ({ opacity: maxEffectiveSize > 0 ? (1 - Math.abs(translateOffset.value) / maxEffectiveSize) * backdropOpacity : 0 }));
134
134
  const animatedSizeStyle = (0, import_react_native_reanimated.useAnimatedStyle)(() => vertical ? { height: animatedSize.value } : { width: animatedSize.value });
135
- const backdropInteractionStyle = { zIndex, pointerEvents: open && blockingBackdrop ? "box-none" : "none" };
135
+ const backdropPointerEvents = open && blockingBackdrop ? "box-none" : "none";
136
136
  const backdropTapAreaStyle = side === "left" ? { left: maxEffectiveSize } : side === "right" ? { right: maxEffectiveSize } : side === "top" ? { top: maxEffectiveSize } : { bottom: maxEffectiveSize };
137
137
  const positionStyle = side === "left" ? styles.anchorLeft : side === "right" ? styles.anchorRight : side === "top" ? styles.anchorTop : styles.anchorBottom;
138
138
  const sizeStyle = vertical ? { height: maxEffectiveSize } : { width: maxEffectiveSize };
@@ -206,11 +206,11 @@ var Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur, children,
206
206
  return { opacity: Math.min(1, Math.max(0, visibleSize / panelShadowFadeDistance)) };
207
207
  });
208
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: [
209
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native_reanimated.default.View, { pointerEvents: backdropPointerEvents, style: [styles.backdropPosition, { zIndex }], children: [
210
210
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native_reanimated.default.View, { style: [styles.backdropTint, backdropStyle], pointerEvents: "none" }),
211
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] }) })
212
212
  ] }),
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: [
213
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.View, { pointerEvents: "box-none", style: [styles.panelClip, { zIndex: zIndex + 1 }], children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native_reanimated.default.View, { style: drawerOuterStyle, children: [
214
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
215
  contentSize ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.View, { style: contentClipStyle, children: fill }) : fill,
216
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 }] }) }) })
package/dist/index.mjs CHANGED
@@ -90,7 +90,7 @@ var Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur, children,
90
90
  const drawerStyle = useAnimatedStyle(() => ({ transform: [vertical ? { translateY: translateOffset.value } : { translateX: translateOffset.value }] }));
91
91
  const backdropStyle = useAnimatedStyle(() => ({ opacity: maxEffectiveSize > 0 ? (1 - Math.abs(translateOffset.value) / maxEffectiveSize) * backdropOpacity : 0 }));
92
92
  const animatedSizeStyle = useAnimatedStyle(() => vertical ? { height: animatedSize.value } : { width: animatedSize.value });
93
- const backdropInteractionStyle = { zIndex, pointerEvents: open && blockingBackdrop ? "box-none" : "none" };
93
+ const backdropPointerEvents = open && blockingBackdrop ? "box-none" : "none";
94
94
  const backdropTapAreaStyle = side === "left" ? { left: maxEffectiveSize } : side === "right" ? { right: maxEffectiveSize } : side === "top" ? { top: maxEffectiveSize } : { bottom: maxEffectiveSize };
95
95
  const positionStyle = side === "left" ? styles.anchorLeft : side === "right" ? styles.anchorRight : side === "top" ? styles.anchorTop : styles.anchorBottom;
96
96
  const sizeStyle = vertical ? { height: maxEffectiveSize } : { width: maxEffectiveSize };
@@ -164,11 +164,11 @@ var Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur, children,
164
164
  return { opacity: Math.min(1, Math.max(0, visibleSize / panelShadowFadeDistance)) };
165
165
  });
166
166
  return /* @__PURE__ */ jsxs(Fragment, { children: [
167
- /* @__PURE__ */ jsxs(Animated.View, { style: [styles.backdropPosition, backdropInteractionStyle], children: [
167
+ /* @__PURE__ */ jsxs(Animated.View, { pointerEvents: backdropPointerEvents, style: [styles.backdropPosition, { zIndex }], children: [
168
168
  /* @__PURE__ */ jsx(Animated.View, { style: [styles.backdropTint, backdropStyle], pointerEvents: "none" }),
169
169
  /* @__PURE__ */ jsx(GestureDetector, { gesture: backdropTapGesture, children: /* @__PURE__ */ jsx(Animated.View, { collapsable: false, style: [StyleSheet.absoluteFill, backdropTapAreaStyle] }) })
170
170
  ] }),
171
- /* @__PURE__ */ jsx(View, { pointerEvents: "box-none", style: styles.panelClip, children: /* @__PURE__ */ jsxs(Animated.View, { style: drawerOuterStyle, children: [
171
+ /* @__PURE__ */ jsx(View, { pointerEvents: "box-none", style: [styles.panelClip, { zIndex: zIndex + 1 }], children: /* @__PURE__ */ jsxs(Animated.View, { style: drawerOuterStyle, children: [
172
172
  resolvedPanelShadow && /* @__PURE__ */ jsx(Animated.View, { pointerEvents: "none", style: [StyleSheet.absoluteFill, panelShadowStyle, panelShadowVisibilityStyle] }),
173
173
  contentSize ? /* @__PURE__ */ jsx(View, { style: contentClipStyle, children: fill }) : fill,
174
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 }] }) }) })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rific/drawer",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
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",
@@ -95,8 +95,7 @@
95
95
  "react-native": ">=0.83.0",
96
96
  "react-native-gesture-handler": ">=2.20.0 <3.0.0",
97
97
  "react-native-paper": ">=5.0.0",
98
- "react-native-reanimated": ">=4.0.0",
99
- "react-native-worklets": "0.10.x"
98
+ "react-native-reanimated": ">=4.0.0"
100
99
  },
101
100
  "peerDependenciesMeta": {
102
101
  "@rific/auto-paper": {
package/src/Drawer.tsx CHANGED
@@ -214,15 +214,23 @@ export const Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur,
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
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
217
+ // wins hit-testing over a plain-DOM-order sibling's lower-tier descendants (the panel lives inside
218
+ // panelClip, which now carries the panel's tier itself — see its comment), so this wrapper being 'auto' made
219
219
  // its own full-screen box outrank the panel for every click anywhere on screen, even where the
220
220
  // panel visually covers it — a tap on real panel content (e.g. a settings toggle) would land on
221
221
  // this inert wrapper instead and silently do nothing. 'box-none' keeps the wrapper itself out of
222
222
  // hit-testing while still letting its own children (the tap-catcher below) receive touches within
223
223
  // their own (now-shrunk, see backdropTapAreaStyle) bounds — exactly the "auto" behavior this was
224
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' }
225
+ //
226
+ //
227
+ // Passed as the pointerEvents PROP, not inside style. On react-native-web a style
228
+ // `pointerEvents: 'box-none'` is written inline as a plain CSS `pointer-events: none`, with nothing
229
+ // switching the children back on - and Animated.View flattens styles to inline, so even a
230
+ // StyleSheet one ends up that way. The tap-catcher below inherited `none`, so a tap beside an open
231
+ // drawer fell straight through to the screen under it. The prop becomes RNW's box-none class,
232
+ // which does re-enable the children; it's how the tint and panelClip already set theirs.
233
+ const backdropPointerEvents = open && blockingBackdrop ? 'box-none' : 'none'
226
234
  // react-native-gesture-handler's web backend resolves a Gesture.Tap's hit region from this
227
235
  // view's own measured bounds, not from real DOM occlusion/z-index the way native UIKit/Android
228
236
  // hit-testing does — so on web, a tap landing anywhere on the (opaque, higher-zIndex) panel on
@@ -469,7 +477,7 @@ export const Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur,
469
477
 
470
478
  return (
471
479
  <>
472
- <Animated.View style={[styles.backdropPosition, backdropInteractionStyle]}>
480
+ <Animated.View pointerEvents={backdropPointerEvents} style={[styles.backdropPosition, { zIndex }]}>
473
481
  {/* The dimming tint is its own child, carrying the actual black backgroundColor and
474
482
  backdropStyle's animated opacity, separate from the tap-catching view below and from the
475
483
  OUTER container above (which must stay paint-free, not just visually transparent at
@@ -509,8 +517,13 @@ export const Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur,
509
517
  (well within panelClip's much larger box) is unaffected, while a closed panel translated past
510
518
  panelClip's edge is clipped from paint and stops contributing to page scroll extent.
511
519
  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}>
520
+ boundary — it must never itself catch a touch, only its real content underneath should.
521
+ zIndex + 1 (the panel's own tier) ON panelClip itself: react-native-web gives every View
522
+ z-index 0, which makes panelClip a stacking context of its own, so the panel's zIndex + 1
523
+ only ranks it inside panelClip. Without a tier here, the backdrop (zIndex, a sibling of
524
+ panelClip) painted over the whole panel, tint included, and an open drawer's own content
525
+ read as dimmed and disabled. */}
526
+ <View pointerEvents='box-none' style={[styles.panelClip, { zIndex: zIndex + 1 }]}>
514
527
  <Animated.View style={drawerOuterStyle}>
515
528
  {/* pointerEvents='none': purely decorative, drawn outside the panel's own box (a directional
516
529
  box-shadow never paints over the box's own content area), so it has no business