简体   繁体   English

React Native Flatlist - VirtualizedList:您有一个很难更新的大型列表

[英]React Native Flatlist - VirtualizedList: You have a large list that is slow to update

I have a flat list with large content and when I am scrolling down after 10 - 15 pages on debugger console i have getting this: 我有一个包含大量内容的平面列表,当我在调试器控制台上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} VirtualizedList:你有一个很快更新的大型列表 - 确保你的renderItem函数呈现遵循React性能最佳实践的组件,如PureComponent,shouldComponentUpdate等。{dt:582,prevDt:1651,contentLength:15187.5}

FYI: I have tried to use PureComponent and more ways but no one is helpful I am getting the same output in console. 仅供参考:我曾尝试使用PureComponent和更多方法,但没有人有用我在控制台中获得相同的输出。

Why I am getting this and how can solve this? 为什么我得到这个以及如何解决这个问题?

This is my code : 这是我的代码:

<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}
/>

I had the same issue with Content in https://docs.nativebase.io and I changed Content to View and used PureComponent . 我在https://docs.nativebase.io中遇到了与Content相同的问题,我将Content更改为View并使用了PureComponent And now it's work! 而现在它的工作!

please use RefreshControl and props refresh control in Content native base 请在内容本机库中使用RefreshControl和props刷新控件

 import { StyleSheet, RefreshControl } from 'react-native';

...
render(
  <Content refreshControl={<RefreshControl refreshing={this.state.refreshing} onRefresh={this._onRefresh.bind(this)} />}>
       <List .../>
      </Content>
...
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 VirtualizedList:您有一个更新缓慢的大列表 - React Native FlatList - VirtualizedList: You have a large list that is slow to update - React Native FlatList React Native - VirtualizedList:您有一个更新缓慢的大列表 - React Native - VirtualizedList: You have a large list that is slow to update Flatlist 重新渲染:VirtualizedList:你有一个更新慢的大列表 - Flatlist Re rendering: VirtualizedList: You have a large list that is slow to update VirtualizedList:您有一个更新缓慢的大型列表 - VirtualizedList: You have a large list that is slow to update VirtualizedList:您有一个更新缓慢的大型列表警告 - VirtualizedList: You have a large list that is slow to update warning “VirtualizedList:您有一个更新缓慢的大列表”警告,即使所有组件都已优化 - "VirtualizedList: You have a large list that is slow to update" warning even though all components are optimized React Native:你的列表很大,更新很慢 - React Native: You have a large list that is slow to update VirtualizedList:您的列表很大,更新速度很慢 我该如何解决这个问题 - VirtualizedList: You have a large list that is slow to update How can i fix this problem 当 List 包含图像时,React Native flatlist 感觉很慢 - React native flatlist feel so slow when List contain Images React Native Flatlist 非常慢 - React Native Flatlist extremely slow
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM