Open hamsterhomka opened 11 months ago
Hey, our Devs will look into this. Thanks!
Hey @hamsterhomka, Thanks for reporting the issue. We'll look into it.
Any updates on fixing this?
@hamsterhomka We're internally using useWindowDimensions
hook from react-native-web
, which returns window viewport width. This causes the difference when scrollbar is rendered. We're going to use window.innerWidth
instead of useWindowDimenstions
. Thanks for reporting this. Hopefully we'll fix this in the coming release.
Description
css and js breakpoints don't match when the "show scroll bars" setting set to "always" on MacOS. It happens because css counts the actual 1264px browser's window width as 1280px, whereas js useMedia() hook counts 1280px as 1280px. We can see that the issue is exactly in the 16px width scrollbar.
CodeSandbox/Snack link
No response
Steps to reproduce
Here's the example repo with the issue. https://github.com/hamsterhomka/gluestack-issue-breakpoints
gluestack-ui Version
1.0.0
Platform
Other Platform
No response
Additional Information
js box is not visible (1279px)
js box is visible (1282px)
css box is not visible (1264px)
css box is visible (1266px)
Here is a simple patch to fix it. I created a hook
useInnerWidth()
that returns window.innerWidth on web (that matches css breakpoints) and used it inuseMedia()
gluestack hook@gluestack-style-react-npm-1.0.11-e64493965f.patch