Hi,
I think there is some bug in View handling or caching. I have this situation:CarouselView with Items bound to ObservableCollection. In ItemTemplate there is simple Grid with Image and Label. I use Label.GestureRecognizer to remove current Item. When I remove item from ObservableCollection CurrentIndex is reset to 0, it can be easily workarounded by "holding" current index and then setting it back. But when CarouselView is on first item(i.e. CurrentIndex=0) and this first item is removed view stays the same. Image(whole Item, to be precise) is not changed until I swipe to next and then back. I tried IsViewCacheEnabled="False" without any effect. I understand Carousel only refresh when CurrentIndex is changed but in this particular situation I need to trigger reload(removing and setting back Binding context makes things only worse, beacause image than stays on top of carousel, and other images slide under). Issue is not limited to Image, I tried replacing image with Label and issue persist
I cannot provide repro solution at the moment , but simply removing first element from ObservableCollection bound to Items after page is loaded via button or something similar should produce described result.
Thanks for feedback
I will dive into the issue
But if you add sample, I will appreciate
I managed to put together quick repo which should help reproducing (and hopefully solve) this issue. Issue is in my case present in linked repository. Testing was done on Samsung Galaxy S9 running Android 8.
Link to the repository https://github.com/Pomezny/CarouselViewIssue26Repro
Decription:
If you need any further assistance or my description is not precise or understandable enough just comment this issue, I will try to respond as soon as possible.
I will investigate it ) tomorrow, maybe
@Pomezny
Martin, one more question from me..
Does this bug occur on android only ? Or on iOS too? Or you haven't tested yet?
@AndreiMisiukevich I will test reproduction repository in few hours on iOS and report back to you.
@Pomezny I've already tested it
Yes, this bug occurs on iOS too)
https://github.com/AndreiMisiukevich/CardView/blob/master/PanCardView/CardsView.cs#L1084-L1110
This method is the reason of our "pain" ))
I need extra time for refactoring it, because it looks like invalid
I extended the sample (first button is buttons list) - http://prntscr.com/jhnzw1
Could you pls validate my fix?
Sample looks awesome, thanks. Although I will create PR since there are minor bugs in sample(typos I guess). I will try to hotwire this fixed version to my app to further verify expected behaviour. Will reply soon.
@Pomezny nice) I'm waiting your PR
By the way, if you enjoy this plugin, please, set "STAR" on the project here)
@Pomezny Don't forget to give me feedback) I will create new version
@AndreiMisiukevich Hi, I tested your fixes and they indeed seem to work on my app where I discovered them. The flickering after clicking item still persist, but its not crucial at the moment. Can you please publish corrected NuGet?
I will try to dig deeper to the flickering issue soon if I find some time for it and eventally open a new issue.
Thanks for your awesome work!
@Pomezny okay, i will publish it today's evening
1.4.2 have been published
It will be available soon