Skip to content

armgit / vaul

Public Imported from GitHub
0

A drawer component for React.

Add non-draggable elements (#250)

Emil Kowalski693fc85f993c
diff --git a/src/index.tsx b/src/index.tsx
index fca1d1d..aa0b798 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -159,6 +159,10 @@ function Root({
const swipeAmount = drawerRef.current ? getTranslate(drawerRef.current, direction) : null;
const date = new Date();
+ if (element.hasAttribute('data-vaul-no-drag')) {
+ return false;
+ }
+
if (direction === 'right' || direction === 'left') {
return true;
}
@@ -260,7 +264,6 @@ function Root({
? `translate3d(0, ${translateValue}px, 0)`
: `translate3d(${translateValue}px, 0, 0)`,
});
-
return;
}