wix / react-native-calendars

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

" Cannot read property 'data' of undefined" on expandable calendar arrows #2485

Open brianbolnick opened 3 months ago

brianbolnick commented 3 months ago

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

image

Environment

Please run these commands in the project folder and fill in their results:

Also specify:

  1. 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: image

Breaking with arrows: image

Screenshots

Screenshots or gifs of the issue and the suggested fix will help us move faster with the review process.

selvakumar-aspire commented 2 weeks ago

I had this issue, added a try-catch around scrollToLocation in agendaList.js and created a patch. It fixes the crash for me.

brianbolnick commented 1 week ago

@selvakumar-aspire do you have a fork or a branch I could pin to?