There was an error while loading. Please reload this page.
1 parent 60a6913 commit 4034ea3Copy full SHA for 4034ea3
packages/window-size/src/index.tsx
@@ -11,6 +11,7 @@ export interface DebouncedWindowSizeOptions {
11
}
12
13
const win = typeof window === 'undefined' ? null : window
14
+const wv = win && typeof win.visualViewport !== 'undefined' ? win.visualViewport : null
15
const getSize = () =>
16
[
17
document.documentElement.clientWidth,
@@ -30,6 +31,7 @@ export const useWindowSize = (
30
31
const setSize = (): void => setDebouncedSize(getSize)
32
33
useEvent(win, 'resize', setSize)
34
+ useEvent(wv, 'resize', setSize)
35
useEvent(win, 'orientationchange', setSize)
36
37
return size
0 commit comments