Skip to content

Commit c7656d5

Browse files
committed
chore: update example to use md3 only, removing md2 references
1 parent e5fcbdc commit c7656d5

25 files changed

+342
-591
lines changed

example/src/DrawerItems.tsx

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
Button,
1010
Dialog,
1111
Drawer,
12-
MD2Colors,
1312
MD3Colors,
1413
Switch,
1514
Text,
@@ -107,7 +106,6 @@ function DrawerItems() {
107106
toggleShouldUseDeviceColors,
108107
toggleTheme,
109108
toggleRtl: toggleRTL,
110-
toggleThemeVersion,
111109
toggleCollapsed,
112110
toggleCustomFont,
113111
toggleRippleEffect,
@@ -137,14 +135,10 @@ function DrawerItems() {
137135
};
138136

139137
const coloredLabelTheme = {
140-
colors: isV3
141-
? {
142-
secondaryContainer: MD3Colors.tertiary80,
143-
onSecondaryContainer: MD3Colors.tertiary20,
144-
}
145-
: {
146-
primary: MD2Colors.tealA200,
147-
},
138+
colors: {
139+
secondaryContainer: MD3Colors.tertiary80,
140+
onSecondaryContainer: MD3Colors.tertiary20,
141+
},
148142
};
149143

150144
return (
@@ -217,15 +211,6 @@ function DrawerItems() {
217211
</TouchableRipple>
218212
)}
219213

220-
<TouchableRipple onPress={toggleThemeVersion}>
221-
<View style={[styles.preference, isV3 && styles.v3Preference]}>
222-
<Text variant="labelLarge">MD 2</Text>
223-
<View pointerEvents="none">
224-
<Switch value={!isV3} />
225-
</View>
226-
</View>
227-
</TouchableRipple>
228-
229214
{isV3 && (
230215
<TouchableRipple onPress={toggleCollapsed}>
231216
<View style={[styles.preference, isV3 && styles.v3Preference]}>

example/src/Examples/ActivityIndicatorExample.tsx

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

4-
import {
5-
ActivityIndicator,
6-
FAB,
7-
List,
8-
MD2Colors,
9-
MD3Colors,
10-
} from 'react-native-paper';
4+
import { ActivityIndicator, FAB, List, MD3Colors } from 'react-native-paper';
115

12-
import { useExampleTheme } from '../hooks/useExampleTheme';
136
import ScreenWrapper from '../ScreenWrapper';
147

158
const ActivityIndicatorExample = () => {
169
const [animating, setAnimating] = React.useState<boolean>(true);
17-
const { isV3 } = useExampleTheme();
1810

1911
return (
2012
<ScreenWrapper style={styles.container}>
@@ -49,7 +41,7 @@ const ActivityIndicatorExample = () => {
4941
<List.Section title="Custom color">
5042
<ActivityIndicator
5143
animating={animating}
52-
color={isV3 ? MD3Colors.error20 : MD2Colors.red500}
44+
color={MD3Colors.error20}
5345
hidesWhenStopped={false}
5446
/>
5547
</List.Section>

example/src/Examples/AnimatedFABExample/AnimatedFABExample.tsx

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +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 {
7-
Avatar,
8-
MD2Colors,
9-
MD3Colors,
10-
Paragraph,
11-
Text,
12-
} from 'react-native-paper';
6+
import { Avatar, MD3Colors, Text } from 'react-native-paper';
137

148
import CustomFAB from './CustomFAB';
159
import CustomFABControls, {
@@ -32,7 +26,7 @@ type Item = {
3226
};
3327

3428
const AnimatedFABExample = () => {
35-
const { colors, isV3 } = useExampleTheme();
29+
const { colors } = useExampleTheme();
3630

3731
const isIOS = Platform.OS === 'ios';
3832

@@ -47,63 +41,55 @@ const AnimatedFABExample = () => {
4741

4842
const renderItem = React.useCallback(
4943
({ item }: { item: Item }) => {
50-
const TextComponent = isV3 ? Text : Paragraph;
51-
5244
return (
5345
<View style={styles.itemContainer}>
5446
<Avatar.Text
5547
style={[styles.avatar, { backgroundColor: item.bgColor }]}
5648
label={item.initials}
57-
color={isV3 ? MD3Colors.primary100 : MD2Colors.white}
49+
color={MD3Colors.primary100}
5850
size={40}
5951
/>
6052
<View style={styles.itemTextContentContainer}>
6153
<View style={styles.itemHeaderContainer}>
62-
<TextComponent
54+
<Text
6355
variant="labelLarge"
6456
style={[styles.header, !item.read && styles.read]}
6557
ellipsizeMode="tail"
6658
numberOfLines={1}
6759
>
6860
{item.sender}
69-
</TextComponent>
70-
<TextComponent
61+
</Text>
62+
<Text
7163
variant="labelLarge"
7264
style={[styles.date, !item.read && styles.read]}
7365
>
7466
{item.date}
75-
</TextComponent>
67+
</Text>
7668
</View>
7769

7870
<View style={styles.itemMessageContainer}>
7971
<View style={styles.flex}>
80-
<TextComponent
72+
<Text
8173
variant="labelLarge"
8274
ellipsizeMode="tail"
8375
numberOfLines={1}
8476
style={!item.read && styles.read}
8577
>
8678
{item.header}
87-
</TextComponent>
88-
<TextComponent
79+
</Text>
80+
<Text
8981
variant="labelLarge"
9082
numberOfLines={1}
9183
ellipsizeMode="tail"
9284
>
9385
{item.message}
94-
</TextComponent>
86+
</Text>
9587
</View>
9688

9789
<Icon
9890
name={item.favorite ? 'star' : 'star-outline'}
9991
color={
100-
item.favorite
101-
? isV3
102-
? MD3Colors.error70
103-
: MD2Colors.orange500
104-
: isV3
105-
? MD3Colors.neutralVariant70
106-
: MD2Colors.grey500
92+
item.favorite ? MD3Colors.error70 : MD3Colors.neutralVariant70
10793
}
10894
size={20}
10995
onPress={() => setVisible(!visible)}
@@ -114,7 +100,7 @@ const AnimatedFABExample = () => {
114100
</View>
115101
);
116102
},
117-
[visible, isV3]
103+
[visible]
118104
);
119105

120106
const onScroll = ({

0 commit comments

Comments
 (0)