FlatList re-mount all the row when using columns
Nessuno ha ancora preso questa issue.
- Lingua principale
- C++
- Stelle
- 127k
- Fork
- 25.3k
- Merge medio
- 1g 23h
- PR unite (30g)
- 4
Descrizione
Description
Regardless of the use of optimization techniques, such as React.memo or useCallback, when a FlatList with columns (numColumns > 1) is created and an element is added or removed from the list, this causes all components of the row where the element was added or removed to be re-mounted. This is easily noticeable if entry animations are used (but it has other serious repercussions). I'm currently stuck in development on this issue (and switching to unsare scroll view would make the app unusable). There are many similar issues by now, all closed without any discussion or solution, and since it has been years now I think it is time to take the problem into consideration.
Steps to reproduce
- configure a Flatlist with numColumns > 1 2) add dynamically a new item or remove an item 3) all the items of the row addicted are re-mounted
React Native Version
0.74.3
Affected Platforms
Runtime - Android, Runtime - iOS
Output of npx react-native info
System:
OS: macOS 14.5
CPU: (8) arm64 Apple M2
Memory: 127.25 MB / 8.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 22.4.1
path: /opt/homebrew/bin/node
Yarn:
version: 1.22.19
path: /opt/homebrew/bin/yarn
npm:
version: 10.8.2
path: /opt/homebrew/bin/npm
Watchman:
version: 2024.07.01.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /Users/niccolocaselli/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.5
- iOS 17.5
- macOS 14.5
- tvOS 17.5
- visionOS 1.2
- watchOS 10.5
Android SDK:
Android NDK: 22.1.7171670
IDEs:
Android Studio: 2023.2 AI-232.10300.40.2321.11567975
Xcode:
version: 15.4/15F31d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.11
path: /usr/bin/javac
Ruby:
version: 2.7.6
path: /Users/niccolocaselli/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.74.3
wanted: 0.74.3
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
Stacktrace or Logs
no crash
Reproducer
https://snack.expo.dev/@niccolocase/0aa680
Screenshots and Videos
https://github.com/user-attachments/assets/891e73d0-d77f-4b3e-8beb-5a1fe60c5a82
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con il riproduttore Snack collegato e con la configurazione di FlatList che usa un valore di numColumns maggiore di uno. Riproduci un inserimento e una rimozione osservando i mount delle righe su Android e iOS. Il lavoro è completato quando gli elementi esistenti della riga interessata non vengono montati nuovamente durante questi aggiornamenti e il comportamento è stato verificato rispetto alla versione di React Native segnalata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, react, react-native
- Ambito
- frontend, mobile-dev
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 28/100