forked from Kureev/react-native-navbar
-
Notifications
You must be signed in to change notification settings - Fork 1
/
NavbarButton.js
57 lines (52 loc) · 1.11 KB
/
NavbarButton.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
import React from 'react';
import {
Text,
TouchableOpacity,
View,
} from 'react-native';
import PropTypes from 'prop-types'
import styles from './styles';
export default function NavbarButton(props) {
const {
style,
tintColor,
title,
handler,
disabled,
accessible,
accessibilityLabel,
textStyle
} = props;
return (
<TouchableOpacity
style={styles.navBarButton}
onPress={handler}
disabled={disabled}
accessible={accessible}
accessibilityLabel={accessibilityLabel}
>
<View style={style}>
<Text style={[styles.navBarButtonText, { color: tintColor }, textStyle]}>{title}</Text>
</View>
</TouchableOpacity>
);
}
NavbarButton.propTypes = {
style: PropTypes.oneOfType([
PropTypes.object,
PropTypes.array,
]),
tintColor: PropTypes.string,
title: PropTypes.string,
handler: PropTypes.func,
disabled: PropTypes.bool,
accessible: PropTypes.bool,
accessibilityLabel: PropTypes.string,
};
NavbarButton.defaultProps = {
style: {},
title: '',
tintColor: '#0076FF',
disabled: false,
handler: () => ({}),
};