Skip to content

Commit 469ac47

Browse files
committed
feat(v6): remove deprecated public API
- Delete src/deprecated.ts and all MD3*/DefaultTheme/useAppTheme re-exports - Remove createMaterialBottomTabNavigator and entire src/react-navigation/ directory - Remove theme.mode field from Theme type and DarkTheme definition - Remove ThemeBase type - Remove deprecated component props: FAB.small, Button.color, BottomNavigation BaseRoute.color - Remove Card adaptive dark mode logic (tonal surfaces handle dark theme in MD3) - Update example app and docs to use canonical names (Palette, LightTheme, DarkTheme) - Rename internal useAppTheme to _useTheme to avoid confusion with removed public symbol
1 parent 96603d4 commit 469ac47

49 files changed

Lines changed: 151 additions & 731 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/src/components/BannerExample.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {
99
Avatar,
1010
Button,
1111
FAB,
12-
MD3DarkTheme as DarkTheme,
13-
MD3LightTheme as DefaultTheme,
12+
DarkTheme,
13+
LightTheme,
1414
ProgressBar,
1515
PaperProvider,
1616
RadioButton,
@@ -167,7 +167,7 @@ const Shimmer = () => {
167167
const ThemedBannerExample = () => {
168168
const isDarkTheme = useColorMode().colorMode === 'dark';
169169
return (
170-
<PaperProvider theme={isDarkTheme ? DarkTheme : DefaultTheme}>
170+
<PaperProvider theme={isDarkTheme ? DarkTheme : LightTheme}>
171171
<BannerExample />
172172
</PaperProvider>
173173
);

docs/src/components/GetStartedButtons.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import Link from '@docusaurus/Link';
99
import { useColorMode } from '@docusaurus/theme-common';
1010
import {
1111
Button,
12-
MD3DarkTheme as DarkTheme,
13-
MD3LightTheme as DefaultTheme,
12+
DarkTheme,
13+
LightTheme,
1414
PaperProvider,
1515
} from 'react-native-paper';
1616

@@ -95,7 +95,7 @@ const Shimmer = () => {
9595
const ThemedGetStarted = () => {
9696
const isDarkTheme = useColorMode().colorMode === 'dark';
9797
return (
98-
<PaperProvider theme={isDarkTheme ? DarkTheme : DefaultTheme}>
98+
<PaperProvider theme={isDarkTheme ? DarkTheme : LightTheme}>
9999
<GetStartedButton />
100100
</PaperProvider>
101101
);

example/src/DrawerItems.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
Button,
1010
Dialog,
1111
Drawer,
12-
MD3Colors,
12+
Palette,
1313
Switch,
1414
Text,
1515
TouchableRipple,
@@ -136,8 +136,8 @@ function DrawerItems() {
136136

137137
const coloredLabelTheme = {
138138
colors: {
139-
secondaryContainer: MD3Colors.tertiary80,
140-
onSecondaryContainer: MD3Colors.tertiary20,
139+
secondaryContainer: Palette.tertiary80,
140+
onSecondaryContainer: Palette.tertiary20,
141141
},
142142
};
143143

example/src/Examples/ActivityIndicatorExample.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { StyleSheet, View } from 'react-native';
33

4-
import { ActivityIndicator, FAB, List, MD3Colors } from 'react-native-paper';
4+
import { ActivityIndicator, FAB, List, Palette } from 'react-native-paper';
55

66
import ScreenWrapper from '../ScreenWrapper';
77

@@ -41,7 +41,7 @@ const ActivityIndicatorExample = () => {
4141
<List.Section title="Custom color">
4242
<ActivityIndicator
4343
animating={animating}
44-
color={MD3Colors.error20}
44+
color={Palette.error20}
4545
hidesWhenStopped={false}
4646
/>
4747
</List.Section>

example/src/Examples/AnimatedFABExample/AnimatedFABExample.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { NativeScrollEvent, NativeSyntheticEvent } from 'react-native';
33
import { Animated, FlatList, Platform, StyleSheet, View } from 'react-native';
44

55
import Icon from '@expo/vector-icons/MaterialCommunityIcons';
6-
import { Avatar, MD3Colors, Text } from 'react-native-paper';
6+
import { Avatar, Palette, Text } from 'react-native-paper';
77

88
import CustomFAB from './CustomFAB';
99
import CustomFABControls, {
@@ -46,7 +46,7 @@ const AnimatedFABExample = () => {
4646
<Avatar.Text
4747
style={[styles.avatar, { backgroundColor: item.bgColor }]}
4848
label={item.initials}
49-
color={MD3Colors.primary100}
49+
color={Palette.primary100}
5050
size={40}
5151
/>
5252
<View style={styles.itemTextContentContainer}>
@@ -89,7 +89,7 @@ const AnimatedFABExample = () => {
8989
<Icon
9090
name={item.favorite ? 'star' : 'star-outline'}
9191
color={
92-
item.favorite ? MD3Colors.error70 : MD3Colors.neutralVariant70
92+
item.favorite ? Palette.error70 : Palette.neutralVariant70
9393
}
9494
size={20}
9595
onPress={() => setVisible(!visible)}

example/src/Examples/AppbarExample.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
Appbar,
77
FAB,
88
List,
9-
MD3Colors,
9+
Palette,
1010
RadioButton,
1111
Snackbar,
1212
Switch,
@@ -32,7 +32,6 @@ const AppbarExample = ({ navigation }: Props) => {
3232
const [showSearchIcon, setShowSearchIcon] = React.useState(true);
3333
const [showMoreIcon, setShowMoreIcon] = React.useState(true);
3434
const [showCustomColor, setShowCustomColor] = React.useState(false);
35-
const [showExactTheme, setShowExactTheme] = React.useState(false);
3635
const [appbarMode, setAppbarMode] = React.useState<AppbarModes>('small');
3736
const [showCalendarIcon, setShowCalendarIcon] = React.useState(false);
3837
const [showElevated, setShowElevated] = React.useState(false);
@@ -49,9 +48,6 @@ const AppbarExample = ({ navigation }: Props) => {
4948
header: () => (
5049
<Appbar.Header
5150
style={showCustomColor ? styles.customColor : null}
52-
theme={{
53-
mode: showExactTheme ? 'exact' : 'adaptive',
54-
}}
5551
mode={appbarMode}
5652
elevated={showElevated}
5753
>
@@ -80,7 +76,6 @@ const AppbarExample = ({ navigation }: Props) => {
8076
showSearchIcon,
8177
showMoreIcon,
8278
showCustomColor,
83-
showExactTheme,
8479
appbarMode,
8580
showCalendarIcon,
8681
isCenterAlignedMode,
@@ -129,10 +124,6 @@ const AppbarExample = ({ navigation }: Props) => {
129124
<Text>Custom Color</Text>
130125
<Switch value={showCustomColor} onValueChange={setShowCustomColor} />
131126
</View>
132-
<View style={styles.row}>
133-
<Text>Exact Dark Theme</Text>
134-
<Switch value={showExactTheme} onValueChange={setShowExactTheme} />
135-
</View>
136127
<View style={styles.row}>
137128
<Text>Elevated</Text>
138129
<Switch value={showElevated} onValueChange={setShowElevated} />
@@ -186,7 +177,6 @@ const AppbarExample = ({ navigation }: Props) => {
186177
},
187178
]}
188179
safeAreaInsets={{ bottom, left, right }}
189-
theme={{ mode: showExactTheme ? 'exact' : 'adaptive' }}
190180
>
191181
<Appbar.Action icon="archive" onPress={() => {}} />
192182
<Appbar.Action icon="email" onPress={() => {}} />
@@ -231,6 +221,6 @@ const styles = StyleSheet.create({
231221
right: 16,
232222
},
233223
customColor: {
234-
backgroundColor: MD3Colors.secondary80,
224+
backgroundColor: Palette.secondary80,
235225
},
236226
});

example/src/Examples/AvatarExample.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { StyleSheet, View } from 'react-native';
33

4-
import { Avatar, List, MD3Colors } from 'react-native-paper';
4+
import { Avatar, List, Palette } from 'react-native-paper';
55

66
import ScreenWrapper from '../ScreenWrapper';
77

@@ -14,11 +14,11 @@ const AvatarExample = () => {
1414
style={[
1515
styles.avatar,
1616
{
17-
backgroundColor: MD3Colors.error70,
17+
backgroundColor: Palette.error70,
1818
},
1919
]}
2020
label="XD"
21-
color={MD3Colors.primary0}
21+
color={Palette.primary0}
2222
/>
2323
<Avatar.Text style={styles.avatar} label="XD" />
2424
<Avatar.Text style={styles.avatar} label="XD" size={80} />
@@ -30,11 +30,11 @@ const AvatarExample = () => {
3030
style={[
3131
styles.avatar,
3232
{
33-
backgroundColor: MD3Colors.error70,
33+
backgroundColor: Palette.error70,
3434
},
3535
]}
3636
icon="folder"
37-
color={MD3Colors.primary0}
37+
color={Palette.primary0}
3838
/>
3939
<Avatar.Icon style={styles.avatar} icon="folder" />
4040
<Avatar.Icon style={styles.avatar} icon="folder" size={80} />

example/src/Examples/BadgeExample.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
Badge,
66
IconButton,
77
List,
8-
MD3Colors,
8+
Palette,
99
Text,
1010
Switch,
1111
} from 'react-native-paper';
@@ -41,7 +41,7 @@ const BadgeExample = () => {
4141
style={[
4242
styles.badge,
4343
{
44-
backgroundColor: MD3Colors.primary80,
44+
backgroundColor: Palette.primary80,
4545
},
4646
]}
4747
>

example/src/Examples/BannerExample.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
View,
99
} from 'react-native';
1010

11-
import { Banner, FAB, MD3Colors } from 'react-native-paper';
11+
import { Banner, FAB, Palette } from 'react-native-paper';
1212

1313
import { useExampleTheme } from '../hooks/useExampleTheme';
1414
import ScreenWrapper from '../ScreenWrapper';
@@ -33,12 +33,12 @@ const BannerExample = () => {
3333
...defaultTheme,
3434
colors: {
3535
...defaultTheme.colors,
36-
onSurface: MD3Colors.tertiary100,
36+
onSurface: Palette.tertiary100,
3737
elevation: {
3838
...defaultTheme.colors.elevation,
39-
level1: MD3Colors.tertiary50,
39+
level1: Palette.tertiary50,
4040
},
41-
primary: MD3Colors.tertiary10,
41+
primary: Palette.tertiary10,
4242
},
4343
};
4444

example/src/Examples/CheckboxExample.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { StyleSheet, View } from 'react-native';
33

4-
import { Checkbox, MD3Colors, Text, TouchableRipple } from 'react-native-paper';
4+
import { Checkbox, Palette, Text, TouchableRipple } from 'react-native-paper';
55

66
import ScreenWrapper from '../ScreenWrapper';
77

@@ -26,7 +26,7 @@ const CheckboxExample = () => {
2626
<Text>Custom</Text>
2727
<View pointerEvents="none">
2828
<Checkbox
29-
color={MD3Colors.error70}
29+
color={Palette.error70}
3030
status={checkedCustom ? 'checked' : 'unchecked'}
3131
/>
3232
</View>

0 commit comments

Comments
 (0)