Skip to content

armgit / vaul

Public Imported from GitHub
0

A drawer component for React.

Safari theme improvements (#49)

Emil Kowalski5b54ab7f09a6
diff --git a/src/index.tsx b/src/index.tsx
index c577150..a2a24a0 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -145,7 +145,6 @@ function Root({
experimentalSafariThemeAnimation,
);
-
usePreventScroll({
isDisabled: !isOpen || isDragging || isAnimating,
});
@@ -563,7 +562,6 @@ const Content = React.forwardRef<HTMLDivElement, ContentProps>(function (
isOpen,
keyboardIsOpen,
setIsAnimating,
- overlayRef,
} = useDrawerContext();
const composedRef = useComposedRefs(ref, drawerRef);
const animationEndTimer = React.useRef<NodeJS.Timeout>(null);
@@ -580,16 +578,6 @@ const Content = React.forwardRef<HTMLDivElement, ContentProps>(function (
}, ANIMATION_DURATION);
onAnimationStart(e);
}}
- onAnimationEnd={(e) => {
- if (e.animationName === 'show-dialog') {
- set(overlayRef.current, {
- opacity: '1',
- });
- set(drawerRef.current, {
- transform: 'translateY(0px)',
- });
- }
- }}
onPointerDown={onPress}
onPointerUp={onRelease}
onPointerMove={onDrag}
diff --git a/src/style.css b/src/style.css
index cd4bea8..dad6631 100644
--- a/src/style.css
+++ b/src/style.css
@@ -1,8 +1,7 @@
[vaul-drawer] {
- transform: translateY(100%);
will-change: transform;
touch-action: none;
- animation: show-dialog 0.5s cubic-bezier(0.32, 0.72, 0, 1) 0.022s;
+ animation: show-dialog 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
[vaul-drawer]::after {
@@ -21,8 +20,7 @@
}
[vaul-overlay] {
- opacity: 0;
- animation: show-overlay 0.5s cubic-bezier(0.32, 0.72, 0, 1) 0.022s;
+ animation: show-overlay 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
[vaul-overlay][data-state='closed'] {
diff --git a/src/use-safari-theme-color.ts b/src/use-safari-theme-color.ts
index 24cf5e5..f818556 100644
--- a/src/use-safari-theme-color.ts
+++ b/src/use-safari-theme-color.ts
@@ -123,7 +123,7 @@ export function useSafariThemeColor(
// @ts-ignore
metaThemeColor.name = 'theme-color';
document.getElementsByTagName('head')[0].appendChild(metaThemeColor);
- } else {
+ } else if (!initialMetaThemeColor) {
setInitialMetaThemeColor(metaThemeColor.getAttribute('content'));
}
diff --git a/website/src/app/globals.css b/website/src/app/globals.css
index 875c8f4..68f9bc6 100644
--- a/website/src/app/globals.css
+++ b/website/src/app/globals.css
@@ -2,6 +2,10 @@
@tailwind components;
@tailwind utilities;
+:root {
+ --vaul-theme-color: 255, 255, 255;
+}
+
html,
body {
overflow: hidden;