Skip to content
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

[iOS] Shell page title fix #20575

Merged
merged 4 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:ns="clr-namespace:Maui.Controls.Sample.Issues"
x:Class="Maui.Controls.Sample.Issues.Issue20199">
<TabBar>
<ShellContent
Title="Home page"
ContentTemplate="{DataTemplate ns:Issue20199Page}"
Route="MainPage">
</ShellContent>
</TabBar>
</Shell>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Xaml;

namespace Maui.Controls.Sample.Issues
{
[XamlCompilation(XamlCompilationOptions.Compile)]
[Issue(IssueTracker.Github, 20199, "[iOS] Page titles do not appear until navigating when pushing a modal page at startup", PlatformAffected.iOS)]
public partial class Issue20199 : Shell
{
public Issue20199()
{
InitializeComponent();
}

protected override async void OnAppearing()
{
base.OnAppearing();

var closeModalPageButton = new Button() { Text = "Hide", AutomationId = "button" };
closeModalPageButton.Clicked += (s, e) => Navigation.PopAsync();

var modalPage = new ContentPage() { Content = closeModalPageButton };

await Navigation.PushModalAsync(modalPage);
}
}

public class Issue20199Page : ContentPage { }
}
7 changes: 5 additions & 2 deletions src/Controls/src/Core/Shell/ShellSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,11 @@ internal void UpdateDisplayedPage()
if (previousPage != DisplayedPage)
{
previousPage?.SendDisappearing();
PresentedPageAppearing();
SendAppearanceChanged();
if (!Navigation.ModalStack.Any())
{
PresentedPageAppearing();
SendAppearanceChanged();
}
}
}

Expand Down
27 changes: 27 additions & 0 deletions src/Controls/tests/UITests/Tests/Issues/Issue20199.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.AppiumTests.Issues
{
public class Issue20199 : _IssuesUITest
{
public override string Issue => "[iOS] Page titles do not appear until navigating when pushing a modal page at startup";

public Issue20199(TestDevice device) : base(device)
{
}

[Test]
public void TitleViewShouldBeVisible()
{
this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Android, TestDevice.Mac, TestDevice.Windows });

_ = App.WaitForElement("button");
App.Click("button");

// The test passes if the 'Home Page' title is visible
VerifyScreenshot();
}
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.