Cardview: CarouselView - Poor performance and even crashing on older devices such as iPad 2

Created on 14 Oct 2020  路  9Comments  路  Source: AndreiMisiukevich/CardView

Hi Andrei,

First of all thank you for your great library and amazing work!

I am using your library in my highly dynamic app where the views are all created using C# based on the JSON API response

I have something like this in my ContentPage:

<panCardView:CarouselView
                IsPanInteractionEnabled="False"
                IsPanSwipeEnabled="False"
                IsVerticalSwipeEnabled="False"
                ItemsSource="{Binding RecordCreateContentViews}"
                MoveThresholdDistance="1"
                SwipeThresholdDistance="20"
                SwipeThresholdTime="20"
                UserInteractionDelay="100">
                <controls:IndicatorsControl
                    IsTapToNavigateEnabled="True"
                    Margin="0,0,0,6"
                    Spacing="10"
                    VerticalOptions="Start" />
            </panCardView:CarouselView>

RecordCreateContentViews is also an ObservableCollection of type ContentView.

So basically, what I am doing is creating ContentViews inside the OnAppearing override and then add them to the ObservableCollection.

It works fine and I can use it just fine:

image
image

The trouble is when I want to navigate to different tabs (either using swipe gesture or by tapping on the dots), it takes around 2-3 seconds on a physical devices - even on iPad Pro (latest generation) and iPhone 11 Pro Max.

on iPad 2 the situation is really worse! It will take around 10 seconds to go to the next tab and it will then give up and crash the app (I cannot see any crash log either!)

My question is:

Is there a way to preload the layouts and somehow cache them? Can anything be done about memory usage as well as smooth navigating across tabs?

Thanks!

question resolved

Most helpful comment

This is what I get from the native Xamarin.Forms's CV:

image

LOL!

All 9 comments

Do other carousels provide better performance?

There is a caching mechanism in CardsView. But obviously, it works with ItemTemplate views only. How can we cache views which are dynamic? :)

Do other carousels provide better performance?

Well, to be honest with you, I don't think there is any other alternative.

I am running the same test with the built-in Xamarin.Forms's CV as I am writing this comment but the chances are I don't think any other implementation comes even close to yours in terms of feature-set and completeness.

This is what I get from the native Xamarin.Forms's CV:

image

LOL!

What observable collection do you use? Regular or range?
Maybe you should try to add all views at the same time instead of adding them one by one

BTW, I see you disabled pan interaction. Why?

IsPanInteractionEnabled="False"
IsPanSwipeEnabled="False"

<panCardView:CarouselView
                OppositePanDirectionDisablingThreshold="1"
                ItemsSource="{Binding RecordCreateContentViews}">
                <controls:IndicatorsControl
                    IsTapToNavigateEnabled="True"
                    Margin="0,0,0,6"
                    Spacing="10"
                    VerticalOptions="Start" />
</panCardView:CarouselView>

Can you try this markup?

It's much better now and more responsive after using your new markup and adding CVs to a list and then at the end of the for loop AddRanging them to the OC.

I will have to test it on iPad 2 as well but sadly, I can only do that once the new version is released into TestFlight as it seems to be a limitation with macOS Catalina and 32-bit support.

I think this issue ticket can be closed)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JTOne123 picture JTOne123  路  5Comments

InquisitorJax picture InquisitorJax  路  6Comments

SkeletonJohn picture SkeletonJohn  路  3Comments

morhung picture morhung  路  7Comments

LeoJHarris picture LeoJHarris  路  3Comments