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

Fixed Issue in agenda where clicking on a new date renders a part of the previously selected date

Open DonovanVA opened this issue 2 years ago • 1 comments

Background : Fixes #1791

Found the component where the data is wrongly updated:

1. In react-native-calendars/src/agenda/index.js:

...
if (!sameDate(newSelectedDate, prevState.selectedDay)) {
            const prevSelectedDate = this.getSelectedDate(prevProps.selected);
}
...

changes to:

...
if (sameDate(newSelectedDate, prevState.selectedDay)) {
            const prevSelectedDate = this.getSelectedDate(prevProps.selected);
}
...

2. In react-native-calendars/src/agenda/reservation-list/index.js:

...
if (!sameDate(prevProps.topDay, this.props.topDay)) {
                this.setState({ reservations: [] }, () => this.updateReservations(this.props));
            }
...

changes to:

...
if (sameDate(newSelectedDate, prevState.selectedDay)) {
            const prevSelectedDate = this.getSelectedDate(prevProps.selected);
}
...

Hope this helps!

DonovanVA avatar May 30 '22 11:05 DonovanVA

thanks @DonovanVA for ur help in my project. However, i think there is a typo on the last code snippet. Regards ze en

zeentan22 avatar Jun 10 '22 10:06 zeentan22

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 Nov 22 '22 19:11 stale[bot]

@zeentan22 oh yea it should be if (sameDate(newSelectedDate, prevState.selectedDay)) { this.setState({ reservations: [] }, () => this.updateReservations(this.props)); }

With the as mentioned by you for the 4th (last code snippet of my comment

DonovanVA avatar Jan 31 '24 17:01 DonovanVA