Rg.Plugins.Popup icon indicating copy to clipboard operation
Rg.Plugins.Popup copied to clipboard

[UWP] Slide-in MoveAnimation does not work on UWP

Open apines-gms-online-de opened this issue 4 years ago • 9 comments

🐛 Bug Report

We use the following code for popup animation

<pages:PopupPage.Animation>
    <animations:MoveAnimation PositionIn="Bottom"
                               PositionOut="Bottom"
                               DurationIn="300"
                               DurationOut="300"
                               EasingIn="SinOut"
                               EasingOut="SinIn"/>
</pages:PopupPage.Animation>

The slide-in and slide-out animations work on Android, but on UWP, the slide-in animation does not work, the popup just appears. The slide-out animation works. Even if we use e.g. DurationIn="2000", it is the same (the background needs more time to become dark, but there is no animation).

Version: 2.0.0.7 popup

apines-gms-online-de avatar Feb 18 '21 12:02 apines-gms-online-de

hey @apines-gms-online-de I'm sorry for being late on this.

Could you try and flip the easing in/easing out and see what happens? and just in general mess with the configuration of this move animation? This is quite an unusual bug, so just wondering if there is a deeper layer going on

LuckyDucko avatar Mar 04 '21 06:03 LuckyDucko

I confirm, same problem. I tried to flip easing in/out, without success. Related to #410?

YZahringer avatar Mar 13 '21 16:03 YZahringer

@YZahringer good find, and thank you for the follow up.

since this one is simple to recreate, I'll try to do so when I am on my windows computer

LuckyDucko avatar Mar 14 '21 22:03 LuckyDucko

Seems like https://github.com/rotorgames/Rg.Plugins.Popup/blob/6a706ee4f10ff17097e83e29bd0b81878313cd15/Rg.Plugins.Popup/Animations/Base/BaseAnimation.cs#L40

doesn't return the correct values on UWP, when Appearing gets called. Both content.Width and page.Width will return -1.

pledi avatar May 10 '21 11:05 pledi

@pledi thanks for this, im trying to get around to the UWP issues, interesting that this would get it wrong, i wonder if it might help another issue im having

LuckyDucko avatar May 10 '21 22:05 LuckyDucko

not works on my macOS and UWP projects too

mhrastegari avatar May 11 '21 14:05 mhrastegari

I wrote a simple workaround, first I used the original MoveAnimation as my new custom animation and override the GetLeftOffset method:

protected override int GetLeftOffset(View content, Page page)
{
    return (int)(content.WidthRequest + page.WidthRequest) / 2;
}

The only thing left is setting the WidthRequest Property of the PopupPage Page and Content in XAML.

pledi avatar May 11 '21 17:05 pledi

I've got a small workaround for this issue add these in your UWP project's App.xaml

            <Style TargetType="rg:PopupPageRenderer">
                <Setter Property="ChildrenTransitions">
                    <Setter.Value>
                        <TransitionCollection>
                            <EdgeUIThemeTransition Edge="Bottom" />
                        </TransitionCollection>
                    </Setter.Value>
                </Setter>
            </Style>
            

mhrastegari avatar Feb 02 '22 08:02 mhrastegari

I've got a small workaround for this issue add these in your UWP project's App.xaml

            <Style TargetType="rg:PopupPageRenderer">
                <Setter Property="ChildrenTransitions">
                    <Setter.Value>
                        <TransitionCollection>
                            <EdgeUIThemeTransition Edge="Bottom" />
                        </TransitionCollection>
                    </Setter.Value>
                </Setter>
            </Style>
            

Thanks!

apines-gms-online-de avatar Feb 02 '22 08:02 apines-gms-online-de