Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
按日期对map函数内flatlist中的api数据进行排序_Api_Sorting_Date_Fetch_Flatlist - Fatal编程技术网

按日期对map函数内flatlist中的api数据进行排序

按日期对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

我尝试按日期对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((历史记录,键)=>
索引}
/>)}