Refactor cloneWithNewChildren method

Reviewed By: achen1

Differential Revision: D7064266

fbshipit-source-id: 71ef5651893359a257c39a5943812853f8d0dbcd
This commit is contained in:
David Vacca
2018-02-27 18:47:50 -08:00
committed by Facebook Github Bot
parent 84ef7bc372
commit ddcd609a86
3 changed files with 34 additions and 20 deletions
@@ -9,6 +9,7 @@ package com.facebook.react.uimanager;
import static java.lang.System.arraycopy;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.annotations.ReactPropertyHolder;
import com.facebook.yoga.YogaAlign;
import com.facebook.yoga.YogaBaselineFunction;
@@ -128,6 +129,14 @@ public class ReactShadowNodeImpl implements ReactShadowNode<ReactShadowNodeImpl>
return new ReactShadowNodeImpl(this);
}
@Override
public ReactShadowNodeImpl mutableCopyWithNewChildren() {
ReactShadowNodeImpl copy = mutableCopy();
copy.mNativeChildren = null;
copy.mChildren = null;
return copy;
}
/**
* Nodes that return {@code true} will be treated as "virtual" nodes. That is, nodes that are not
* mapped into native views (e.g. nested text node). By default this method returns {@code false}.
@@ -484,14 +493,6 @@ public class ReactShadowNodeImpl implements ReactShadowNode<ReactShadowNodeImpl>
return removed;
}
@Override
public final void removeAllChildren() {
removeAllNativeChildren();
if (mChildren != null) {
mChildren.clear();
}
}
@Override
public final void removeAllNativeChildren() {
if (mNativeChildren != null) {