2

i am making a system like the tinder cards, you can swipe left and right, but now i want to add a way to click on it. Wheen i add a touchableOpacity i can't moove it anymore because when i place my finger on it, it change the opacity of the view and its blocked.

Basically i tried to use touchableHighlight but nothing change

So i have :

<Animated.View>
  <TouchableOpacity>
    //Stuff here
  </TouchableOpacity>
</Animated.View>

I want the card to still be able to moove the and only trigger the click when i really want to click

quentin mayer
  • 137
  • 1
  • 1
  • 12

1 Answers1

0

There is an existing component react-native-swipe-gestures for handling swipe gestures in up, down, left and right direction, see https://github.com/glepur/react-native-swipe-gestures

so directly not but you can use the below code for reference:

 <GestureRecognizer
        onSwipe={(direction, state) => this.onSwipe(direction, state)}
        onSwipeUp={(state) => this.onSwipeUp(state)}
        onSwipeDown={(state) => this.onSwipeDown(state)}
        onSwipeLeft={(state) => this.onSwipeLeft(state)}
        onSwipeRight={(state) => this.onSwipeRight(state)}
        config={config}
        style={{
          flex: 1,
          backgroundColor: this.state.backgroundColor
        }}
        >
         // enter code here
      </GestureRecognizer>
vishu2124
  • 4,243
  • 2
  • 14
  • 10
  • 1
    Thats no what i was asking for, the gesturees work on my card the problem is when i add the TouchableOpacity when i put my finger on the card it press the Touchable so i can't moove it – quentin mayer May 19 '19 at 18:59