MCPcopy Index your code
hub / github.com/react-dates/react-dates / onNextMonthTransition

Method onNextMonthTransition

src/components/DayPicker.jsx:609–639  ·  view source on GitHub ↗
(nextFocusedDate)

Source from the content-addressed store, hash-verified

607 }
608
609 onNextMonthTransition(nextFocusedDate) {
610 const { isRTL, numberOfMonths, daySize } = this.props;
611 const { calendarMonthWidth, monthTitleHeight } = this.state;
612
613 let translationValue;
614
615 if (this.isVertical()) {
616 const firstVisibleMonthWeeks = this.calendarMonthWeeks[1];
617 const calendarMonthWeeksHeight = firstVisibleMonthWeeks * (daySize - 1);
618 translationValue = -(monthTitleHeight + calendarMonthWeeksHeight + 1);
619 }
620
621 if (this.isHorizontal()) {
622 translationValue = -calendarMonthWidth;
623 if (isRTL) {
624 translationValue = 0;
625 }
626
627 const visibleCalendarWeeks = this.calendarMonthWeeks.slice(2, numberOfMonths + 2);
628 const calendarMonthWeeksHeight = Math.max(0, ...visibleCalendarWeeks) * (daySize - 1);
629 const newMonthHeight = monthTitleHeight + calendarMonthWeeksHeight + 1;
630 this.adjustDayPickerHeight(newMonthHeight);
631 }
632
633 this.setState({
634 monthTransition: NEXT_TRANSITION,
635 translationValue,
636 focusedDate: null,
637 nextFocusedDate,
638 });
639 }
640
641 getFirstDayOfWeek() {
642 const { firstDayOfWeek } = this.props;

Callers 3

onNextMonthClickMethod · 0.95
DayPicker_spec.jsxFile · 0.80

Calls 3

isVerticalMethod · 0.95
isHorizontalMethod · 0.95
adjustDayPickerHeightMethod · 0.95

Tested by

no test coverage detected