Skip to content

Commit

Permalink
dismiss the modal when IsAnimated is set to false (#23879)
Browse files Browse the repository at this point in the history
* dismiss the modal when IsAnimated is set to false

* add test to validate the change
  • Loading branch information
pictos committed Jul 29, 2024
1 parent 4f439b3 commit f52f95d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ Task<Page> PopModalPlatformAsync(bool animated)
}
else
{
dialogFragment.Dismiss();
source.TrySetResult(modal);
}

Expand Down
23 changes: 23 additions & 0 deletions src/Controls/tests/DeviceTests/Elements/Modal/ModalTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,29 @@ await CreateHandlerAndAddToWindow<IWindowHandler>(rootPage,
Assert.Empty(rootPage.GetCurrentPage().Navigation.ModalStack);
}

[Fact]
public async Task DismissModalIfNotAnimated()
{
SetupBuilder();
var page = new ContentPage();

var modalPage = new ContentPage()
{
Content = new Label() { Text = "Page with no animation" }
};

var window = new Window(page);

await CreateHandlerAndAddToWindow(window, async () =>
{
await page.Navigation.PushModalAsync(modalPage, false);
await OnLoadedAsync(modalPage);
await modalPage.Navigation.PopModalAsync(false);
await OnUnloadedAsync(modalPage);
});
}

class PageTypes : IEnumerable<object[]>
{
public IEnumerator<object[]> GetEnumerator()
Expand Down

0 comments on commit f52f95d

Please sign in to comment.