AndreiMisiukevich / CardView

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

CarouselView in CollectionView header refuses to draw on load (Android) #396

Closed mlyrstad closed 3 years ago

mlyrstad commented 3 years ago

We're in a bind and we're nearing deadline.

We've changed out the built-in CarouselView with yours, to deal with the countless bugs with that component. It has solved some major problems of ours, so thank you.

However.

When we try to replace the CarouselView we're using in a CollectionView header, it simply refuses to draw itself after load on Android, until we poke it by dragging on it.

I have tried setting the selected index and changing it after load, hoping it would redraw itself, but no. I've tried making a behavior which calls both ForceLayout and ForceRedrawViews... to no avail.

I will have to use something else for now, to my great chagrin, as I doubt you'll be able to answer before I have to push this even if you against all odds would know of another thing I could try... but I'm still asking, with the hopes that I at least can change to your control again later. I do not have the time to create a reproduction for you right now but I will try to find the time later.

Thank you and I'm very sorry for the rushed report.

AndreiMisiukevich commented 3 years ago

Hi @mlyrstad thanks for your report and sorry for the late response (I was on vacation).

Hmm, interesting behavior. Just wondering, did you try to replace CarouselView with ListView or set a HeightRequest to CarouselVie?

AndreiMisiukevich commented 3 years ago

Cannot reproduce it image

<CollectionView ItemsSource="{Binding Items}">
        <CollectionView.ItemTemplate>
            <DataTemplate>
                <ContentView BackgroundColor="Aqua" HeightRequest="1000" />
            </DataTemplate>
        </CollectionView.ItemTemplate>
        <CollectionView.Header>
            <cards:CarouselView
                ItemsSource="{Binding Items}"
                SlideShowDuration="3500"
                SelectedIndex="{Binding CurrentIndex}">

                <x:Arguments>
                    <proc:CarouselProcessor ScaleFactor="0.5" OpacityFactor="0" RotationFactor="0.1" />
                </x:Arguments>

                <cards:CarouselView.ItemTemplate>
                    <DataTemplate>
                        <ContentView>
                            <Frame 
                                VerticalOptions="Center"
                                HorizontalOptions="Center"
                                HeightRequest="300"
                                WidthRequest="300"
                                Padding="0" 
                                HasShadow="false"
                                IsClippedToBounds="true"
                                CornerRadius="10"
                                BackgroundColor="{Binding Color}">

                                <ffimage:CachedImage Source="{Binding Source}"/> 

                            </Frame>
                        </ContentView>
                    </DataTemplate>
                </cards:CarouselView.ItemTemplate>

                <controls:IndicatorsControl ToFadeDuration="1500"/>
                <controls:LeftArrowControl ToFadeDuration="2500"/>
                <controls:RightArrowControl ToFadeDuration="2500"/>
            </cards:CarouselView>
        </CollectionView.Header>
    </CollectionView>
AndreiMisiukevich commented 3 years ago

Please make sure that it's not a bug on your side (or Xamairn.Forms bug) Would be great to receive a reproduction (since I can't replicate it) Until that, I keep this issue closed, but feel free to reopen it when the sample is provided :)

mlyrstad commented 3 years ago

Hello Mr. Misiukevich; I hope you had an enjoyable vacation!

Well, I never completely discount the possibility of bugs in our code, but in this case it seems very unlikely as it works just fine on iOS, and a replacement with the built-in CarouselView fixed that problem.

I was simply hoping this was a known problem you had some workaround for, really.

I'm not surprised you can't reproduce. Most likely I won't be able to either, if I ever manage to get time to try... and I can't send you our whole app, so we're gonna have to live with the built-in for now.

AndreiMisiukevich commented 3 years ago

@mlyrstad yeah :( that's difficult/impossible to fix w/out reproduction. Unfortunately, I wasn't able to reproduce.

Please, feel free to reopen this issue if you have some time to build a repro :)