我正在尝试使用React FlatList和ListItem从API渲染一些数据,每个文档都有许多字段,但是ListItem只提供了“标题”和“子标题”的选项,是否有任何方法可以自定义并添加更多字段?
我查看了文档和其他示例,但是我只看到了“标题”和“子标题”。
render() {
return (
<ScrollView>
<List containerStyle={{ borderTopWidth: 0, borderBottomWidth: 0 }}>
<FlatList
data={this.state.data}
renderItem={({ item }) => (
<ListItem
title={`${item.origin} - ${item.destination}`}
subtitle={item.date}
subtitle1={item.price}
seats={{seats:item.status}}
containerStyle={{ borderBottomWidth: 0 }}
/>
)}
keyExtractor={item => item._id}
ItemSeparatorComponent={this.renderSeparator}
/>
</List>
</ScrollView>
);
}
}
我想在呈现中显示比“标题”和“子标题”更多的字段。
item.date
改为{item.date}
。 - Swam Didam