mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-24 13:48:49 +08:00
Used hasDirtyChildren tag for the optimization
Reviewed By: emilsjolander Differential Revision: D6134754 fbshipit-source-id: bbcfee14058140b946401de756a3f130de0f51cd
This commit is contained in:
committed by
Facebook Github Bot
parent
387a3557ae
commit
587225ab45
@@ -82,6 +82,8 @@ public interface ReactShadowNode<T extends ReactShadowNode> {
|
||||
|
||||
boolean isDirty();
|
||||
|
||||
boolean hasDirtyDescendants();
|
||||
|
||||
void addChildAt(T child, int i);
|
||||
|
||||
T removeChildAt(int i);
|
||||
|
||||
@@ -134,7 +134,7 @@ public class ReactShadowNodeImpl implements ReactShadowNode<ReactShadowNodeImpl>
|
||||
|
||||
@Override
|
||||
public final boolean hasUpdates() {
|
||||
return mNodeUpdated || hasNewLayout() || isDirty();
|
||||
return mNodeUpdated || hasNewLayout() || isDirty() || hasDirtyDescendants();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -174,6 +174,11 @@ public class ReactShadowNodeImpl implements ReactShadowNode<ReactShadowNodeImpl>
|
||||
return mYogaNode != null && mYogaNode.isDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasDirtyDescendants() {
|
||||
return mYogaNode != null && mYogaNode.hasDirtyDescendants();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChildAt(ReactShadowNodeImpl child, int i) {
|
||||
if (child.getParent() != null) {
|
||||
|
||||
@@ -9,13 +9,11 @@
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@DoNotStrip
|
||||
public class YogaNode {
|
||||
@@ -198,6 +196,12 @@ public class YogaNode {
|
||||
return jni_YGNodeIsDirty(mNativePointer);
|
||||
}
|
||||
|
||||
private native boolean jni_YGNodeHasDirtyDescendants(long nativePointer);
|
||||
|
||||
public boolean hasDirtyDescendants() {
|
||||
return jni_YGNodeHasDirtyDescendants(mNativePointer);
|
||||
}
|
||||
|
||||
private native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer);
|
||||
public void copyStyle(YogaNode srcNode) {
|
||||
jni_YGNodeCopyStyle(mNativePointer, srcNode.mNativePointer);
|
||||
|
||||
Reference in New Issue
Block a user