mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Extract SoftException categories (#48289)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48289 Provide a mechanism to register specific category constants, which can be used by individual `ReactSoftExceptionListener`s to differentiate behavior, if desired. Changelog: [Android][Added] SoftException categories Reviewed By: makovkastar Differential Revision: D66785403 fbshipit-source-id: cb2c8861bb1dce29a6787d328b814cee09f36464
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2516414f02
commit
c832f94cf7
@@ -1423,6 +1423,12 @@ public final class com/facebook/react/bridge/ReactSoftExceptionLogger {
|
||||
public static final fun removeListener (Lcom/facebook/react/bridge/ReactSoftExceptionLogger$ReactSoftExceptionListener;)V
|
||||
}
|
||||
|
||||
public final class com/facebook/react/bridge/ReactSoftExceptionLogger$Categories {
|
||||
public static final field INSTANCE Lcom/facebook/react/bridge/ReactSoftExceptionLogger$Categories;
|
||||
public static final field RVG_IS_VIEW_CLIPPED Ljava/lang/String;
|
||||
public static final field RVG_ON_VIEW_REMOVED Ljava/lang/String;
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/bridge/ReactSoftExceptionLogger$ReactSoftExceptionListener {
|
||||
public abstract fun logSoftException (Ljava/lang/String;Ljava/lang/Throwable;)V
|
||||
}
|
||||
|
||||
+5
@@ -14,6 +14,11 @@ import kotlin.jvm.JvmStatic
|
||||
|
||||
@DoNotStrip
|
||||
public object ReactSoftExceptionLogger {
|
||||
/** Constants that listeners can utilize for custom category-based behavior. */
|
||||
public object Categories {
|
||||
public const val RVG_IS_VIEW_CLIPPED: String = "ReactViewGroup.isViewClipped"
|
||||
public const val RVG_ON_VIEW_REMOVED: String = "ReactViewGroup.onViewRemoved"
|
||||
}
|
||||
|
||||
// Use a list instead of a set here because we expect the number of listeners
|
||||
// to be very small, and we want listeners to be called in a deterministic
|
||||
|
||||
+2
-2
@@ -610,7 +610,7 @@ public class ReactViewGroup extends ViewGroup
|
||||
Object tag = child.getTag(R.id.view_clipped);
|
||||
if (!expectedTag.equals(tag)) {
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
"ReactViewGroup.onViewRemoved",
|
||||
ReactSoftExceptionLogger.Categories.RVG_ON_VIEW_REMOVED,
|
||||
new ReactNoCrashSoftException(
|
||||
"View clipping tag mismatch: tag=" + tag + " expected=" + expectedTag));
|
||||
}
|
||||
@@ -777,7 +777,7 @@ public class ReactViewGroup extends ViewGroup
|
||||
boolean transitioning = isChildRemovedWhileTransitioning(view);
|
||||
if (index != null) {
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
"ReactViewGroup.isViewClipped",
|
||||
ReactSoftExceptionLogger.Categories.RVG_IS_VIEW_CLIPPED,
|
||||
new ReactNoCrashSoftException(
|
||||
"View missing clipping tag: index="
|
||||
+ index
|
||||
|
||||
Reference in New Issue
Block a user