@rific/drawer 0.4.2 → 0.4.4

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 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 @rific/haptic-press
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rific/drawer",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
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",
@@ -47,32 +47,31 @@
47
47
  "scripts": {
48
48
  "build": "tsup src/index.ts --format cjs,esm --dts --clean",
49
49
  "build:watch": "tsup src/index.ts --format cjs,esm --dts --watch",
50
+ "ci": "npm run lint && npm test && npm run typecheck && npm run build",
50
51
  "fix": "eslint --fix",
51
52
  "lint": "eslint",
52
53
  "prepublishOnly": "npm run build",
53
54
  "release": "git push --follow-tags",
54
- "release:major": "npm version major && git push --follow-tags",
55
- "release:minor": "npm version minor && git push --follow-tags",
56
- "release:patch": "npm version patch && git push --follow-tags",
55
+ "release:major": "npm version major && npm run release",
56
+ "release:minor": "npm version minor && npm run release",
57
+ "release:patch": "npm version patch && npm run release",
57
58
  "test": "jest",
58
59
  "test:watch": "jest --watchAll",
59
60
  "typecheck": "tsc --noEmit",
60
- "preversion": "npm run lint && npm test && npm run build"
61
+ "preversion": "npm run ci"
61
62
  },
63
+ "prettier": "@infinitetoken/eslint-config/prettier",
62
64
  "devDependencies": {
63
- "@rific/auto-paper": "^0.7.0",
64
- "@rific/haptic-press": "^0.4.3",
65
+ "@infinitetoken/eslint-config": "^0.1.4",
66
+ "@infinitetoken/tsconfig": "^0.1.1",
67
+ "@rific/auto-paper": "^0.10.1",
65
68
  "@testing-library/dom": "^10.4.1",
66
69
  "@testing-library/react": "^16.3.2",
67
70
  "@types/jest": "^30.0.0",
68
71
  "@types/react": "^19.0.0",
69
- "@typescript-eslint/parser": "^8.59.3",
70
72
  "eslint": "^9.39.4",
71
- "eslint-config-prettier": "^10.1.8",
72
- "eslint-plugin-package-json": "^1.0.0",
73
- "eslint-plugin-prettier": "^5.5.5",
73
+ "eslint-plugin-react-hooks": "^7.1.1",
74
74
  "eslint-plugin-react-native": "^5.0.0",
75
- "eslint-plugin-simple-import-sort": "^13.0.0",
76
75
  "jest": "^30.4.2",
77
76
  "jest-environment-jsdom": "^30.4.1",
78
77
  "prettier": "^3.8.3",
@@ -86,12 +85,10 @@
86
85
  "ts-jest": "^29.4.9",
87
86
  "ts-node": "^10.9.2",
88
87
  "tsup": "^8.0.0",
89
- "typescript": "^6.0.3",
90
- "typescript-eslint": "^8.59.3"
88
+ "typescript": "^6.0.3"
91
89
  },
92
90
  "peerDependencies": {
93
91
  "@rific/auto-paper": ">=0.7.0",
94
- "@rific/haptic-press": ">=0.4.0",
95
92
  "react": ">=19.0.0",
96
93
  "react-native": ">=0.83.0",
97
94
  "react-native-gesture-handler": ">=2.20.0 <3.0.0",
package/src/Drawer.tsx CHANGED
@@ -191,6 +191,7 @@ export const Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur,
191
191
  // onOpened/onClosed deliberately excluded: both are plain closures (DrawerInstanceProvider passes a
192
192
  // fresh function every render), and including them would restart this spring from its current
193
193
  // position every time the parent re-renders for any unrelated reason.
194
+ // eslint-disable-next-line react-hooks/exhaustive-deps
194
195
  }, [open, closedOffset, restOffset, translateOffset])
195
196
 
196
197
  useEffect(() => {
@@ -324,7 +325,7 @@ export const Drawer = ({ backdropOpacity = 0.45, blockingBackdrop = true, blur,
324
325
  // needs to offset from wherever the panel actually was, not always from rest.
325
326
  const gestureStartOffset = useSharedValue(closedOffset)
326
327
 
327
- // react-native-gesture-handler's own Tap, not @rific/haptic-press's plain-RN Pressable: this
328
+ // react-native-gesture-handler's own Tap, not @rific/feedback-press's plain-RN Pressable: this
328
329
  // sits in the same GestureDetector-based system as the panel's own drag handle below, rather
329
330
  // than mixing RNGH's native recognizers with RN's separate classic responder system on the one
330
331
  // view in the tree (the backdrop) that most needs to reliably win a touch over whatever's behind
@@ -51,6 +51,9 @@ export const DrawerEdgeSwipe = ({ edgeInset = 0, enabled = true, height = 300, m
51
51
  .onUpdate((event) => {
52
52
  'worklet'
53
53
  const translation = vertical ? event.translationY : event.translationX
54
+ // react-hooks/immutability flags this because translateOffset is a prop, but mutating a
55
+ // Reanimated SharedValue's .value is the correct way to drive it — not a prop reassignment.
56
+ // eslint-disable-next-line react-hooks/immutability
54
57
  translateOffset.value = Math.min(clampMax, Math.max(clampMin, closedOffset + translation))
55
58
  })
56
59
  .onEnd((event) => {
@@ -59,6 +62,8 @@ export const DrawerEdgeSwipe = ({ edgeInset = 0, enabled = true, height = 300, m
59
62
  const velocity = vertical ? event.velocityY : event.velocityX
60
63
  const commit = translation * openDirection > effectiveSize / 3 || velocity * openDirection > VELOCITY_THRESHOLD
61
64
  if (commit) {
65
+ // see onUpdate's comment above -- same SharedValue false positive
66
+ // eslint-disable-next-line react-hooks/immutability
62
67
  translateOffset.value = withSpring(restOffset, SPRING)
63
68
  runOnJS(onOpen)()
64
69
  } else {