Skip to content

SectionList: fix separators position when list is inverted - #53799

Closed
Simek wants to merge 2 commits into
mainfrom
@simek/sectionlist-fix-inverted-separators
Closed

Simek wants to merge 2 commits into
mainfrom
@simek/sectionlist-fix-inverted-separators

Conversation

@Simek

@Simek Simek commented Sep 16, 2025

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Contributor

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

@yungsters

Copy link
Copy Markdown
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

Simek commented Sep 24, 2025 •

Copy link
Copy Markdown
Collaborator Author

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. 🙂

@react-native-bot

Copy link
Copy Markdown
Collaborator

This PR is stale because it has been open for 180 days with no activity. It will be closed in 7 days unless you comment on it or remove the "Stale" label.

@react-native-bot react-native-bot added Stale There has been a lack of activity on this issue and it may be closed soon. and removed Stale There has been a lack of activity on this issue and it may be closed soon. labels Mar 24, 2026
@react-native-bot

Copy link
Copy Markdown
Collaborator

This PR is stale because it has been open for 180 days with no activity. It will be closed in 7 days unless you comment on it or remove the "Stale" label.

@react-native-bot

Copy link
Copy Markdown
Collaborator

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@react-native-bot react-native-bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Sep 21, 2026
@react-native-bot

Copy link
Copy Markdown
Collaborator

This PR was closed because it has been stalled for 7 days with no activity.

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. Stale There has been a lack of activity on this issue and it may be closed soon.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SectionList shows inconsistent SeparatorComponent behaviour when using inverted

4 participants