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

Remove current index #554

Open minuitagency opened 5 years ago

minuitagency commented 5 years ago

Hi,

We have a carousel in our app, we need to give the user the ability to remove the current slide once he read it.

Problem being, when we slice the item from the array, the carousel jumps two slides ahead and not to the next slide...

Thanks,

Théo

flyandi commented 4 years ago

I had the same/similar issue and solved by assigning an explicit key to the component rendered in the renderItem iterator.

Basically the problem is that React does not see the item changed and just re-renders the data and not the actual component - that's why it looks like you jumping ahead because technically the item was never removed.

Hope that helps.

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