@@ -40,6 +40,7 @@ type Props = $ReadOnly<{|
40
40
minimumDate ?: ?Date ,
41
41
minuteInterval ?: ?( 1 | 2 | 3 | 4 | 5 | 6 | 10 | 12 | 15 | 20 | 30 ) ,
42
42
mode ?: ?( 'date' | 'time' | 'datetime' ) ,
43
+ onChange ?: ?( event : Event ) => void ,
43
44
onDateChange : ( date : Date ) => void ,
44
45
timeZoneOffsetInMinutes ?: ?number ,
45
46
| } > ;
@@ -75,6 +76,15 @@ const DatePickerIOS = ((createReactClass({
75
76
*/
76
77
initialDate : PropTypes . instanceOf ( Date ) ,
77
78
79
+ /**
80
+ * Date change handler.
81
+ *
82
+ * This is called when the user changes the date or time in the UI.
83
+ * The first and only argument is an Event. For getting the date the picker
84
+ * was changed to, use onDateChange instead.
85
+ */
86
+ onChange : PropTypes . func ,
87
+
78
88
/**
79
89
* Date change handler.
80
90
*
@@ -144,7 +154,6 @@ const DatePickerIOS = ((createReactClass({
144
154
const nativeTimeStamp = event . nativeEvent . timestamp ;
145
155
this . props . onDateChange &&
146
156
this . props . onDateChange ( new Date ( nativeTimeStamp ) ) ;
147
- // $FlowFixMe(>=0.41.0)
148
157
this . props . onChange && this . props . onChange ( event ) ;
149
158
} ,
150
159
@@ -193,16 +202,6 @@ const styles = StyleSheet.create({
193
202
} ,
194
203
} ) ;
195
204
196
- const RCTDatePickerIOS = requireNativeComponent ( 'RCTDatePicker' , {
197
- propTypes : {
198
- ...DatePickerIOS . propTypes ,
199
- date : PropTypes . number ,
200
- locale : PropTypes . string ,
201
- minimumDate : PropTypes . number ,
202
- maximumDate : PropTypes . number ,
203
- onDateChange : ( ) => null ,
204
- onChange : PropTypes . func ,
205
- } ,
206
- } ) ;
205
+ const RCTDatePickerIOS = requireNativeComponent ( 'RCTDatePicker' ) ;
207
206
208
207
module . exports = DatePickerIOS ;
0 commit comments