@rific/drawer 0.4.1 → 0.4.3
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/README.md +1 -1
- package/dist/index.js +5 -1
- package/dist/index.mjs +5 -1
- package/package.json +1 -3
- package/src/Drawer.tsx +1 -1
- package/src/DrawerEdgeSwipe.tsx +15 -2
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ npm install @rific/drawer
|
|
|
11
11
|
**Peer dependencies:**
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
|
-
npm install react-native-gesture-handler react-native-reanimated react-native-paper
|
|
14
|
+
npm install react-native-gesture-handler react-native-reanimated react-native-paper
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
Your app's root must already be wrapped in `GestureHandlerRootView` (from `react-native-gesture-handler`). This package doesn't add its own, since only one should ever wrap the whole app.
|
package/dist/index.js
CHANGED
|
@@ -305,7 +305,7 @@ var DrawerEdgeSwipe = ({ edgeInset = 0, enabled = true, height = 300, maxHeight,
|
|
|
305
305
|
}
|
|
306
306
|
});
|
|
307
307
|
const edgeStyle = vertical ? [styles2.edgeHorizontal, side === "top" ? styles2.top : styles2.bottom] : [styles2.edgeVertical, side === "left" ? styles2.left : styles2.right];
|
|
308
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native_gesture_handler2.GestureDetector, { gesture, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.View, { style: [...edgeStyle, webCursorStyle] }) });
|
|
308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native_gesture_handler2.GestureDetector, { gesture, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.View, { style: [...edgeStyle, webCursorStyle, enabled ? styles2.interactive : styles2.nonInteractive] }) });
|
|
309
309
|
};
|
|
310
310
|
var webCursorStyle = { cursor: import_react_native3.Platform.OS === "web" ? "pointer" : void 0 };
|
|
311
311
|
var styles2 = import_react_native3.StyleSheet.create({
|
|
@@ -324,7 +324,11 @@ var styles2 = import_react_native3.StyleSheet.create({
|
|
|
324
324
|
width: EDGE_WIDTH,
|
|
325
325
|
zIndex: 5
|
|
326
326
|
},
|
|
327
|
+
// See enabled's own comment above for why this needs to be a real style toggle, not just the
|
|
328
|
+
// gesture's own .enabled(enabled).
|
|
329
|
+
interactive: { pointerEvents: "auto" },
|
|
327
330
|
left: { left: 0 },
|
|
331
|
+
nonInteractive: { pointerEvents: "none" },
|
|
328
332
|
right: { right: 0 },
|
|
329
333
|
top: { top: 0 }
|
|
330
334
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -263,7 +263,7 @@ var DrawerEdgeSwipe = ({ edgeInset = 0, enabled = true, height = 300, maxHeight,
|
|
|
263
263
|
}
|
|
264
264
|
});
|
|
265
265
|
const edgeStyle = vertical ? [styles2.edgeHorizontal, side === "top" ? styles2.top : styles2.bottom] : [styles2.edgeVertical, side === "left" ? styles2.left : styles2.right];
|
|
266
|
-
return /* @__PURE__ */ jsx3(GestureDetector2, { gesture, children: /* @__PURE__ */ jsx3(View2, { style: [...edgeStyle, webCursorStyle] }) });
|
|
266
|
+
return /* @__PURE__ */ jsx3(GestureDetector2, { gesture, children: /* @__PURE__ */ jsx3(View2, { style: [...edgeStyle, webCursorStyle, enabled ? styles2.interactive : styles2.nonInteractive] }) });
|
|
267
267
|
};
|
|
268
268
|
var webCursorStyle = { cursor: Platform2.OS === "web" ? "pointer" : void 0 };
|
|
269
269
|
var styles2 = StyleSheet2.create({
|
|
@@ -282,7 +282,11 @@ var styles2 = StyleSheet2.create({
|
|
|
282
282
|
width: EDGE_WIDTH,
|
|
283
283
|
zIndex: 5
|
|
284
284
|
},
|
|
285
|
+
// See enabled's own comment above for why this needs to be a real style toggle, not just the
|
|
286
|
+
// gesture's own .enabled(enabled).
|
|
287
|
+
interactive: { pointerEvents: "auto" },
|
|
285
288
|
left: { left: 0 },
|
|
289
|
+
nonInteractive: { pointerEvents: "none" },
|
|
286
290
|
right: { right: 0 },
|
|
287
291
|
top: { top: 0 }
|
|
288
292
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rific/drawer",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
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",
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@rific/auto-paper": "^0.7.0",
|
|
64
|
-
"@rific/haptic-press": "^0.4.3",
|
|
65
64
|
"@testing-library/dom": "^10.4.1",
|
|
66
65
|
"@testing-library/react": "^16.3.2",
|
|
67
66
|
"@types/jest": "^30.0.0",
|
|
@@ -91,7 +90,6 @@
|
|
|
91
90
|
},
|
|
92
91
|
"peerDependencies": {
|
|
93
92
|
"@rific/auto-paper": ">=0.7.0",
|
|
94
|
-
"@rific/haptic-press": ">=0.4.0",
|
|
95
93
|
"react": ">=19.0.0",
|
|
96
94
|
"react-native": ">=0.83.0",
|
|
97
95
|
"react-native-gesture-handler": ">=2.20.0 <3.0.0",
|
package/src/Drawer.tsx
CHANGED
|
@@ -324,7 +324,7 @@ export const Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur,
|
|
|
324
324
|
// needs to offset from wherever the panel actually was, not always from rest.
|
|
325
325
|
const gestureStartOffset = useSharedValue(closedOffset)
|
|
326
326
|
|
|
327
|
-
// react-native-gesture-handler's own Tap, not @rific/
|
|
327
|
+
// react-native-gesture-handler's own Tap, not @rific/feedback-press's plain-RN Pressable: this
|
|
328
328
|
// sits in the same GestureDetector-based system as the panel's own drag handle below, rather
|
|
329
329
|
// than mixing RNGH's native recognizers with RN's separate classic responder system on the one
|
|
330
330
|
// view in the tree (the backdrop) that most needs to reliably win a touch over whatever's behind
|
package/src/DrawerEdgeSwipe.tsx
CHANGED
|
@@ -72,8 +72,17 @@ export const DrawerEdgeSwipe = ({ edgeInset = 0, enabled = true, height = 300, m
|
|
|
72
72
|
<GestureDetector gesture={gesture}>
|
|
73
73
|
{/* Same web-only affordance Drawer.tsx's own handle strip gives its drag grip (see its
|
|
74
74
|
webCursorStyle) — without it, nothing on screen hints that this edge is draggable at
|
|
75
|
-
all on a platform with a mouse cursor to change in the first place.
|
|
76
|
-
|
|
75
|
+
all on a platform with a mouse cursor to change in the first place.
|
|
76
|
+
|
|
77
|
+
pointerEvents here (not just gesture.enabled(enabled) above) matters on web specifically:
|
|
78
|
+
RNGH's own enabled() only stops the Pan gesture from recognizing/completing a touch, it
|
|
79
|
+
doesn't stop this View's underlying DOM node from being hit-tested. Without this, a caller
|
|
80
|
+
passing enabled={false} to shed the edge-swipe-to-open behavior (e.g. because their own
|
|
81
|
+
screen never uses it) still ends up with this zone as an invisible, unconditionally opaque
|
|
82
|
+
strip along the edge — silently swallowing presses meant for anything else placed there,
|
|
83
|
+
even though the gesture it exists for no longer does anything. 'none' when disabled lets
|
|
84
|
+
that click/tap fall straight through to whatever's actually underneath. */}
|
|
85
|
+
<View style={[...edgeStyle, webCursorStyle, enabled ? styles.interactive : styles.nonInteractive]} />
|
|
77
86
|
</GestureDetector>
|
|
78
87
|
)
|
|
79
88
|
}
|
|
@@ -98,7 +107,11 @@ const styles = StyleSheet.create({
|
|
|
98
107
|
width: EDGE_WIDTH,
|
|
99
108
|
zIndex: 5
|
|
100
109
|
},
|
|
110
|
+
// See enabled's own comment above for why this needs to be a real style toggle, not just the
|
|
111
|
+
// gesture's own .enabled(enabled).
|
|
112
|
+
interactive: { pointerEvents: 'auto' },
|
|
101
113
|
left: { left: 0 },
|
|
114
|
+
nonInteractive: { pointerEvents: 'none' },
|
|
102
115
|
right: { right: 0 },
|
|
103
116
|
top: { top: 0 }
|
|
104
117
|
})
|