Skip to content

Instantly share code, notes, and snippets.

@jehartzog
Created December 23, 2020 22:07
Show Gist options
  • Save jehartzog/ef5e4091d18176c55a84b67c9e5358b7 to your computer and use it in GitHub Desktop.
Save jehartzog/ef5e4091d18176c55a84b67c9e5358b7 to your computer and use it in GitHub Desktop.
RN Patch to fix SectionList header remount when switching to/from empty section array
diff --git a/node_modules/react-native/Libraries/Lists/VirtualizedSectionList.js b/node_modules/react-native/Libraries/Lists/VirtualizedSectionList.js
index 53eb54b..d870b3b 100644
--- a/node_modules/react-native/Libraries/Lists/VirtualizedSectionList.js
+++ b/node_modules/react-native/Libraries/Lists/VirtualizedSectionList.js
@@ -173,7 +173,7 @@ class VirtualizedSectionList<
_computeState(props: Props<SectionT>): State {
const offset = props.ListHeaderComponent ? 1 : 0;
- const stickyHeaderIndices = [];
+ const stickyHeaderIndices = [0];
const itemCount = props.sections
? props.sections.reduce((v, section) => {
stickyHeaderIndices.push(v + offset);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment