如何将 ItemSeparatorComponent 添加到 FlatList 中的最后一项

How to add the ItemSeparatorComponent to the last item in FlatList

我正在为我的 FlatList 使用 Item SeparatorComponent。有没有办法将行添加到列表的最后,就像最后一项的底部边框一样?

export default Item = ({ title, data }) => {

    const renderSeparator = () => (
        <View
          style={{
            backgroundColor: 'lightgrey',
            height: 0.5,
          }}
        />
    )

    return (
        <View style={styles.container}>
            <View style={styles.title}>
                <Text style={styles.titleText}>{title}</Text>
            </View>
            <View style={styles.subItem}>
                <FlatList
                    ItemSeparatorComponent={renderSeparator}   
                    data={data}
                    renderItem={({ item }) => (
                        <SubItem 
                            title={item.title} 
                            subText={item.subText} 
                        />
                    )}
                    keyExtractor={item => item.id.toString()}
                />
            </View>
        </View>
    )
}

低于

ItemSeparatorComponent={renderSeparator}

添加

ListFooterComponent={renderSeparator}