Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Null check Element in VisualElementRenderer.LayoutSubviews (#11668)
Browse files Browse the repository at this point in the history
* Null check Element in VisualElementRenderer.LayoutSubviews

* - add shell if def

fixes #11664
  • Loading branch information
PureWeen committed Aug 6, 2020
1 parent 9c5ce9f commit f6490bf
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,45 @@ public Issue10608()
{
}

void AddPage(string title)
{
var page = AddFlyoutItem(title);

page.Content = new Grid()
{
Children =
{
new ScrollView()
{
Content =
new StackLayout()
{
Children =
{
new Button()
{
Text = "Learn More",
Margin = new Thickness(0,10,0,0),
BackgroundColor = Color.Purple,
TextColor = Color.White
}
}
}
}
}
};
}

protected override void Init()
{
FlyoutBehavior = FlyoutBehavior.Locked;

AddFlyoutItem("Click");
AddFlyoutItem("Between");
AddFlyoutItem("These Flyouts");
AddFlyoutItem("Really Fast");
AddFlyoutItem("If it doesn't");
AddFlyoutItem("Lock test has passed");
AddPage("Click");
AddPage("Between");
AddPage("These Flyouts");
AddPage("Really Fast");
AddPage("If it doesn't");
AddPage("Lock test has passed");

int i = 0;
foreach(var item in Items)
Expand Down Expand Up @@ -71,7 +100,7 @@ protected override void Init()
Items[1].FlyoutDisplayOptions = FlyoutDisplayOptions.AsMultipleItems;
}

#if UITEST
#if UITEST && __SHELL__
[Test]
[Category(UITestCategories.Shell)]
public void ShellWithTopTabsFreezesWhenNavigatingFlyoutItems()
Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public override void LayoutSubviews()
Superview.Add(_blur);
}

bool hasBackground = Element.Background != null && !Element.Background.IsEmpty;
bool hasBackground = Element?.Background != null && !Element.Background.IsEmpty;

if (hasBackground)
NativeView.UpdateBackgroundLayer();
Expand Down

0 comments on commit f6490bf

Please sign in to comment.