-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBadge.js
70 lines (59 loc) · 1.4 KB
/
Badge.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
60
61
62
63
64
65
66
67
68
69
70
/*
* @providesModule Component/Badge
*/
'use strict';
import React, {
Component,
StyleSheet,
Text,
View,
} from 'react-native';
class Badge extends Component {
render() {
const {
label,
color,
backgroundColor,
borderColor,
borderRadius,
borderWidth
} = this.props;
return (
<View style={[styles.container, {backgroundColor: backgroundColor,borderColor: borderColor, borderRadius:borderRadius,borderWidth:borderWidth}]}>
<Text style={[styles.label, {color:color,}]}>{label}</Text>
</View>
);
}
}
Badge.defaultProps = {
color: '#fff',
size: 18,
backgroundColor: '#0f0',
borderColor: '#0f0',
borderWidth: 1,
borderRadius: 80,
};
Badge.propTypes = {
/** label color */
color: React.PropTypes.string,
/** font size */
size: React.PropTypes.number,
/** background color */
backgroundColor: React.PropTypes.string,
/** border color */
borderColor: React.PropTypes.string,
/** border radius */
borderRadius: React.PropTypes.number,
/** border width */
borderWidth: React.PropTypes.number,
/** label */
label: React.PropTypes.string.isRequired,
};
const styles = StyleSheet.create({
container: {
flex: -1,
},
label: {
},
});
module.exports = Badge;