react / react/react-native

[iOS] SectionList - Weird ListHeaderComponent re-render when no section data

Aperta
#34,399 4 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Component: SectionList Needs: Triage :mag: Never gets stale Platform: iOS
Lingua principale
C++
Stelle
127k
Fork
25.3k
Merge medio
1g 23h
PR unite (30g)
4

Descrizione

Description

Only on iOS, when using a SectionList ListHeaderComponent, providing sections = [] will cause a weird re-render, whereas if there is any section data, this re-render does not happen.

Basically, is there any reason that the HeaderComponent should be forced to re-render when "sections" changes?

2022-08-12 11 36 42

See Snack below of repro steps.

Version

0.67.2

Output of npx react-native info

System:
OS: macOS 12.5
CPU: (10) arm64 Apple M1 Pro
Memory: 581.61 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 14.18.1 - ~/.nvm/versions/node/v14.18.1/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v14.18.1/bin/yarn
npm: 6.14.15 - ~/.nvm/versions/node/v14.18.1/bin/npm
Watchman: 2022.05.30.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: 17.0.1 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: ^0.67.2 => 0.67.2
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

See Snack below, and follow these steps (need to load on iOS device, doesn't happen in web/android)

  1. Scroll "filter pills" component to it's right-most state
  2. Click "One", notice how the section list data filters to only rows with "One"
  3. Deselect "One"
  4. Click "Seven", notice how the "filter pills" component has jolted all the way back to the left, as there is no data found to filter by
Snack, code example, screenshot, or link to a repository

https://snack.expo.dev/@tyler16cote/section-list-empty-render

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo l'esempio Snack su un dispositivo iOS con SectionList, un array sections vuoto e un ListHeaderComponent. Traccia il comportamento di SectionList quando sections cambia e verifica che l'header non venga più renderizzato nuovamente e non abbia scatti quando la lista non contiene dati, mantenendo il comportamento per sections valorizzato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
ios, react-native
Ambito
mobile
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.