meliorence/react-native-snap-carousel

Adjust index if data item is removed

Open

#157 建立於 2017年9月21日

在 GitHub 查看
 (17 留言) (6 反應) (0 負責人)JavaScript (10,045 star) (2,223 fork)batch import
*help wanted

描述

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.

貢獻者指南