File tree Expand file tree Collapse file tree 7 files changed +162
-77
lines changed
Expand file tree Collapse file tree 7 files changed +162
-77
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ import MonthPicker from "../../examples/monthPicker";
6565import RangeMonthPicker from "../../examples/rangeMonthPicker" ;
6666import QuarterPicker from "../../examples/quarterPicker" ;
6767import RangeQuarterPicker from "../../examples/rangeQuarterPicker" ;
68+ import OnCalendarChangeStateCallbacks from "../../examples/onCalendarOpenStateCallbacks" ;
6869
6970import "./style.scss" ;
7071import "react-datepicker/dist/react-datepicker.css" ;
@@ -323,6 +324,10 @@ export default class exampleComponents extends React.Component {
323324 {
324325 title : "Range Quarter Picker" ,
325326 component : RangeQuarterPicker
327+ } ,
328+ {
329+ title : "Calendar open state callbacks" ,
330+ component : OnCalendarChangeStateCallbacks
326331 }
327332 ] ;
328333
Original file line number Diff line number Diff line change 1+ ( ) => {
2+ const [ date , setDate ] = useState ( new Date ( ) ) ;
3+
4+ const handleCalendarClose = ( ) => console . log ( "Calendar closed" ) ;
5+ const handleCalendarOpen = ( ) => console . log ( "Calendar opened" ) ;
6+
7+ return (
8+ < DatePicker
9+ selected = { date }
10+ onChange = { date => setDate ( date ) }
11+ onCalendarClose = { handleCalendarClose }
12+ onCalendarOpen = { handleCalendarOpen }
13+ />
14+ ) ;
15+ } ;
Original file line number Diff line number Diff line change @@ -41,15 +41,17 @@ General datepicker component.
4141| ` monthsShown ` | ` number ` | ` 1 ` | |
4242| ` name ` | ` string ` | | |
4343| ` onBlur ` | ` func ` | ` function() {} ` | |
44+ | ` onCalendarClose ` | ` func ` | | |
45+ | ` onCalendarOpen ` | ` func ` | | |
4446| ` onChange ` (required) | ` func ` | ` function() {} ` | |
4547| ` onChangeRaw ` | ` func ` | | |
4648| ` onClickOutside ` | ` func ` | ` function() {} ` | |
4749| ` onFocus ` | ` func ` | ` function() {} ` | |
4850| ` onKeyDown ` | ` func ` | ` function() {} ` | |
4951| ` onMonthChange ` | ` func ` | ` function() {} ` | |
50- | ` onYearChange ` | ` func ` | ` function() {} ` | |
5152| ` onSelect ` | ` func ` | ` function() {} ` | |
5253| ` onWeekSelect ` | ` func ` | | |
54+ | ` onYearChange ` | ` func ` | ` function() {} ` | |
5355| ` openToDate ` | ` instanceOf(Date) ` | | |
5456| ` peekNextMonth ` | ` bool ` | | |
5557| ` placeholderText ` | ` string ` | | |
You can’t perform that action at this time.
0 commit comments