按日期对map函数内flatlist中的api数据进行排序
我尝试按日期对flatlist中的数据进行排序,但不起作用,我尝试了以下方法:按日期对map函数内flatlist中的api数据进行排序,api,sorting,date,fetch,flatlist,Api,Sorting,Date,Fetch,Flatlist,我尝试按日期对flatlist中的数据进行排序,但不起作用,我尝试了以下方法: data={history.historySortie.sort(function(a,b){return a.date.getTime() - b.date.getTime()})} 这是我的全部代码: {this.state.dataSource.map((history,key) => <FlatList
data={history.historySortie.sort(function(a,b){return a.date.getTime() - b.date.getTime()})}
这是我的全部代码:
{this.state.dataSource.map((history,key) =>
<FlatList
key={key}
data={history.historySortie.sort(function(a,b){return a.date.getTime() -
b.date.getTime()})}
renderItem={this.renderItem}
keyExtractor={(item, index) => index}
/>)}
{this.state.dataSource.map((历史记录,键)=>
索引}
/>)}