rotorgames / Rg.Plugins.Popup

Xamarin Forms popup plugin
MIT License
1.15k stars 336 forks source link

Updated MoveAnimation to fix iOS flickering #711 #752

Open jlbeard84 opened 1 year ago

jlbeard84 commented 1 year ago

Added rapid opacity change to MoveAnimation to fix flicking issue on iOS #711

:sparkles: What kind of change does this PR introduce? (Bug fix, feature, docs update...)

Bug fix

:arrow_heading_down: What is the current behavior?

iOS has a timing issue where the popup will occasionally flicker before a MoveAnimation starts X/Y translation.

:new: What is the new behavior (if this is a feature change)?

An opacity change timed at 1ms to cover the timing issue.

:boom: Does this PR introduce a breaking change?

Not that I am aware of.

:bug: Recommendations for testing

Various configurations of the MoveAnimation popup.

:memo: Links to relevant issues/docs

Issue #711

:thinking: Checklist before submitting

beeradmoore commented 1 year ago

Unfortunately this fix still doesn't work for me. Even if I move page.Opacity = 0; to the very first line in Appearing and moving taskList.Add(page.FadeTo(100, 1)); to the line after taskList.Add(content.TranslateTo(.

I tried changing the duration from 1 to DurationIn and I noticed it didn't fade in, so I thought maybe ShowPage(page); was overriding everything else so I nuked and HidePage and replaced them with page.Opacity = 0; and then for ShowPage I put in the taskList.Add(page.FadeTo(100, 1)); and it still flickered.

At this point I wasn't sure if my code was working so I did a sanity check and removed the page.FadeTo and confirmed the page never appeared (meaning the code was being executed).

To make things more annoying to debug screen recording also did not show the misplaced frame but I can still see it.

What I found that did end up working was reverting everything back to your code, but then changing the fade actions to content instead of page and that appeared to work 🤔. Should this be the intended use case rather than applying the fade to the page?

Another odd thing I found is that if I changed taskList.Add(content.FadeTo(100, 1)); to taskList.Add(content.FadeTo(100, 5000)); the popup won't fade in over the full 5 seconds. I noticed a bug in your code that this FadeTo should be to 1 not 100. taskList.Add(content.FadeTo(1, 5000)); will indeed fade in over 5 seconds.

I am curious now if these new change (and Show/HidePage) should be wrapped in an iOS check if they are not required on the other platforms.