AnimationNavigationPage icon indicating copy to clipboard operation
AnimationNavigationPage copied to clipboard

Push problem rotation

Open rudacs opened this issue 6 years ago • 1 comments

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

rudacs avatar Aug 18 '19 23:08 rudacs

@rudacs is it only on iOS . i couldnt reproduce it on Android

pmahend1 avatar Dec 10 '19 20:12 pmahend1