Merge pull request #28392 from danilobuerger/patch-4

[react-native] SectionList is a VirtualizedList
This commit is contained in:
Eloy Durán
2018-08-26 17:53:38 +02:00
committed by GitHub
2 changed files with 7 additions and 4 deletions

View File

@@ -4042,7 +4042,7 @@ export interface SectionListRenderItemInfo<ItemT> extends ListRenderItemInfo<Ite
export type SectionListRenderItem<ItemT> = (info: SectionListRenderItemInfo<ItemT>) => React.ReactElement<any> | null;
export interface SectionListProps<ItemT> extends ScrollViewProps {
export interface SectionListProps<ItemT> extends VirtualizedListWithoutRenderItemProps<ItemT> {
/**
* Rendered in between adjacent Items within each section.
*/
@@ -4201,7 +4201,11 @@ export interface SectionListStatic<SectionT> extends React.ComponentClass<Sectio
/**
* @see https://facebook.github.io/react-native/docs/virtualizedlist.html#props
*/
export interface VirtualizedListProps<ItemT> extends ScrollViewProps {
export interface VirtualizedListProps<ItemT> extends VirtualizedListWithoutRenderItemProps<ItemT> {
renderItem: ListRenderItem<ItemT>;
}
export interface VirtualizedListWithoutRenderItemProps<ItemT> extends ScrollViewProps {
/**
* Rendered when the list is empty. Can be a React Component Class, a render function, or
* a rendered element.
@@ -4345,8 +4349,6 @@ export interface VirtualizedListProps<ItemT> extends ScrollViewProps {
*/
removeClippedSubviews?: boolean;
renderItem: ListRenderItem<ItemT>;
/**
* Render a custom scroll component, e.g. with a differently styled `RefreshControl`.
*/

View File

@@ -360,6 +360,7 @@ export class SectionListTest extends React.Component<SectionListProps<string>, {
<Text>{`${info.section.title} - ${info.item}`}</Text>
</View>
)}
maxToRenderPerBatch={5}
/>
</React.Fragment>
);