mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-31 01:36:11 +00:00
[fix] use getBoundingClientRect instead of getRect for measureInWindow
Fix #2589 Close #2613
This commit is contained in:
committed by
Nicolas Gallagher
parent
8f55ed0f60
commit
e44bcf4e81
@@ -7,6 +7,7 @@
|
|||||||
* @noflow
|
* @noflow
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import getBoundingClientRect from '../../modules/getBoundingClientRect';
|
||||||
import setValueForStyles from '../../modules/setValueForStyles';
|
import setValueForStyles from '../../modules/setValueForStyles';
|
||||||
|
|
||||||
const getRect = (node) => {
|
const getRect = (node) => {
|
||||||
@@ -82,7 +83,7 @@ const UIManager = {
|
|||||||
measureInWindow(node, callback) {
|
measureInWindow(node, callback) {
|
||||||
if (node) {
|
if (node) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const { height, left, top, width } = getRect(node);
|
const { height, left, top, width } = getBoundingClientRect(node);
|
||||||
callback(left, top, width, height);
|
callback(left, top, width, height);
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user