Skip to content

Commit 828ed4a

Browse files
authored
CalendarList - check date passed to xdateToData() (#2020)
1 parent 1b63508 commit 828ed4a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/calendar-list/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,11 @@ const CalendarList = (props: CalendarListProps, ref: any) => {
146146

147147
useDidUpdate(() => {
148148
const currMont = currentMonth?.clone();
149-
onMonthChange?.(xdateToData(currMont));
150-
onVisibleMonthsChange?.([xdateToData(currMont)]);
149+
if (currMont) {
150+
const data = xdateToData(currMont);
151+
onMonthChange?.(data);
152+
onVisibleMonthsChange?.([data]);
153+
}
151154
}, [currentMonth]);
152155

153156
const scrollToDay = (date: XDate | string, offset: number, animated: boolean) => {

0 commit comments

Comments
 (0)