Skip to content

Commit

Permalink
android: Make dark-theme support official, in styles.xml.
Browse files Browse the repository at this point in the history
As Android's dark theme guide says is necessary [1].

Done now, to follow the template-app change in
facebook/react-native@2b56011f9, on the path to the RN v0.64
upgrade.

The RN commit contains other changes to the template app that we
don't transfer to our project right now:

- The placeholder App.js starts using `useColorScheme` [1], an API
  that was new in RN v0.62. We may want to use this API in some
  places, during or after #4009, but it doesn't seem necessary now.

- On iOS, the root view defined in AppDelegate.m gets its
  `.backgroundColor` set to `[UIColor systemBackgroundColor]` when
  possible. That seems intended to vary the background with the
  system-set theme (dark or light). We don't want to make this
  change: we've so far decided to set `.loadingView` instead of
  `.backgroundColor`, and we do so in a way that explicitly doesn't
  change with the theme (it uses the brand color).

- On iOS, the launch-screen storyboard is changed to adapt to the
  system-set theme. No need to make that change; we've so far chosen
  not to have it change with the theme, and just to use our brand
  color.

[1] https://developer.android.com/guide/topics/ui/look-and-feel/darktheme#support-dark-theme
[2] https://reactnative.dev/docs/usecolorscheme
  • Loading branch information
chrisbobbe committed Jul 2, 2021
1 parent 5359d7b commit 453e551
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<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="colorPrimary">@color/primaryColor</item>
<item name="colorPrimaryDark">@color/primaryColorDark</item>
Expand Down

0 comments on commit 453e551

Please sign in to comment.