mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Add onPressDate, onPressCancel methods to DatePicker class (#23313)
These two methods are available on instances and documented at the bottom of the README.md here: https://github.com/xgfe/react-native-datepicker#instance-methods.
This commit is contained in:
committed by
Sheetal Nandi
parent
ab5329620a
commit
83b24fbabb
+3
@@ -38,6 +38,9 @@ export interface DatePickerProps {
|
||||
|
||||
declare class DatePicker extends React.Component<DatePickerProps> {
|
||||
constructor(props: DatePickerProps);
|
||||
|
||||
onPressDate(): void;
|
||||
onPressCancel(): void;
|
||||
}
|
||||
|
||||
export default DatePicker;
|
||||
|
||||
@@ -6,14 +6,23 @@ interface MyDatePickerState {
|
||||
}
|
||||
|
||||
export default class MyDatePicker extends React.Component<{}, MyDatePickerState> {
|
||||
datepicker: DatePicker | null;
|
||||
|
||||
constructor(props: {}) {
|
||||
super(props);
|
||||
this.state = {date: "2016-05-15"};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (this.datepicker) {
|
||||
this.datepicker.onPressDate();
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<DatePicker
|
||||
ref={datepicker => this.datepicker = datepicker}
|
||||
style={{width: 200}}
|
||||
date={this.state.date}
|
||||
mode="date"
|
||||
|
||||
Reference in New Issue
Block a user