elemental-design / elemental-design/react-platform
Test useWindowDimensions polyfill for web
- Dominant language
- TypeScript
- Stars
- 17
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
It appears that web `window.screen.width` and `window.innerWidth` have some unreliable behaviour on desktop, e.g. when resizing a window to mobile width, and on a mobile device, where the viewport is artificial, but `innerWidth` isn't.
I've implemented a hack with a comparison operator, but this needs to be tested, and needs feedback.
This deviates from using `react-native-web`, which uses `window.innerHeight` and `window.innerWidth`, which in my testing seem to not render density independent pixels, as they do on React Native: https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/exports/useWindowDimensions/index.js#L19 . ~So maybe this should be raised as an issue there?~
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.