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
@@ -165,7 +162,3 @@ export default function Main() {
165
162
);
166
163
}
167
164
```
168
-
169
-
:::note
170
-
For MD2 check the following [Material Design 2 default theme](https://github.com/callstack/react-native-paper/blob/main/src/styles/themes/v2/LightTheme.tsx).
@@ -28,8 +28,6 @@ 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`.
32
-
33
31
## Accessing theme properties
34
32
35
33
Use the built-in `useTheme()` hook to get access to the theme's variables:
@@ -65,9 +63,6 @@ You can change the theme prop dynamically and all the components will automatica
65
63
A theme usually contains the following properties:
66
64
67
65
-`dark` (`boolean`): whether this is a dark theme or light theme.
68
-
-`version`: specify which design system components should follow in the app
69
-
- 3 - new Material You (MD3)
70
-
- 2 - previous Material Design (MD2)
71
66
-`mode` (`'adaptive' | 'exact'`): color mode for dark theme (See [Dark Theme](#dark-theme)).
72
67
-`roundness` (`number`): roundness of common elements, such as buttons.
73
68
-`colors` (`object`): various colors used throughout different elements.
@@ -160,10 +155,7 @@ Keeping your own properties in the theme is fully supported by our library:
Due to the amount of changes in the theme's schema shape it falls into the [Advanced theme overrides](#advanced-theme-overrides) category. The steps are identical as with any advanced theme, just make sure to extend the built-in `MD2LightTheme` or `MD2DarkTheme` instead of `MD3LightTheme` or `MD3DarkTheme`.
532
-
533
-
The final example for Material Design 2 would look like this:
If you are migrating from Material Design 2 (4.x and lower) to Material You (5.x), please refer to our [Migration Guide](https://callstack.github.io/react-native-paper/docs/guides/migration-guide-to-5.0)
579
-
580
454
## Applying a theme to a paper component
581
455
582
456
If you want to change the theme for a certain component from the library, you can directly pass the `theme` prop to the component. The theme passed as the prop is merged with the theme from the `PaperProvider`:
@@ -586,11 +460,7 @@ import * as React from 'react';
@@ -616,22 +486,6 @@ export default function FancyButton(props) {
616
486
617
487
Now you can use your `FancyButton` component everywhere instead of using `Button` from Paper.
618
488
619
-
## Dark Theme
620
-
621
-
Since 3.0 we adapt dark theme to follow [Material design guidelines](https://material.io/design/color/dark-theme.html). <br/>
622
-
In contrast to light theme, dark theme by default uses `surface` colour instead of `primary` on large components like `AppBar` or `BottomNavigation`.<br/>
623
-
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.
624
-
625
-
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/>
626
-
That's why if you are using dark theme you can switch between two dark theme `mode`s:
627
-
628
-
-`exact` where everything is like it was before. `Appbar` and `BottomNavigation` will still use primary colour by default.<br/>
629
-
-`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.
630
-
631
-
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.
632
-
633
-
Otherwise, your custom theme will need to handle it manually, using React Native's [Appearance API](https://reactnative.dev/docs/appearance).
634
-
635
489
## Gotchas
636
490
637
491
The `PaperProvider` exposes the theme to the components via [React's context API](https://reactjs.org/docs/context.html), which means that the component must be in the same tree as the `PaperProvider`. Some React Native components will render a different tree such as a `Modal`, in which case the components inside the `Modal` won't be able to access the theme. The work around is to get the theme using the `withTheme` HOC and pass it down to the components as props, or expose it again with the exported `ThemeProvider` component.
0 commit comments