mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Add missing ListItemComponent prop to VirtualizedList/FlatList/SectionList TypeScript types (#57754)
Summary: `ListItemComponent` is a valid prop on `FlatList`, `SectionList` and `VirtualizedList` (it's in the Flow types in `VirtualizedListProps.js`), but it's missing from the `.d.ts`, so TypeScript errors on it even though it works at runtime. Added it to `VirtualizedListWithoutRenderItemProps` next to the other `List*Component` props, so all three inherit it. ## Changelog: [GENERAL] [ADDED] - Add missing ListItemComponent type to VirtualizedList props Pull Request resolved: https://github.com/react/react-native/pull/57754 Test Plan: Errors on `main`, type-checks with the change: ```tsx <FlatList data={[]} ListItemComponent={MyItem} /> ``` Type-only, addition only, no runtime changes. Reviewed By: Abbondanzo Differential Revision: D114061127 Pulled By: fabriziocucci fbshipit-source-id: e843645a93b2320370829e8fd86deda078d6852a
This commit is contained in:
1 parent
8e74464127
commit
5306e9229c
1 file changed
+8
@@ -188,6 +188,14 @@ export interface VirtualizedListWithoutRenderItemProps<
|
||||
*/
|
||||
ListHeaderComponentStyle?: StyleProp<ViewStyle> | undefined;
|
||||
|
||||
/**
|
||||
* Each data item is rendered using this element, as an alternative to `renderItem`.
|
||||
* Can be a React Component Class or a render function. In addition to the data provided
|
||||
* to `renderItem`, this receives `index` and `separators` metadata.
|
||||
*/
|
||||
ListItemComponent?:
|
||||
React.ComponentType<any> | React.ReactElement | null | undefined;
|
||||
|
||||
/**
|
||||
* The default accessor functions assume this is an Array<{key: string}> but you can override
|
||||
* getItem, getItemCount, and keyExtractor to handle any type of index-based data.
|
||||
|
||||
Reference in new issue
Block a user