meliorence/react-native-snap-carousel

Adjust index if data item is removed

Open

#157 opened on 2017年9月21日

GitHub で見る
 (17 comments) (6 reactions) (0 assignees)JavaScript (2,223 forks)batch import
*help wanted

Repository metrics

Stars
 (10,045 stars)
PR merge metrics
 (30d に merged PR はありません)

説明

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.

コントリビューターガイド