-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathButton.js
More file actions
44 lines (41 loc) · 1.01 KB
/
Button.js
File metadata and controls
44 lines (41 loc) · 1.01 KB
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
import { Pressable, StyleSheet, Text, View } from 'react-native';
import { GlobalStyles } from '../../constants/styles';
function Button({ children, onPress, mode, style }) {
return (
<View style={style}>
<Pressable
onPress={onPress}
style={({ pressed }) => pressed && styles.pressed}
>
<View style={[styles.button, mode === 'flat' && styles.flat]}>
<Text style={[styles.buttonText, mode === 'flat' && styles.flatText]}>
{children}
</Text>
</View>
</Pressable>
</View>
);
}
export default Button;
const styles = StyleSheet.create({
button: {
borderRadius: 4,
padding: 8,
backgroundColor: GlobalStyles.colors.primary500,
},
flat: {
backgroundColor: 'transparent',
},
buttonText: {
color: 'white',
textAlign: 'center',
},
flatText: {
color: GlobalStyles.colors.primary200,
},
pressed: {
opacity: 0.75,
backgroundColor: GlobalStyles.colors.primary100,
borderRadius: 4,
},
});