Skip to content

Commit

Permalink
[breaking] Implement controlled component support
Browse files Browse the repository at this point in the history
* Implement defaultValue, defaultView, defaultActiveStartDate
* Add onViewChange callback
* Rename onActiveDateChange to onActiveStartDateChange
* Prioritize activeStartDate over value when getting default active start date
  • Loading branch information
wojtekmaj committed Sep 26, 2019
1 parent ef315ba commit b5997ef
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 149 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Displays a complete, interactive calendar.
|nextLabel|Content of the "next" button on the navigation pane.|`"›"`|<ul><li>String: `"›"`</li><li>React element: `<NextIcon />`</li></ul>|
|next2AriaLabel|`aria-label` attribute of the "next on higher level" button on the navigation pane.|n/a|`"Jump forwards"`|
|next2Label|Content of the "next on higher level" button on the navigation pane.|`"»"`|<ul><li>String: `"»"`</li><li>React element: `<DoubleNextIcon />`</li></ul>|
|onActiveDateChange|Function called when the user navigates from one view to another using previous/next button.|n/a|`({ activeStartDate, view }) => alert('Changed view to: ', activeStartDate, view)`|
|onActiveStartDateChange|Function called when the user navigates from one view to another using previous/next button.|n/a|`({ activeStartDate, view }) => alert('Changed view to: ', activeStartDate, view)`|
|onChange|Function called when the user clicks an item (day on month view, month on year view and so on) on the most detailed view available.|n/a|`(value) => alert('New date is: ', value)`|
|onClickDay|Function called when the user clicks a day.|n/a|`(value) => alert('Clicked day: ', value)`|
|onClickDecade|Function called when the user clicks a decade.|n/a|`(value) => alert('Clicked decade: ', value)`|
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ declare module "react-calendar" {
next2Label?: string | JSX.Element | null;
nextAriaLabel?: string;
nextLabel?: string | JSX.Element;
onActiveDateChange?: ViewCallback;
onActiveStartDateChange?: ViewCallback;
onChange?: OnChangeDateCallback;
onClickDay?: DateCallback;
onClickDecade?: DateCallback;
Expand Down
Loading

0 comments on commit b5997ef

Please sign in to comment.