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.

When using Virtualize HOC for infinite loop, swiping works fine, but when changing the index with the previous and next button the the slides do not animate

See original GitHub issue

I’ve implemented the infinite swipe like this:


import SwipeableViews from 'react-swipeable-views'
import virtualize from 'react-swipeable-views-utils/lib/virtualize'
import mod from 'react-swipeable-views-core/lib/mod'
...

const EnhancedSwipeableViews = virtualize(SwipeableViews)
const slideRenderer = ({key, index}) =>  (
 <HouseCard
    key={index}
    title={props.houseTypes[(mod(index, props.houseTypes.length))].title}
    slug={props.houseTypes[(mod(index, props.houseTypes.length))].slug}
 /> )
    
...
<EnhancedSwipeableViews
  index={this.state.swipeIndex}
 onChangeIndex={this.handleChangeIndex}
 slideRenderer={slideRenderer}
/>

<ArrowNext
   key='next'
   onClick={() => this.setState({swipeIndex: this.state.swipeIndex + 1})}
>
<ArrowPrev
   key='prev'
   onClick={() => this.setState({swipeIndex: this.state.swipeIndex - 1})}
>

I’ve implemented the SwipeableView with virtualize as seen in the code above. The infinite loop works pretty good while swiping. However when i click the ArrowNext or the ArrowPrev button to go the the next or previous slide, the slides changes postiton, but the transition from the slide change is gone. The correct slide appears with no transition at all. Does someone know what the solution is to the problem?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ckohtzcommented, Apr 27, 2022

@Jianru-Lin Thank you!!!

1reaction
retrojorgencommented, Oct 9, 2017

I am having the same issue in my project. Actually the animation stops at the third slide (3/8 slides) Any solution to this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

slick slider - css transition infinite loop bug - Stack Overflow
I've tried a few different slider plugins and they all seem to have similar issues.
Read more >
Lightkey User Guide
alongside your DMX lights through the same user interface. Setting up a lighting installation with Lightkey is quick and easy. It comes with...
Read more >
react-swipeable-views - Bountysource
So the children of SwipableViews changes dynamically. When this happens, this component successfully navigates to the new slide, but there is no animation....
Read more >
React scroll to element after render - Caritas Castellaneta
In this case, we can use the React. 2. Modify the render() method useMenu. Now the next step is to figure out how...
Read more >
How Is the Internet Changing the Way You Think? - Edge.org
I do not think that the Internet has changed the ability of my brain to do this. While we may use the word...
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