A drawer component for React.
prevent from exceeding boundaries of the last snap point while dragging (#206)
Eris Leci90b0e56ffa3e
diff --git a/src/use-snap-points.ts b/src/use-snap-points.tsindex 500919f..461ab8f 100644--- a/src/use-snap-points.ts+++ b/src/use-snap-points.ts@@ -178,6 +178,9 @@ export function useSnapPoints({if (activeSnapPointOffset === null) return;const newYValue = activeSnapPointOffset - draggedDistance;+ // Don't do anything if we exceed the last(highest) snap point+ if (newYValue < snapPointsOffset[snapPointsOffset.length - 1]) return;+set(drawerRef.current, {transform: `translate3d(0, ${newYValue}px, 0)`,});