Pretty-print Native AnimatedNode values

Summary:
For debugging, add prettyPrint method to AnimatedNode classes.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D22752292

fbshipit-source-id: ce1f08fc4fd97f38629dd82151c6ea762026c7c9
This commit is contained in:
Joshua Gross
2020-07-25 13:45:11 -07:00
committed by Facebook GitHub Bot
parent 8d613c6f32
commit ab5e87fd95
13 changed files with 130 additions and 0 deletions
@@ -57,4 +57,20 @@ import java.util.List;
* it can be used to calculate node's value.
*/
public void update() {}
/**
* Pretty-printer for the AnimatedNode. Only called in production pre-crash for debug diagnostics.
*/
public abstract String prettyPrint();
public String prettyPrintWithChildren() {
String children = "";
if (mChildren != null && mChildren.size() > 0) {
for (AnimatedNode child : mChildren) {
children += " " + child.mTag;
}
}
return prettyPrint() + (children.length() > 0 ? " children: " + children : "");
}
}