Skip to content

FlatList re-renders its items many times #24206

@BanidAzin

Description

@BanidAzin

🐛 Bug Report

When I render FlatList with simple static data array (also with dynamic array), FlatList renders renderItem many times.
For example, it first renders the first 10 items, then the first 20 (first 10 second time!), then the first 30, etc.

To Reproduce

  1. Add a FlatList with some data(more than 20 items)
  2. Log the FlatList renderItem function and check how much time renderItemfunction is called

Expected Behavior

The item components already rendered should be reused

Code Example

https://snack.expo.io/By_l9Jnu4

Environment

React Native Environment Info:
System:
OS: Linux 4.15 Ubuntu 18.04.2 LTS (Bionic Beaver)
CPU: (4) x64 Intel(R) Core(TM) i5-3317U CPU @ 1.70GHz
Memory: 224.72 MB / 7.68 GB
Shell: 4.4.19 - /bin/bash
Binaries:
Node: 10.8.0 - /usr/bin/node
npm: 6.8.0 - /usr/bin/npm
npmPackages:
react: 16.8.3 => 16.8.3
react-native: ^0.59.2 => 0.59.2
npmGlobalPackages:
create-react-native-app: 2.0.2
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions