wix / react-native-calendars

React Native Calendar Components 🗓️ 📆
MIT License
9.52k stars 2.95k forks source link

Agenda, can`t scroll before date selected from calendar #1963

Open Saikedo opened 2 years ago

Saikedo commented 2 years ago

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 commented 2 years ago

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.

fkranenburg commented 2 years ago

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

SidneiWolcow commented 2 years ago

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

nes123 commented 2 years ago

Maybe we can use this component instead of the flatlist:

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

What are your thoughts?

chunghn commented 1 year ago

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

nes123 commented 1 year ago

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.

LucasPMM commented 1 year ago

Same issue, is there any fix available?

fkranenburg commented 1 year ago

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

wagnercsfilho commented 1 year ago

+1

stale[bot] commented 1 year ago

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.

maximilian commented 1 year ago

Any updates on this?

stale[bot] commented 1 year ago

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.

Louisptc commented 1 year ago

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 ! :)