Support cloning of virtual ReactShadowNodes
Reviewed By: achen1 Differential Revision: D7542648 fbshipit-source-id: 58494db9f8525d4deabc6345f36941fa93a1d887
This commit is contained in:
parent
3372541a2a
commit
16bed9e6e5
|
@ -164,22 +164,32 @@ public class ReactShadowNodeImpl implements ReactShadowNode<ReactShadowNodeImpl>
|
|||
@Override
|
||||
public ReactShadowNodeImpl mutableCopy() {
|
||||
ReactShadowNodeImpl copy = copy();
|
||||
if (mYogaNode != null) {
|
||||
copy.mYogaNode = mYogaNode.clone();
|
||||
copy.mYogaNode.setData(copy);
|
||||
} else {
|
||||
// Virtual ReactShadowNode do not have a YogaNode associated
|
||||
copy.mYogaNode = null;
|
||||
}
|
||||
copy.mNativeChildren = mNativeChildren == null ? null : new ArrayList<>(mNativeChildren);
|
||||
copy.mTotalNativeChildren = mTotalNativeChildren;
|
||||
copy.mChildren = mChildren == null ? null : new ArrayList<>(mChildren);
|
||||
copy.mYogaNode.setData(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReactShadowNodeImpl mutableCopyWithNewChildren() {
|
||||
ReactShadowNodeImpl copy = copy();
|
||||
if (mYogaNode != null) {
|
||||
copy.mYogaNode = mYogaNode.cloneWithNewChildren();
|
||||
copy.mYogaNode.setData(copy);
|
||||
} else {
|
||||
// Virtual ReactShadowNode do not have a YogaNode associated
|
||||
copy.mYogaNode = null;
|
||||
}
|
||||
copy.mNativeChildren = null;
|
||||
copy.mChildren = null;
|
||||
copy.mTotalNativeChildren = 0;
|
||||
copy.mYogaNode.setData(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue