mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
Add section in SectionListRenderItemInfo
This commit is contained in:
committed by
Vincent Langlet
parent
a2a659c351
commit
aa28f4cd15
Vendored
+12
-2
@@ -3973,7 +3973,7 @@ export interface SectionBase<ItemT> {
|
||||
|
||||
key?: string;
|
||||
|
||||
renderItem?: ListRenderItem<ItemT>;
|
||||
renderItem?: SectionListRenderItem<ItemT>;
|
||||
|
||||
ItemSeparatorComponent?: React.ComponentClass<any> | (() => React.ReactElement<any>) | null;
|
||||
|
||||
@@ -3984,6 +3984,16 @@ export interface SectionListData<ItemT> extends SectionBase<ItemT> {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://facebook.github.io/react-native/docs/sectionlist.html#props
|
||||
*/
|
||||
|
||||
export interface SectionListRenderItemInfo<ItemT> extends ListRenderItemInfo<ItemT> {
|
||||
section: SectionListData<ItemT>;
|
||||
}
|
||||
|
||||
export type SectionListRenderItem<ItemT> = (info: SectionListRenderItemInfo<ItemT>) => React.ReactElement<any> | null;
|
||||
|
||||
export interface SectionListProps<ItemT> extends ScrollViewProps {
|
||||
/**
|
||||
* Rendered in between adjacent Items within each section.
|
||||
@@ -4087,7 +4097,7 @@ export interface SectionListProps<ItemT> extends ScrollViewProps {
|
||||
/**
|
||||
* Default renderer for every item in every section. Can be over-ridden on a per-section basis.
|
||||
*/
|
||||
renderItem?: ListRenderItem<ItemT>;
|
||||
renderItem?: SectionListRenderItem<ItemT>;
|
||||
|
||||
/**
|
||||
* Rendered at the top of each section. Sticky headers are not yet supported.
|
||||
|
||||
@@ -49,6 +49,7 @@ import {
|
||||
findNodeHandle,
|
||||
ScrollView,
|
||||
ScrollViewProps,
|
||||
SectionListRenderItemInfo,
|
||||
RefreshControl,
|
||||
TabBarIOS,
|
||||
NativeModules,
|
||||
@@ -350,9 +351,9 @@ export class SectionListTest extends React.Component<SectionListProps<string>, {
|
||||
<Text>{section.title}</Text>
|
||||
</View>
|
||||
)}
|
||||
renderItem={(info: { item: string }) => (
|
||||
renderItem={(info: SectionListRenderItemInfo<string>) => (
|
||||
<View>
|
||||
<Text>{info.item}</Text>
|
||||
<Text>{`${info.section.title} - ${info.item}`}</Text>
|
||||
</View>
|
||||
)}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user