-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathRoundedButton.js
More file actions
43 lines (41 loc) · 1 KB
/
RoundedButton.js
File metadata and controls
43 lines (41 loc) · 1 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
import React from 'react';
import { Text, View, TouchableOpacity, StyleSheet } from 'react-native';
export default function RoundedButton(props) {
const { text, icon, textColor, backgroundColor, onPress } = props;
const color = textColor || 'white';
return (
<TouchableOpacity
onPress={() => onPress && onPress()}
style={[
{ backgroundColor: backgroundColor || 'transparent' },
styles.wrapper
]}
>
<View style={styles.ButtonTextWrapper}>
{icon}
<Text style={[{ color }, styles.buttonText]}>{text}</Text>
</View>
</TouchableOpacity>
);
}
const styles = StyleSheet.create({
wrapper: {
padding: 15,
display: 'flex',
borderRadius: 40,
borderWidth: 1,
borderColor: 'white',
backgroundColor: 'white',
marginBottom: 15,
alignItems: 'center'
},
buttonText: {
fontSize: 16,
width: '100%',
textAlign: 'center'
},
ButtonTextWrapper: {
flexDirection: 'row',
justifyContent: 'flex-end'
}
});