Skip to content

Commit

Permalink
Add more logs into FabricUIManager and ReactShadowNodeImpl
Browse files Browse the repository at this point in the history
Reviewed By: shergin, achen1

Differential Revision: D7495615

fbshipit-source-id: 4227b6648aaff8d9fe59bff1d4f75fd546baae6a
  • Loading branch information
mdvacca authored and facebook-github-bot committed Apr 6, 2018
1 parent 84ae1c9 commit 9fd2b9a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ private ReactShadowNode calculateDiffingAndCreateNewRootNode(
TAG,
"ReactShadowNodeHierarchy after calculateLayout: " + newRootShadowNode.getHierarchyInfo());
}

mFabricReconciler.manageChildren(currentRootShadowNode, newRootShadowNode);
return newRootShadowNode;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

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;
Expand Down Expand Up @@ -58,6 +59,8 @@
@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();
Expand All @@ -68,10 +71,17 @@ public YogaNode cloneNode(YogaNode oldYogaNode,
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);

if (DEBUG) {
Log.d(
TAG,
"YogaNode started cloning: oldYogaNode: " + oldReactShadowNode + " - parent: "
+ parentReactShadowNode + " index: " + childIndex);
}

ReactShadowNodeImpl newNode = newReactShadowNode.mutableCopy();
ReactShadowNodeImpl newNode = oldReactShadowNode.mutableCopy();
parentReactShadowNode.replaceChild(newNode, childIndex);
return newNode.mYogaNode;
}
Expand Down Expand Up @@ -1044,17 +1054,19 @@ public String getHierarchyInfo() {
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;
Expand Down

0 comments on commit 9fd2b9a

Please sign in to comment.