Skip to content

fix: pass full contentContainerStyle in FlashList wrapper (Android minHeight)#497

Open
AgathaCrystal wants to merge 1 commit into
PedroBern:mainfrom
AgathaCrystal:fix/flashlist-minheight-android
Open

fix: pass full contentContainerStyle in FlashList wrapper (Android minHeight)#497
AgathaCrystal wants to merge 1 commit into
PedroBern:mainfrom
AgathaCrystal:fix/flashlist-minheight-android

Conversation

@AgathaCrystal

@AgathaCrystal AgathaCrystal commented May 19, 2026

Copy link
Copy Markdown

Summary

FlashList.tsx only extracted paddingTop from the library's calculated contentContainerStyle, dropping minHeight. This caused Android scroll sync to fail on tab switch when content was shorter than the viewport.

The fix spreads the full contentContainerStyle (matching FlatList.tsx behavior), ensuring the library's calculated minHeight reaches the FlashList.

Root Cause

useCollapsibleStyle() calculates minHeight: containerHeight + headerScrollDistance to ensure content is tall enough for Android's scroll sync. FlatList.tsx passes this through correctly, but FlashList.tsx only extracted paddingTop:

// Before (FlashList.tsx) — drops minHeight:
() => ({
  paddingTop: contentContainerStyle.paddingTop,
  ..._contentContainerStyle,
})

// After — matches FlatList.tsx behavior:
() => ({
  ...contentContainerStyle,
  ..._contentContainerStyle,
})

Without minHeight, Android's scrollTo(headerScrollDistance) silently fails when tab content is shorter than the viewport, because the max scroll offset is less than the target. iOS is unaffected (uses native contentInset).

Reproduction

  1. Use Tabs.FlashList with 2+ tabs on Android
  2. Have one tab with content shorter than the screen height
  3. Scroll down until the header fully collapses
  4. Switch to the short-content tab
  5. Expected: Content appears immediately below the collapsed header
  6. Actual: Large gap (~headerScrollDistance pixels) above the content

Test plan

  • Android: Scroll down, switch to short-content tab — no gap
  • iOS: No regression — same behavior as before

fixes #498

FlashList.tsx only extracted paddingTop from the library's calculated
contentContainerStyle, dropping minHeight. This caused Android scroll
sync to fail on tab switch when content was shorter than the viewport.

The fix spreads the full contentContainerStyle (matching FlatList.tsx
behavior), so the library's minHeight reaches the FlashList.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] FlashList.tsx drops minHeight from contentContainerStyle, breaking scroll sync on tab switch

1 participant