Skip to content

Commit

Permalink
Update ShellSectionRenderer.cs (#18945)
Browse files Browse the repository at this point in the history
* Update ShellSectionRenderer.cs

Fix crash navigating in Shell and trying to get the navbar visibility

* Apply suggestions from code review

* Update src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSectionRenderer.cs

---------

Co-authored-by: gc <gc@keba.com>
Co-authored-by: Gerald Versluis <gerald@verslu.is>
  • Loading branch information
3 people committed Dec 4, 2023
1 parent 8c370bd commit b39cd8a
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -724,11 +724,15 @@ public override void WillShowViewController(UINavigationController navigationCon
{
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 is not null)
{
if (element is ShellSection)
navBarVisible = _self._renderer.ShowNavBar;
else
navBarVisible = Shell.GetNavBarIsVisible(element);
}

navigationController.SetNavigationBarHidden(!navBarVisible, true);

Expand Down

0 comments on commit b39cd8a

Please sign in to comment.