@rific/drawer 0.4.3 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rific/drawer",
3
- "version": "0.4.3",
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,31 +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",
65
+ "@infinitetoken/eslint-config": "^0.1.4",
66
+ "@infinitetoken/tsconfig": "^0.1.1",
67
+ "@rific/auto-paper": "^0.10.1",
64
68
  "@testing-library/dom": "^10.4.1",
65
69
  "@testing-library/react": "^16.3.2",
66
70
  "@types/jest": "^30.0.0",
67
71
  "@types/react": "^19.0.0",
68
- "@typescript-eslint/parser": "^8.59.3",
69
72
  "eslint": "^9.39.4",
70
- "eslint-config-prettier": "^10.1.8",
71
- "eslint-plugin-package-json": "^1.0.0",
72
- "eslint-plugin-prettier": "^5.5.5",
73
+ "eslint-plugin-react-hooks": "^7.1.1",
73
74
  "eslint-plugin-react-native": "^5.0.0",
74
- "eslint-plugin-simple-import-sort": "^13.0.0",
75
75
  "jest": "^30.4.2",
76
76
  "jest-environment-jsdom": "^30.4.1",
77
77
  "prettier": "^3.8.3",
@@ -85,8 +85,7 @@
85
85
  "ts-jest": "^29.4.9",
86
86
  "ts-node": "^10.9.2",
87
87
  "tsup": "^8.0.0",
88
- "typescript": "^6.0.3",
89
- "typescript-eslint": "^8.59.3"
88
+ "typescript": "^6.0.3"
90
89
  },
91
90
  "peerDependencies": {
92
91
  "@rific/auto-paper": ">=0.7.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(() => {
@@ -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 {