Skip to content

Commit 4d7c63f

Browse files
Fix view state when cloning in willCommit hook
1 parent e86f9db commit 4d7c63f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,11 @@ void YogaLayoutableShadowNode::adoptYogaChild(size_t index) {
215215
} else {
216216
// The child is owned by some other node, we need to clone that.
217217
// TODO: At this point, React has wrong reference to the node. (T138668036)
218-
auto clonedChildNode = childNode.clone({});
218+
auto clonedChildNode = childNode.clone({
219+
ShadowNodeFragment::propsPlaceholder(),
220+
ShadowNodeFragment::childrenPlaceholder(),
221+
childNode.getState(),
222+
});
219223

220224
if (ReactNativeFeatureFlags::
221225
useRuntimeShadowNodeReferenceUpdateOnLayout()) {

0 commit comments

Comments
 (0)