-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Description
🐛 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
- Add a FlatList with some data(more than 20 items)
- 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