Skip to content

armgit / vaul

Public Imported from GitHub
0

A drawer component for React.

Move setVisible call to Content] (#123)

Emil Kowalski519af1f6b0f6
diff --git a/src/index.tsx b/src/index.tsx
index a4113ed..84a1b92 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -513,7 +513,6 @@ function Root({
// Trigger enter animation without using CSS animation
if (isOpen) {
openTime.current = new Date();
- setVisible(true);
scaleBackground(true);
}
}, [isOpen]);
@@ -684,9 +683,15 @@ const Content = React.forwardRef<HTMLDivElement, ContentProps>(function (
visible,
closeDrawer,
modal,
+ setVisible,
} = useDrawerContext();
const composedRef = useComposedRefs(ref, drawerRef);
+ React.useEffect(() => {
+ // Trigger enter animation without using CSS animation
+ setVisible(true);
+ }, []);
+
return (
<DialogPrimitive.Content
onOpenAutoFocus={(e) => {