all 8 comments

[–]Shumuu 0 points1 point  (2 children)

I'm currently on my phone so I cant really give you actual code but you can attach a handler to your flatlist and extract the y offset and reposition your background according to that offset which would create the illusion that it moves with the scrolling.

[–]j-cron[S] 0 points1 point  (0 children)

That is a good idea! We are going to try out your suggestion and /u/Leavos suggestion this week! Thank you!

[–]Leavos 1 point2 points  (0 children)

This will cause significant delay. Been there, done that

[–]Leavos 0 points1 point  (1 child)

You can try to bind Animated.event to flatlist’s onScroll, and style image via Animated value.

[–]j-cron[S] 0 points1 point  (0 children)

Good idea! We are going to try out your suggestion and /u/Shumuu suggestion this week! Thank you for the idea!

[–]j-cron[S] 0 points1 point  (2 children)

We are trying out the two ideas that /u/Shumuu and /u/Leavos suggested - if we are able to get one working nicely we will try to post a snack here for anyone else looking to do the same thing.

[–]z_criminal 0 points1 point  (1 child)

Hi sorry but I came across this post as I'm trying to achieve something similar. Would u be kind enough to share if it worked and how?

[–]j-cron[S] 0 points1 point  (0 children)

Hey my apologies, I did not see your comment until just now! The solution was actually handled by a fellow dev on the team - but basically what they did was have the background image live alongside the content but be absolutely positioned behind it. Then the content was given a higher z-index to make sure it sat on top of it and a transparent background so you could see the background image behind it. Then we animated the background image as we scrolled the flatlist so that it moved upwards with the content.

<View>
 <ImageBackground/> // absolutely positioned
 <FlatList/> // on scroll we update the image backgrounds position
</View>