Ryan Angelo
Ryan Angelo

Reputation: 93

Swipe card when button clicks in react native

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?

Upvotes: 0

Views: 2756

Answers (1)

Eldelshell
Eldelshell

Reputation: 6940

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.

Upvotes: 2

Related Questions