-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update conditions when adjustDayPickerHeight is called #1241
Update conditions when adjustDayPickerHeight is called #1241
Conversation
66dc966
to
0e17f26
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One quick fix and we should be good to go! Thank you for writing tests!
src/components/DayPicker.jsx
Outdated
this.isHorizontal() | ||
&& (orientation !== prevProps.orientation || daySize !== prevProps.daySize) | ||
) { | ||
this.adjustDayPickerHeight(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that in #1192, we changed this function so that it now takes a value. If we change this line to:
const visibleCalendarWeeks = this.calendarMonthWeeks.slice(0, numberOfMonths);
const calendarMonthWeeksHeight = Math.max(0, ...visibleCalendarWeeks) * (daySize - 1);
const newMonthHeight = monthTitleHeight + calendarMonthWeeksHeight + 1;
this.adjustDayPickerHeight(newMonthHeight);
that should work (monthTitleHeight
is in state).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@majapw thanks for the catch, have updated.
3d3e06c
to
a60cabc
Compare
src/components/DayPicker.jsx
Outdated
this.isHorizontal() | ||
&& (orientation !== prevProps.orientation || daySize !== prevProps.daySize) | ||
) { | ||
const visibleCalendarWeeks = this.calendarMonthWeeks.slice(0, numberOfMonths); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah shit, this should be this.calendarMonthWeeks.slice(1, numberOfMonths + 1);
(we have to slice off the first and last months because they are hidden). I will update this.
* Added checks for daySize and orientation in DayPicker.componentDidUpdate() so that DayPicker height is recalculated if either of these change between renders * Added new tests for DayPicker.componentDidUpdate
a60cabc
to
ab8c80b
Compare
All right! This looks great! I'll merge in when tests pass. :) |
Fixes #443
Replaces #446, #640