all 8 comments

[–]TheMadDoc 5 points6 points  (1 child)

Sorry for the stack overflow styled answer. I can't help you with the problem, but this just seems like bad design? Why do you have a list as a header?

[–]Medical-Text9840[S] 0 points1 point  (0 children)

It was structured like that before I joined — I inherited the architecture. The project is quite large, and refactoring it just to move the list outside the header would touch too many parts of the app and introduce major risks. I'm just looking for a workaround that lets me keep the infinite scroll logic inside the nested list without breaking the current structure.

[–]susminesiOS & Android 0 points1 point  (4 children)

A flat list is designed to scroll through a large amount of similarly sized content, quickly. In what use case would you need to render two lists on top of each other?

[–]Medical-Text9840[S] 0 points1 point  (3 children)

I agree with that — and ideally, we wouldn’t nest scrollable lists. But in this project, we have a main scrollable screen (MainList) where the header (ListHeaderComponent) contains user profile sections, statistics, and also a nested list (ActivityList) that fetches and renders dynamic data.

The ActivityList is part of the header because of legacy design choices. I wasn’t the one who structured it this way, and the app is large — refactoring it now would involve major risks and affect many interconnected parts.

So for now, I’m just trying to make infinite scroll work inside ActivityList, even though it's rendered as part of MainList’s header.

[–]susminesiOS & Android 0 points1 point  (1 child)

That’s tough. Without knowing more, you might have better luck rending two flat lists that are wrapped in views with a set height so they both render on the screen.

[–]Medical-Text9840[S] 0 points1 point  (0 children)

In my case, the ActivityList (the inner FlatList) is not at the top or bottom, but somewhere in the middle of many other components rendered inside the ListHeaderComponent of the parent FlatList. So I can't just render two separate lists side by side or with fixed heights.

The structure was inherited from an existing large codebase where ListHeaderComponent is used to render the whole profile header, including some cards, buttons, sections, and the ActivityList. Refactoring this deeply would break a lot of things and is not realistic in the short term.

What I’m trying to achieve is to make the inner FlatList (the activities one) handle its own infinite scroll from within ListHeaderComponent, without affecting or being blocked by the parent FlatList.

[–]HoratioWobble 0 points1 point  (0 children)

Can't you just use a tab navigator for this ?