react-native-reanimated-carousel icon indicating copy to clipboard operation
react-native-reanimated-carousel copied to clipboard

Load infinite uncertain items

Open imyuanx opened this issue 2 years ago • 11 comments

Is your feature request related to a problem? Please describe. I have many items to show, I put all items in data, But i don't think it's good, I think we can speed up by locking the length of the render items and async loading items, it can even to be loading infinite uncertain items.

Describe the solution you'd like I want to add hooks when add new items to the front or back of render list, At this point, we can loading async content before show this item.

imyuanx avatar Jul 11 '22 11:07 imyuanx

image

imyuanx avatar Jul 11 '22 11:07 imyuanx

That's an interesting idea. Do you mean dynamically load data items and append them to a data array?

dohooo avatar Jul 11 '22 12:07 dohooo

And have you ever tried appending a new item to a data array dynamically?

dohooo avatar Jul 11 '22 12:07 dohooo

That's an interesting idea. Do you mean dynamically load data items and append them to a data array?

I need to try. When i used other carousel library before, I noticed reset data array causes view re-render and page index confusion. Also in react-native-reanimated-carousel I need listen page index change, When near last page, Add new items to data array, but onScrollEnd will not be triggered untill the end of the animation, i must stop when continuous sliding to last page.

imyuanx avatar Jul 11 '22 12:07 imyuanx

emm, I tried to modify data length from 3 to 6, and current index is 2 ( the last item ), then I swipe the carousel, prop onScrollEnd works well. I think it works fine for data length changed. If you wanna a new carousel component, maybe you can set prop key to this

key={data.length}

This will get a new component and a fresh state. Thx for your detailed description. I will reopen this issue if you have any another question.

dohooo avatar Aug 12 '22 03:08 dohooo

@dohooo Hi! I use your library the way how @yunying1 described (actually the lib can work as this guy said with no forking). It works well but not perfect (especially on android). I need throttle using nex/prev slide commands via ref and set scrollAnimationDuration about 1000. If you add this feature into app, the library will be the best swiper in the react-native world. As I can think there is no library which supports this way to use but this idea is not uniq at all.

gigby avatar Dec 23 '22 15:12 gigby

In fact, I use this library to implement functions like TikTok (slide to the next page to dynamically load content), but in fact, this library is not designed for that kind of requirement, and there is no better solution at present.

imyuanx avatar Dec 23 '22 16:12 imyuanx

I am so sorry that I think I can solve all the problems you mentioned, but I have more important things to do at present, so I can only temporarily stop maintaining this project, but I will definitely come back and complete every feature you expect.

dohooo avatar Dec 23 '22 16:12 dohooo

same here. looking for a way to append more data to the end as the user scrolls through the carousel.. I do this my updating the array that is setting the data property but after some 100 items it becomes very lagged and performance seems to slow down. there is also a "flash" like behavior when the next page is added and it looks like the carousel resets itself..

appsgenie avatar Sep 03 '23 21:09 appsgenie

Influenced by this library, I created a simplified replacement: https://github.com/imyuanx/unlimited-carousel It might help you.

imyuanx avatar Sep 04 '23 02:09 imyuanx

Anyone found a good solution to this?

Nitrammets avatar Mar 21 '24 14:03 Nitrammets