Closed workbyken closed 4 months ago
onDateChanged
from the CalendarProvider
fires after WeekCalendar
has been scrolled
It is not behaving as you have mentioned. It only fires when you press a day, not when you are just scrolling through the weeks, or im doing something wrong?
const handleChangeDate = (date:string, updateSource: string) => {
console.log("DATE INSIDE handleChangeDate", date);
console.log("updateSource (REASON OF UPDATE)", updateSource);
}
<CalendarProvider onDateChanged={handleChangeDate} date={selectedDate}>
<WeekCalendar
firstDay={1}
current={selectedDate}
onDayPress={onDayPress}
monthFormat={'yyyy MM'}
markingType={'multi-dot'}
markedDates={markedDates}
/>
</CalendarProvider>
Using the code in example/src/screens/expandableCalendarScreen.tsx
with your handleChangeDate
fn:
DATE INSIDE handleChangeDate 2024-08-19
LOG updateSource (REASON OF UPDATE) pageScroll
When you scroll the weeks does the date change?
Got it, thanks - I had to import useRef! import React, { useRef, useEffect, useState, useCallback, useLayoutEffect } from 'react';
I'm trying to do something after the WeekCalendar has been scrolled, eg. set the current Month title of the visible week.
I've tried:
onScroll, onScrollBeginDrag, onScrollEndDrag, onMomentumScrollBegin, onMomentumScrollEnd,
is it possible to do this at all?
Expected Behavior
Nothing
Observed Behavior
Nothing
Environment
Reproducible Demo
Screenshots