0

What I am trying to accomplish:

I have a horizontal flatlist (with pagination: true) and I would like to animate the scrolling depending on where on the y axis the user started swiping from.

If the scrolling started from the upper half of the flatlist then its border would animate to a certain color, otherwise it would switch to a different color, and depending on the scroll start position I would call a different function when the next index when the next index is scrolled to.

My question:

So is it possible to use a gesture responder (from react-native-gesture-handler) to handle the scrolling instead of relying on the built in responder of flatList?

for example: calling scrollToOffset repeatedly from inside my gesture responder or set a "current scroll position" prop with an animated value and pass it to the flatList component? no matter what I try I get bombarded with obscure error messages so I was wondering if it is even possible.

Ahmed Nasr
  • 319
  • 5
  • 12
  • Isn't it you can check offset x and y to do it? May be using onScroll or onScrollBeginDrag? – Hardik Chavda Jul 12 '22 at 12:57
  • @HardikChavda Flatlist exposes the current offset (offset X as it's a horizontal list) but I need to also know the start Y to determine how the change will occur as the offset X is changed. However flatlist captures the gesture and doesn't expose any information on the gesture in the y direction – Ahmed Nasr Jul 13 '22 at 13:10

0 Answers0