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

Agenda, can`t scroll before date selected from calendar

Open Saikedo opened this issue 3 years ago • 1 comments

Description

When using the Agenda component, if I choose a date from calendar (not the header but the collapsible calendar), I am unable to scroll up to any dates prior to the chosen date from the calendar.

As an example, please select either Android or iOS in the provided demo, roll down the calendar, press on 25th day and then try to scroll up.

Expected Behavior

Expected to allow the agenda scroll past the date selected from the calendar, just like it works when selecting days from agenda header.

Environment

react-native-calendars version: 1.1286.0 react-native version: 0.68.2

Tested both on iOS and Android

Reproducible Demo

Demo for the bug

Saikedo avatar Aug 07 '22 21:08 Saikedo

Seems like the issue occurs in reservation-list/index.js in componentDidUpdate method.

When sameDate returns false (which happens when we select a date from month, the reservations in state is set to empty array. After that updateReservations is called, which in turn calls getReservations. Sincere there are no reservations anymore, it ends up iterating and adding reservations starting only from selectedDay, which is chosen from the day that you click on the calendar.

The problem however originates inside agenda/index.js onDayPress method. Here, when choosing the day from calendar, this.state.calendarScrollable is true and we end up passing optimisticScroll: false to chooseDay, which sets topDay to the chosen date.

Saikedo avatar Aug 08 '22 14:08 Saikedo

Any updates on this issue? Found a lot of simular issues but none of them contains a workaround for this.

https://github.com/wix/react-native-calendars/issues/1586 https://github.com/wix/react-native-calendars/issues/259 https://github.com/wix/react-native-calendars/issues/979 https://github.com/wix/react-native-calendars/issues/80

fkranenburg avatar Sep 28 '22 13:09 fkranenburg

I'm facing the same issue here, appreciate any help on this.

SidneiWolcow avatar Oct 04 '22 01:10 SidneiWolcow

Maybe we can use this component instead of the flatlist:

https://www.npmjs.com/package/react-native-bidirectional-infinite-scroll

What are your thoughts?

nes123 avatar Oct 12 '22 22:10 nes123

Same issue. It is frustrating to leave it like that in the application.

chunghn avatar Oct 17 '22 08:10 chunghn

I solved it on my fork. I can try to suggest a merge once I make it more compatible with the last version of this repo.

nes123 avatar Oct 17 '22 09:10 nes123

Same issue, is there any fix available?

LucasPMM avatar Jan 10 '23 18:01 LucasPMM

Because of this issue we migrated to this one: https://github.com/howljs/react-native-calendar-kit

fkranenburg avatar Jan 10 '23 18:01 fkranenburg

+1

wagnercsfilho avatar Jan 25 '23 22:01 wagnercsfilho

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 '23 23:04 stale[bot]

Any updates on this?

maximilian avatar May 05 '23 19:05 maximilian

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 Aug 07 '23 05:08 stale[bot]

I solved it on my fork. I can try to suggest a merge once I make it more compatible with the last version of this repo.

could be very helpful ! :)

Louisptc avatar Oct 02 '23 16:10 Louisptc