react-native-calendars
react-native-calendars copied to clipboard
Fixed Issue in agenda where clicking on a new date renders a part of the previously selected date
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!
thanks @DonovanVA for ur help in my project. However, i think there is a typo on the last code snippet. Regards ze en
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.
@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