A drawer component for React.
fix: prevent undefined window (#453)
Emil Kowalskia60e76abeefd
diff --git a/package.json b/package.jsonindex 0350df4..01749f9 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "vaul",- "version": "0.9.7",+ "version": "0.9.8","description": "Drawer component for React.","main": "./dist/index.js","module": "./dist/index.mjs",diff --git a/src/index.tsx b/src/index.tsxindex 3bac0fa..f70ea42 100644--- a/src/index.tsx+++ b/src/index.tsx@@ -707,9 +707,12 @@ export const Overlay = React.forwardRef<HTMLDivElement, React.ComponentPropsWith// Overlay is the component that is locking scroll, removing it will unlock the scroll without having to dig into Radix's Dialog libraryif (!modal) {// Need to do this manually unfortunately- window.requestAnimationFrame(() => {- document.body.style.pointerEvents = 'auto';- });+ if (typeof window !== 'undefined') {+ window.requestAnimationFrame(() => {+ document.body.style.pointerEvents = 'auto';+ });+ }+return null;}