A drawer component for React.
Cancel current drag when closing the drawer (#263)
Henrique Malheirosb75b703b05e4
diff --git a/src/index.tsx b/src/index.tsxindex aa0b798..52aa659 100644--- a/src/index.tsx+++ b/src/index.tsx@@ -392,6 +392,8 @@ function Root({function closeDrawer() {if (!drawerRef.current) return;+ cancelDrag();+onClose?.();set(drawerRef.current, {transform: isVertical(direction)@@ -492,6 +494,15 @@ function Root({}}+ function cancelDrag() {+ if (!isDragging || !drawerRef.current) return;++ drawerRef.current.classList.remove(DRAG_CLASS);+ isAllowedToDrag.current = false;+ setIsDragging(false);+ dragEndTime.current = new Date();+ }+function onRelease(event: React.PointerEvent<HTMLDivElement>) {if (!isDragging || !drawerRef.current) return;