AlexandrNikulin / AnimationNavigationPage

AnimationNavigationPage is a NavigationPage with custom transitions animation effects.
Apache License 2.0
236 stars 37 forks source link

Push problem rotation #59

Open rudacs opened 5 years ago

rudacs commented 5 years ago

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

pmahend1 commented 4 years ago

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