Skip to content

Commit 6c33fd1

Browse files
aliakbarazizifacebook-github-bot
authored andcommitted
Fix virtual list type (#35434)
Summary: Add missing props to virtual list ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [General] [Fixed] - Virtual list props Pull Request resolved: #35434 Test Plan: relative pull request in DefinitelyTyped DefinitelyTyped/DefinitelyTyped#63323 Reviewed By: javache Differential Revision: D41553396 Pulled By: NickGerleman fbshipit-source-id: d51a93410ece9ad5f0bb61e2ee51076973e80c8c
1 parent 4e66816 commit 6c33fd1

3 files changed

Lines changed: 17 additions & 84 deletions

File tree

Libraries/Lists/FlatList.d.ts

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -19,48 +19,6 @@ import {ViewStyle} from '../StyleSheet/StyleSheetTypes';
1919
import {View} from '../Components/View/View';
2020

2121
export interface FlatListProps<ItemT> extends VirtualizedListProps<ItemT> {
22-
/**
23-
* Rendered in between each item, but not at the top or bottom
24-
*/
25-
ItemSeparatorComponent?: React.ComponentType<any> | null | undefined;
26-
27-
/**
28-
* Rendered when the list is empty.
29-
*/
30-
ListEmptyComponent?:
31-
| React.ComponentType<any>
32-
| React.ReactElement
33-
| null
34-
| undefined;
35-
36-
/**
37-
* Rendered at the very end of the list.
38-
*/
39-
ListFooterComponent?:
40-
| React.ComponentType<any>
41-
| React.ReactElement
42-
| null
43-
| undefined;
44-
45-
/**
46-
* Styling for internal View for ListFooterComponent
47-
*/
48-
ListFooterComponentStyle?: StyleProp<ViewStyle> | undefined;
49-
50-
/**
51-
* Rendered at the very beginning of the list.
52-
*/
53-
ListHeaderComponent?:
54-
| React.ComponentType<any>
55-
| React.ReactElement
56-
| null
57-
| undefined;
58-
59-
/**
60-
* Styling for internal View for ListHeaderComponent
61-
*/
62-
ListHeaderComponentStyle?: StyleProp<ViewStyle> | undefined;
63-
6422
/**
6523
* Optional custom style for multi-item rows generated when numColumns > 1
6624
*/

Libraries/Lists/SectionList.d.ts

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -61,48 +61,6 @@ export type SectionListRenderItem<ItemT, SectionT = DefaultSectionT> = (
6161

6262
export interface SectionListProps<ItemT, SectionT = DefaultSectionT>
6363
extends VirtualizedListWithoutRenderItemProps<ItemT> {
64-
/**
65-
* Rendered in between adjacent Items within each section.
66-
*/
67-
ItemSeparatorComponent?: React.ComponentType<any> | null | undefined;
68-
69-
/**
70-
* Rendered when the list is empty.
71-
*/
72-
ListEmptyComponent?:
73-
| React.ComponentType<any>
74-
| React.ReactElement
75-
| null
76-
| undefined;
77-
78-
/**
79-
* Rendered at the very end of the list.
80-
*/
81-
ListFooterComponent?:
82-
| React.ComponentType<any>
83-
| React.ReactElement
84-
| null
85-
| undefined;
86-
87-
/**
88-
* Styling for internal View for ListFooterComponent
89-
*/
90-
ListFooterComponentStyle?: StyleProp<ViewStyle> | undefined | null;
91-
92-
/**
93-
* Rendered at the very beginning of the list.
94-
*/
95-
ListHeaderComponent?:
96-
| React.ComponentType<any>
97-
| React.ReactElement
98-
| null
99-
| undefined;
100-
101-
/**
102-
* Styling for internal View for ListHeaderComponent
103-
*/
104-
ListHeaderComponentStyle?: StyleProp<ViewStyle> | undefined | null;
105-
10664
/**
10765
* Rendered in between each section.
10866
*/

Libraries/Lists/VirtualizedList.d.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
import type * as React from 'react';
1111
import type {LayoutChangeEvent} from '../../types';
12+
import {StyleProp} from '../StyleSheet/StyleSheet';
13+
import {ViewStyle} from '../StyleSheet/StyleSheetTypes';
1214
import type {ScrollViewProps} from '../Components/ScrollView/ScrollView';
1315

1416
export interface ViewToken {
@@ -124,6 +126,11 @@ export interface VirtualizedListProps<ItemT>
124126

125127
export interface VirtualizedListWithoutRenderItemProps<ItemT>
126128
extends ScrollViewProps {
129+
/**
130+
* Rendered in between each item, but not at the top or bottom
131+
*/
132+
ItemSeparatorComponent?: React.ComponentType<any> | null | undefined;
133+
127134
/**
128135
* Rendered when the list is empty. Can be a React Component Class, a render function, or
129136
* a rendered element.
@@ -144,6 +151,11 @@ export interface VirtualizedListWithoutRenderItemProps<ItemT>
144151
| null
145152
| undefined;
146153

154+
/**
155+
* Styling for internal View for ListFooterComponent
156+
*/
157+
ListFooterComponentStyle?: StyleProp<ViewStyle> | undefined;
158+
147159
/**
148160
* Rendered at the top of all the items. Can be a React Component Class, a render function, or
149161
* a rendered element.
@@ -154,6 +166,11 @@ export interface VirtualizedListWithoutRenderItemProps<ItemT>
154166
| null
155167
| undefined;
156168

169+
/**
170+
* Styling for internal View for ListHeaderComponent
171+
*/
172+
ListHeaderComponentStyle?: StyleProp<ViewStyle> | undefined;
173+
157174
/**
158175
* The default accessor functions assume this is an Array<{key: string}> but you can override
159176
* getItem, getItemCount, and keyExtractor to handle any type of index-based data.

0 commit comments

Comments
 (0)