Skip to content

Commit

Permalink
Allow pages without content (#1015)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuarezruiz authored May 12, 2021
1 parent 5969945 commit d4df78a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/Core/src/Handlers/Page/PageHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ public override void SetVirtualView(IView view)
NativeView.CrossPlatformMeasure = VirtualView.Measure;
NativeView.CrossPlatformArrange = VirtualView.Arrange;
NativeView.RemoveAllViews();
//var wrap = ViewGroup.LayoutParams.WrapContent;
NativeView.AddView(VirtualView.Content.ToNative(MauiContext)); // , new ViewGroup.LayoutParams(wrap, wrap));

if (VirtualView.Content != null)
NativeView.AddView(VirtualView.Content.ToNative(MauiContext));
}

public static void MapTitle(PageHandler handler, IPage page)
Expand Down
4 changes: 3 additions & 1 deletion src/Core/src/Handlers/Page/PageHandler.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public override void SetVirtualView(IView view)
NativeView.CrossPlatformArrange = VirtualView.Arrange;

NativeView.Children.Clear();
NativeView.Children.Add(VirtualView.Content.ToNative(MauiContext));

if (VirtualView.Content != null)
NativeView.Children.Add(VirtualView.Content.ToNative(MauiContext));
}

protected override PagePanel CreateNativeView()
Expand Down
4 changes: 0 additions & 4 deletions src/Core/src/Handlers/Page/PageHandler.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.Maui.Handlers
{
public partial class PageHandler : IViewHandler
Expand Down
4 changes: 3 additions & 1 deletion src/Core/src/Handlers/Page/PageHandler.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public override void SetVirtualView(IView view)
oldChildren.ForEach(x => x.RemoveFromSuperview());

NativeView.CrossPlatformArrange = VirtualView.Arrange;
NativeView.AddSubview(VirtualView.Content.ToNative(MauiContext));

if (VirtualView.Content != null)
NativeView.AddSubview(VirtualView.Content.ToNative(MauiContext));
}

public static void MapTitle(PageHandler handler, IPage page)
Expand Down

0 comments on commit d4df78a

Please sign in to comment.