I have been trying to recreate the functionality of an Instagram or Twitter profile page, and I have run into a problem that I don't know how to solve.
The main idea that I use to reproduce this functionality is to use the contentOffset of ScrollView with cells, and change the vertical offset of the ProfileView so that when scrolling the list it disappears, and the view of the list switcher is fixed on top.
The problem is that when scrolling one list, and switching to another, I have an indent in top of the list, which I do not know how to make adaptive to the scroll of any of the lists and to the cells count in each list.
Maybe it would be worth adding another ScrollView in which to place the ProfileView and the view list switcher, but how to make them work similarly to what is in Instagram?
I have searched a lot on the internet for a solution, but I have not found anything to help me solve this exact problem, I will be very grateful for your help.
I created a small project demonstrating the problem, here is the GitHub link, you can download and run it: https://github.com/swiloper/StickyHeader
And also an example of the problem and desired functionality with Instagram: enter image description here enter image description here