AndreiMisiukevich / CardView

CardsView | CarouselView | CoverflowView | CubeView for Xamarin.Forms
MIT License
711 stars 114 forks source link

Setting BackCardsDepth causes items to flash in and out #387

Closed BlueRaja closed 3 years ago

BlueRaja commented 3 years ago

Repro steps:

  1. Have a list with a bunch of items (eg. 6). Use IsCyclical="False"
  2. Set BackCardsDepth to a large number (eg. 10)
  3. Create two buttons which increment/decrement SelectedIndex
  4. Scroll to the end of the list, then scroll back to the start

Expected Results: Nothing unusual

Actual results: When you scroll back to the first item, the last item briefly (~250ms) flashes on the screen

AndreiMisiukevich commented 3 years ago

Hi, @BlueRaja thanks for your report. Can I ask what's the purpose of setting BackCardsDepth to SO BIG value?

AndreiMisiukevich commented 3 years ago

This property makes a sense for CoverFlowView only (for showing more than 1 element at the same time)

AndreiMisiukevich commented 3 years ago

Anyway, that's not a bug. That's the limitation of Forms. XF can't render so many views at the same time, that's why some glitches appear.

If you want to forbid reusing views among different items while scrolling the carousel, then just set IsViewReusingEnabled to False

And optionally set DesiredMaxChildrenCount to 12 for example

yonkahlon commented 3 years ago

Hi @AndreiMisiukevich,

I'm experiencing something similar - I'm using CarouselView, and when I set BackViewsDepth to 3 a different view flashes when you change view.

Animation

In each view I'm basically just loading an image (using FFImageCache). Each image is hosted on our server and I use BackViewsDepth so that the next few images can start downloading.

AndreiMisiukevich commented 3 years ago

@yonkahlon can I ask you what the reason you set this property to 3?

I guess I need to hide this property...

Well, just don't do it. You load too many views at the same time it causes bad performance. If you need it for some reason, then replace CarouselView by CoverFlowView (btw it has 2 as the default value for this property).

But I don't see any reason to do it in your design.

yonkahlon commented 3 years ago

The same thing happens if I set it to 2. After you swipe past a few pages, everything works normal. It's almost like a few views load on top of each other.

It's just really nice if users don't have to wait for images to download. I.e. while you are reading page 1, page 2 is downloading.

I'll try CoverFlowView and let you know

yonkahlon commented 3 years ago

CoverFlowView works perfectly :-)

Thanks for pointing me in the right direction!