You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add DynamicTheme using PlatformColor (#4901)
* chore: remove md2 support
* fix: update colors as per material-components color tokens
* see https://github.com/material-components/material-components-android/blob/master/lib/java/com/google/android/material/color/res/values/tokens.xml
* fix: update the color schema for LightTheme and DarkTheme
* see: https://m3.material.io/styles/color/roles
* feat: add DynamicTheme
* Known limitation: surface/container roles on API 31-33 use
* @color/m3_ref_palette_dynamic_neutral_variant* (MCL resources that require a
* native DynamicColors setup). No @android:color/ equivalent exists for those
* slots. Reference palette values are used as fallback on API 31-33.
* refactor: remove usage of expo-material3-theme
* refactor: rename "device colors" to "Dynamic Theme"
* feat: update Colors and stateOpacity tokens
for PlatformColor compatibility
* surfaceDisabled, onSurfaceDisabled and backdrop which were not part of the MD standard were removed
* the reference theme elevation colors now use the correct neutral tones; see https://m3.material.io/blog/tone-based-surface-color-m3
* replace usage of "alpha" with opacity or surface colors
* remove disabled FAB prop
Copy file name to clipboardExpand all lines: docs/docs/guides/02-theming.mdx
+9-14Lines changed: 9 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -227,31 +227,26 @@ export default function Main() {
227
227
228
228
### Sync dynamic colors with system colors
229
229
230
-
Using [`pchmn/expo-material3-theme`](https://github.com/pchmn/expo-material3-theme) library you can easily access the Material 3 system colors from Android 12+ devices and seamlessly integrate them into your dynamic theme. Any changes made by the user to the system colors will be automatically reflected in the theme.
230
+
React Native Paper provides built-in support for Android dynamic colors through `DynamicLightTheme` and `DynamicDarkTheme`. These themes use React Native's `PlatformColor` API to map all Material Design 3 color roles to Android system colors, so any changes the user makes to their system palette are automatically reflected in the app.
231
231
232
232
:::info
233
-
In case of incompatible devices, the library will revert to a default theme.
233
+
Dynamic colors require Android 12 (API 31+). On older Android versions and all other platforms, these themes fall back to the default `LightTheme` / `DarkTheme`.
234
234
:::
235
235
236
-
To get started, follow the [installation instructions](https://github.com/pchmn/expo-material3-theme#installation) and check the following code:
Material Design themed [time picker](https://material.io/components/time-pickers), maintained by [@RichardLindhout](https://twitter.com/RichardLindhout)
Retrieve Material 3 system colors from Android 12+ devices
36
+
Material Design themed [time picker](https://material.io/components/time-pickers), maintained by [@RichardLindhout](https://twitter.com/RichardLindhout)
0 commit comments