forked from ivanchenko/react-native-day-picker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.ios.js
50 lines (42 loc) · 912 Bytes
/
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
'use strict';
import React from 'react';
import {
View,
StyleSheet,
AppRegistry
} from 'react-native';
import Calendar from './src/Calendar';
class DayPicker extends React.Component {
render() {
var from = new Date();
from.setDate(from.getDate() - 16);
var to = new Date();
var startDate = new Date();
startDate.setMonth(startDate.getMonth());
return (
<View style={styles.container}>
<Calendar
monthsCount={24}
startFormMonday={true}
startDate={startDate}
selectFrom={from}
selectTo={to}
width={350}
onSelectionChange={(current, previous) => {
console.log(current, previous);
}}
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: 20,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5F5F5'
}
});
AppRegistry.registerComponent('DayPicker', () => DayPicker);