-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathindex.ios.js
144 lines (136 loc) · 3.45 KB
/
index.ios.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/**
* Example app using the Calendar component.
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
import Calendar from 'react-native-calendar-datepicker';
import Moment from 'moment';
type State = {
date?: Moment,
};
class demo extends Component {
state: State
constructor(props: Object) {
super(props);
this.state = {};
}
render() {
const BLUE = '#2196F3';
const WHITE = '#FFFFFF';
const GREY = '#BDBDBD';
const BLACK = '#424242';
const LIGHT_GREY = '#F5F5F5';
return (
<View style={styles.container}>
<View>
<Text style={styles.dateText}>
{this.state.date ?
this.state.date.format('DD-MM-YYYY h:mm a') :
"No date selected"}
</Text>
</View>
<View style={{flexDirection: 'row'}}>
<View style={{flexGrow: 1}}></View>
<Calendar
onChange={(date) => this.setState({date})}
selected={this.state.date}
//finalStage="month"
minDate={Moment().startOf('day')}
maxDate={Moment().add(10, 'years').startOf('day')}
//General Styling}
style={{
borderWidth: 1,
borderColor: GREY,
borderRadius: 5,
alignSelf: 'center',
marginTop: 20,
}}
barView={{
backgroundColor: BLUE,
padding: 10,
}}
barText={{
fontWeight: 'bold',
color: WHITE,
}}
stageView={{
padding: 0,
}}
// Day selector styling
dayHeaderView={{
backgroundColor: LIGHT_GREY,
borderBottomColor: GREY,
}}
dayHeaderText={{
fontWeight: 'bold',
color: BLACK,
}}
dayRowView={{
borderColor: LIGHT_GREY,
height: 40,
}}
dayText={{
color: BLACK,
}}
dayDisabledText={{
color: GREY,
}}
dayTodayText={{
fontWeight: 'bold',
color: BLUE,
}}
daySelectedText={{
fontWeight: 'bold',
backgroundColor: BLUE,
color: WHITE,
borderRadius: 15,
borderColor: "transparent",
overflow: 'hidden',
}}
// Styling month selector.
monthText={{
color: BLACK,
borderColor: BLACK,
}}
monthDisabledText={{
color: GREY,
borderColor: GREY,
}}
monthSelectedText={{
fontWeight: 'bold',
backgroundColor: BLUE,
color: WHITE,
overflow: 'hidden',
}}
// Styling year selector.
yearMinTintColor={BLUE}
yearMaxTintColor={GREY}
yearText={{
color: BLACK,
}}
/>
<View style={{flexGrow: 1}}></View>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flexGrow: 1,
paddingTop: 40,
backgroundColor: '#F5FCFF',
},
dateText: {
fontSize: 18,
fontWeight: 'bold',
marginLeft: 20,
}
});
AppRegistry.registerComponent('demo', () => demo);