Swipe card when button clicks in react native

2.6k views Asked by At

I am currently building a mobile application like tinder using react native, I use Deck Swiper from native base package and I don't find a solution on how to swipe card when then button clicks.

This link is the Deck Swiper Component from native base that I've been using: http://nativebase.io/docs/v0.5.13/components#deckSwiper

Any suggestions or idea on how to swipe cards with button click?

1

There are 1 answers

0
Eldelshell On BEST ANSWER

First, you need to save the reference of the DeckSwiper component:

<DeckSwiper ref={(deck) => this.deck = deck}>

Later, you can use this.deck.swipeRight() or this.deck.swipeLeft.