Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sticky headers don't work with content insets #1464

Open
1 of 2 tasks
bryanmylee opened this issue Jan 5, 2025 · 0 comments
Open
1 of 2 tasks

Sticky headers don't work with content insets #1464

bryanmylee opened this issue Jan 5, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@bryanmylee
Copy link

bryanmylee commented Jan 5, 2025

Current behavior

I'm using FlashList to render a list that flows under the device's safe area in combination with a sticky header. However, the sticky header does not respect the safe area insets and therefore gets stickied at top: 0 under the safe area.

This can be seen on my demo:

flashlist.sticky.header.mp4

The main issue comes from:

<FlashList
  contentInset={{ top: safeAreaInsets.top }}
  contentOffset={{ y: -safeAreaInsets.top }}
  stickyHeaderIndices={[1]}
  // snip
/>

Expected behavior

In contrast, swapping FlashList for FlatList produces the correct behaviour:

flatlist.sticky.header.mp4
<FlatList
  contentInset={{ top: safeAreaInsets.top }}
  contentOffset={{ y: -safeAreaInsets.top }}
  stickyHeaderIndices={[1]}
  // snip
/>

To Reproduce

I've created a minimal reproduction here:

https://github.com/bryanmylee/flashlist-sticky-inset-demo

<FlashList
  contentInset={{ top: safeAreaInsets.top }}
  contentOffset={{ y: -safeAreaInsets.top }}
  stickyHeaderIndices={[1]}
  // snip
/>

Platform:

  • iOS
  • Android

Environment

1.7.2

@bryanmylee bryanmylee added the bug Something isn't working label Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant