React-native-snap-carousel: How disable onPress on image - when swiping carousel ?

Created on 3 Mar 2019  ·  3Comments  ·  Source: meliorence/react-native-snap-carousel

Hi all , how i can disable onPress when user swiping carousel ? Just now when user swiping - he can onPress on image, but i want disable possibility onPress on carousel image when user swiping between images, but if user fast onPress without swiping - i want trigger onPress event. How can i do this ? Thanks

All 3 comments

you should try add Touchable component swap item in renderItems props of carousel

Hi @Murena7

Do you find any workaround?

cc @tuvudu @bd-arc

With v3 you can use prop lockScrollWhileSnapping.

With v4 you probably need to change scrollEnabled prop's value based on onScroll and onSnapToItem. In that case, I recommend doing it with setNativeProps() rather than with a state update to avoid unresponsiveness. Here's an example.

Was this page helpful?
0 / 5 - 0 ratings