Commit 0b1561a
Fix misleading ListItemComponent JSDoc in VirtualizedList types (#58500)
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
Pull Request resolved: #58500
Test Plan:
Comment-only change in a `.d.ts`, no type changes. Checked the wording against `_renderElement`:
```js
if (ListItemComponent) {
return (
<ListItemComponent item={item} index={index} separators={this._separators} />
);
}
if (renderItem) {
return renderItem({item, index, separators: this._separators});
}
```
Reviewed By: cortinico
Differential Revision: D120077066
Pulled By: Abbondanzo
fbshipit-source-id: 489321ae950b169c9a985d18220d1ec84114e5fc1 parent 7fc66cc commit 0b1561a
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
194 | | - | |
| 193 | + | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| |||
0 commit comments