How to implement a sticky header in React Native? (Like in Instagram profile)

Viewed 1003

I am trying to implement a sticky header like in the instagram profile. The thing is, that I want a MaterialTopTabNavigator to be the thing that sticks to the head. And inside this navigator I have a screen with a FlatList in it. On the outside I currently have a ScrollView and I think the difficulty is to detect, if the user wants to scroll the ScrollView or the FlatList. But I want the user to be able to scroll on the whole screen (1:1 like the instagram profile).

Here I created a snack, which shows how far I got: https://snack.expo.io/@christophhummler/stickyheader

You can use this as a template or implement your own solution if you have other ideas how to implement this...The weird thing is the stickyHeaderIndices={[1]} is not working in the Web emulator, but on Android/iOS it is.

Thank you for your help!

0 Answers
Related