Skip to content

Commit

Permalink
Fix unreadable dev menu header on dark theme apps (#37253)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #37253

Currently the Dev Menu has unreadable header/subtitle on apps with Dark theme. Here I'm fixing it:
* First I'm adding support for Dark Theme to RN Tester (we were forcign ligth theme).
* Then I'm removing any color reference and defaulting to the theme provided colors.

Changelog:
[Android] [Fixed] - Fix unreadable dev menu header on dark theme apps

Reviewed By: mdvacca

Differential Revision: D45566321

fbshipit-source-id: 947693aefdea846fec927a2cfa4d8236e02e0bfd
  • Loading branch information
cortinico authored and facebook-github-bot committed May 4, 2023
1 parent 6a31799 commit 88e3130
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import android.content.IntentFilter;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.Typeface;
import android.hardware.SensorManager;
import android.util.Pair;
Expand Down Expand Up @@ -498,23 +497,21 @@ public void onOptionSelected() {
return;
}

final LinearLayout header = new LinearLayout(getApplicationContext());
final LinearLayout header = new LinearLayout(context);
header.setOrientation(LinearLayout.VERTICAL);

final TextView title = new TextView(getApplicationContext());
final TextView title = new TextView(context);
title.setText(context.getString(R.string.catalyst_dev_menu_header, 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());
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.setTextColor(Color.GRAY);
jsExecutorLabel.setTextSize(14);

header.addView(title);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
</style>

Expand Down

0 comments on commit 88e3130

Please sign in to comment.