AndreiMisiukevich / CardView

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

Carousel content overlaps bounds - second card only, iOS #424

Closed garnelsoftware closed 1 year ago

garnelsoftware commented 1 year ago

Hi Andrei, thank you so much for your fantastic plugin - I'd be lost without it and I've benefited hugely from it since launching my first app in 2020.

I have an app regression occurring whereby the layout for my carousel view is overlapping its bounds but only when:

I setup the template layout when the constructor is called and also when the carousel view size is changed (upon rotate). No noticeable layout events fire when we show the second card and forcing the layout to redraw upon each card appearing does not work.

Android is rock solid across platforms.

Please help!

Tom

AndreiMisiukevich commented 1 year ago

Hi Tom, thanks for your warm words!

Can you try calling it carousel.ForceRedrawViews(). Also, can you build a small sample?

garnelsoftware commented 1 year ago

Hi Andrei,

Great to hear from you, I shall try to get an example prepared.

Many thanks,

Tom

On Mon, 17 Jul 2023, 16:18 Andrei, @.***> wrote:

Hi Tom, thanks for your warm words!

Can you try calling it carousel.ForceRedrawViews(). Also, can you build a small sample?

— Reply to this email directly, view it on GitHub https://github.com/AndreiMisiukevich/CardView/issues/424#issuecomment-1638361531, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCCEDBWJNI4MMPMSGEWJWLXQVJVRANCNFSM6AAAAAA2MVFCEY . You are receiving this because you authored the thread.Message ID: @.***>

garnelsoftware commented 1 year ago

Andrei,

For a minute there I thought that had fixed it but I have at least narrowed it down to a more specific scenario. It's only happening when I use the "next" button which does only one thing: update the carousel selected index. If I swipe the control instead then the layout is correct!

Sorry I've still not had time to prepare an example.

Tom

On Mon, 17 Jul 2023 at 16:31, Munchkin Studios < @.***> wrote:

Hi Andrei,

Great to hear from you, I shall try to get an example prepared.

Many thanks,

Tom

On Mon, 17 Jul 2023, 16:18 Andrei, @.***> wrote:

Hi Tom, thanks for your warm words!

Can you try calling it carousel.ForceRedrawViews(). Also, can you build a small sample?

— Reply to this email directly, view it on GitHub https://github.com/AndreiMisiukevich/CardView/issues/424#issuecomment-1638361531, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCCEDBWJNI4MMPMSGEWJWLXQVJVRANCNFSM6AAAAAA2MVFCEY . You are receiving this because you authored the thread.Message ID: @.***>

garnelsoftware commented 1 year ago

I forgot to add that it's actually not restricted to landscape either.

I hadn't realised that on a phone where I tended to use portrait I would swipe but on tablet, I'd use landscape and tended to use the buttons!

On Tue, 18 Jul 2023, 09:18 Munchkin Studios, @.***> wrote:

Andrei,

For a minute there I thought that had fixed it but I have at least narrowed it down to a more specific scenario. It's only happening when I use the "next" button which does only one thing: update the carousel selected index. If I swipe the control instead then the layout is correct!

Sorry I've still not had time to prepare an example.

Tom

On Mon, 17 Jul 2023 at 16:31, Munchkin Studios < @.***> wrote:

Hi Andrei,

Great to hear from you, I shall try to get an example prepared.

Many thanks,

Tom

On Mon, 17 Jul 2023, 16:18 Andrei, @.***> wrote:

Hi Tom, thanks for your warm words!

Can you try calling it carousel.ForceRedrawViews(). Also, can you build a small sample?

— Reply to this email directly, view it on GitHub https://github.com/AndreiMisiukevich/CardView/issues/424#issuecomment-1638361531, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCCEDBWJNI4MMPMSGEWJWLXQVJVRANCNFSM6AAAAAA2MVFCEY . You are receiving this because you authored the thread.Message ID: @.***>

AndreiMisiukevich commented 1 year ago

@garnelsoftware hmm, interesting. You can try to implement your own arrows and use SelectedItem instead of SelectedIndex.

garnelsoftware commented 1 year ago

Thanks Andrei,

After looking at the implementation of SelectedItem I feel that it will do the same as SelectedIndex.

I have just tried calling carousel.OnSwiped(PanDirection) in place of the index modification and the same display glitch occurs...

ForceRedrawViews caused the app to crash and so I abandoned that idea.

On Tue, 18 Jul 2023, 21:41 Andrei, @.***> wrote:

@garnelsoftware https://github.com/garnelsoftware hmm, interesting. You can try to implement your own arrows and use SelectedItem instead of SelectedIndex.

— Reply to this email directly, view it on GitHub https://github.com/AndreiMisiukevich/CardView/issues/424#issuecomment-1640963782, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCCEDHM72FZSKRPMQXVC7LXQ3YGRANCNFSM6AAAAAA2MVFCEY . You are receiving this because you were mentioned.Message ID: @.***>

AndreiMisiukevich commented 1 year ago

@garnelsoftware try to call ForceRedrawViews in Main thread

garnelsoftware commented 1 year ago

I gave it a go but it made no difference. I best get that sample ready for you!

Thanks for your help thus far!

On Wed, 19 Jul 2023, 15:59 Andrei, @.***> wrote:

@garnelsoftware https://github.com/garnelsoftware try to call ForceRedrawViews in Main thread

— Reply to this email directly, view it on GitHub https://github.com/AndreiMisiukevich/CardView/issues/424#issuecomment-1642253757, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCCEDAT552OZUQDF6RJP5LXQ7Y5NANCNFSM6AAAAAA2MVFCEY . You are receiving this because you were mentioned.Message ID: @.***>

garnelsoftware commented 1 year ago

Andrei,

I decided to take a step back and grab all of my view model bound height and widths in the constructor and store them in fields. Then when the layout method was invoked later in the constructor or upon rotate I could guarantee the only thing that would change would be the width/height of the page.

This seems to have fixed my issue! I think what was happening is that the view model values were not always set when I expected them to and so sometimes the sizes would differ and throw the layout out of kilter.

Sorry about all of that.

Once again thank you for your excellent plugin AND thank you so much for providing me with support.

Many thanks,

Tom

On Wed, 19 Jul 2023 at 21:22, Munchkin Studios < @.***> wrote:

I gave it a go but it made no difference. I best get that sample ready for you!

Thanks for your help thus far!

On Wed, 19 Jul 2023, 15:59 Andrei, @.***> wrote:

@garnelsoftware https://github.com/garnelsoftware try to call ForceRedrawViews in Main thread

— Reply to this email directly, view it on GitHub https://github.com/AndreiMisiukevich/CardView/issues/424#issuecomment-1642253757, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCCEDAT552OZUQDF6RJP5LXQ7Y5NANCNFSM6AAAAAA2MVFCEY . You are receiving this because you were mentioned.Message ID: @.***>

AndreiMisiukevich commented 1 year ago

Thanks Tom!