The way virtualised collection was handled before conflicted with CarouselView on XF.Android...
Before:
We applied immediately the item template provided by the user to the items before setting the ItemsSource property
ItemTemplate was set to a static DataTemplateSelector that only creates the real cell based on the current widget item
After:
We directly set the items provided by the user to the ItemsSource property with no modification
ItemTemplate is set to a dynamic data template selector that first apply the item template function provided by the user before generating the real cell
The issue before is that CarouselViewRenderer on Android is actually trying to find the index of an item in the ItemsSource. This is fine except Widgets generated by Fabulous are not equatable so the index will be -1 is some cases, which is an invalid value.
The way virtualised collection was handled before conflicted with CarouselView on XF.Android...
Before:
ItemsSource
propertyItemTemplate
was set to a staticDataTemplateSelector
that only creates the real cell based on the current widget itemAfter:
ItemsSource
property with no modificationItemTemplate
is set to a dynamic data template selector that first apply the item template function provided by the user before generating the real cellThe issue before is that
CarouselViewRenderer
on Android is actually trying to find the index of an item in theItemsSource
. This is fine exceptWidget
s generated by Fabulous are not equatable so the index will be-1
is some cases, which is an invalid value.https://github.com/xamarin/Xamarin.Forms/blob/12708e140f1f8cd6e61e36804cc0e7f5b1a88daf/Xamarin.Forms.Platform.Android/CollectionView/CarouselViewRenderer.cs#L354