react-native-calendars
react-native-calendars copied to clipboard
" Cannot read property 'data' of undefined" on expandable calendar arrows
Please make our job easier by filling this template out to completion. If you're requesting a feature instead of reporting a bug, please feel free to skip the Environment and Reproducible Demo sections.
Description
I found a weird issue with our implementation that uses the expandable calendar and agenda list, where occasionally the app will crash when navigating months using the arrows, but not by swiping? Swiping to the next month works just fine, but using the next month arrow triggers the proper date changes (and in our case begins to load data), but then subsequently crashes with the error "Cannot read property 'data' of undefined" (see the error screenshot below).
It looks like it occurs in the VirtualizedSectionList class. This is running in a managed expo project v51.0.11
Expected Behavior
Same experience as swiping to navigate
Observed Behavior
What actually happened when you performed the above actions?
If there's an error message, please paste the full terminal output and error message in this code block:
ERROR TypeError: Cannot read property 'data' of undefined, js engine: hermes
Environment
Please run these commands in the project folder and fill in their results:
npm ls react-native-calendars: [email protected]npm ls react-native: [email protected]
Also specify:
- Device/emulator/simulator & OS version: iOS 17 (multiple devices, emulators and physical)
Reproducible Demo
Please provide a minimized reproducible demonstration of the problem you're reporting.
Issues that come with minimal repro's are resolved much more quickly than issues where a maintainer has to reproduce themselves.
Functioning with swipe action:

Breaking with arrows:

Screenshots
Screenshots or gifs of the issue and the suggested fix will help us move faster with the review process.
I had this issue, added a try-catch around scrollToLocation in agendaList.js and created a patch. It fixes the crash for me.
@selvakumar-aspire do you have a fork or a branch I could pin to?
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.