From 1b86d02300e3a8f65f68599b8707ea80f6081868 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Sat, 7 Jan 2017 18:03:03 -0800 Subject: [PATCH] [change] wrap layout measurement in 'asap' --- src/apis/UIManager/index.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/apis/UIManager/index.js b/src/apis/UIManager/index.js index 1901d84a..70e28d86 100644 --- a/src/apis/UIManager/index.js +++ b/src/apis/UIManager/index.js @@ -1,15 +1,18 @@ +import asap from 'asap'; import createReactDOMStyle from '../StyleSheet/createReactDOMStyle'; import flattenStyle from '../StyleSheet/flattenStyle'; import CSSPropertyOperations from 'react-dom/lib/CSSPropertyOperations'; import prefixInlineStyles from '../StyleSheet/prefixInlineStyles'; const _measureLayout = (node, relativeToNativeNode, callback) => { - const relativeNode = relativeToNativeNode || node.parentNode; - const relativeRect = relativeNode.getBoundingClientRect(); - const { height, left, top, width } = node.getBoundingClientRect(); - const x = left - relativeRect.left; - const y = top - relativeRect.top; - callback(x, y, width, height, left, top); + asap(() => { + const relativeNode = relativeToNativeNode || node.parentNode; + const relativeRect = relativeNode.getBoundingClientRect(); + const { height, left, top, width } = node.getBoundingClientRect(); + const x = left - relativeRect.left; + const y = top - relativeRect.top; + callback(x, y, width, height, left, top); + }); }; const UIManager = {