forked from callstack/react-native-paper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathActivityIndicatorExample.tsx
55 lines (45 loc) · 1.31 KB
/
ActivityIndicatorExample.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import * as React from 'react';
import { View, StyleSheet } from 'react-native';
import { ActivityIndicator, Colors, FAB, useTheme } from 'react-native-paper';
const ActivityIndicatorExample = () => {
const [animating, setAnimating] = React.useState<boolean>(true);
const {
colors: { background },
} = useTheme();
return (
<View style={[styles.container, { backgroundColor: background }]}>
<View style={styles.row}>
<FAB
small
icon={animating ? 'pause' : 'play'}
onPress={() => setAnimating(!animating)}
/>
</View>
<View style={styles.row}>
<ActivityIndicator animating={animating} />
</View>
<View style={styles.row}>
<ActivityIndicator animating={animating} hidesWhenStopped={false} />
</View>
<View style={styles.row}>
<ActivityIndicator animating={animating} size="large" />
</View>
<View style={styles.row}>
<ActivityIndicator animating={animating} color={Colors.red500} />
</View>
</View>
);
};
ActivityIndicatorExample.title = 'Activity Indicator';
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 4,
},
row: {
justifyContent: 'center',
alignItems: 'center',
margin: 10,
},
});
export default ActivityIndicatorExample;