Add more logs into FabricUIManager and ReactShadowNodeImpl

Reviewed By: shergin, achen1

Differential Revision: D7495615

fbshipit-source-id: 4227b6648aaff8d9fe59bff1d4f75fd546baae6a
This commit is contained in:
David Vacca 2018-04-06 15:01:17 -07:00 committed by Facebook Github Bot
parent 84ae1c9aec
commit 9fd2b9a75f
2 changed files with 21 additions and 9 deletions

View File

@ -305,7 +305,7 @@ public class FabricUIManager implements UIManager {
TAG,
"ReactShadowNodeHierarchy after calculateLayout: " + newRootShadowNode.getHierarchyInfo());
}
mFabricReconciler.manageChildren(currentRootShadowNode, newRootShadowNode);
return newRootShadowNode;
}

View File

@ -8,6 +8,7 @@ package com.facebook.react.uimanager;
import static java.lang.System.arraycopy;
import android.util.Log;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.uimanager.annotations.ReactPropertyHolder;
import com.facebook.yoga.YogaNodeCloneFunction;
@ -58,6 +59,8 @@ import javax.annotation.Nullable;
@ReactPropertyHolder
public class ReactShadowNodeImpl implements ReactShadowNode<ReactShadowNodeImpl> {
private static final boolean DEBUG = true;
private static final String TAG = ReactShadowNodeImpl.class.getSimpleName();
private static final YogaConfig sYogaConfig;
static {
sYogaConfig = ReactYogaConfigProvider.get();
@ -68,10 +71,17 @@ public class ReactShadowNodeImpl implements ReactShadowNode<ReactShadowNodeImpl>
int childIndex) {
ReactShadowNodeImpl parentReactShadowNode = (ReactShadowNodeImpl) parent.getData();
Assertions.assertNotNull(parentReactShadowNode);
ReactShadowNodeImpl newReactShadowNode = (ReactShadowNodeImpl) oldYogaNode.getData();
Assertions.assertNotNull(newReactShadowNode);
ReactShadowNodeImpl oldReactShadowNode = (ReactShadowNodeImpl) oldYogaNode.getData();
Assertions.assertNotNull(oldReactShadowNode);
ReactShadowNodeImpl newNode = newReactShadowNode.mutableCopy();
if (DEBUG) {
Log.d(
TAG,
"YogaNode started cloning: oldYogaNode: " + oldReactShadowNode + " - parent: "
+ parentReactShadowNode + " index: " + childIndex);
}
ReactShadowNodeImpl newNode = oldReactShadowNode.mutableCopy();
parentReactShadowNode.replaceChild(newNode, childIndex);
return newNode.mYogaNode;
}
@ -1044,17 +1054,19 @@ public class ReactShadowNodeImpl implements ReactShadowNode<ReactShadowNodeImpl>
private void getHierarchyInfoWithIndentation(StringBuilder result, int level) {
// Spaces and tabs are dropped by IntelliJ logcat integration, so rely on __ instead.
for (int i = 0; i < level; ++i) {
result.append("__");
result.append(" ");
}
result.append(getClass().getSimpleName()).append(" ").append(getReactTag()).append(" ");
result.append("<").append(getClass().getSimpleName()).append(" tag=").append(getReactTag()).append(" hash=")
.append(hashCode());
if (mYogaNode != null) {
result.append(getScreenX()).append(";").append(getScreenY()).append(";")
.append(getLayoutWidth()).append(";").append(getLayoutHeight());
result.append(" layout='x:").append(getScreenX())
.append(" y:").append(getScreenY()).append(" w:").append(getLayoutWidth()).append(" h:")
.append(getLayoutHeight()).append("'");
} else {
result.append("(virtual node)");
}
result.append("\n");
result.append(">\n");
if (getChildCount() == 0) {
return;