From 53ff6133a7da8a35128cbbef913793df4a5dea70 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Mon, 24 Feb 2025 03:15:56 -0800 Subject: [PATCH] Re-land: Make `RedBoxContentView` internal (#49596) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49596 I'm relanding D69934543 as it was previsouly reverted. I'm making this class internal as I've verified that there are no meaningful usages. [Source](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+user%3Acortinico+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+com.facebook.react.devsupport.RedBoxContentView) Changelog: [Internal] [Changed] - Reviewed By: cipolleschi Differential Revision: D69987752 fbshipit-source-id: 191a5f5aacbe6ff642e98d4e8c621c17156e55de --- .../react-native/ReactAndroid/api/ReactAndroid.api | 9 --------- .../com/facebook/react/devsupport/RedBoxContentView.kt | 10 +++++----- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index aa55711b9b5..b4a6084a19c 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -2169,15 +2169,6 @@ public abstract interface class com/facebook/react/devsupport/ReactInstanceDevHe public abstract fun toggleElementInspector ()V } -public final class com/facebook/react/devsupport/RedBoxContentView : android/widget/LinearLayout, android/widget/AdapterView$OnItemClickListener { - public fun (Landroid/content/Context;Lcom/facebook/react/devsupport/interfaces/DevSupportManager;Lcom/facebook/react/devsupport/interfaces/RedBoxHandler;)V - public final fun init ()V - public fun onItemClick (Landroid/widget/AdapterView;Landroid/view/View;IJ)V - public final fun refreshContentView ()V - public final fun resetReporting ()V - public final fun setExceptionDetails (Ljava/lang/String;[Lcom/facebook/react/devsupport/interfaces/StackFrame;)V -} - public class com/facebook/react/devsupport/ReleaseDevSupportManager : com/facebook/react/devsupport/interfaces/DevSupportManager { public fun ()V public fun addCustomDevOption (Ljava/lang/String;Lcom/facebook/react/devsupport/interfaces/DevOptionHandler;)V diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxContentView.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxContentView.kt index 2d645a4ddd2..b247666ee7c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxContentView.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxContentView.kt @@ -45,7 +45,7 @@ import org.json.JSONObject /** Dialog for displaying JS errors in an eye-catching form (red box). */ @SuppressLint("ViewConstructor") -public class RedBoxContentView( +internal class RedBoxContentView( context: Context?, private val devSupportManager: DevSupportManager, private val redBoxHandler: RedBoxHandler?, @@ -190,7 +190,7 @@ public class RedBoxContentView( } } - public fun init() { + fun init() { LayoutInflater.from(context).inflate(R.layout.redbox_view, this) stackView = @@ -220,12 +220,12 @@ public class RedBoxContentView( } } - public fun setExceptionDetails(title: String, stack: Array) { + fun setExceptionDetails(title: String, stack: Array) { stackView.setAdapter(StackAdapter(title, stack)) } /** Show the report button, hide the report textview and the loading indicator. */ - public fun resetReporting() { + fun resetReporting() { if (redBoxHandler?.isReportEnabled() == false) { return } @@ -244,7 +244,7 @@ public class RedBoxContentView( } /** Refresh the content view with latest errors from dev support manager */ - public fun refreshContentView() { + fun refreshContentView() { val message: String? = devSupportManager.lastErrorTitle val stack: Array = devSupportManager.lastErrorStack ?: emptyArray() val errorType: ErrorType = checkNotNull(devSupportManager.lastErrorType)