UNPKG

1.03 kBJavaScriptView Raw
1import React, {
2 PropTypes,
3 Component,
4} from 'react';
5import {
6 View,
7 Text,
8 StyleSheet,
9} from 'react-native';
10
11const styles = StyleSheet.create({
12 bdWrap: {
13 flex: 1,
14 justifyContent: 'center',
15 alignItems: 'center',
16 // height: 30,
17 },
18 bd: {
19 height: 3,
20 width: 1,
21 backgroundColor: '#DCDEE5',
22 },
23 textColor: {
24 color: '#DCDEE5',
25 },
26});
27
28class AxisX extends Component {
29 static propTypes = {
30 showAxisXLine: PropTypes.bool,
31 label: PropTypes.string,
32 style: PropTypes.object,
33 }
34 static defaultProps = {
35 showAxisXLine: null,
36 label: '',
37 style: {},
38 }
39 render() {
40 const showAxisXLine = this.props.showAxisXLine;
41 const style = this.props.style;
42 const isLine = showAxisXLine ? styles.bd : null;
43 return (
44 <View style={styles.bdWrap}>
45 <View style={[isLine, { backgroundColor: style.borderColor }]} />
46 <View><Text style={[styles.textColor, style]}>{this.props.label}</Text></View>
47 </View>
48 );
49 }
50}
51
52export default AxisX;