DatePickerIOS add onChange event definition
Reviewed By: sahrens Differential Revision: D8219622 fbshipit-source-id: 37f26d0981318b7eab9d3c734c44e7714fa6f0e8
This commit is contained in:
parent
edd7acbb1e
commit
3b53091869
|
@ -40,6 +40,7 @@ type Props = $ReadOnly<{|
|
||||||
minimumDate?: ?Date,
|
minimumDate?: ?Date,
|
||||||
minuteInterval?: ?(1 | 2 | 3 | 4 | 5 | 6 | 10 | 12 | 15 | 20 | 30),
|
minuteInterval?: ?(1 | 2 | 3 | 4 | 5 | 6 | 10 | 12 | 15 | 20 | 30),
|
||||||
mode?: ?('date' | 'time' | 'datetime'),
|
mode?: ?('date' | 'time' | 'datetime'),
|
||||||
|
onChange?: ?(event: Event) => void,
|
||||||
onDateChange: (date: Date) => void,
|
onDateChange: (date: Date) => void,
|
||||||
timeZoneOffsetInMinutes?: ?number,
|
timeZoneOffsetInMinutes?: ?number,
|
||||||
|}>;
|
|}>;
|
||||||
|
@ -75,6 +76,15 @@ const DatePickerIOS = ((createReactClass({
|
||||||
*/
|
*/
|
||||||
initialDate: PropTypes.instanceOf(Date),
|
initialDate: PropTypes.instanceOf(Date),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date change handler.
|
||||||
|
*
|
||||||
|
* This is called when the user changes the date or time in the UI.
|
||||||
|
* The first and only argument is an Event. For getting the date the picker
|
||||||
|
* was changed to, use onDateChange instead.
|
||||||
|
*/
|
||||||
|
onChange: PropTypes.func,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date change handler.
|
* Date change handler.
|
||||||
*
|
*
|
||||||
|
@ -144,7 +154,6 @@ const DatePickerIOS = ((createReactClass({
|
||||||
const nativeTimeStamp = event.nativeEvent.timestamp;
|
const nativeTimeStamp = event.nativeEvent.timestamp;
|
||||||
this.props.onDateChange &&
|
this.props.onDateChange &&
|
||||||
this.props.onDateChange(new Date(nativeTimeStamp));
|
this.props.onDateChange(new Date(nativeTimeStamp));
|
||||||
// $FlowFixMe(>=0.41.0)
|
|
||||||
this.props.onChange && this.props.onChange(event);
|
this.props.onChange && this.props.onChange(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -193,16 +202,6 @@ const styles = StyleSheet.create({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const RCTDatePickerIOS = requireNativeComponent('RCTDatePicker', {
|
const RCTDatePickerIOS = requireNativeComponent('RCTDatePicker');
|
||||||
propTypes: {
|
|
||||||
...DatePickerIOS.propTypes,
|
|
||||||
date: PropTypes.number,
|
|
||||||
locale: PropTypes.string,
|
|
||||||
minimumDate: PropTypes.number,
|
|
||||||
maximumDate: PropTypes.number,
|
|
||||||
onDateChange: () => null,
|
|
||||||
onChange: PropTypes.func,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = DatePickerIOS;
|
module.exports = DatePickerIOS;
|
||||||
|
|
Loading…
Reference in New Issue