mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Set dev menu title to "React Native Dev Menu", add JS executor description (#37195)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37195 Updates the Dev Menu header on Android. - Small alignment related to D44872456. - Add subheading label showing current JS executor description (matching iOS) (note: on Android this is unformatted (but informative), e.g. `JSIExecutor+HermesRuntime`). Changelog: [Internal] Reviewed By: cortinico Differential Revision: D45142924 fbshipit-source-id: 5c95fc85e6d3b6879287440f76165b02957283e5
This commit is contained in:
committed by
Lorenzo Sciandra
parent
8de71e58b6
commit
738e01430a
+26
-8
@@ -24,6 +24,7 @@ import android.util.Pair;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -553,17 +554,30 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
|
||||
return;
|
||||
}
|
||||
|
||||
final TextView textView = new TextView(getApplicationContext());
|
||||
textView.setText("React Native DevMenu (" + getUniqueTag() + ")");
|
||||
textView.setPadding(0, 50, 0, 0);
|
||||
textView.setGravity(Gravity.CENTER);
|
||||
textView.setTextColor(Color.BLACK);
|
||||
textView.setTextSize(17);
|
||||
textView.setTypeface(textView.getTypeface(), Typeface.BOLD);
|
||||
final LinearLayout header = new LinearLayout(getApplicationContext());
|
||||
header.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
final TextView title = new TextView(getApplicationContext());
|
||||
title.setText("React Native Dev Menu (" + getUniqueTag() + ")");
|
||||
title.setPadding(0, 50, 0, 0);
|
||||
title.setGravity(Gravity.CENTER);
|
||||
title.setTextColor(Color.DKGRAY);
|
||||
title.setTextSize(16);
|
||||
title.setTypeface(title.getTypeface(), Typeface.BOLD);
|
||||
|
||||
final TextView jsExecutorLabel = new TextView(getApplicationContext());
|
||||
jsExecutorLabel.setText(getJSExecutorDescription());
|
||||
jsExecutorLabel.setPadding(0, 20, 0, 0);
|
||||
jsExecutorLabel.setGravity(Gravity.CENTER);
|
||||
jsExecutorLabel.setTextColor(Color.GRAY);
|
||||
jsExecutorLabel.setTextSize(14);
|
||||
|
||||
header.addView(title);
|
||||
header.addView(jsExecutorLabel);
|
||||
|
||||
mDevOptionsDialog =
|
||||
new AlertDialog.Builder(context)
|
||||
.setCustomTitle(textView)
|
||||
.setCustomTitle(header)
|
||||
.setItems(
|
||||
options.keySet().toArray(new String[0]),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@@ -587,6 +601,10 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
|
||||
}
|
||||
}
|
||||
|
||||
private String getJSExecutorDescription() {
|
||||
return "Running " + getReactInstanceDevHelper().getJavaScriptExecutorFactory().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ReactInstanceDevCommandsHandler} is responsible for enabling/disabling dev support when
|
||||
* a React view is attached/detached or when application state changes (e.g. the application is
|
||||
|
||||
Reference in New Issue
Block a user