Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

Commit

Permalink
handle slide count exception
Browse files Browse the repository at this point in the history
  • Loading branch information
RyotaSugawara committed Aug 31, 2017
1 parent 7ed8b04 commit 3f12a93
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class Carousel extends React.Component<Props, State> {
static get defaultProps() {
return {
label: '',
useDots: true,
useDots: false,
dotStyle: {},
duration: 500, // ms
autoSlideInterval: 0, // ms
Expand Down Expand Up @@ -136,7 +136,7 @@ export class Carousel extends React.Component<Props, State> {
}

renderDots() {
if (!this.props.useDots) {
if (!this.props.useDots || this.state.slideCount <= 1) {
return null;
}
return (
Expand Down Expand Up @@ -230,7 +230,7 @@ export class Carousel extends React.Component<Props, State> {
position: 'relative',
overflow: 'hidden',
width: 'auto',
height: this.state.slideHeight,
height: (this.state.slideCount > 1) ? this.state.slideHeight : 'auto',
transform: 'translate3d(0, 0, 0)',
WebkitTransform: 'translate3d(0, 0, 0)',
msTransform: 'translate(0, 0)'
Expand All @@ -256,7 +256,7 @@ export class Carousel extends React.Component<Props, State> {
}
}
return {
position: this.state.canUseDOM ? 'absolute' : 'relative',
position: (this.state.canUseDOM && this.state.slideCount > 1) ? 'absolute' : 'relative',
display: canDisplay ? 'block' : 'none',
width: '100%',
top: 0,
Expand Down

0 comments on commit 3f12a93

Please sign in to comment.