Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide JS executor in Dev Menu when unimplemented #38622

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -510,16 +510,19 @@ public void onOptionSelected() {
title.setGravity(Gravity.CENTER);
title.setTextSize(16);
title.setTypeface(title.getTypeface(), Typeface.BOLD);
header.addView(title);

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);
String jsExecutorDescription = getJSExecutorDescription();

header.addView(title);
header.addView(jsExecutorLabel);
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)
Expand All @@ -539,7 +542,11 @@ public void onOptionSelected() {
}

private String getJSExecutorDescription() {
return getReactInstanceDevHelper().getJavaScriptExecutorFactory().toString();
try {
return getReactInstanceDevHelper().getJavaScriptExecutorFactory().toString();
} catch (IllegalStateException e) {
return null;
}
}

/**
Expand Down