react-native-calendars icon indicating copy to clipboard operation
react-native-calendars copied to clipboard

Delay when using WeekCalendar and AgendaList together.

Open aleberguer opened this issue 2 years ago • 8 comments

Description

Hello! I’m using the CalendarProvider to show a page with a WeekCalendar and an AgendaList working together. Everything looks good except for a delay when tapping on a day in the WeekCalendar. I’m attaching a video with this issue.

I was digging into the code, and I found that there is a debounce of 1 second in the scrollToSection function that is causing this delay. I tried to remove the debounce, and the delay is gone.

I'm not sure why this debounce is there, but maybe we can add a prop to decide whether to use the debounce or not?

Expected Behavior

When tapping a day in the WeekCalendar, the AgendaList scrolls immediately, and there is no noticeable delay between the tap in WeekCalendar and the scrolling.

Observed Behavior

When tapping a day in the WeekCalendar, there is a delay in scrolling the AgendaList to the day selected.

Environment

[email protected] [email protected]

This is happening on both iOS/Android emulators and physical devices.

Reproducible Demo

 <CalendarProvider date="2022-01-07">
        <WeekCalendar hideDayNames firstDay={1} />
        <AgendaList
          sections={ITEMS}
          renderItem={CardItem}
          horizontal
          pagingEnabled
        />
</CalendarProvider>

Video

https://user-images.githubusercontent.com/5271876/226691487-1925e483-cc17-4dc2-9684-d8b2be645c48.mov

aleberguer avatar Mar 21 '23 17:03 aleberguer

Also experiencing this but when I remove the debounce the delay seems to persist for some reason. Have used patch package, removed node_modules, cleared expo cache, etc etc.

brianjuhl avatar Mar 22 '23 03:03 brianjuhl

I removed the debounce and it works smoothly. @brianjuhl Have you tried changing directly in the node_modules package?

aleberguer avatar Mar 23 '23 14:03 aleberguer

@Inbal-Tish, what are your thoughts on this issue? I can work on making a PR, but I would like to know the best approach here. I don't know what the debounce is expected to solve, but it is making the calendar very laggy and not the best user experience.

Can we add a prop to the AgendaList to decide whether to use the debounce? Or maybe a prop to give the debounce time, 1000 seems pretty arbitrary here.

aleberguer avatar May 31 '23 15:05 aleberguer

@aleberguer Hi. PR will be best. I would add a prop to control the debounce time.

Inbal-Tish avatar Jun 01 '23 07:06 Inbal-Tish

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 17 '23 05:09 stale[bot]

same issue

zkteco-home avatar Oct 27 '23 19:10 zkteco-home

Hey, I have had the same issue and created this patch which works as a temporary fix until the team creates a PR:

react-native-calendars+1.1307.0.patch

PS: You can apply the patch making use of patch-package

juanmigdr avatar Dec 16 '24 18:12 juanmigdr

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 25 '25 00:04 stale[bot]