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
Copy file name to clipboardExpand all lines: docs/docs/guides/01-getting-started.md
+5-8Lines changed: 5 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ title: Getting Started
12
12
npm install react-native-paper
13
13
```
14
14
15
-
-From `v5` there is a need to install[react-native-safe-area-context](https://github.com/th3rdwave/react-native-safe-area-context) for handling safe area.
15
+
-Install[react-native-safe-area-context](https://github.com/th3rdwave/react-native-safe-area-context) for handling safe area.
16
16
17
17
```bash npm2yarn
18
18
npm install react-native-safe-area-context
@@ -136,22 +136,19 @@ export default function Main() {
136
136
137
137
## Customization
138
138
139
-
You can provide a custom theme to customize the colors, typescales etc. with the `Provider` component. Check the [Material Design 3 default theme](https://github.com/callstack/react-native-paper/blob/main/src/styles/themes/v3/LightTheme.tsx) to see what customization options are supported.
139
+
You can provide a custom theme to customize the colors, typescales etc. with the `Provider` component. Check the [default theme](https://github.com/callstack/react-native-paper/blob/main/src/theme/schemes/LightTheme.tsx) to see what customization options are supported.
Copy file name to clipboardExpand all lines: docs/docs/guides/02-theming.mdx
+65-66Lines changed: 65 additions & 66 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ export default function Main() {
28
28
}
29
29
```
30
30
31
-
By default React Native Paper will apply the [Material You theme (MD3)](https://github.com/callstack/react-native-paper/blob/main/src/styles/themes/v3/LightTheme.tsx) if no `theme`or `version`prop is passed to the `PaperProvider`.
31
+
By default React Native Paper will apply `LightTheme` if no `theme` prop is passed to the `PaperProvider`, automatically switching to `DarkTheme` when the device color scheme is dark.
You can change the theme prop dynamically and all the components will automatically update to reflect the new theme.
64
64
65
-
A theme usually contains the following properties:
65
+
A theme contains the following properties:
66
66
67
67
-`dark` (`boolean`): whether this is a dark theme or light theme.
68
-
-`version`: Material You (MD3); kept for compatibility and normalized to `3` by `PaperProvider`
69
-
-`mode` (`'adaptive' | 'exact'`): color mode for dark theme (See [Dark Theme](#dark-theme)).
70
-
-`roundness` (`number`): roundness of common elements, such as buttons.
71
68
-`colors` (`object`): various colors used throughout different elements.
72
69
73
70
> The primary key color is used to derive roles for key components across the UI, such as the FAB, prominent buttons, active states, as well as the tint of elevated surfaces.
@@ -143,34 +140,39 @@ A theme usually contains the following properties:
143
140
-`fontWeight`
144
141
-`lineHeight`
145
142
-`fontSize`
146
-
-`animation` (`object`)
147
-
-`scale` - scale for all animations
148
-
149
-
When creating a custom theme, you will need to provide all of these properties.
150
-
151
-
If you don't use a custom theme, Paper will automatically turn animations on/off, depending on device settings.
152
-
153
-
Otherwise, your custom theme will need to handle it manually, using React Native's [AccessibilityInfo API](https://reactnative.dev/docs/accessibilityinfo).
143
+
-`state` (`object`): interaction state opacity layers per the Material Design 3 spec.
144
+
-`opacity` - opacities for each interaction state: `hovered` (0.08), `focused` (0.1), `pressed` (0.1), `dragged` (0.16), `disabled` (0.38), `enabled` (1.0)
145
+
-`shapes` (`object`): corner radius tokens per the Material Design 3 shape scale.
-`motion` (`object`): animation tokens: spring physics, easing curves, and durations.
148
+
-`spring` - spring stiffness/damping configs for `fast`, `default`, and `slow` speeds, each with `spatial` and `effects` variants
149
+
-`easing` - cubic bezier easing curves: `emphasized`, `emphasizedAccelerate`, `emphasizedDecelerate`, `standard`, `standardAccelerate`, `standardDecelerate`, `legacy`, and more
150
+
-`duration` - duration milestones in ms: `short1` (50 ms) through `extraLong4`
151
+
-`prefersReducedMotion` (`boolean`) - automatically set from device accessibility settings by `PaperProvider`
152
+
-`elevation` (`object`): maps elevation level names to their numeric values (`level0`–`level5`).
153
+
-`dynamic` (`boolean`, optional): `true` when Android Material You dynamic colors are active.
154
+
-`roundness` (`number`): **Deprecated.** Use `theme.shapes.*` instead.
155
+
-`animation` (`object`): **Deprecated.** Use `theme.motion.*` instead.
156
+
-`scale` - **Deprecated.** Use `theme.motion.prefersReducedMotion` instead.
157
+
158
+
`PaperProvider` automatically reflects the device's "Reduce Motion" accessibility setting into `theme.motion.prefersReducedMotion` (and the legacy `theme.animation.scale`). To opt out and handle accessibility yourself, pass `accessibilityAdapters={false}` to `PaperProvider`.
154
159
155
160
## Extending the theme
156
161
157
162
Keeping your own properties in the theme is fully supported by our library:
@@ -187,7 +189,7 @@ export default function Main() {
187
189
## Creating dynamic theme colors
188
190
189
191
Dynamic Color Themes allows for generating two color schemes lightScheme and darkScheme, based on the provided source color.
190
-
Created schemes are following the Material Design 3 color system and covering colors structure from the Paper theme. User may generate these schemes using the following tool:
192
+
Created schemes follow the Material Design 3 color system and cover the full color structure of the Paper theme. Use the tool below to generate them:
191
193
192
194
<DynamicColorTheme />
193
195
@@ -205,14 +207,11 @@ Once we have copied the color schemes from the generated JSON above, we can use
colors:yourGeneratedLightOrDarkScheme.colors, // Copy it from the color codes scheme and then use it here
217
216
};
218
217
@@ -227,12 +226,29 @@ export default function Main() {
227
226
228
227
### Sync dynamic colors with system colors
229
228
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.
229
+
React Native Paper supports Android Material You dynamic colors (wallpaper-seeded colors). The simplest way to enable them is the `dynamicColor` prop on `PaperProvider`:
When `dynamicColor` is enabled, `PaperProvider` overlays the Android system colors onto `theme.colors` and sets `theme.dynamic = true`. On unsupported platforms and Android versions below API 31, it silently falls back to the static theme.
231
245
232
246
:::info
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`.
247
+
Dynamic colors require Android 12 (API 31+). On older Android versions and all other platforms, `dynamicColor` has no effect.
234
248
:::
235
249
250
+
Alternatively, you can use the pre-built `DynamicLightTheme` and `DynamicDarkTheme` objects directly. These use React Native's `PlatformColor` API to map all color roles to the system palette:
251
+
236
252
```tsx
237
253
import { useColorScheme } from'react-native';
238
254
import {
@@ -255,7 +271,7 @@ export default function Main() {
255
271
256
272
## Adapting React Navigation theme
257
273
258
-
The `adaptNavigationTheme` function takes an existing React Navigation theme and returns a React Navigation theme using the colors from Material Design 3. This theme can be passed to `NavigationContainer` so that React Navigation's UI elements have the same color scheme as Paper.
274
+
The `adaptNavigationTheme` function takes an existing React Navigation theme and returns a React Navigation theme using Paper's color scheme. Pass the result to `NavigationContainer` so that React Navigation's UI elements match Paper's colors.
@@ -466,7 +475,7 @@ export default function HomeScreen() {
466
475
467
476
## Material Design 3
468
477
469
-
React Native Paper ships with Material Design 3 (Material You) only. Customize the default experience by extending `MD3LightTheme` or `MD3DarkTheme` (see [Extending the theme](#extending-the-theme) and [Advanced theme overrides](#advanced-theme-overrides)).
478
+
React Native Paper implements Material Design 3 exclusively. Customize the default experience by extending `LightTheme` or `DarkTheme` (see [Extending the theme](#extending-the-theme) and [Advanced theme overrides](#advanced-theme-overrides)).
470
479
471
480
## Applying a theme to a paper component
472
481
@@ -509,19 +518,9 @@ Now you can use your `FancyButton` component everywhere instead of using `Button
509
518
510
519
## Dark Theme
511
520
512
-
Since 3.0 we adapt dark theme to follow [Material design guidelines](https://material.io/design/color/dark-theme.html). <br/>
513
-
In contrast to light theme, dark theme by default uses `surface` colour instead of `primary` on large components like `AppBar` or `BottomNavigation`.<br/>
514
-
The dark theme adds a white overlay with opacity depending on elevation of surfaces. It uses it for the better accentuation of surface elevation. Using only shadow is highly imperceptible on dark surfaces.
515
-
516
-
We are aware that users often use dark theme in their own ways and may not want to use the default dark theme features from the guidelines.<br/>
517
-
That's why if you are using dark theme you can switch between two dark theme `mode`s:
518
-
519
-
-`exact` where everything is like it was before. `Appbar` and `BottomNavigation` will still use primary colour by default.<br/>
520
-
-`adaptive` where we follow [Material design guidelines](https://material.io/design/color/dark-theme.html), the surface will use white overlay with opacity to show elevation, `Appbar` and `BottomNavigation` will use surface colour as a background.
521
-
522
-
If you don't use a custom theme, Paper will automatically change between the default theme and the default dark theme, depending on device settings.
521
+
React Native Paper follows the [Material Design 3 dark theme guidelines](https://m3.material.io/styles/color/dark-theme). Dark surfaces use tonal color overlays derived from the primary color to convey elevation.
523
522
524
-
Otherwise, your custom theme will need to handle it manually, using React Native's [Appearance API](https://reactnative.dev/docs/appearance).
523
+
`PaperProvider` automatically switches between `LightTheme` and `DarkTheme` based on the device color scheme. If you pass a custom `theme` prop, it is used as-is; you can toggle dark mode by changing `theme.dark` or swapping between your own light and dark theme objects.
Copy file name to clipboardExpand all lines: docs/docs/guides/04-fonts.md
+7-13Lines changed: 7 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,15 +47,9 @@ Now, you are able to use `fontFamily` from font files.
47
47
48
48
## Configuring fonts in ThemeProvider
49
49
50
-
:::note
51
-
Older Material Design 2 platform-split font configuration (`configureFonts` with per-platform `ios` / `android` / `web` keys) is no longer supported. Use the Material Design 3 typescale and `configureFonts` as documented below.
52
-
:::
53
-
54
-
### Material Design 3
55
-
56
50
#### Variants
57
51
58
-
In the latest version fonts in theme are structured based on the `variant` keys e.g. `displayLarge` or `bodyMedium` which are then used in`Text`'s component throughout the whole library.
52
+
Fonts in the theme are structured based on `variant` keys, e.g. `displayLarge` or `bodyMedium`, which are used by`Text`throughout the library.
59
53
60
54
:::info
61
55
The default `fontFamily` is different per particular platfrom:
@@ -317,7 +311,7 @@ If any component uses Paper's `Text` component, without specified <b>variant</b>
0 commit comments