Skip to content

Fix misleading ListItemComponent JSDoc in VirtualizedList types - #58500

Open
aravi365 wants to merge 1 commit into
react:mainfrom
aravi365:fix-listitemcomponent-jsdoc
Open

Fix misleading ListItemComponent JSDoc in VirtualizedList types#58500
aravi365 wants to merge 1 commit into
react:mainfrom
aravi365:fix-listitemcomponent-jsdoc

Conversation

@aravi365

Copy link
Copy Markdown
Contributor

Summary

I added ListItemComponent to these types in #57754 and got the comment wrong. It says the component receives index and separators "in addition to the data provided to renderItem", which reads as if renderItem doesn't get them. It does. _renderElement in VirtualizedListCellRenderer.js passes the same item, index and separators to both.

This fixes that sentence and mentions the one thing that actually is different, which is precedence. When both are set, ListItemComponent wins and _renderElement logs a warning saying so.

Changelog:

[INTERNAL] [FIXED] - Fix JSDoc for ListItemComponent in VirtualizedList types

Test Plan

Comment-only change in a .d.ts, no type changes. Checked the wording against _renderElement:

if (ListItemComponent) {
  return (
    <ListItemComponent item={item} index={index} separators={this._separators} />
  );
}
if (renderItem) {
  return renderItem({item, index, separators: this._separators});
}

The comment said ListItemComponent receives index and separators in
addition to what renderItem gets, but _renderElement passes the same
item, index and separators to both. Say that, and note that
ListItemComponent takes precedence when both are set.
@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 13, 2026
@facebook-github-tools facebook-github-tools 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 13, 2026
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. 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.

1 participant