@@ -343,29 +362,19 @@ There are two supported ways of overriding the theme:
change the built-in schema shape
-:::caution
-TypeScript support for `withTheme` is currently limited to Material You (MD3) theme only.
-
-
- We are planning to provide a better support of handling custom theme overrides
- in future releases.
-
-:::
-
### Simple built-in theme overrides
You can provide a `theme` prop with a theme object with the same properties as the default theme:
```js
import * as React from 'react';
-import { MD3LightTheme, PaperProvider } from 'react-native-paper';
+import { LightTheme, PaperProvider } from 'react-native-paper';
import App from './src/App';
const theme = {
- ...MD3LightTheme, // or MD3DarkTheme
- roundness: 2,
+ ...LightTheme, // or DarkTheme
colors: {
- ...MD3LightTheme.colors,
+ ...LightTheme.colors,
primary: '#3498db',
secondary: '#f1c40f',
tertiary: '#a1b2c3',
@@ -389,18 +398,18 @@ If you need to modify the built-in theme schema by adding a new property or chan
```ts
import * as React from 'react';
-import { MD3LightTheme, PaperProvider } from 'react-native-paper';
+import { LightTheme, PaperProvider } from 'react-native-paper';
import App from './src/App';
const theme = {
- ...MD3LightTheme,
+ ...LightTheme,
// Specify a custom property
custom: 'property',
// Specify a custom property in nested object
colors: {
- ...MD3LightTheme.colors,
+ ...LightTheme.colors,
brandPrimary: '#fefefe',
brandSecondary: 'red',
},
@@ -419,18 +428,18 @@ export default function Main() {
```ts
import * as React from 'react';
-import { MD3LightTheme, PaperProvider, useTheme } from 'react-native-paper';
+import { LightTheme, PaperProvider, useTheme } from 'react-native-paper';
import App from './src/App';
const theme = {
- ...MD3LightTheme,
+ ...LightTheme,
// Specify a custom property
custom: 'property',
// Specify a custom property in nested object
colors: {
- ...MD3LightTheme.colors,
+ ...LightTheme.colors,
brandPrimary: '#fefefe',
brandSecondary: 'red',
},
@@ -466,7 +475,7 @@ export default function HomeScreen() {
## Material Design 3
-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)).
+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)).
## Applying a theme to a paper component
@@ -509,19 +518,9 @@ Now you can use your `FancyButton` component everywhere instead of using `Button
## Dark Theme
-Since 3.0 we adapt dark theme to follow [Material design guidelines](https://material.io/design/color/dark-theme.html).
-In contrast to light theme, dark theme by default uses `surface` colour instead of `primary` on large components like `AppBar` or `BottomNavigation`.
-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.
-
-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.
-That's why if you are using dark theme you can switch between two dark theme `mode`s:
-
-- `exact` where everything is like it was before. `Appbar` and `BottomNavigation` will still use primary colour by default.
-- `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.
-
-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.
+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.
-Otherwise, your custom theme will need to handle it manually, using React Native's [Appearance API](https://reactnative.dev/docs/appearance).
+`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.
## Gotchas
diff --git a/docs/docs/guides/04-fonts.md b/docs/docs/guides/04-fonts.md
index 5e8e435c0a..115418feab 100644
--- a/docs/docs/guides/04-fonts.md
+++ b/docs/docs/guides/04-fonts.md
@@ -47,15 +47,9 @@ Now, you are able to use `fontFamily` from font files.
## Configuring fonts in ThemeProvider
-:::note
-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.
-:::
-
-### Material Design 3
-
#### Variants
-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.
+Fonts in the theme are structured based on `variant` keys, e.g. `displayLarge` or `bodyMedium`, which are used by `Text` throughout the library.
:::info
The default `fontFamily` is different per particular platfrom:
@@ -317,7 +311,7 @@ If any component uses Paper's `Text` component, without specified variant
```js
import * as React from 'react';
-import { configureFonts, MD3LightTheme, PaperProvider } from 'react-native-paper';
+import { configureFonts, LightTheme, PaperProvider } from 'react-native-paper';
import App from './src/App';
const fontConfig = {
@@ -335,7 +329,7 @@ const fontConfig = {
};
const theme = {
- ...MD3LightTheme,
+ ...LightTheme,
fonts: configureFonts({config: fontConfig}),
};
@@ -362,7 +356,7 @@ export const Text = customText<'customVariant'>()
```js
import * as React from 'react';
-import { configureFonts, MD3LightTheme, PaperProvider } from 'react-native-paper';
+import { configureFonts, LightTheme, PaperProvider } from 'react-native-paper';
import App from './src/App';
const fontConfig = {
@@ -374,7 +368,7 @@ const fontConfig = {
};
const theme = {
- ...MD3LightTheme,
+ ...LightTheme,
fonts: configureFonts({config: fontConfig}),
};
@@ -391,7 +385,7 @@ export default function Main() {
```js
import * as React from 'react';
-import { configureFonts, MD3LightTheme, PaperProvider } from 'react-native-paper';
+import { configureFonts, LightTheme, PaperProvider } from 'react-native-paper';
import App from './src/App';
const fontConfig = {
@@ -399,7 +393,7 @@ const fontConfig = {
};
const theme = {
- ...MD3LightTheme,
+ ...LightTheme,
fonts: configureFonts({config: fontConfig}),
};
diff --git a/docs/docs/guides/08-theming-with-react-navigation.md b/docs/docs/guides/08-theming-with-react-navigation.md
index 272b0c08cd..7921da6726 100644
--- a/docs/docs/guides/08-theming-with-react-navigation.md
+++ b/docs/docs/guides/08-theming-with-react-navigation.md
@@ -11,11 +11,9 @@ But how to make them work together?
## Themes adaptation
-### Material Design 3
+React Native Paper uses the Material Design 3 color system, which differs from React Navigation’s default theme shape.
-React Native Paper follows the Material Design 3 (Material You) color system, which differs from React Navigation’s default theme shape.
-
-However, to simplify adapting React Navigation theme colors, to use the ones from React Native Paper, it's worth using a utility called `adaptNavigationTheme` – it accepts navigation-compliant themes in both modes and returns their equivalents adjusted to Material Design 3.
+To adapt React Navigation’s theme to use Paper’s colors, use the `adaptNavigationTheme` utility. It accepts navigation-compliant themes and returns equivalents that match Paper’s color scheme.
```ts
import {
@@ -24,19 +22,17 @@ import {
} from '@react-navigation/native';
import { adaptNavigationTheme } from 'react-native-paper';
-const { LightTheme, DarkTheme } = adaptNavigationTheme({
- reactNavigationLight: NavigationDefaultTheme,
- reactNavigationDark: NavigationDarkTheme,
-});
+const { LightTheme: NavLightTheme, DarkTheme: NavDarkTheme } =
+ adaptNavigationTheme({
+ reactNavigationLight: NavigationDefaultTheme,
+ reactNavigationDark: NavigationDarkTheme,
+ });
```
-Library exports also Material Design 3 themes in both modes:
+Library exports themes in both modes:
```js
-import {
- MD3LightTheme,
- MD3DarkTheme,
-} from 'react-native-paper';
+import { LightTheme, DarkTheme } from 'react-native-paper';
```
## Combining theme objects
@@ -110,8 +106,6 @@ To make things easier we can use [deepmerge](https://www.npmjs.com/package/deepm
npm install deepmerge
```
-### Material Design 3
-
```js
import {
NavigationContainer,
@@ -119,45 +113,45 @@ import {
DefaultTheme as NavigationDefaultTheme,
} from '@react-navigation/native';
import {
- MD3DarkTheme,
- MD3LightTheme,
+ DarkTheme,
+ LightTheme,
adaptNavigationTheme,
} from 'react-native-paper';
import merge from 'deepmerge';
-const { LightTheme, DarkTheme } = adaptNavigationTheme({
- reactNavigationLight: NavigationDefaultTheme,
- reactNavigationDark: NavigationDarkTheme,
-});
+const { LightTheme: NavLightTheme, DarkTheme: NavDarkTheme } =
+ adaptNavigationTheme({
+ reactNavigationLight: NavigationDefaultTheme,
+ reactNavigationDark: NavigationDarkTheme,
+ });
-const CombinedDefaultTheme = merge(MD3LightTheme, LightTheme);
-const CombinedDarkTheme = merge(MD3DarkTheme, DarkTheme);
+const CombinedDefaultTheme = merge(LightTheme, NavLightTheme);
+const CombinedDarkTheme = merge(DarkTheme, NavDarkTheme);
```
Alternatively, we could merge those themes using vanilla JavaScript:
-### Material Design 3
-
```js
-const { LightTheme, DarkTheme } = adaptNavigationTheme({
- reactNavigationLight: NavigationDefaultTheme,
- reactNavigationDark: NavigationDarkTheme,
-});
+const { LightTheme: NavLightTheme, DarkTheme: NavDarkTheme } =
+ adaptNavigationTheme({
+ reactNavigationLight: NavigationDefaultTheme,
+ reactNavigationDark: NavigationDarkTheme,
+ });
const CombinedDefaultTheme = {
- ...MD3LightTheme,
...LightTheme,
+ ...NavLightTheme,
colors: {
- ...MD3LightTheme.colors,
...LightTheme.colors,
+ ...NavLightTheme.colors,
},
};
const CombinedDarkTheme = {
- ...MD3DarkTheme,
...DarkTheme,
+ ...NavDarkTheme,
colors: {
- ...MD3DarkTheme.colors,
...DarkTheme.colors,
+ ...NavDarkTheme.colors,
},
};
```
diff --git a/docs/docs/guides/09-bottom-navigation.md b/docs/docs/guides/09-bottom-navigation.md
index 21776718c9..7ac8e0b17d 100644
--- a/docs/docs/guides/09-bottom-navigation.md
+++ b/docs/docs/guides/09-bottom-navigation.md
@@ -2,247 +2,8 @@
title: Using BottomNavigation with React Navigation
---
-:::caution
-The `createMaterialBottomTabNavigator` has been deprecated as of `react-native-paper@5.14.0`. Instead, use `@react-navigation/bottom-tabs` version `7.x` or later, combined with `BottomNavigation.Bar` to achieve a Material Design look.
+:::danger Removed in v6
+`createMaterialBottomTabNavigator` has been removed from React Native Paper as of v6. Use `@react-navigation/bottom-tabs` (v7+) together with `BottomNavigation.Bar` to achieve the same look.
-For implementation details, see the [dedicated example](https://callstack.github.io/react-native-paper/docs/components/BottomNavigation/BottomNavigationBar#with-react-navigation).
+See the [BottomNavigation.Bar documentation](https://callstack.github.io/react-native-paper/docs/components/BottomNavigation/BottomNavigationBar#with-react-navigation) for a complete integration example.
:::
-
-A material-design themed tab bar on the bottom of the screen that lets you switch between different routes with animation. Routes are lazily initialized - their screen components are not mounted until they are first focused.
-
-This wraps the [`BottomNavigation`](https://callstack.github.io/react-native-paper/docs/components/BottomNavigation/) component from `react-native-paper`, however if you [configure the Babel plugin](https://callstack.github.io/react-native-paper/docs/guides/getting-started/), it won't include the whole library in your bundle.
-
-
-
-:::info
-To use this navigator, ensure that you have [`@react-navigation/native` and its dependencies (follow this guide)](https://reactnavigation.org/docs/getting-started):
-:::
-
-> 👉 For a complete example please visit `createMaterialBottomTabNavigator` [snack](https://snack.expo.dev/@react-native-paper/creatematerialbottomtabnavigator)
-
-## API Definition
-
-To use this tab navigator, import it from `react-native-paper/react-navigation`:
-
-```js
-import { createMaterialBottomTabNavigator } from 'react-native-paper/react-navigation';
-
-const Tab = createMaterialBottomTabNavigator();
-
-function MyTabs() {
- return (
-
-
-
-
- );
-}
-```
-
-> 👉 For a complete usage guide please visit [Tab Navigation](https://reactnavigation.org/docs/tab-based-navigation/)
-
-### Props
-
-The `Tab.Navigator` component accepts following props:
-
-#### `id`
-
-Optional unique ID for the navigator. This can be used with [`navigation.getParent`](https://reactnavigation.org/docs/navigation-prop#getparent) to refer to this navigator in a child navigator.
-
-#### `initialRouteName`
-
-The name of the route to render on first load of the navigator.
-
-#### `screenOptions`
-
-Default options to use for the screens in the navigator.
-
-#### `backBehavior`
-
-This controls what happens when `goBack` is called in the navigator. This includes pressing the device's back button or back gesture on Android.
-
-It supports the following values:
-
-- `firstRoute` - return to the first screen defined in the navigator (default)
-- `initialRoute` - return to initial screen passed in `initialRouteName` prop, if not passed, defaults to the first screen
-- `order` - return to screen defined before the focused screen
-- `history` - return to last visited screen in the navigator; if the same screen is visited multiple times, the older entries are dropped from the history
-- `none` - do not handle back button
-
-#### `shifting`
-
-Whether the shifting style is used, the active tab icon shifts up to show the label and the inactive tabs won't have a label.
-
-By default, this is `true` when you have more than 3 tabs. Pass `shifting={false}` to explicitly disable this animation, or `shifting={true}` to always use this animation.
-
-#### `labeled`
-
-Whether to show labels in tabs. When `false`, only icons will be displayed.
-
-#### `activeColor`
-
-Custom color for icon and label in the active tab.
-
-#### `inactiveColor`
-
-Custom color for icon and label in the inactive tab.
-
-#### `barStyle`
-
-Style for the bottom navigation bar. You can pass custom background color here:
-
-```js
-
- {/* ... */}
-
-```
-
-If you have a translucent navigation bar on Android, you can also set a bottom padding here:
-
-```js
-
- {/* ... */}
-
-```
-
-#### `theme`
-
-Enables the customization of default theme attributes (e.g. colors) or facilitates the utilization of a personalized custom theme.
-
-### Options
-
-The following [options](https://reactnavigation.org/docs/screen-options) can be used to configure the screens in the navigator:
-
-#### `title`
-
-Generic title that can be used as a fallback for `headerTitle` and `tabBarLabel`.
-
-#### `tabBarIcon`
-
-Function that given `{ focused: boolean, color: string }` returns a React.Node, to display in the tab bar.
-
-#### `tabBarColor` In v5.x works only with theme version 2.
-
-Color for the tab bar when the tab corresponding to the screen is active. Used for the ripple effect. This is only supported when `shifting` is `true`.
-
-#### `tabBarLabel`
-
-Title string of a tab displayed in the tab bar. When undefined, scene `title` is used. To hide, see `labeled` option in the previous section.
-
-#### `tabBarBadge`
-
-Badge to show on the tab icon, can be `true` to show a dot, `string` or `number` to show text.
-
-#### `tabBarAccessibilityLabel`
-
-Accessibility label for the tab button. This is read by the screen reader when the user taps the tab. It's recommended to set this if you don't have a label for the tab.
-
-#### `tabBarTestID`
-
-ID to locate this tab button in tests.
-
-### Events
-
-The navigator can [emit events](https://reactnavigation.org/docs/navigation-events) on certain actions. Supported events are:
-
-#### `tabPress`
-
-This event is fired when the user presses the tab button for the current screen in the tab bar. By default a tab press does several things:
-
-- If the tab is not focused, tab press will focus that tab
-- If the tab is already focused:
- - If the screen for the tab renders a scroll view, you can use [`useScrollToTop`](https://reactnavigation.org/docs/use-scroll-to-top) to scroll it to top
- - If the screen for the tab renders a stack navigator, a `popToTop` action is performed on the stack
-
-To prevent the default behavior, you can call `event.preventDefault`:
-
-```js
-React.useEffect(() => {
- const unsubscribe = navigation.addListener('tabPress', (e) => {
- // Prevent default behavior
-
- e.preventDefault();
- // Do something manually
- // ...
- });
-
- return unsubscribe;
-}, [navigation]);
-```
-
-### Helpers
-
-The tab navigator adds the following methods to the navigation prop:
-
-#### `jumpTo`
-
-Navigates to an existing screen in the tab navigator. The method accepts following arguments:
-
-- `name` - _string_ - Name of the route to jump to.
-- `params` - _object_ - Screen params to pass to the destination route.
-
-
-
-```js
-navigation.jumpTo('Profile', { name: 'Michaś' });
-```
-
-## Example
-
-```js
-import { createMaterialBottomTabNavigator } from 'react-native-paper/react-navigation';
-import MaterialDesignIcons from '@react-native-vector-icons/material-design-icons';
-
-const Tab = createMaterialBottomTabNavigator();
-
-function MyTabs() {
- return (
-
- (
-
- ),
- }}
- />
- (
-
- ),
- }}
- />
- (
-
- ),
- }}
- />
-
- );
-}
-```