Skip to content

Commit

Permalink
onIndexChanged this.setState({}) Loop does not work. fixed by removin…
Browse files Browse the repository at this point in the history
…g commit 1fb7ff2 leecade#569
  • Loading branch information
jinglinwishlife committed May 2, 2018
1 parent a1e052e commit bf7858a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ export default class extends Component {

const initState = {
autoplayEnd: false,
loopJump: false,
offset: {}
// loopJump: false,
// offset: {}
}

initState.total = props.children ? props.children.length || 1 : 0
Expand Down Expand Up @@ -251,9 +251,9 @@ export default class extends Component {
initState.height = height;
}

initState.offset[initState.dir] = initState.dir === 'y'
? height * props.index
: width * props.index
// initState.offset[initState.dir] = initState.dir === 'y'
// ? height * props.index
// : width * props.index


this.internals = {
Expand Down Expand Up @@ -543,10 +543,11 @@ export default class extends Component {
marginTop: 3,
marginBottom: 3
}, this.props.dotStyle ]} />
const specialDot = this.props.specialDot
for (let i = 0; i < this.state.total; i++) {
dots.push(i === this.state.index
? React.cloneElement(ActiveDot, {key: i})
: React.cloneElement(Dot, {key: i})
: ((this.props.specialDotKeys && this.props.specialDotKeys.indexOf(i) > -1 ) ? React.cloneElement(specialDot, {key: i}) : React.cloneElement(Dot, {key: i}))
)
}

Expand Down

0 comments on commit bf7858a

Please sign in to comment.