/
Button.js
59 lines (55 loc) · 1.25 KB
/
Button.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import React from 'react';
import { TouchableOpacity, Dimensions } from 'react-native';
const width = Dimensions.get('window').width;
const buttonWidth = (width * 0.8);
const Button = ({ onPress, style, children }) => {
let styleMarker = '';
switch (style) {
case 'cancel':
styleMarker = styles.cancelButton;
break;
default:
styleMarker = styles.primaryButton;
}
return (
<TouchableOpacity
onPress={onPress}
style={styleMarker}
>
{children}
</TouchableOpacity>
);
};
export { Button };
const styles = {
primaryButton: {
backgroundColor: '#99AAFF',
borderRadius: 15,
borderWidth: 1,
borderColor: '#000033',
padding: 10,
width: buttonWidth,
alignItems: 'center',
marginBottom: 15,
shadowColor: '#000000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
elevation: 2,
position: 'relative'
},
cancelButton: {
backgroundColor: '#ff5858',
borderRadius: 15,
borderWidth: 1,
borderColor: '#cf0033',
padding: 10,
width: buttonWidth,
alignItems: 'center',
marginBottom: 15,
shadowColor: '#000000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.2,
elevation: 2,
position: 'relative'
}
};