0

I'm using a Horizontal ScrollVIew with paging in react native, I'm trying to recreate the coverflow view like Spotify. visually is perfect however I want to call a function when paging left or right, like playNext or playPrev. is there a way to listen to the paging event and direction?

<ScrollView pagingEnabled={true} horizontal={true}>

    <CoverFlowItem page_width={D.width} width={width} height={height}
                           source={{uri: current.poster}}/>
 .....


 </ScrollView>

1 Answer 1

1

https://facebook.github.io/react-native/docs/scrollview#pagingenabled

With this props, you'll get the pagination you want. To get which way its going, you component will need to save the offset each time you scroll. use the props: onScroll, onScrollBeginDrag and/or onScrollEndDrag to access the current offset of the scroll. With it, and the one previously saved, you can determine which way the scroll is going

Sign up to request clarification or add additional context in comments.

1 Comment

Correct prop to use is onMomentumScrollEnd

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.