Skip to content

Conversation

Simek
Copy link
Collaborator

@Simek Simek commented Sep 16, 2025

Summary:

Fixes:

Before:

AndroidiOS
Screenshot (16 Sept 2025 14_20_06)IMG_2891

If inverted prop is used, update section index calculation to return correct value in VirtualizedSectionList.

I have also altered the RNTester example styling slightly to make it easier to debug and test the issue (removed applied by default items margin).

Changelog:

[GENERAL] [FIXED] - SectionList: fix separators position when list is inverted

Test Plan:

Modify the RNTester "SectionList with separators" to include invert option. Make sure that Flow checks are passing, test the changes on real devices on both platforms.

I have also make sure that non-inverted lists are not affected by the changes.

Preview:

AndroidiOS
Screenshot (16 Sept 2025 13_56_21)IMG_2890

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 16, 2025
@Simek Simek marked this pull request as ready for review September 16, 2025 12:42
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Sep 16, 2025
@facebook-github-bot
Copy link
Contributor

@philIip has imported this pull request. If you are a Meta employee, you can view this in D82792798.

@yungsters
Copy link
Contributor

I've been trying to understand the bug and why this fixes it, and I see the screenshots in the test plan which looks right. But I'm having trouble reasoning about it.

In particular, I'm trying to understand why the inverted checks in ItemWithSeparator are insufficient:

https://github.com/facebook/react-native/blob/main/packages/virtualized-lists/Lists/VirtualizedSectionList.js#L632-L633

For reference, these checks were originally introduced by #26933 which seemingly sought to solve the same problem.

@Simek
Copy link
Collaborator Author

Simek commented Sep 24, 2025

As I understand it, it looks like at some point the separators logic has been refactored to be based on the indexes, but the indexes were taken from info helper (_subExtractor), which basically maps to the user provided sections/data (and other props) which are passed to list component.

The inverted prop is display only, and info data remains unchanged no matter of prop value, which seems to re-introduced the issue, hence the idea to calculate display index and pass it everywhere where the info.index has been used, so the separators can be injected at right points.

But I might be wrong, if you have any other idea how to approach that issue please let me know, I'm happy to update the PR accordingly. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Expo Partner: Expo Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SectionList shows inconsistent SeparatorComponent behaviour when using inverted
3 participants