Reputation: 2057
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
Reputation: 21
Try to add keyExtractor and checkout this article by react-native
Upvotes: 0