Added missing type cases for ItemSeparatorComponent on react-native FlatList

This commit is contained in:
mcousillas6
2017-08-13 19:56:02 -03:00
parent d77e701618
commit 6f13f3dcba
2 changed files with 13 additions and 2 deletions
+1 -1
View File
@@ -3491,7 +3491,7 @@ export interface FlatListProperties<ItemT> extends VirtualizedListProperties<Ite
/**
* Rendered in between each item, but not at the top or bottom
*/
ItemSeparatorComponent?: React.ComponentClass<any> | null
ItemSeparatorComponent?: React.ComponentClass<any> | React.ReactElement<any> | (() => React.ReactElement<any>) | null
/**
* Rendered when the list is empty.
+12 -1
View File
@@ -208,11 +208,22 @@ InteractionManager.runAfterInteractions(() => {
}).then(() => 'done')
export class FlatListTest extends React.Component<FlatListProperties<number>, {}> {
_renderItem = (rowData: any) => {
return (
<View>
<Text> {rowData.item} </Text>
</View>
);
}
_renderSeparator= () => <View style={{height: 1, width: '100%', backgroundColor: 'gray'}} />
render() {
return (
<FlatList
data={[1, 2, 3, 4, 5]}
renderItem={(info: { item: number }) => <View><Text>{info.item}</Text></View>}
renderItem={this._renderItem}
ItemSeparatorComponent={this._renderSeparator}
/>
);
}