Skip to content

Commit

Permalink
Ignore SafeArea on templates and shell flyout item templates (#20403)
Browse files Browse the repository at this point in the history
* Ignore SafeArea on templates and shell flyout item templates

* - add delay for compat test
  • Loading branch information
PureWeen committed Feb 7, 2024
1 parent 67829ee commit f6d4b94
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,23 @@ protected override void Init()
var headerLabel = (VisualElement)FlyoutHeader;
var footerLabel = (VisualElement)FlyoutFooter;
headerLabel.BackgroundColor = Colors.LightBlue;
footerLabel.BackgroundColor = Colors.LightBlue;
if (footerLabel is not null)
footerLabel.BackgroundColor = Colors.LightBlue;
if (headerLabel.HeightRequest == 60)
{
headerLabel.HeightRequest = 200;
footerLabel.HeightRequest = 200;
if (footerLabel is not null)
footerLabel.HeightRequest = 200;
}
else
{
headerLabel.HeightRequest = 60;
footerLabel.HeightRequest = 60;
if (footerLabel is not null)
footerLabel.HeightRequest = 60;
}
}),
AutomationId = "ResizeHeaderFooter"
Expand All @@ -167,8 +173,10 @@ protected override void Init()
Margin = 0,
Children =
{
new Label() { Text = "Header View" }
}
new Label() { Text = "Header View" }
},
BackgroundColor = Colors.Purple,
IgnoreSafeArea = true
};
FlyoutHeaderTemplate = null;
Expand All @@ -184,10 +192,13 @@ protected override void Init()

#if __IOS__
[Test]
public void FlyoutHeaderWithZeroMarginShouldHaveNoY()
public async Task FlyoutHeaderWithZeroMarginShouldHaveNoY()
{
RunningApp.WaitForElement("PageLoaded");
this.TapInFlyout("ZeroMarginHeader", makeSureFlyoutStaysOpen: true);
// Adding this to just really make sure layout is finished
// Once we move this to appium we can remove this
await Task.Delay(1000);
var layout = RunningApp.WaitForElement("ZeroMarginLayout")[0].Rect.Y;
Assert.AreEqual(0, layout);
}
Expand Down
5 changes: 4 additions & 1 deletion src/Controls/src/Core/Shell/BaseShellItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,10 @@ internal static DataTemplate CreateDefaultFlyoutItemCell(string textBinding, str
{
return new DataTemplate(() =>
{
var grid = new Grid();
var grid = new Grid()
{
IgnoreSafeArea = true
};
if (DeviceInfo.Platform == DevicePlatform.WinUI)
grid.ColumnSpacing = grid.RowSpacing = 0;
Expand Down

0 comments on commit f6d4b94

Please sign in to comment.