Flatlist inside ScrollView

I was trying to resolve another issue (VirtualizedLists should never be nested inside plain ScrollViews with the same orientation - use another VirtualizedList-backed container instead.) so it got me thinking about something I use in my app which might be done in a better way.

What I want to achieve is to have a layout on a screen like this:

[scrollview]
    [gallery of images, simple horizontal scrollview /]
    [flatlist, vertical with some items /]
[/scrollview]

At first the flatlist is locked and you can’t scroll it, the only thing that happens is the screen moves up, the gallery disappears and when that happens the flatlist now covers entire screen and can be scrolled.

Same way when you scroll to the top of the flatlist, the flatlist is locked and gallery shows up again sliding down.

Something similar to how Samsung One UI screens with headers, but this is used in many other apps as well.

What would be the best way to go about this?