sectionList is always scrolling to first section if item index 0 regardless of section index: X #48031
Labels
Component: SectionList
Needs: Author Feedback
Type: Unsupported Version
Issues reported to a version of React Native that is no longer supported
Description
I am using a SectionList in React Native to display multiple sections with multiple items in each section. I am programmatically scrolling to specific sections and items using the scrollToLocation method.
The issue I am facing is that if I attempt to scroll to an item with an itemIndex of 0, the SectionList always scrolls to the first item of the first section, regardless of the sectionIndex I provide. If the itemIndex is greater than 0, the scrolling works as expected and goes to the correct section and item. The issue is happening in iOS. I have tested it against latest stable version of react-native (0.76.3) as well, which has same issue. Here's a simplified code to reproduce the issue:
Steps to reproduce
Run following code and try to scroll by pressing buttons. Note that the issue i found in iOS only.
React Native Version
0.76.3
Affected Platforms
Runtime - iOS
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://snack.expo.dev/@anasyarn/sectionlist-example
Screenshots and Videos
Screen.Recording.2024-12-01.at.8.mp4
The text was updated successfully, but these errors were encountered: