Open Kekaradag opened 5 years ago
The swipeBack method receives as argument a callback function, which in turn is passed the decremented card index when called.
In the code you posted, you're passing this.swiper.previousCardIndex as a parameter to the swipeBack function which is definitely not a callback. [this.swiper.swipeBack(this.swiper.previousCardIndex)
]
Should be something like:
this.swiper.swipeBack(( newCardIndex ) => {
console.log(`this is the newly decremented card index ${newCardIndex}`);
})
First, thank you for this great API.
I am new to react native and Javascript. And I have a problem about cardIndex delay when i called swipeBack method. For example, when i called swipeBack, my onSwiped props works and cardIndex increments by 1 instead of decrementing. After that, when i called swipeBack again it work properly. So, when i used swipeBack, first cardIndex increments then decrements. Thus, the order and cardIndex number becomes problematic.
Here is my code:
And in an other page, I take the cardNumber and render some info about that card.