question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Number of flatlist in a screen the app freezes for some time (Performance issue)

See original GitHub issue

Hi, 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:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
douglowdercommented, Oct 30, 2021

If you could copy over the complete App.js, that would be great. The code you copied here omits renderItem, getItemLayout, etc.

0reactions
sankar9659commented, Nov 2, 2021

If you could copy over the complete App.js, that would be great. The code you copied here omits renderItem, getItemLayout, etc.

issue fixed

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found