question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'jumpToCardIndex' doesn't work when called from the function that is called on onSwipedRight/onSwipedLeft events

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

0reactions
isAlmogKcommented, Aug 13, 2017

Has this been fixed and published/merged?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found