我正在尝试使用 react FlatList 从 api 呈现一些数据,ListItem 每个文档都有许多字段,但 ListItems 只给我一个“标题”和“副标题”的选项,是否有自定义和添加更多字段的选项?
我检查了文档和其他示例,但我看到的只是“标题”和“副标题”
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>
);
}
}
Run Code Online (Sandbox Code Playgroud)
我想在渲染上显示更多的字段,而不仅仅是“标题”和“副标题”。