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

Commit

Permalink
Fix crash navigating in Shell and trying to get the navbar visibility (
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuarezruiz authored Oct 6, 2021
1 parent b4efb7f commit 833b1bf
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Xamarin.Forms.Platform.iOS/Renderers/ShellSectionRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -703,11 +703,15 @@ public override void WillShowViewController(UINavigationController navigationCon
System.Diagnostics.Debug.Write($"WillShowViewController {viewController.GetHashCode()}");
var element = _self.ElementForViewController(viewController);

bool navBarVisible;
if (element is ShellSection)
navBarVisible = _self._renderer.ShowNavBar;
else
navBarVisible = Shell.GetNavBarIsVisible(element);
bool navBarVisible = false;

if (element != null)
{
if (element is ShellSection)
navBarVisible = _self._renderer.ShowNavBar;
else
navBarVisible = Shell.GetNavBarIsVisible(element);
}

navigationController.SetNavigationBarHidden(!navBarVisible, true);

Expand Down

0 comments on commit 833b1bf

Please sign in to comment.