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

Make AgendaList scroll to today by default

Open Alper-Demir-Eng opened this issue 1 year ago • 3 comments

Hello everyone, I have integrated AgendaList in my app and It works quite nicely, I can make the ExpandableCalendar select today by default using the date={getCurrentDate()} prop but I'm not able to do the same for AgendaList as there is no comparable prop, it is worth mentioning that Agenda for example has a selected prop that does what I'm looking for.

Any idea how to achieve this for AgendaList?

Thank you

Alper-Demir-Eng avatar Feb 23 '24 06:02 Alper-Demir-Eng

I came to the understanding that if a day is not yet loaded then it cannot be scrolled to, and days' events seem to be loaded in patches for performance reasons presumably, so maybe if it is possible to force load all days it will scroll to today...

Alper-Demir-Eng avatar Feb 23 '24 07:02 Alper-Demir-Eng

Hei! I would like to achieve the same behaviour, have you come to any solution yet?

jelsiis avatar Apr 02 '24 13:04 jelsiis

I could not do exactly what I wanted, but I ended up doing the following: 1- set "avoidDateUpdates" propirty under AgendaList to true 2- set a boolean variable to determine if the AgendaList is being populated for the first time (after navigating to the screen), or a second time (when a user pulls down to refresh). 3- If it was the first time, only load events starting from today and ignore past events, if it is a user refreshing by pulling down then load the whole set of events.

Alper-Demir-Eng avatar Apr 02 '24 14:04 Alper-Demir-Eng