DateSelector.js
1.25 KB
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
'use strict';
import React from 'react-native';
const {
Component,
StyleSheet,
TouchableOpacity,
Text,
Image,
} = React;
export default class DateSelector extends Component {
static propTypes = {
date: React.PropTypes.string.isRequired,
toogleSelector: React.PropTypes.func,
};
constructor(props) {
super(props);
this.onPress = this.onPress.bind(this);
}
onPress() {
this.props.toogleSelector && this.props.toogleSelector();
}
render() {
return (
<TouchableOpacity
activeOpacity={0.5}
style={styles.container}
onPress={this.onPress}>
<Text style={styles.text}>{this.props.date}</Text>
<Image source={require('./date.png')} style={styles.thumb} />
</TouchableOpacity>
);
}
}
let styles = StyleSheet.create({
container: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white',
height: 45,
},
text: {
fontSize: 14,
color: '#444444',
textAlign: 'center',
},
thumb: {
left: 5,
width: 15,
height: 15,
},
});