2

I am developing a React Native app with Relay. I was using a FlatList inside a ScrollView like this:

<ScrollView>
  ...

  <Suspense>
    <FlatList />
  </Suspense>
</ScrollView>

I experienced issues with ondEndReached (it’s being called every time) so I moved to something like this:

<FlatList
  ListHeaderComponent={...}
  ...
/>

That works properly (onEndReached is called when it has to), but as I am using Relay I have to use the Suspense to add a Spinner/Loader and if I wrap the FlatList in the Suspense it will suspense all the component (including the Header) and not only the items.

Do you have any idea about how to advance? One alternative is to make it work the FlatList inside the ScrollView and the other one, to make it work the Suspense only for the items from the FlatList. Thanks!

0 Answers0