mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-05 03:09:23 +00:00
[change] wrap layout measurement in 'asap'
This commit is contained in:
@@ -1,15 +1,18 @@
|
|||||||
|
import asap from 'asap';
|
||||||
import createReactDOMStyle from '../StyleSheet/createReactDOMStyle';
|
import createReactDOMStyle from '../StyleSheet/createReactDOMStyle';
|
||||||
import flattenStyle from '../StyleSheet/flattenStyle';
|
import flattenStyle from '../StyleSheet/flattenStyle';
|
||||||
import CSSPropertyOperations from 'react-dom/lib/CSSPropertyOperations';
|
import CSSPropertyOperations from 'react-dom/lib/CSSPropertyOperations';
|
||||||
import prefixInlineStyles from '../StyleSheet/prefixInlineStyles';
|
import prefixInlineStyles from '../StyleSheet/prefixInlineStyles';
|
||||||
|
|
||||||
const _measureLayout = (node, relativeToNativeNode, callback) => {
|
const _measureLayout = (node, relativeToNativeNode, callback) => {
|
||||||
const relativeNode = relativeToNativeNode || node.parentNode;
|
asap(() => {
|
||||||
const relativeRect = relativeNode.getBoundingClientRect();
|
const relativeNode = relativeToNativeNode || node.parentNode;
|
||||||
const { height, left, top, width } = node.getBoundingClientRect();
|
const relativeRect = relativeNode.getBoundingClientRect();
|
||||||
const x = left - relativeRect.left;
|
const { height, left, top, width } = node.getBoundingClientRect();
|
||||||
const y = top - relativeRect.top;
|
const x = left - relativeRect.left;
|
||||||
callback(x, y, width, height, left, top);
|
const y = top - relativeRect.top;
|
||||||
|
callback(x, y, width, height, left, top);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const UIManager = {
|
const UIManager = {
|
||||||
|
|||||||
Reference in New Issue
Block a user