forked from testshallpass/react-native-dropdownalert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
label.js
34 lines (33 loc) · 826 Bytes
/
label.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
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Text } from 'react-native';
export default class Label extends Component {
static propTypes = {
text: PropTypes.string,
style: PropTypes.object,
numberOfLines: PropTypes.number,
textProps: PropTypes.object,
};
static defaultProps = {
numberOfLines: 1,
style: {
fontSize: 16,
textAlign: 'left',
fontWeight: 'normal',
color: 'white',
backgroundColor: 'transparent',
},
textProps: {},
};
render() {
const { text, style, numberOfLines, textProps } = this.props;
if (text !== null && text.length > 0) {
return (
<Text {...textProps} style={style} numberOfLines={numberOfLines}>
{text}
</Text>
);
}
return null;
}
}