GiampaoloGabba / Xamarin.Plugin.SharedTransitions

Shared Element Transitions between pages in Xamarin.Forms (IOS/Android)
MIT License
414 stars 57 forks source link

[BUG] [iOS] Entry placeholder color changes during animation when it shouldn't #40

Closed vniehues closed 3 years ago

vniehues commented 3 years ago

As you can see in the .gif provided below, there is a weird bug happening when transitioning from one entry to another. It looks to my like the color in question is being set for the animation and is ignoring the (placeholder) color property of the entry.

Bug Information

Version Number of Plugin: 2.2.0 Device Tested On: iPhone 11 Pro Simulator Tested On: iOS (Multiple) Version of Xamarin: 4.8.0.1269 Versions of other things you are using:

Steps to reproduce the Behavior

Expected Behavior

Seamles transition from one page to another without changing any colors since origin & destination have the same colors.

Actual Behavior

The entry placeholder turns to a different shade of gray before "popping back in"

Code snippet

<Entry Text="{Binding Password}" BackgroundColor="Transparent" sharedTransitions:Transition.Name="EntryPassword" PlaceholderColor="#A2A2A2" Placeholder="Test"> </Entry>

Screenshots

RPReplay_Final1596748897

afaik the PancakeView is doing what it should do since gradients need to be rendered seperately on iOS

vniehues commented 3 years ago

I investigated further and found out that a custom border (via custom renderer) also gets overridden.

Anything I can do to fix this? ezgif com-crop (1)

GiampaoloGabba commented 3 years ago

This is because the plugin is trying to recreate the view to apply smooth transition between views that change borders, colors, ecc...

In your casethis behaviour is overkill and produce unwanted effects to the views. I'm planning in the next version to add a "light" transition for ios that just take a raster snaspshot of the view and animate it (so we dont mess with borders, and other properties). This should fix your UI.

I'm planning the update by the end of this month, maybe sooner as my healthkit/googlefit plugin require more works i'm going to switch to the SharedTransitions and ship an update

vniehues commented 3 years ago

Thank you for your swift and in-depth response! I see why you chose this behavior. Will the "light transition" be opt-in per View or default? I'm looking forward to the next update.

GiampaoloGabba commented 3 years ago

it will be opt-in with a simple boolean (or maybe an enum) so we dont break other apps already using this plugin :)

GiampaoloGabba commented 3 years ago

This is fixed in master, i have added this property: sharedTransitions:Transition.LightSnapshot="True"

Wich will take a raster snapshot of the view to transition. This will preserve all the views attributes and has higher performance compared to the standard snapshot we are making.

But remember to use it when size and proportions doesnt change (or change a little), otherwise the animation will be very bad :)

New nuget is coming very soon

vniehues commented 3 years ago

Thank you for your work!