Bug 36721 - Hidden NavigationBar causes layout to adjust when navigating
Summary: Hidden NavigationBar causes layout to adjust when navigating
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.0.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-12-08 17:34 UTC by John Miller [MSFT]
Modified: 2018-02-06 18:43 UTC (History)
8 users (show)

Tags: ac, layout, navigationbar, ios
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description John Miller [MSFT] 2015-12-08 17:34:02 UTC

   When a page is pushed with a hidden navigation bar, the layout is adjusted by the height of the hidden navigation bar. 

**Steps to Reproduce:**

   1. Run this project on an iOS simulator: https://github.com/armintelker/NavigationBarHideBug
   2. Press the button to navigate
   3. Notice as the animation happens, the red portion is adjusted

**Actual Results:**

   The red portion is adjusted when navigating

**Expected Results:**

   The red portion should not be adjusted. 

**Build Date & Platform:**

   XF 2.0.1 pre1
Comment 1 adrianknight89 2016-10-21 03:42:23 UTC
I can confirm this in 2.3.3-pre3. To be exact, the layout of the whole page is adjusted by the height of the navigation bar. Right now, layout calculations seem to be triggered as the push/pop happens not after they are complete. Layouting seems to be happening for all pages on the stack.

I think what needs to happen is the appearing page needs to layout and all other pages need to layout once the topmost page has appeared.
Comment 2 adrianknight89 2016-10-21 03:44:54 UTC
or even better, only the appearing page needs to layout. If other pages are "hidden" behind the current page, they don't need to adjust their size until each page actually becomes visible.
Comment 3 adrianknight89 2016-10-21 08:07:33 UTC
Put this code in LayoutChildren() of Page:

var container = this as NavigationPage;
var page = child as Page;

if (container != null && page != null && container.CurrentPage != page && container.IsPushing)

Create IsPushing in NavigationPage and set it on and off in PushAsyncInner()

This disables layout for all pages on the stack except for the topmost page when it's being pushed. This will fix the issue described in this bug. However, this would be a behavioral change in that page Width/Height property changes won't occur on push. Device orientation changes should work fine. Popping pages should work fine.

This is the only fix I could think of, and it's not pretty.

On AppCompat, the issue looks different. I see a flicker as the page is laid out several times.
Comment 4 David Ortinau [MSFT] 2017-09-07 03:24:03 UTC
Observed the bottom constraint is not recalculated properly. I know we made improvements on this, but this case was not covered. Re-confirming. BAD BAD
Comment 5 Paul Brenner 2018-02-06 15:59:47 UTC
Migrated to github - https://github.com/xamarin/Xamarin.Forms/issues/1807