mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Hide JS executor in Dev Menu when unimplemented
Summary: Fixes exception thrown when `getJavaScriptExecutorFactory()` is not implemented on bridgeless. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D47755422 fbshipit-source-id: 80170db521ab02c4f23c9ddf3c2f5b0381df020b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3c196fb2f5
commit
51a63f4a5e
+17
-10
@@ -510,16 +510,19 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
|
||||
title.setGravity(Gravity.CENTER);
|
||||
title.setTextSize(16);
|
||||
title.setTypeface(title.getTypeface(), Typeface.BOLD);
|
||||
|
||||
final TextView jsExecutorLabel = new TextView(context);
|
||||
jsExecutorLabel.setText(
|
||||
context.getString(R.string.catalyst_dev_menu_sub_header, getJSExecutorDescription()));
|
||||
jsExecutorLabel.setPadding(0, 20, 0, 0);
|
||||
jsExecutorLabel.setGravity(Gravity.CENTER);
|
||||
jsExecutorLabel.setTextSize(14);
|
||||
|
||||
header.addView(title);
|
||||
header.addView(jsExecutorLabel);
|
||||
|
||||
String jsExecutorDescription = getJSExecutorDescription();
|
||||
|
||||
if (jsExecutorDescription != null) {
|
||||
final TextView jsExecutorLabel = new TextView(context);
|
||||
jsExecutorLabel.setText(
|
||||
context.getString(R.string.catalyst_dev_menu_sub_header, jsExecutorDescription));
|
||||
jsExecutorLabel.setPadding(0, 20, 0, 0);
|
||||
jsExecutorLabel.setGravity(Gravity.CENTER);
|
||||
jsExecutorLabel.setTextSize(14);
|
||||
header.addView(jsExecutorLabel);
|
||||
}
|
||||
|
||||
mDevOptionsDialog =
|
||||
new AlertDialog.Builder(context)
|
||||
@@ -539,7 +542,11 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
|
||||
}
|
||||
|
||||
private String getJSExecutorDescription() {
|
||||
return getReactInstanceDevHelper().getJavaScriptExecutorFactory().toString();
|
||||
try {
|
||||
return getReactInstanceDevHelper().getJavaScriptExecutorFactory().toString();
|
||||
} catch (IllegalStateException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user