Number of flatlist in a screen the app freezes for some time (Performance issue)
See original GitHub issueHi, we are working on a tvos project. In this we have a screen, In that screen we are having 5 flatlist, Whenever I go to the screen, the app freezes for some time, or app crashes, I’m not able to scroll the items for 30 seconds, After that only I can able to scroll the items. How to fix that issue
Here is the example code, In that component I’m using 6 flatlist. Whenever I go to this screen app freezer or crashed.
import React, { Component } from 'react';
import { View, StyleSheet, TouchableOpacity, Button, FlatList, Text } from 'react-native';
const listData = [
{"id":"210fa414-ed54-4836-98ac-b136828f1be2","firstName":"Alicea","lastName":"Skea"},
{"id":"5ccf0ca3-720b-4a18-8eac-43cb2543565a","firstName":"Rubin","lastName":"Dulson"},
{"id":"e7f20eb2-4c30-4266-afba-7287fd2240e9","firstName":"Delaney","lastName":"Fishbie"},
];
export default class App extends Component {
render() {
return (
<View style={styles.container}>
<FlatList
data={this.state.data}
extraData={this.state.checkedLookup}
keyExtractor={x => x.id}
renderItem={this.renderItem}
getItemLayout={this.getItemLayout}
/>
<FlatList
data={this.state.data}
extraData={this.state.checkedLookup}
keyExtractor={x => x.id}
renderItem={this.renderItem}
getItemLayout={this.getItemLayout}
/>
<FlatList
data={this.state.data}
extraData={this.state.checkedLookup}
keyExtractor={x => x.id}
renderItem={this.renderItem}
getItemLayout={this.getItemLayout}
/>
<FlatList
data={this.state.data}
extraData={this.state.checkedLookup}
keyExtractor={x => x.id}
renderItem={this.renderItem}
getItemLayout={this.getItemLayout}
/>
<FlatList
data={this.state.data}
extraData={this.state.checkedLookup}
keyExtractor={x => x.id}
renderItem={this.renderItem}
getItemLayout={this.getItemLayout}
/>
<FlatList
data={this.state.data}
extraData={this.state.checkedLookup}
keyExtractor={x => x.id}
renderItem={this.renderItem}
getItemLayout={this.getItemLayout}
/>
</View>
);
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
When there is a large list , flat list is laggy and sometimes ...
Try using RecyclerListview component. Flatlist natively is using RecyclerListView in android.
Read more >FlatList is killing the performance of your app - YouTube
Lists are one of the most common components in React Native, but the FlatList has always been kinda slow and buggy when dealing...
Read more >Long text in inverted Flatlist causes huge performance drop on ...
After investigating, I found out that it happens when using inverted on a FlatList that contains items with a lot of text (see...
Read more >Optimizing Flatlist Configuration - React Native
Pros: Define precise number of items that would cover the screen for every device. This can be a big performance boost for the...
Read more >Debug your React Native app performance issues - Bam Tech
Debug lags, scroll bugs, and React Native performance issues with the Chrome profiler and Flipper.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you could copy over the complete
App.js
, that would be great. The code you copied here omitsrenderItem
,getItemLayout
, etc.issue fixed