-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLinkButton.js
47 lines (43 loc) · 1.37 KB
/
LinkButton.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
import React from 'react'
import PropTypes from 'prop-types'
import { View, Text } from 'react-native'
import Button from './Button'
import { Colors } from './Themes'
import Styles from './Styles/ButtonStyles'
const LinkButton = ({ leftIcon, rightIcon, label, labelStyle, uppercase, active, disabled, activityIndicatorColor, onPress }) => {
if (leftIcon || rightIcon) {
return (
<Button style={Styles.buttonWithIcon} active={active} onPress={onPress} activityIndicatorColor={activityIndicatorColor}>
<View style={Styles.iconCont}>{leftIcon}</View>
<Text style={labelStyle || Styles.defaultLabel}>{uppercase ? label.toUpperCase() : label }</Text>
<View style={Styles.iconCont}>{rightIcon}</View>
</Button>
)
}
return (
<Button
label={label}
active={active}
disabled={disabled}
onPress={onPress}
uppercase={uppercase}
labelStyle={labelStyle}
activityIndicatorColor={activityIndicatorColor}
/>
)
}
LinkButton.defaultProps = {
label: 'Link button',
activityIndicatorColor: Colors.snow
}
LinkButton.propTypes = {
active: PropTypes.bool,
disabled: PropTypes.bool,
label: PropTypes.string,
uppercase: PropTypes.bool,
leftIcon: PropTypes.element,
rightIcon: PropTypes.element,
activityIndicatorColor: PropTypes.string,
onPress: PropTypes.func.isRequired
}
export default LinkButton