We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 118a3d1 commit 5ac2a64Copy full SHA for 5ac2a64
Sources/YogaKit/YGLayout.mm
@@ -489,7 +489,12 @@ static void YGAttachNodesFromViewHierachy(UIView* const view) {
489
if (!YGNodeHasExactSameChildren(node, subviewsToInclude)) {
490
YGRemoveAllChildren(node);
491
for (int i = 0; i < subviewsToInclude.count; i++) {
492
- YGNodeInsertChild(node, subviewsToInclude[i].yoga.node, i);
+ YGNodeRef child = subviewsToInclude[i].yoga.node;
493
+ YGNodeRef parent = YGNodeGetParent(child);
494
+ if (parent != NULL) {
495
+ YGNodeRemoveChild(parent, child);
496
+ }
497
+ YGNodeInsertChild(node, child, i);
498
}
499
500
0 commit comments