meliorence / react-native-snap-carousel

Swiper/carousel component for React Native featuring previews, multiple layouts, parallax images, performant handling of huge numbers of items, and more. Compatible with Android & iOS.
BSD 3-Clause "New" or "Revised" License
10.25k stars 2.26k forks source link

How disable onPress on image - when swiping carousel ? #488

Open Murena7 opened 5 years ago

Murena7 commented 5 years ago

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

tuvudu commented 4 years ago

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

xcarpentier commented 3 years ago

Hi @Murena7

Do you find any workaround?

cc @tuvudu @bd-arc

bd-arc commented 3 years ago

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.

dohooo commented 2 years ago

Sorry, please allow me to advertise for my open source library! ~ I think this library react-native-reanimated-carousel will solve your problem. It is a high performance and very simple component, complete with React-Native reanimated 2