Skip to content

Commit

Permalink
use isConnected
Browse files Browse the repository at this point in the history
  • Loading branch information
LucioChavezFuentes committed Mar 27, 2023
1 parent 96913a2 commit 65be413
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions packages/react-native-web/src/exports/UIManager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,11 @@ const getRect = (node) => {
return { width, height, top, left };
};

function hasLayoutBox(node) {
return !!(
node.offsetWidth ||
node.offsetHeight ||
node.getClientRects().length
);
}

const measureLayout = (node, relativeToNativeNode, callback) => {
const relativeNode = relativeToNativeNode || (node && node.parentNode);
if (node && relativeNode) {
setTimeout(() => {
if (hasLayoutBox(node) && hasLayoutBox(relativeNode)) {
if (node.isConnected && relativeNode.isConnected) {
const relativeRect = getRect(relativeNode);
const { height, left, top, width } = getRect(node);
const x = left - relativeRect.left;
Expand Down

0 comments on commit 65be413

Please sign in to comment.