Skip to content

Commit b8d07e8

Browse files
committed
Add TS definitions for onViewModeChange callback
Original commit by josefernand: arqex@8ea6ea8
1 parent 5377a9c commit b8d07e8

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

DateTime.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ declare namespace ReactDatetimeClass {
8888
input (a string).
8989
*/
9090
onBlur?: EventOrValueHandler<FocusEvent<any>>;
91+
/*
92+
Callback trigger when the view mode changes. The callback receives the selected view mode
93+
string ('years', 'months', 'days', 'time') as only parameter.
94+
*/
95+
onViewModeChange?: (viewMode: string) => void;
9196
/*
9297
The default view to display when the picker is shown. ('years', 'months', 'days', 'time')
9398
*/

react-datetime.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ declare module ReactDatetime {
6969
input (a string).
7070
*/
7171
onBlur?: (momentOrInputString : string|any) => void;
72+
/*
73+
Callback trigger when the view mode changes. The callback receives the selected view mode
74+
string ('years', 'months', 'days', 'time') as only parameter.
75+
*/
76+
onViewModeChange?: (viewMode: string) => void;
7277
/*
7378
The default view to display when the picker is shown. ('years', 'months', 'days', 'time')
7479
*/

typings/react-datetime-tests.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ const TEST_INPUT_PROPS: JSX.Element = <ReactDatetime
8181
onBlur={
8282
(momentOrInputString:string) => {}
8383
}
84+
onViewModeChange={
85+
(viewMode:string) => {}
86+
}
8487
/>;
8588

8689
const TEST_EVENT_HANDLERS_WITH_MOMENT: JSX.Element = <ReactDatetime

0 commit comments

Comments
 (0)