How do I make ItemSeparatorComponent
prop of FlatList
get called for each row, so that one can customize for each row. Something similar of what renderSeparator prop of deprecated ListView
.
I had the same requirement, turns out you can pass a function as well:
renderSeparator = ({leadingItem, section})=>{
if (section.noSeparator || !leadingItem.noSeparator)
return null;
return <Separator />;
};
render(){
return <SectionList
renderSectionHeader={this.renderSectionHeader}
sections={this.sections}
renderItem={this.renderItem}
ItemSeparatorComponent={this.renderSeparator}
/>;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With