mirror of
https://github.com/status-im/react-native.git
synced 2025-02-06 06:34:01 +00:00
add UI Manager operations
Reviewed By: achen1 Differential Revision: D5741087 fbshipit-source-id: f6b8f713cb3c4e48b417b47557a45ff9a4a5bf05
This commit is contained in:
parent
e9a090fd9b
commit
672db77eae
@ -16,4 +16,9 @@ public class NoopPrinter implements Printer {
|
||||
|
||||
@Override
|
||||
public void logMessage(DebugOverlayTag tag, String message) {}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplayLogMessage(final DebugOverlayTag tag) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,10 @@ package com.facebook.debug.holder;
|
||||
|
||||
import com.facebook.debug.debugoverlay.model.DebugOverlayTag;
|
||||
|
||||
/** Interface to pass data to debugging tools. */
|
||||
/** Interface to debugging tool. */
|
||||
public interface Printer {
|
||||
|
||||
void logMessage(final DebugOverlayTag tag, final String message, Object... args);
|
||||
|
||||
void logMessage(final DebugOverlayTag tag, final String message);
|
||||
boolean shouldDisplayLogMessage(final DebugOverlayTag tag);
|
||||
}
|
||||
|
@ -19,4 +19,9 @@ public class ReactDebugOverlayTags {
|
||||
"Bridge Calls", "JS to Java calls (warning: this is spammy)", Color.MAGENTA);
|
||||
public static final DebugOverlayTag NATIVE_MODULE =
|
||||
new DebugOverlayTag("Native Module", "Native Module init", Color.rgb(0x80, 0x00, 0x80));
|
||||
public static final DebugOverlayTag UI_MANAGER =
|
||||
new DebugOverlayTag(
|
||||
"UI Manager",
|
||||
"UI Manager View Operations (requires restart\nwarning: this is spammy)",
|
||||
Color.CYAN);
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ android_library(
|
||||
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
|
||||
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
react_native_target("java/com/facebook/debug/tags:tags"),
|
||||
react_native_target("java/com/facebook/debug/holder:holder"),
|
||||
react_native_target("java/com/facebook/react/animation:animation"),
|
||||
react_native_target("java/com/facebook/react/bridge:bridge"),
|
||||
react_native_target("java/com/facebook/react/common:common"),
|
||||
|
@ -15,6 +15,8 @@ import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_M
|
||||
import android.content.ComponentCallbacks2;
|
||||
import android.content.res.Configuration;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.debug.holder.PrinterHolder;
|
||||
import com.facebook.debug.tags.ReactDebugOverlayTags;
|
||||
import com.facebook.react.animation.Animation;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.GuardedRunnable;
|
||||
@ -83,7 +85,8 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
|
||||
protected static final String NAME = "UIManager";
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
private static final boolean DEBUG =
|
||||
PrinterHolder.getPrinter().shouldDisplayLogMessage(ReactDebugOverlayTags.UI_MANAGER);
|
||||
|
||||
private final EventDispatcher mEventDispatcher;
|
||||
private final Map<String, Object> mModuleConstants;
|
||||
@ -254,9 +257,10 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
@ReactMethod
|
||||
public void createView(int tag, String className, int rootViewTag, ReadableMap props) {
|
||||
if (DEBUG) {
|
||||
FLog.d(
|
||||
ReactConstants.TAG,
|
||||
"(UIManager.createView) tag: " + tag + ", class: " + className + ", props: " + props);
|
||||
String message =
|
||||
"(UIManager.createView) tag: " + tag + ", class: " + className + ", props: " + props;
|
||||
FLog.d(ReactConstants.TAG, message);
|
||||
PrinterHolder.getPrinter().logMessage(ReactDebugOverlayTags.UI_MANAGER, message);
|
||||
}
|
||||
mUIImplementation.createView(tag, className, rootViewTag, props);
|
||||
}
|
||||
@ -264,9 +268,10 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
@ReactMethod
|
||||
public void updateView(int tag, String className, ReadableMap props) {
|
||||
if (DEBUG) {
|
||||
FLog.d(
|
||||
ReactConstants.TAG,
|
||||
"(UIManager.updateView) tag: " + tag + ", class: " + className + ", props: " + props);
|
||||
String message =
|
||||
"(UIManager.updateView) tag: " + tag + ", class: " + className + ", props: " + props;
|
||||
FLog.d(ReactConstants.TAG, message);
|
||||
PrinterHolder.getPrinter().logMessage(ReactDebugOverlayTags.UI_MANAGER, message);
|
||||
}
|
||||
mUIImplementation.updateView(tag, className, props);
|
||||
}
|
||||
@ -291,14 +296,21 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
@Nullable ReadableArray addAtIndices,
|
||||
@Nullable ReadableArray removeFrom) {
|
||||
if (DEBUG) {
|
||||
FLog.d(
|
||||
ReactConstants.TAG,
|
||||
"(UIManager.manageChildren) tag: " + viewTag +
|
||||
", moveFrom: " + moveFrom +
|
||||
", moveTo: " + moveTo +
|
||||
", addTags: " + addChildTags +
|
||||
", atIndices: " + addAtIndices +
|
||||
", removeFrom: " + removeFrom);
|
||||
String message =
|
||||
"(UIManager.manageChildren) tag: "
|
||||
+ viewTag
|
||||
+ ", moveFrom: "
|
||||
+ moveFrom
|
||||
+ ", moveTo: "
|
||||
+ moveTo
|
||||
+ ", addTags: "
|
||||
+ addChildTags
|
||||
+ ", atIndices: "
|
||||
+ addAtIndices
|
||||
+ ", removeFrom: "
|
||||
+ removeFrom;
|
||||
FLog.d(ReactConstants.TAG, message);
|
||||
PrinterHolder.getPrinter().logMessage(ReactDebugOverlayTags.UI_MANAGER, message);
|
||||
}
|
||||
mUIImplementation.manageChildren(
|
||||
viewTag,
|
||||
@ -321,9 +333,9 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
int viewTag,
|
||||
ReadableArray childrenTags) {
|
||||
if (DEBUG) {
|
||||
FLog.d(
|
||||
ReactConstants.TAG,
|
||||
"(UIManager.setChildren) tag: " + viewTag + ", children: " + childrenTags);
|
||||
String message = "(UIManager.setChildren) tag: " + viewTag + ", children: " + childrenTags;
|
||||
FLog.d(ReactConstants.TAG, message);
|
||||
PrinterHolder.getPrinter().logMessage(ReactDebugOverlayTags.UI_MANAGER, message);
|
||||
}
|
||||
mUIImplementation.setChildren(viewTag, childrenTags);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user