Fix yoga node owner getting out of sync with children

Summary:
Changelog: [internal]

# Problem
We have node A with N children.

Calling cloning constructor on `YogaLayoutableShadowNode` causes new `yogaNode_` to be created.
However if `fragment.children` is nil in cloning constructor, which basically says children were not changed, then the existing children's `owner` becomes invalid.

# Solution
In the clone constructor, always call `updateYogaChildren`. This updates yoga children with the new `owner`.

Reviewed By: JoshuaGross

Differential Revision: D20139582

fbshipit-source-id: 3932694d4381b601df07dd8a57887ce7c09f1582
This commit is contained in:
Samuel Susla
2020-02-28 06:17:55 -08:00
committed by Facebook Github Bot
parent 0a9cc34dd8
commit 85696298bf
@@ -61,9 +61,10 @@ YogaLayoutableShadowNode::YogaLayoutableShadowNode(
updateYogaProps();
}
if (fragment.children) {
updateYogaChildren();
}
// Yoga children have `yogaNode_` set as owner. At this point that yogaNode_
// is from previous `YogaLayoutableShadowNode` that is being cloned here.
// Calling `updateYogaChildren` is needed in order to update owner of children.
updateYogaChildren();
}
void YogaLayoutableShadowNode::cleanLayout() {