-
Notifications
You must be signed in to change notification settings - Fork 2k
[Android] Fix Flickering issue when calling Navigation.PopAsync #24887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
16c0e0d
22d7398
4e1c926
4632a2d
226352e
2826ecc
44e8bfc
06e9530
4b9074c
92a1c94
53764a1
7666e57
19d79a6
fce9a9a
0870f89
106a119
6d91239
5035f51
d85371d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,25 +46,6 @@ void SetupBuilder() | |
| }); | ||
| } | ||
|
|
||
| [Theory] | ||
| [ClassData(typeof(FlyoutPageLayoutBehaviorTestCases))] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test has two different cases that need to be captured in the UITest
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the test case |
||
| public async Task PoppingFlyoutPageDoesntCrash(Type flyoutPageType) | ||
| { | ||
| SetupBuilder(); | ||
| var navPage = new NavigationPage(new ContentPage()) { Title = "App Page" }; | ||
|
|
||
| await CreateHandlerAndAddToWindow<WindowHandlerStub>(new Window(navPage), async (handler) => | ||
| { | ||
| var flyoutPage = CreateFlyoutPage( | ||
| flyoutPageType, | ||
| new NavigationPage(new ContentPage() { Content = new Border(), Title = "Detail" }), | ||
| new ContentPage() { Title = "Flyout" }); | ||
|
|
||
| await navPage.PushAsync(flyoutPage); | ||
| await navPage.PopAsync(); | ||
| }); | ||
| } | ||
|
|
||
| [Theory] | ||
| [ClassData(typeof(FlyoutPageLayoutBehaviorTestCases))] | ||
| public async Task SwappingDetailPageWorksForSplitFlyoutBehavior(Type flyoutPageType) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| namespace Maui.Controls.Sample.Issues | ||
| { | ||
| [XamlCompilation(XamlCompilationOptions.Compile)] | ||
| [Issue(IssueTracker.Github, 10274, "MAUI Flyout does not work on Android when not using Shell", PlatformAffected.Android)] | ||
| public class Issue10274 : NavigationPage | ||
| { | ||
| public Issue10274() : base(new MainPage()) | ||
| { | ||
|
|
||
| } | ||
|
|
||
| public class MainPage : ContentPage | ||
| { | ||
| public MainPage() | ||
| { | ||
| var button = new Button | ||
| { | ||
| Text = "Navigate to Flyout Page", | ||
| AutomationId = "mainPageButton" | ||
| }; | ||
|
|
||
| button.Clicked += OnNavigateToFlyoutPageClicked; | ||
|
|
||
| var label = new Label | ||
| { | ||
| Text = "This is MainPage", | ||
| AutomationId = "mainPageLabel" | ||
| }; | ||
|
|
||
| Content = new StackLayout | ||
| { | ||
| Padding = new Thickness(20), | ||
| Children = { label, button } | ||
| }; | ||
| } | ||
| private async void OnNavigateToFlyoutPageClicked(object sender, EventArgs e) | ||
| { | ||
| await Navigation.PushAsync(new CustomFlyoutPage()); | ||
| } | ||
| } | ||
|
|
||
| public class CustomFlyoutPage : FlyoutPage | ||
| { | ||
| public CustomFlyoutPage() | ||
| { | ||
| Flyout = new ContentPage | ||
| { | ||
| Title = "Flyout", | ||
| Content = new StackLayout | ||
| { | ||
| Padding = new Thickness(20), | ||
| Children = | ||
| { | ||
| new Label { Text = "This is the Flyout page." } | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| var button = new Button | ||
| { | ||
| Text = "Go Back", | ||
| AutomationId = "flyoutPageButton" | ||
| }; | ||
| button.Clicked += OnGoBackClicked; | ||
|
|
||
| var label = new Label | ||
| { | ||
| Text = "This is FlyoutPage", | ||
| AutomationId = "flyoutPageLabel" | ||
| }; | ||
|
|
||
| var detailPage = new ContentPage | ||
| { | ||
| Title = "Detail", | ||
| Content = new StackLayout | ||
| { | ||
| Padding = new Thickness(20), | ||
| Children = { label, button } | ||
| } | ||
| }; | ||
|
|
||
| Detail = new NavigationPage(detailPage); | ||
| } | ||
|
|
||
| private async void OnGoBackClicked(object sender, EventArgs e) | ||
| { | ||
| await Navigation.PopAsync(); | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues | ||
| { | ||
| public class Issue10274 : _IssuesUITest | ||
| { | ||
| public Issue10274(TestDevice device): base(device) | ||
| { | ||
| } | ||
|
|
||
| public override string Issue => "MAUI Flyout does not work on Android when not using Shell"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.FlyoutPage)] | ||
| public void FlyoutPageNavigation() | ||
| { | ||
| App.WaitForElement("mainPageButton"); | ||
| App.Tap("mainPageButton"); // Navigate to FlyoutPage using PushAsync() | ||
|
|
||
| var flyoutLabel = App.WaitForElement("flyoutPageLabel"); | ||
| Assert.That(flyoutLabel.GetText(), Is.EqualTo("This is FlyoutPage")); | ||
|
|
||
| App.Tap("flyoutPageButton"); // Navigate to MainPage using PopAsync() | ||
|
|
||
| var mainLabel = App.WaitForElement("mainPageLabel"); | ||
| Assert.That(mainLabel.GetText(), Is.EqualTo("This is MainPage")); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this change is causing the winui device tests to crash.
you can download the crash dump from the artifacts and analyze it inside VS to see the exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! @devanathan-vaithiyanathan can you please fix it? It is an annoying bug that would be great to have fixed as soon as possible. I can help you if you want :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PureWeen I have updated the code to include null checks for MauiContext to address the WinUI device test crashes. Could you please review the changes and let me know if you have any further concerns?