Skip to content

Commit a2f1a89

Browse files
kubaflojsuarezruiz
andauthored
[iOS] Shell page title fix (#20575)
* [iOS] Shell page title fix (#20199) * Added a UiTest (#20199) * Added pending snapshot * Shell page title fix --------- Co-authored-by: Javier Suárez <[email protected]>
1 parent 05e72cf commit a2f1a89

File tree

5 files changed

+74
-2
lines changed

5 files changed

+74
-2
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:ns="clr-namespace:Maui.Controls.Sample.Issues"
5+
x:Class="Maui.Controls.Sample.Issues.Issue20199">
6+
<TabBar>
7+
<ShellContent
8+
Title="Home page"
9+
ContentTemplate="{DataTemplate ns:Issue20199Page}"
10+
Route="MainPage">
11+
</ShellContent>
12+
</TabBar>
13+
</Shell>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using Microsoft.Maui.Controls;
2+
using Microsoft.Maui.Controls.Xaml;
3+
4+
namespace Maui.Controls.Sample.Issues
5+
{
6+
[XamlCompilation(XamlCompilationOptions.Compile)]
7+
[Issue(IssueTracker.Github, 20199, "[iOS] Page titles do not appear until navigating when pushing a modal page at startup", PlatformAffected.iOS)]
8+
public partial class Issue20199 : Shell
9+
{
10+
public Issue20199()
11+
{
12+
InitializeComponent();
13+
}
14+
15+
protected override async void OnAppearing()
16+
{
17+
base.OnAppearing();
18+
19+
var closeModalPageButton = new Button() { Text = "Hide", AutomationId = "button" };
20+
closeModalPageButton.Clicked += (s, e) => Navigation.PopAsync();
21+
22+
var modalPage = new ContentPage() { Content = closeModalPageButton };
23+
24+
await Navigation.PushModalAsync(modalPage);
25+
}
26+
}
27+
28+
public class Issue20199Page : ContentPage { }
29+
}

src/Controls/src/Core/Shell/ShellSection.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,8 +648,11 @@ internal void UpdateDisplayedPage()
648648
if (previousPage != DisplayedPage)
649649
{
650650
previousPage?.SendDisappearing();
651-
PresentedPageAppearing();
652-
SendAppearanceChanged();
651+
if (!Navigation.ModalStack.Any())
652+
{
653+
PresentedPageAppearing();
654+
SendAppearanceChanged();
655+
}
653656
}
654657
}
655658

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using NUnit.Framework;
2+
using UITest.Appium;
3+
using UITest.Core;
4+
5+
namespace Microsoft.Maui.AppiumTests.Issues
6+
{
7+
public class Issue20199 : _IssuesUITest
8+
{
9+
public override string Issue => "[iOS] Page titles do not appear until navigating when pushing a modal page at startup";
10+
11+
public Issue20199(TestDevice device) : base(device)
12+
{
13+
}
14+
15+
[Test]
16+
public void TitleViewShouldBeVisible()
17+
{
18+
this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Android, TestDevice.Mac, TestDevice.Windows });
19+
20+
_ = App.WaitForElement("button");
21+
App.Click("button");
22+
23+
// The test passes if the 'Home Page' title is visible
24+
VerifyScreenshot();
25+
}
26+
}
27+
}
10.8 KB
Loading

0 commit comments

Comments
 (0)