Open matthew-dean opened 5 years ago
Hmm never mind, document.documentElement.clientHeight
doesn't seem to be correct either at providing the viewport size......
Why not just use https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia?
@bitworking I got rid of react-sizes
and did just that. 🤷♂️
I was using
react-sizes
to replace some media query stuff, and got some strange behaviors when zooming on iOS. e.g. it would eventually re-render with new sizes even though my device was the same. Like, if I scrolled the page, it would re-render.The reason: window.innerWidth / innerHeight does not give the document width / height (which is what is useful for components in doing media-query-like stuff in JS), it gives the viewport width. However, pinching / zooming does not fire any sort of event, so basically
react-sizes
was changing props sort of at random, to values which broke layout.Instead, this should be using document.documentElement.clientHeight/clientWidth, so that values do not change (eventually) after zooming into the document.