diff --git a/.gitignore b/.gitignore index a41dc55..39156bd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.tgz +*.zip dist node_modules coverage diff --git a/packages/ui/src/layout.tsx b/packages/ui/src/layout.tsx index 4ab93cc..5e77829 100644 --- a/packages/ui/src/layout.tsx +++ b/packages/ui/src/layout.tsx @@ -16,6 +16,7 @@ interface LayoutProps { children: ReactNode } +const orientationMql = window.matchMedia('(orientation: landscape)') const Layout: FC = ({ children }) => { const location = useLocation() const { mode } = useTheme() @@ -45,14 +46,14 @@ const Layout: FC = ({ children }) => { if (map) { map.on('move', moveListener) map.on('moveend', moveEndListener) - screen.orientation.addEventListener('change', orientationListener) + orientationMql.addEventListener('change', orientationListener) } return () => { if (map) { map.off('move', moveListener) map.off('moveend', moveEndListener) - screen.orientation.removeEventListener('change', orientationListener) + orientationMql.removeEventListener('change', orientationListener) } } }, [map])