react-native-calendars: Agenda loadItemsForMonth calls two time and gives wrong date
Description
Following are the issues in my app :-
- First time
loadItemsForMonthcalls twice. - On scroll month
loadItemsForMonthgives wrong date. - On press date,
loadItemsForMonthmethod call.
Expected Behavior
- First time
loadItemsForMonthcall only one time and it should return the exact date. - On scroll month
loadItemsForMonthreturn exact the date of visible month. - On press date, calls only
onDayPressnotloadItemsForMonth.
My Code
<Agenda
items={this.state.items}
loadItemsForMonth={day => this.loadMonthData(day)}
onDayPress={day => this.onDatePress(day)}
renderItem={this.renderItem.bind(this)}
renderEmptyDate={this.renderEmptyDate.bind(this)}
rowHasChanged={this.rowHasChanged.bind(this)}
refreshing={false}
/>
loadMonthData(day) {
console.log("Month date :- ", day);
}
onDatePress(day) {
console.log("On date press :- ", day);
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 20
- Comments: 32 (1 by maintainers)
So…I tried to debug the error myself. I don’t like messing in module code for risk it will break on updates, and I don’t understand the issue well enough to send a pull request, but when I add the prop
it shows that an additional month is being added the the “months” array. Then the
onViewableItemsChangedis being called for some reason and setting the component state tomonths[0]. I changed the function to selectmonths[1]and it appears to work well enough for now. I don’t know why this is happening, but if someone on the core team is going to fix the issue, I hope this will be a lead!Another month, another person with this issue. How has everyone else worked around this?
still no solution?
Any solution to this ?
Any solution??