Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix view state when cloning in willCommit hook
Browse files Browse the repository at this point in the history
janicduplessis committed Jun 23, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent acb1a44 commit 87a81db
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -213,7 +213,11 @@ void YogaLayoutableShadowNode::adoptYogaChild(size_t index) {
} else {
// The child is owned by some other node, we need to clone that.
// TODO: At this point, React has wrong reference to the node. (T138668036)
auto clonedChildNode = childNode.clone({});
auto clonedChildNode = childNode.clone({
ShadowNodeFragment::propsPlaceholder(),
ShadowNodeFragment::childrenPlaceholder(),
childNode.getState(),
});

// Replace the child node with a newly cloned one in the children list.
replaceChild(childNode, clonedChildNode, static_cast<int32_t>(index));

0 comments on commit 87a81db

Please sign in to comment.