'jumpToCardIndex' doesn't work when called from the function that is called on onSwipedRight/onSwipedLeft events
See original GitHub issueI want the swiper to render previous card on rightSwipe. I have a method(renderPreviousCard) that is called when ‘onSwipedRight’ event is fired. In renderPreviousCard function ‘jumpToCardIndex’ is used with swiper’s reference. ‘jumpToCardIndex’ is not working.
<Swiper
infinite={true}
cardIndex={0}
showSecondCard={false}
cardVerticalMargin={0}
cardHorizontalMargin={0}
verticalSwipe={false}
cards={this.state.demoArray}
renderCard={(card) => this.renderCardMethod(card)}
onSwiped={(cardIndex) => {console.log(cardIndex)}}
onSwipedAll={() => {console.log('onSwipedAll')}}
backgroundColor={'white'}
onSwipedRight={(cardIndex) => this.renderPreviousCard(cardIndex)}
ref={(ref) => {this.swiperReference = ref}}>
</Swiper>
renderPreviousCard = (cardIndex) =>{
this.swiperReference.jumpToCardIndex(cardIndex-1);
}
NOTE: The ‘jumpToCardIndex’ is working in other scenarios. Whenever the ‘jumpToCardIndex’ method is within the scope of functions called from the swiper props/events.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Can You Require That Employees Attend Social Functions?
Employers should weigh the pros and cons of hosting a mandatory social event from an employee-relations perspective, not just a legal one.
Read more >What are part-time and on-call work? - ILO
Part-time work is one of the traditional forms of non-standard employment. However, over the past decades, not only has it grown in importance,...
Read more >Reporting time pay
Each workday an employee is required to report to work, but is not put to work ... you were called back to work...
Read more >When Your Boss Doesn't Respect Your Family Commitments
When he first started at the company, he and his boss — we'll call her Sheila — had a good working relationship. Willie...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
fixed in 1.3.0 https://github.com/alexbrillant/react-native-deck-swiper#swipe-back-to-previous-card-props
Has this been fixed and published/merged?