MCPcopy Create free account
hub / github.com/react-dates/react-dates / onPrevMonthTransition

Method onPrevMonthTransition

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

Source from the content-addressed store, hash-verified

544 }
545
546 onPrevMonthTransition(nextFocusedDate) {
547 const { daySize, isRTL, numberOfMonths } = this.props;
548 const { calendarMonthWidth, monthTitleHeight } = this.state;
549
550 let translationValue;
551 if (this.isVertical()) {
552 const calendarMonthWeeksHeight = this.calendarMonthWeeks[0] * (daySize - 1);
553 translationValue = monthTitleHeight + calendarMonthWeeksHeight + 1;
554 } else if (this.isHorizontal()) {
555 translationValue = calendarMonthWidth;
556 if (isRTL) {
557 translationValue = -2 * calendarMonthWidth;
558 }
559
560 const visibleCalendarWeeks = this.calendarMonthWeeks.slice(0, numberOfMonths);
561 const calendarMonthWeeksHeight = Math.max(0, ...visibleCalendarWeeks) * (daySize - 1);
562 const newMonthHeight = monthTitleHeight + calendarMonthWeeksHeight + 1;
563 this.adjustDayPickerHeight(newMonthHeight);
564 }
565
566 this.setState({
567 monthTransition: PREV_TRANSITION,
568 translationValue,
569 focusedDate: null,
570 nextFocusedDate,
571 });
572 }
573
574 onMonthChange(currentMonth) {
575 this.setCalendarMonthWeeks(currentMonth);

Callers 3

onPrevMonthClickMethod · 0.95
DayPicker_spec.jsxFile · 0.80

Calls 3

isVerticalMethod · 0.95
isHorizontalMethod · 0.95
adjustDayPickerHeightMethod · 0.95

Tested by

no test coverage detected