You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Removing the last item in a non-looping carousel remains empty. Any swipe gesture is required to snap the carousel back to the previous item. Other items in the carousel correctly display the next available item when removed.
To Reproduce
Below is a minimum reproducible example. Scrolling to the third item and pressing "Delete Me" shows the behavior.
Pretty hacky at the moment but hope it can help someone...this is a snippet from the function to delete the image at the current index.
constcurrentIndex=carouselRef.current?.getCurrentIndex();if(currentIndex===undefined)return;// Figure out the new index after deletionconstnewIndex=Math.min(currentIndex,images.length-2);// Delete the currently displayed imageconstnewImages=images.filter((_,index)=>index!==currentIndex);// Update the images - this is tied to the carousel data.setImages(newImages);// Calling scrollTo seems to redraw the image and make it visible.carouselRef.current?.scrollTo({index: newIndex});
Describe the bug
Removing the last item in a non-looping carousel remains empty. Any swipe gesture is required to snap the carousel back to the previous item. Other items in the carousel correctly display the next available item when removed.
To Reproduce
Below is a minimum reproducible example. Scrolling to the third item and pressing "Delete Me" shows the behavior.
Expected behavior
When the last item in the carousel is removed, it should show the new last item.
Screenshots
https://github.com/dohooo/react-native-reanimated-carousel/assets/4079858/66910188-1d83-4ed2-bad3-3a6236e0e275
Versions (please complete the following information):
Smartphone (please complete the following information):
The text was updated successfully, but these errors were encountered: