diff --git a/src/ModalView.web.tsx b/src/ModalView.web.tsx index 09efe10..944c602 100644 --- a/src/ModalView.web.tsx +++ b/src/ModalView.web.tsx @@ -64,6 +64,13 @@ export const ModalView: FC = ({ }; }, [isTopmost, onRequestDismiss]); + // renders nothing on server side + // typically "document" is undeclared on the server + // and "typeof" can safely touch undeclared variables without throwing + if (typeof document === 'undefined') { + return null; + } + return createPortal(