Skip to content

Commit 88ffcd2

Browse files
authored
Merge pull request #317 from adospace/issue-312
Fixed Navigation stack is empty issue in tests
2 parents c9f348c + 173dfad commit 88ffcd2

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/MauiReactor/Component.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ protected virtual void OnMountedOrPropsChanged()
151151
}
152152

153153
public INavigation? Navigation
154-
=> ContainerPage?.Navigation ?? NavigationProvider.Navigation;// ?? NavigationProvider.Navigation ?? throw new InvalidOperationException("Navigation is not available, , check its availability with the property IsNavigationAvailable");
154+
=> NavigationProvider.Navigation ?? ContainerPage?.Navigation;
155155

156156
public Microsoft.Maui.Controls.Shell? CurrentShell
157157
=> MauiControlsShellExtensions.CurrentShell;

src/MauiReactor/TemplateHost.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public class TemplateHost : VisualNode, ITemplateHost, IVisualNode, IHostElement
2121
private readonly LinkedList<IVisualNodeWithNativeControl> _listOfVisualsToAnimate = new();
2222
private bool _layoutCallEnqueued;
2323
private bool _started;
24-
private Microsoft.Maui.Controls.Page? _containerPage;
2524

2625
public TemplateHost(VisualNode root)
2726
{
@@ -46,11 +45,10 @@ public VisualNode Root
4645

4746
internal static void FireLayoutCycleExecuted(object? sender)
4847
=> LayoutCycleExecuted?.Invoke(sender, EventArgs.Empty);
49-
public Microsoft.Maui.Controls.Page? ContainerPage => _containerPage ??= ((IVisualNode)_root).GetContainerPage();
5048

5149
Microsoft.Maui.Controls.Page? IVisualNode.GetContainerPage()
5250
{
53-
return ContainerPage;
51+
return NativeElement as Microsoft.Maui.Controls.Page;
5452
}
5553

5654
IHostElement? IVisualNode.GetPageHost()

0 commit comments

Comments
 (0)