dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.28k stars 1.76k forks source link

Flickering when calling Navigation.PopAsync(false). #13810

Open cat0363 opened 1 year ago

cat0363 commented 1 year ago

Discussed in https://github.com/dotnet/maui/discussions/13809

Originally posted by **cat0363** March 10, 2023 The layout of the page is as follows. Page1 layout:
cat0363 commented 1 year ago

I have uploaded the code for this issue to github. https://github.com/cat0363/Maui-Issue13810

cat0363 commented 1 year ago

This problem does not occur if you use Shell as follows.

[App.xaml.cs]

public App()
{
    InitializeComponent();

    MainPage = new AppShell();
}

[Page1.xaml.cs]

private async void Button_Clicked(object sender, EventArgs e)
{
    await Shell.Current.Navigation.PushAsync(new Page2(), false);
}

[Page2.xaml.cs]

private async void Button_Clicked(object sender, EventArgs e)
{
    await Shell.Current.Navigation.PopAsync(false);
}

https://user-images.githubusercontent.com/125236133/228122165-4763991a-43ce-4284-999a-eef2bd3ff99d.mp4

Since there is no problem with Shell, it is a problem only with NavigationPage. From the above, there is no problem with Shell's Navigation. Since changing from NavigationPage to Shell involves a significant change, I hope that this problem will be resolved.

SagarPanwala commented 1 year ago

At first glance, issue seems minor, but it's major if you have your page background color to something else than white. In your sample, for page2 I set BackgroundColor to Pink, so on pop from page2, app shows pink color for a 1-2 seconds.

homeyf commented 1 year ago

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 1.0. Can repro on android platform with sample project. https://github.com/cat0363/Maui-Issue13810 image

evgenyKozlov1996 commented 1 year ago

Verified this issue with Visual Studio 17.7.5. Repro on Android platform.

matmork commented 8 months ago

I am also experiencing this on Android, iOS is fine. Not using shell. Disabling animation while navigating seems to work in my case, but its not as nice.

Got the idea from https://github.com/xamarin/Xamarin.Forms/issues/8581#issuecomment-557104526

maratoss commented 6 months ago

Is there any workaround?