Skip to content

Push problem rotation #59

@rudacs

Description

@rudacs

I'm having a problem with Push animation only.
When pushing and rotating and returning, the screen does not return to the correct position.
The same is true when rotating, pushing and returning, the screen does not return to the correct position.

In other animations this problem does not occur.

Below is the code and a gif showing the problem.

using FormsControls.Base;
using Xamarin.Forms;

namespace test
{
    public class App : Application
    {
        public App()
        {
            MainPage = new AnimationNavigationPage(new Page1());
        }
    }

    public class Page1 : ContentPage
    {
        public Page1()
        {
            Title = "Page 1...";

            Content = new Label()
            {
                Text = "PushPageAnimation",
                FontSize = 20,
                Margin = 15,
                TextColor = Color.White,
                BackgroundColor = Color.Blue,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment = TextAlignment.Center
            };

            Content.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(x => Navigation.PushAsync(new Page2()))
            });
        }
    }

    public class Page2 : ContentPage, IAnimationPage
    {
        public Page2()
        {
            Title = "Page 2...";

            Content = new Label()
            {
                Text = "Page 2",
                FontSize = 20,
                Margin = 15,
                TextColor = Color.White,
                BackgroundColor = Color.Green,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment = TextAlignment.Center
            };

            Content.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(x => Navigation.PopAsync())
            });
        }

        public virtual IPageAnimation PageAnimation => new PushPageAnimation { Duration = AnimationDuration.Short, Subtype = AnimationSubtype.FromTop };

        public void OnAnimationFinished(bool isPopAnimation)
        {
        }

        public void OnAnimationStarted(bool isPopAnimation)
        {
        }
    }
}

ezgif-2-4e2d0d6f7a35

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions