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
+70-66Lines changed: 70 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,38 @@ 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
+
-`roundness` (`number`): **Deprecated.** Use `theme.shapes.*` instead.
154
+
-`animation` (`object`): **Deprecated.** Use `theme.motion.*` instead.
155
+
-`scale` - **Deprecated.** Use `theme.motion.prefersReducedMotion` instead.
156
+
157
+
`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
158
155
159
## Extending the theme
156
160
157
161
Keeping your own properties in the theme is fully supported by our library:
@@ -187,7 +188,7 @@ export default function Main() {
187
188
## Creating dynamic theme colors
188
189
189
190
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:
191
+
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
192
192
193
<DynamicColorTheme />
193
194
@@ -205,14 +206,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
215
};
218
216
@@ -227,11 +225,7 @@ export default function Main() {
227
225
228
226
### Sync dynamic colors with system colors
229
227
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
-
232
-
:::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`.
234
-
:::
228
+
React Native Paper supports Android Material Design dynamic colors (wallpaper-seeded colors) via the pre-built `DynamicLightTheme` and `DynamicDarkTheme` objects. These use React Native's `PlatformColor` API to map all color roles to the system palette:
235
229
236
230
```tsx
237
231
import { useColorScheme } from'react-native';
@@ -253,9 +247,13 @@ export default function Main() {
253
247
}
254
248
```
255
249
250
+
:::info
251
+
Dynamic colors require Android 12 (API 31+). On unsupported platforms and older Android versions, `DynamicLightTheme` and `DynamicDarkTheme` fall back to the static `LightTheme` and `DarkTheme` so consumer code stays platform-agnostic. Use the exported `isDynamicColorSupported` constant if you need to gate UI on platform support.
252
+
:::
253
+
256
254
## Adapting React Navigation theme
257
255
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.
256
+
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 +457,7 @@ export default function HomeScreen() {
466
457
467
458
## Material Design 3
468
459
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)).
460
+
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
461
471
462
## Applying a theme to a paper component
472
463
@@ -509,19 +500,32 @@ Now you can use your `FancyButton` component everywhere instead of using `Button
509
500
510
501
## Dark Theme
511
502
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.
503
+
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.
504
+
505
+
`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.
506
+
507
+
### Using the operating system preferences
515
508
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:
509
+
To follow the device's light/dark preference with your own themes, read it with React Native's `useColorScheme()` hook and pick the matching theme:
-`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.
517
+
exportdefaultfunction Main() {
518
+
const scheme =useColorScheme();
521
519
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.
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