react / react/react-native

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

Offen
#34,399 4 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Component: SectionList Needs: Triage :mag: Never gets stale Platform: iOS
Vorherrschende Sprache
C++
Sterne
127k
Forks
25.3k
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
4

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, das Snack-Beispiel auf einem iOS-Gerät mit SectionList, einem leeren sections-Array und einer ListHeaderComponent zu reproduzieren. Verfolge das Verhalten von SectionList, wenn sich sections ändert, und bestätige, dass der Header nicht mehr neu gerendert wird oder ruckelt, wenn die Liste keine Daten enthält, während das Verhalten für befüllte sections erhalten bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
ios, react-native
Bereich
mobile
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.