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

Commit f6490bf

Browse files
authored
Null check Element in VisualElementRenderer.LayoutSubviews (#11668)
* Null check Element in VisualElementRenderer.LayoutSubviews * - add shell if def fixes #11664
1 parent 9c5ce9f commit f6490bf

File tree

2 files changed

+37
-8
lines changed

2 files changed

+37
-8
lines changed

Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue10608.cs

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,45 @@ public Issue10608()
2121
{
2222
}
2323

24+
void AddPage(string title)
25+
{
26+
var page = AddFlyoutItem(title);
27+
28+
page.Content = new Grid()
29+
{
30+
Children =
31+
{
32+
new ScrollView()
33+
{
34+
Content =
35+
new StackLayout()
36+
{
37+
Children =
38+
{
39+
new Button()
40+
{
41+
Text = "Learn More",
42+
Margin = new Thickness(0,10,0,0),
43+
BackgroundColor = Color.Purple,
44+
TextColor = Color.White
45+
}
46+
}
47+
}
48+
}
49+
}
50+
};
51+
}
52+
2453
protected override void Init()
2554
{
2655
FlyoutBehavior = FlyoutBehavior.Locked;
2756

28-
AddFlyoutItem("Click");
29-
AddFlyoutItem("Between");
30-
AddFlyoutItem("These Flyouts");
31-
AddFlyoutItem("Really Fast");
32-
AddFlyoutItem("If it doesn't");
33-
AddFlyoutItem("Lock test has passed");
57+
AddPage("Click");
58+
AddPage("Between");
59+
AddPage("These Flyouts");
60+
AddPage("Really Fast");
61+
AddPage("If it doesn't");
62+
AddPage("Lock test has passed");
3463

3564
int i = 0;
3665
foreach(var item in Items)
@@ -71,7 +100,7 @@ protected override void Init()
71100
Items[1].FlyoutDisplayOptions = FlyoutDisplayOptions.AsMultipleItems;
72101
}
73102

74-
#if UITEST
103+
#if UITEST && __SHELL__
75104
[Test]
76105
[Category(UITestCategories.Shell)]
77106
public void ShellWithTopTabsFreezesWhenNavigatingFlyoutItems()

Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ public override void LayoutSubviews()
328328
Superview.Add(_blur);
329329
}
330330

331-
bool hasBackground = Element.Background != null && !Element.Background.IsEmpty;
331+
bool hasBackground = Element?.Background != null && !Element.Background.IsEmpty;
332332

333333
if (hasBackground)
334334
NativeView.UpdateBackgroundLayer();

0 commit comments

Comments
 (0)