Skip to content

Commit f32c084

Browse files
committed
wrapping with useCallback
1 parent ed1afcf commit f32c084

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/calendar/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ const Calendar = (props: CalendarProps) => {
113113
updateMonth(newMonth);
114114
}, [currentMonth, updateMonth]);
115115

116-
const handleDayInteraction = (date: DateData, interaction?: (date: DateData) => void) => {
116+
const handleDayInteraction = useCallback((date: DateData, interaction?: (date: DateData) => void) => {
117117
const day = parseDate(date);
118118
const min = parseDate(minDate);
119119
const max = parseDate(maxDate);
@@ -126,17 +126,17 @@ const Calendar = (props: CalendarProps) => {
126126
interaction(date);
127127
}
128128
}
129-
};
129+
}, [minDate, maxDate, allowSelectionOutOfRange, disableMonthChange, updateMonth]);
130130

131131
const onPressDay = useCallback((date?: DateData) => {
132132
if (date)
133133
handleDayInteraction(date, onDayPress);
134-
}, []);
134+
}, [handleDayInteraction, onDayPress]);
135135

136136
const onLongPressDay = useCallback((date?: DateData) => {
137137
if (date)
138138
handleDayInteraction(date, onDayLongPress);
139-
}, []);
139+
}, [handleDayInteraction, onDayLongPress]);
140140

141141
const onSwipeLeft = useCallback(() => {
142142
// @ts-expect-error

0 commit comments

Comments
 (0)