Index not updating
subpublic opened this issue · comments
Hello.
I've bound onMomentumScrollEnd and there I'm console logging the ref to my Swiper.
The state.index is always set to 0.
Is that a bug or is there another way to find out which node is viewed?
Seems like if I don't bind onMomentumScrollEnd, the index updates.
So when binding onTouchStartCapture everything works better.
Still not sure if that was a bug, but this works for me.
Thanks @subpublicanders
First update index, then call onMomentumScrollEnd
, is this helpfully? or I am very pleased to follow up your problem.
/**
* Scroll end handle
* @param {object} e native event
*/
onScrollEnd(e) {
// update scroll state
this.setState({
isScrolling: false
})
let offset = e.nativeEvent.contentOffset
this.updateIndex(offset, this.state.dir)
// if `onMomentumScrollEnd` registered will be called here
this.props.onMomentumScrollEnd && this.props.onMomentumScrollEnd.call(this)
},
Well, I solved it by not using onMoementumScrollEnd
at all.
If i bind onMoementumScrollEnd
in my Swiper-jsx, then the onScrollEnd
is never even called.
I set a console.log in your code to try it. Could it have something to do with the default render (line 389)? That it gets overridden.
oh yes, onMoementumScrollEnd be overridden, thanks, i will fix it later.
@leecade when im loading content from some rest service, onMomentumScrollEnd and onIndexxhanged related is not working till the response returns back to the application from API. can you have any idea on this ???