Avoid cleaning up Owner of YGNode during clonning

Summary:
This diff refactors the cloning mechanism for YogaNode used from Fabric UI renderer and RN iOS graphs.
Previously, we were cleaning the owner of the child's cloned node inside the C++ implementation of YogaNode. This was a mistake because this modified the last commited YogaTree, causing side effect in RN iOS graphs.

Reviewed By: shergin

Differential Revision: D8672627

fbshipit-source-id: c9902d00690e0361fd58aed84b506c42258bd995
This commit is contained in:
David Vacca
2018-06-28 22:38:42 -07:00
committed by Facebook Github Bot
parent 77ea79490f
commit f4d29e6f11
3 changed files with 21 additions and 3 deletions

View File

@@ -244,9 +244,6 @@ YGNodeRef YGNodeClone(YGNodeRef oldNode) {
oldNode->getConfig(),
node != nullptr,
"Could not allocate memory for node");
for (auto &item : oldNode->getChildren()) {
item->setOwner(nullptr);
}
gNodeInstanceCount++;
node->setOwner(nullptr);
return node;