我有一个包含多列的 FlatList:
<FlatList
numColumns={4}
ItemSeparatorComponent={this.renderSeparator}
...
</FlatList>
和一个行分隔符:
renderSeparator = () => (
<View
style={{
backgroundColor: 'red',
height: 0.5,
}}
/>
);
但是分隔符只出现在行之间,而不是列之间(即使我添加 width: 0.5
原文由 Avery235 发布,翻译遵循 CC BY-SA 4.0 许可协议
您可以在 renderItems 中添加 if else 条件并检查索引模数以添加分隔符。我只使用这个,一切都很好。
就像是 :-
希望这会帮助你。