-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathButton.tsx
56 lines (55 loc) · 1.18 KB
/
Button.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
56
import {
Text,
View,
TouchableOpacity,
TouchableOpacityProps,
ActivityIndicator,
} from "react-native";
export const Button = ({
children,
loading,
...props
}: Omit<TouchableOpacityProps, "children"> & {
children: string;
loading?: boolean;
}) => {
return (
<TouchableOpacity
{...props}
activeOpacity={0.7}
style={[
{
backgroundColor: "rgba(0,0,0,0.1)",
borderRadius: 4,
padding: 10,
width: "100%",
marginVertical: 10,
display: "flex",
justifyContent: "center",
alignItems: "center",
},
props.style,
]}
>
<View
style={{
display: "flex",
justifyContent: "center",
alignItems: "center",
flexDirection: "row",
gap: 10,
}}
>
<Text
style={{
color: props.disabled ? "rgba(0,0,0,0.3)" : "rgba(0,0,0,0.5)",
fontStyle: props.disabled ? "italic" : "normal",
}}
>
{children}
</Text>
{loading && <ActivityIndicator size="small" color="rgba(0,0,0,0.3)" />}
</View>
</TouchableOpacity>
);
};