-
Notifications
You must be signed in to change notification settings - Fork 318
Expand file tree
/
Copy pathNavbarButton.js
More file actions
68 lines (63 loc) · 1.37 KB
/
Copy pathNavbarButton.js
File metadata and controls
68 lines (63 loc) · 1.37 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import React from 'react';
import {
Text,
TouchableOpacity,
View,
} from 'react-native';
import PropTypes from 'prop-types'
import styles from './styles';
import Icon from 'react-native-vector-icons/FontAwesome';
export default function NavbarButton(props) {
const {
style,
icon,
iconSize,
tintColor,
title,
handler,
disabled,
accessible,
accessibilityLabel
} = props;
return (
<TouchableOpacity
style={styles.navBarButton}
onPress={handler}
disabled={disabled}
accessible={accessible}
accessibilityLabel={accessibilityLabel}
>
<View style={style}>
<Text style={[styles.navBarButtonText, { color: tintColor }]}>
{ icon &&
<Icon name={icon} size={iconSize} color={tintColor} />
}
{title}
</Text>
</View>
</TouchableOpacity>
);
}
NavbarButton.propTypes = {
style: PropTypes.oneOfType([
PropTypes.object,
PropTypes.array,
]),
icon: PropTypes.string,
iconSize: PropTypes.number,
tintColor: PropTypes.string,
title: PropTypes.string,
handler: PropTypes.func,
disabled: PropTypes.bool,
accessible: PropTypes.bool,
accessibilityLabel: PropTypes.string,
};
NavbarButton.defaultProps = {
style: {},
icon: '',
iconSize: 22,
title: '',
tintColor: '#0076FF',
disabled: false,
handler: () => ({}),
};