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 to scroll two carousel same time #338

Open Devid2727 opened 6 years ago

Devid2727 commented 6 years ago

I have used two different carousel in one screen, i want scroll two items it same time, i mean if i scroll carousel-1 then carousel-2 should be scroll with carousel-1 and vice versa. i have added two carousel in one screen , but i am not able to take event when scroll start of any carousel just programatically start scrolling of another carousel. let me is it possible to scroll both items at same time. shall i use scrollBy or scrollTo Method to scroll the carousel programatically or is there any other solution to fix this issue.

Below i have attached image of my sample UI. please let me know if anybody have done this type of carousel uses. sample_ui_image

I am using below versions

"react": "16.3.1", "react-native": "0.55.3" "react-native-snap-carousel": "^3.7.0",

Thanks

bd-arc commented 6 years ago

@Devid2727 Implementing a "two-way control" has been discussed in #202.

To be honest, I haven't tried it yet. But since the carousel is basically a ScrollView, you should be able to implement it the way that's mentioned in this SO thread.

LeviWilliams commented 6 years ago

Any progress on this?

Kinark commented 4 years ago

@bd-arc Unfortunately the _onScroll method doesn't work well with item snapping :(

Did someone manage a way to achieve this sync effect?

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