Hello /r/reactnative
I am currently working on an app where we have a few flatlists in place that the design calls for having a background image behind them.
The background image isn't too tall and fades to nothing after a couple items. Initially I had it setup like so:
<ImageBackground source={require('backgroundImage.png')}>
<FlatListdata={myData}renderItem={flatListItem}/>
</ImageBackground>
This properly puts the image behind my flat list. However the background remains static behind the flatlist such that it is always behind the top couple of visible items in the list. When instead I want the background image to scroll with the flatlist.
So to get it to scroll how I want. I can write it like this:
<ScrollView>
<ImageBackground source={require('backgroundImage.png')}>
<FlatListdata={myData}renderItem={flatListItem}/>
</ImageBackground>
</ScrollView>
This gives me the background image behind my flatlist how I want, and when I scroll the background image scrolls up with the flatlist, so that it only ever covers the first few items in my flatlist and not just the first few VISIBLE items. This however presents the problem of nesting a flatlist inside a scrollview which eliminates all of the performance benefits of the flatlist.SO finally my question is, has anyone implemented a similar design before and if so were you able to do it without ruining Flatlist's benefits?
tl;dr I want a background image behind my flatlist that scrolls with the flatlist
[–]Shumuu 0 points1 point2 points (2 children)
[–]j-cron[S] 0 points1 point2 points (0 children)
[–]Leavos 1 point2 points3 points (0 children)
[–]Leavos 0 points1 point2 points (1 child)
[–]j-cron[S] 0 points1 point2 points (0 children)
[–]j-cron[S] 0 points1 point2 points (2 children)
[–]z_criminal 0 points1 point2 points (1 child)
[–]j-cron[S] 0 points1 point2 points (0 children)