Add toString to all MountItem subclasses

Summary:
Useful when Fabric debug logging is enabled

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D31399518

fbshipit-source-id: b5907084604adf1f7093798315147ac63b5876f2
This commit is contained in:
Pieter De Baets
2021-10-06 04:03:13 -07:00
committed by Facebook GitHub Bot
parent 25a2c608f7
commit cd4bef97d0
3 changed files with 26 additions and 3 deletions
@@ -628,6 +628,15 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
public int getSurfaceId() {
return View.NO_ID;
}
@Override
public String toString() {
String propsString =
IS_DEVELOPMENT_ENVIRONMENT
? (props != null ? props.toHashMap().toString() : "<null>")
: "<hidden>";
return String.format("SYNC UPDATE PROPS [%d]: %s", reactTag, propsString);
}
};
// If the reactTag exists, we assume that it might at the end of the next
@@ -1016,6 +1025,11 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
public int getSurfaceId() {
return surfaceId;
}
@Override
public String toString() {
return String.format("SET_JS_RESPONDER [%d] [surface:%d]", reactTag, surfaceId);
}
});
}
@@ -1035,6 +1049,11 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
public int getSurfaceId() {
return View.NO_ID;
}
@Override
public String toString() {
return "CLEAR_JS_RESPONDER";
}
});
}
@@ -226,8 +226,12 @@ public class IntBufferBatchMountItem implements MountItem {
: "<hidden>";
s.append(String.format("UPDATE PROPS [%d]: %s\n", mIntBuffer[i++], propsString));
} else if (type == INSTRUCTION_UPDATE_STATE) {
j += 1;
s.append(String.format("UPDATE STATE [%d]\n", mIntBuffer[i++]));
StateWrapper state = castToState(mObjBuffer[j++]);
String stateString =
IS_DEVELOPMENT_ENVIRONMENT
? (state != null ? state.getStateData().toString() : "<null>")
: "<hidden>";
s.append(String.format("UPDATE STATE [%d]: %s\n", mIntBuffer[i++], stateString));
} else if (type == INSTRUCTION_UPDATE_LAYOUT) {
s.append(
String.format(
@@ -59,7 +59,7 @@ import javax.lang.model.util.Types;
/**
* This annotation processor crawls subclasses of ReactShadowNode and ViewManager and finds their
* exported properties with the @ReactProp or @ReactGroupProp annotation. It generates a class per
* shadow node/view manager that is named {@code <classname>$$PropSetter}. This class contains
* shadow node/view manager that is named {@code <classname>$$PropsSetter}. This class contains
* methods to retrieve the name and type of all methods and a way to set these properties without
* reflection.
*/