meliorence/react-native-snap-carousel

Adjust index if data item is removed

Open

#157 opened on Sep 21, 2017

View on GitHub
 (17 comments) (6 reactions) (0 assignees)JavaScript (10,045 stars) (2,223 forks)batch import
*help wanted

Description

I want to use this component to let a user navigate through a (potentially endless) stream of items and as such I am adding new items to the data array as the user nears the end of the list and this works just perfectly. Obviously though I can't just keep adding items without removing older ones forever as this will exhaust memory at some point.

Removing items from the start of the data array seems to work pretty well except for the fact that it seems to act very strange with the index system. The problem is that the index doesn't change and after navigation there is a huge jump to the position of the old index+1. It would be nice if the component could automatically deal with this or provide me with a way to decrement the index without visually navigating.

Contributor guide