我正在我的React Native项目中使用Flatlist和SectionList,并且有300多行数据。然而,我发现一个严重的问题,就是当我不停地向下和向上滚动时,内存使用量越来越高。我该如何解决这个问题?或者说,我该如何释放内存?
我知道这里有一些相关的问题,但我已经尝试了许多解决方案,但没有一个有效。
例如,
1. 我使用了Pure.component或shouldcomponentUpdate 2. 我使用了Flatlist和SectionList的一些props
我知道这里有一些相关的问题,但我已经尝试了许多解决方案,但没有一个有效。
例如,
1. 我使用了Pure.component或shouldcomponentUpdate 2. 我使用了Flatlist和SectionList的一些props
initialNumToRender={9}
windowSize={10}
maxToRenderPerBatch={2}
removeClippedSubviews={true}
disableVirtualization={true}
getItemLayout={this.getItemLayout}
keyExtractor={(item, index) => item[0]}
extraData={this.state}
还有其他解决方案可以帮助我解决问题吗?非常感谢!
overflow: 'hidden'
样式。 - Melih Mucuk