@@ -15,11 +15,13 @@ type Props = {
15
15
max : Object ,
16
16
customHeader ?: React . Element < * > ,
17
17
showHeader : boolean ,
18
+ showFooter : boolean ,
18
19
showCaption : boolean ,
19
20
dateConfig : Object | Array < string > ,
20
21
headerFormat : string ,
21
22
confirmText : string ,
22
23
cancelText : string ,
24
+ onChange : Function ,
23
25
onSelect : Function ,
24
26
onCancel : Function ,
25
27
}
@@ -118,7 +120,9 @@ class DatePicker extends Component<void, Props, State> {
118
120
* @return {undefined }
119
121
*/
120
122
handleDateSelect ( value ) {
121
- this . setState ( { value } ) ;
123
+ this . setState ( { value } , ( ) => {
124
+ this . props . onChange ( value ) ;
125
+ } ) ;
122
126
}
123
127
124
128
/**
@@ -161,7 +165,7 @@ class DatePicker extends Component<void, Props, State> {
161
165
* @return {Object } JSX对象
162
166
*/
163
167
render ( ) {
164
- const { min, max, theme, dateConfig, confirmText, cancelText, headerFormat, showHeader, customHeader, showCaption } = this . props ;
168
+ const { min, max, theme, dateConfig, confirmText, cancelText, headerFormat, showHeader, showFooter , customHeader, showCaption } = this . props ;
165
169
const value = this . state . value ;
166
170
const themeClassName =
167
171
[ 'default' , 'dark' , 'ios' , 'android' , 'android-dark' ] . indexOf ( theme ) === - 1 ?
@@ -197,14 +201,14 @@ class DatePicker extends Component<void, Props, State> {
197
201
onSelect = { this . handleDateSelect } />
198
202
) ) }
199
203
</ div >
200
- < div className = "datepicker-navbar" >
204
+ { showFooter && < div className = "datepicker-navbar" >
201
205
< a
202
206
className = "datepicker-navbar-btn"
203
207
onClick = { this . handleFinishBtnClick } > { confirmText } </ a >
204
208
< a
205
209
className = "datepicker-navbar-btn"
206
210
onClick = { this . props . onCancel } > { cancelText } </ a >
207
- </ div >
211
+ </ div > }
208
212
</ div >
209
213
) ;
210
214
}
0 commit comments