File tree Expand file tree Collapse file tree 1 file changed +39
-24
lines changed Expand file tree Collapse file tree 1 file changed +39
-24
lines changed Original file line number Diff line number Diff line change @@ -16,30 +16,45 @@ Check [index.android.js](https://github.com/xgfe/react-native-datepicker/blob/ma
16
16
## Usage
17
17
18
18
``` javascript
19
- < DatePicker
20
- style= {{width: 200 }}
21
- date= {this .state .date }
22
- mode= " date"
23
- placeholder= " select date"
24
- format= " YYYY-MM-DD"
25
- minDate= " 2016-05-01"
26
- maxDate= " 2016-06-01"
27
- confirmBtnText= " Confirm"
28
- cancelBtnText= " Cancel"
29
- customStyles= {{
30
- dateIcon: {
31
- position: ' absolute' ,
32
- left: 0 ,
33
- top: 4 ,
34
- marginLeft: 0
35
- },
36
- dateInput: {
37
- marginLeft: 36
38
- },
39
- ... // You can check the source to find the other keys.
40
- }}
41
- onDateChange= {(date ) => {this .setState ({date: date})}}
42
- / >
19
+
20
+ import React , { Component } from ' react'
21
+ import DatePicker from ' react-native-datepicker'
22
+
23
+ export default class MyDatePicker extends Component {
24
+ constructor (props ){
25
+ super (props)
26
+ this .state = {date: " 2016-05-15" }
27
+ }
28
+
29
+ render (){
30
+ return (
31
+ < DatePicker
32
+ style= {{width: 200 }}
33
+ date= {this .state .date }
34
+ mode= " date"
35
+ placeholder= " select date"
36
+ format= " YYYY-MM-DD"
37
+ minDate= " 2016-05-01"
38
+ maxDate= " 2016-06-01"
39
+ confirmBtnText= " Confirm"
40
+ cancelBtnText= " Cancel"
41
+ customStyles= {{
42
+ dateIcon: {
43
+ position: ' absolute' ,
44
+ left: 0 ,
45
+ top: 4 ,
46
+ marginLeft: 0
47
+ },
48
+ dateInput: {
49
+ marginLeft: 36
50
+ }
51
+ // ... You can check the source to find the other keys.
52
+ }}
53
+ onDateChange= {(date ) => {this .setState ({date: date})}}
54
+ / >
55
+ )
56
+ }
57
+ }
43
58
```
44
59
45
60
You can check [ index.js] ( https://github.com/xgfe/react-native-datepicker/blob/master/index.android.js ) in the Example for detail.
You can’t perform that action at this time.
0 commit comments