I have used this FlatList
, where I have called renderRow
function in which I have written code to render list Items, How can I get the rowId
for each row renderer
in renderRow
method?
<List containerStyle={{borderTopWidth:0 , borderBottomWidth:0}}>
<FlatList data={this.state.horseList}
renderItem={(item) => this.renderRow(item)}
_keyExtractor ={item => item.id}
onRefresh={this.handleRefresh}
refreshing={this.state.refreshing}
onEndReached={this.handleLoadMore}
onEndReachedThreshold={1}
ListFooterComponent={this.renderFooter}
onRefresh={this.handleRefresh}
/>
</List>
If I understand your issue correctly, you can access the index of each row in this way:
<FlatList data={this.state.horseList}
...
renderItem={({item, index}) => this.renderRow(item, index)}
...
/>