private void applyLayoutRecursive(ReactShadowNode toUpdate, int x, int y) { if (!toUpdate.isLayoutOnly() && toUpdate.getNativeParent() != null) { int tag = toUpdate.getReactTag(); mUIViewOperationQueue.enqueueUpdateLayout( toUpdate.getNativeParent().getReactTag(), tag, x, y, toUpdate.getScreenWidth(), toUpdate.getScreenHeight()); return; } for (int i = 0; i < toUpdate.getChildCount(); i++) { ReactShadowNode child = toUpdate.getChildAt(i); int childTag = child.getReactTag(); if (mTagsWithLayoutVisited.get(childTag)) { continue; } mTagsWithLayoutVisited.put(childTag, true); int childX = child.getScreenX(); int childY = child.getScreenY(); childX += x; childY += y; applyLayoutRecursive(child, childX, childY); } }
/** * Handles an updateLayout call. All updateLayout calls are collected and dispatched at the end of * a batch because updateLayout calls to layout-only nodes can necessitate multiple updateLayout * calls for all its children. */ public void handleUpdateLayout(ReactShadowNode node) { if (!ENABLED) { mUIViewOperationQueue.enqueueUpdateLayout( Assertions.assertNotNull(node.getParent()).getReactTag(), node.getReactTag(), node.getScreenX(), node.getScreenY(), node.getScreenWidth(), node.getScreenHeight()); return; } applyLayoutBase(node); }