tamtoum1987
tamtoum1987

Reputation: 2057

Reactnative FlatList memory or is very Slow

I have a big Flat List (around 2000 elements) ont the item i have shouldComponentUpdate false so the item doesn't load several times

My FlatList is declared like this <FlatList showsVerticalScrollIndicator={false} inverted data={this.props.dataSourcePr} ref={ref => { this.state.flatListTimeLine = ref; }} renderItem={this.renderItem} onViewableItemsChanged={this.onViewableItemsChanged} viewabilityConfig={{ itemVisiblePercentThreshold: 30, }} keyExtractor={(item, index) => index} initialScrollIndex={this.state.lastIndex} onScrollToIndexFailed={info => {}}

        initialNumToRender={70}
        maxToRenderPerBatch={50}
        onEndReachedThreshold={0.1}
        windowSize={70}
        onScroll={this._onScroll}
        removeClippedSubviews = {true}
      />

How can i avoid crashes problem, and how can i make this FlatList less slow ? how can i tell FlatList to load only shown element on screen ?

any help would be greatly appreciated

Upvotes: 0

Views: 408

Answers (1)

manoharglm
manoharglm

Reputation: 21

Try to add keyExtractor and checkout this article by react-native

Upvotes: 0

Related Questions