Skip to content

Commit 02a50e8

Browse files
committed
refactor: migrate components to Reanimated
1 parent df3cdfd commit 02a50e8

76 files changed

Lines changed: 38679 additions & 19504 deletions

File tree

Some content is hidden

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

‎docs/6.x/docs/components/Appbar/Appbar.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,11 @@ export default MyComponent;
131131

132132
<div>
133133

134-
### elevated <span class="badge badge-supported "><span class="badge-text">Available in v5.x with theme version 3</span></span>
134+
### elevation
135135

136136
</div>
137137

138-
<PropTable componentLink="Appbar/Appbar" prop="elevated" />
138+
<PropTable componentLink="Appbar/Appbar" prop="elevation" />
139139

140140
<div>
141141

‎docs/6.x/docs/components/Appbar/AppbarHeader.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ export default MyComponent;
8282

8383
<div>
8484

85-
### elevated <span class="badge badge-supported "><span class="badge-text">Available in v5.x with theme version 3</span></span>
85+
### elevation
8686

8787
</div>
8888

89-
<PropTable componentLink="Appbar/AppbarHeader" prop="elevated" />
89+
<PropTable componentLink="Appbar/AppbarHeader" prop="elevation" />
9090

9191
<div>
9292

‎docs/6.x/docs/components/Surface.mdx‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ import { Surface, Text } from 'react-native-paper';
2626
import { StyleSheet } from 'react-native';
2727

2828
const MyComponent = () => (
29-
<Surface style={styles.surface} elevation={4}>
29+
<Surface
30+
style={styles.surface}
31+
contentStyle={styles.content}
32+
elevation={4}
33+
>
3034
<Text>Surface</Text>
3135
</Surface>
3236
);
@@ -35,9 +39,12 @@ export default MyComponent;
3539

3640
const styles = StyleSheet.create({
3741
surface: {
38-
padding: 8,
3942
height: 80,
4043
width: 80,
44+
},
45+
content: {
46+
flex: 1,
47+
padding: 8,
4148
alignItems: 'center',
4249
justifyContent: 'center',
4350
},
@@ -68,6 +75,14 @@ const styles = StyleSheet.create({
6875

6976
<div>
7077

78+
### contentStyle
79+
80+
</div>
81+
82+
<PropTable componentLink="Surface" prop="contentStyle" />
83+
84+
<div>
85+
7186
### elevation <span class="badge badge-supported "><span class="badge-text">Available in v5.x with theme version 3</span></span>
7287

7388
</div>

‎example/src/Examples/AppbarExample.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const AppbarExample = () => {
4747
<Appbar.Header
4848
style={showCustomColor ? styles.customColor : null}
4949
mode={appbarMode}
50-
elevated={showElevated}
50+
elevation={showElevated ? 2 : 0}
5151
>
5252
{showLeftIcon && (
5353
<Appbar.BackAction onPress={() => navigation.goBack()} />

‎example/src/Examples/BottomNavigationExample.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const BottomNavigationExample = () => {
8686

8787
return (
8888
<View style={styles.screen}>
89-
<Appbar.Header elevated>
89+
<Appbar.Header>
9090
<Appbar.BackAction onPress={() => navigation.goBack()} />
9191
<Appbar.Content title="Bottom Navigation" />
9292
<Menu

‎example/src/Examples/MenuExample.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const MenuExample = () => {
5050

5151
return (
5252
<View style={styles.screen}>
53-
<Appbar.Header elevated>
53+
<Appbar.Header>
5454
<Appbar.BackAction onPress={() => navigation.goBack()} />
5555
<Appbar.Content title="Menu" />
5656
<Menu

‎example/src/Examples/SurfaceExample.tsx‎

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

44
import { Surface, Text, Palette, List, IconButton } from 'react-native-paper';
55
import type { Elevation } from 'react-native-paper';
@@ -12,19 +12,14 @@ const AnimatedSurface = () => {
1212
const [index, setIndex] = React.useState(3);
1313

1414
const level = elevationLevels[index];
15-
const elevation = React.useRef(new Animated.Value(level)).current;
16-
17-
React.useEffect(() => {
18-
Animated.timing(elevation, {
19-
toValue: level,
20-
duration: 250,
21-
useNativeDriver: false,
22-
}).start();
23-
}, [elevation, level]);
2415

2516
return (
2617
<View style={styles.scroll}>
27-
<Surface style={styles.surface} elevation={elevation}>
18+
<Surface
19+
style={styles.surface}
20+
contentStyle={styles.surfaceContent}
21+
elevation={level}
22+
>
2823
<Text variant="bodySmall">{`Elevation ${level}`}</Text>
2924
</Surface>
3025
<View style={styles.actions}>
@@ -49,7 +44,13 @@ const SurfaceExample = () => {
4944
const elevationValues: Elevation[] = [0, 1, 2, 3, 4, 5];
5045

5146
const renderSurface = (index: Elevation, mode: 'flat' | 'elevated') => (
52-
<Surface key={index} style={styles.surface} mode={mode} elevation={index}>
47+
<Surface
48+
key={index}
49+
style={styles.surface}
50+
contentStyle={styles.surfaceContent}
51+
mode={mode}
52+
elevation={index}
53+
>
5354
<Text variant="bodySmall">{`Elevation ${index}`}</Text>
5455
</Surface>
5556
);
@@ -93,10 +94,16 @@ const SurfaceExample = () => {
9394
</Surface>
9495
</View>
9596
<View style={styles.verticalSurfacesContainer}>
96-
<Surface style={styles.verticalSurface}>
97+
<Surface
98+
style={styles.verticalSurface}
99+
contentStyle={styles.verticalSurfaceContent}
100+
>
97101
<Text style={styles.centerText}>Top</Text>
98102
</Surface>
99-
<Surface style={styles.verticalSurface}>
103+
<Surface
104+
style={styles.verticalSurface}
105+
contentStyle={styles.verticalSurfaceContent}
106+
>
100107
<Text style={styles.centerText}>Bottom</Text>
101108
</Surface>
102109
</View>
@@ -122,6 +129,10 @@ const styles = StyleSheet.create({
122129
height: 120,
123130
width: 120,
124131
borderRadius: 8,
132+
},
133+
surfaceContent: {
134+
flex: 1,
135+
borderRadius: 8,
125136
alignItems: 'center',
126137
justifyContent: 'center',
127138
},
@@ -153,6 +164,9 @@ const styles = StyleSheet.create({
153164
},
154165
verticalSurface: {
155166
height: '48%',
167+
},
168+
verticalSurfaceContent: {
169+
flex: 1,
156170
justifyContent: 'center',
157171
},
158172

‎example/src/Examples/TeamDetails.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ const ThemeBasedOnSourceColor = () => {
207207
return (
208208
<PaperProvider theme={theme[colorScheme]}>
209209
<View style={styles.screen}>
210-
<Appbar.Header elevated>
210+
<Appbar.Header>
211211
<Appbar.BackAction onPress={() => navigation.goBack()} />
212212
<Appbar.Content title={headerTitle} />
213213
</Appbar.Header>

‎example/src/Examples/TooltipExample.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const TooltipExample = () => {
4444
React.useLayoutEffect(() => {
4545
navigation.setOptions({
4646
header: () => (
47-
<Appbar.Header elevated>
47+
<Appbar.Header>
4848
<Tooltip title="Go back">
4949
<Appbar.BackAction onPress={() => navigation.goBack()} />
5050
</Tooltip>

‎example/src/RootNavigator.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function Header({ navigation, route, options, back }: NativeStackHeaderProps) {
2525
const drawerNavigation = useNavigation('Home');
2626

2727
return (
28-
<Appbar.Header elevated>
28+
<Appbar.Header>
2929
{back ? (
3030
<Appbar.BackAction onPress={() => navigation.goBack()} />
3131
) : (

0 commit comments

Comments
 (0)