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:
Alex Hunt
2023-07-25 09:00:04 -07:00
committed by Facebook GitHub Bot
parent 3c196fb2f5
commit 51a63f4a5e
@@ -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;
}
}
/**