-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
measureInWindow inaccurate in Safari #1037
Comments
Note that |
I think this should be fixed by the patch above and will be in the 0.10 release. |
FYI, I used View I used this method to simply load something when it's appearing on screen (via a simple viewport observer component) With the fix shipped (I am using 0.10.0-alpha.3), it's perfectly working as expected in all browsers. Thanks @necolas! |
The problem
Chrome/Firefox: node.scroll[Top|Left] when node is body is always 0, so window page[Y|X]Offset should be used in place of node.scroll[Top|Left] for only the body node.
Safari: measureInWindow is off by the sum of top and left borders of all parents.
How to reproduce
App here demonstrates the issue: https://rnw-measureinwindow.glitch.me/
Try it in Safari and Chrome/Firefox.
Code: https://glitch.com/edit/#!/rnw-measureinwindow?path=src/components/App/index.js
Steps to reproduce:
Expected behavior
The blue square should cover the pink square completely to demonstrate that measureInWindow measured the pink square correctly.
Environment (include versions). Did this work in previous versions?
I started a PR here: #955
Demo of this PR in use: http://davepack.com/rnw-scroll-measure-test/
Source for demo: https://github.com/davepack/rnw-scroll-measure-test/blob/master/src/App.js
I either need guidance and further understanding of edge cases that the getRect() function needs to meet, or somebody else needs to complete my work.
Thanks!
The text was updated successfully, but these errors were encountered: