-
Notifications
You must be signed in to change notification settings - Fork 2
/
CustomButton.js
33 lines (29 loc) · 809 Bytes
/
CustomButton.js
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
import { StyleSheet, useColorScheme, Pressable, Text } from "react-native";
export default function CustomButton(props) {
const colorScheme = useColorScheme(); // device color mode: dark / light
const styles = StyleSheet.create({
button: {
alignItems: 'center',
justifyContent: 'center',
paddingVertical: 12,
paddingHorizontal: 32,
borderRadius: 4,
elevation: 3,
backgroundColor: colorScheme === 'dark' ? '#fa2' : '#fa2', // example, we change the bg
},
text: {
fontSize: 16,
lineHeight: 21,
fontWeight: 'bold',
letterSpacing: 0.25,
color: 'white',
},
});
return (
<Pressable style={styles.button}>
<Text style={styles.text}>
{props.children}
</Text>
</Pressable>
);
}