Skip to content

Commit

Permalink
#99: Fixing bug with infinite loop and showArrows=false
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrowd committed Apr 19, 2017
1 parent 1ccf3ad commit eef9597
Show file tree
Hide file tree
Showing 3 changed files with 7,400 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/Carousel.js
Expand Up @@ -414,9 +414,9 @@ module.exports = React.createClass({
var canShowArrows = this.props.showArrows && itemsLength > 1;

// show left arrow?
var hasPrev = canShowArrows && this.state.selectedItem > 0 || this.props.infiniteLoop;
var hasPrev = canShowArrows && (this.state.selectedItem > 0 || this.props.infiniteLoop);
// show right arrow
var hasNext = canShowArrows && this.state.selectedItem < itemsLength - 1 || this.props.infiniteLoop;
var hasNext = canShowArrows && (this.state.selectedItem < itemsLength - 1 || this.props.infiniteLoop);
// obj to hold the transformations and styles
var itemListStyles = {};

Expand Down
10 changes: 10 additions & 0 deletions stories/index.js
Expand Up @@ -47,6 +47,16 @@ storiesOf('Carousel', module)
{ baseChildren.props.children }
</Carousel>
))
.add('no arrows + infinite loop + auto play', () => (
<Carousel showArrows={false} infiniteLoop autoPlay>
{ baseChildren.props.children }
</Carousel>
))
.add('no arrows + infinite loop + emulateTouch', () => (
<Carousel showArrows={false} infiniteLoop emulateTouch>
{ baseChildren.props.children }
</Carousel>
))
.add('no status', () => (
<Carousel showStatus={false}>
{ baseChildren.props.children }
Expand Down

0 comments on commit eef9597

Please sign in to comment.