Skip to content

armgit / vaul

Public Imported from GitHub
0

A drawer component for React.

Fix useSnapPoints onRelease position (#227)

Suphon T85f6b4577b57
diff --git a/src/use-snap-points.ts b/src/use-snap-points.ts
index c21da0e..9979050 100644
--- a/src/use-snap-points.ts
+++ b/src/use-snap-points.ts
@@ -137,8 +137,8 @@ export function useSnapPoints({
const currentPosition =
direction === 'bottom' || direction === 'right'
- ? activeSnapPointOffset ?? 0 - draggedDistance
- : activeSnapPointOffset ?? 0 + draggedDistance;
+ ? (activeSnapPointOffset ?? 0) - draggedDistance
+ : (activeSnapPointOffset ?? 0) + draggedDistance;
const isOverlaySnapPoint = activeSnapPointIndex === fadeFromIndex - 1;
const isFirst = activeSnapPointIndex === 0;
const hasDraggedUp = draggedDistance > 0;