Skip to content

armgit / vaul

Public Imported from GitHub
0

A drawer component for React.

Fix fixed position when unmounting (#147)

Emil Kowalski40d6ebc27b9a
diff --git a/src/index.tsx b/src/index.tsx
index 5c054c1..319ff66 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -290,15 +290,10 @@ function Root({
}
React.useEffect(() => {
- // Clean up the wrapper styles in case the drawer has been unmounted without closing it
- const wrapper = document.querySelector('[vaul-drawer-wrapper]');
-
- if (wrapper) {
- return () => {
- scaleBackground(false);
- restorePositionSetting();
- };
- }
+ return () => {
+ scaleBackground(false);
+ restorePositionSetting();
+ };
}, []);
React.useEffect(() => {