FlatList won't scroll with panResponder

94 Views Asked by At

I've never used panResponder before and I'm pretty new to using animations in react native. I have a component with a FlatList where each item is able to move to the left using panResponder. The issue I'm having is that I need the FlatList to still be able to scroll through the list, but the the panResponder is preventing this. I've tried looking for a solution, but I can't seem to find one that works for me.

Changing onMoveShouldSetPanResponder from true to a conditional statement such as:

onMoveShouldSetPanResponder: (_, gesture) => {
        if (gesture.vx !== 0 && gesture.dx !== 0){
          return true
        }
         else if (gesture.vy !== 0 && gesture.dy !== 0) {
          return false
        }
      },

works when I save on the screen with the FlatList, but then if I get out of that screen and then go back into it the FlatList will scroll, but the items will no longer move to the left. (I've tried adjusting onMoveShouldSetPanResponder a number of ways, but none of them have worked.) Does anyone know how to get this to work? Is there maybe a way to tell the FlatList to scroll onPanResponderRelease or something? I would really appreciate any help or advice!

0

There are 0 best solutions below