gpt4 book ai didi

react-native - React Native Flatlist-VirtualizedList : You have a large list that is slow to update

转载 作者:行者123 更新时间:2023-12-03 16:23:50 28 4
gpt4 key购买 nike

我有一个包含大量内容的平面列表,当我在调试器控制台上滚动10到15页后向下滚动时,我得到了以下信息:

VirtualizedList: You have a large list that is slow to update - make sure your renderItem function renders components that follow React performance best practices like PureComponent, shouldComponentUpdate, etc. {dt: 582, prevDt: 1651, contentLength: 15187.5}



仅供引用:我尝试过使用PureComponent和更多方法,但是没有人帮忙,我在控制台中得到了相同的输出。

为什么我得到这个,如何解决呢?

这是我的代码:
<FlatList
data={outfits}
keyExtractor={(item, index) => index}
numColumns={2}
initialNumToRender={5}
getItemLayout={(outfits, index) => (
{ length: 50, offset: 50 * index, index }
)}
extraData={this.state.extraData}
renderItem={({item,index}) => <Items item={item} index={index}/>}
onRefresh={this.handleRefresh}
refreshing={this.state.refreshing}
onEndReached={this.handleLoadMore}
onEndReachedThreshold={20}
ListFooterComponent={this.renderFooter}
/>

最佳答案

我对https://docs.nativebase.io中的Content有相同的问题,我将Content更改为View并使用了PureComponent。现在工作了!

关于react-native - React Native Flatlist-VirtualizedList : You have a large list that is slow to update,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47696404/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com