Ruddy Ruddy - 1 year ago 133
iOS Question

Xamarin.Forms SetHasNavigationBar false causes jump on PushAsync

I am adding a navigation bar using

MainPage = new NavigationPage (new Home ());

Then on my
page I do not want to show the navigation bar, it is only for pages that link from this page I want to show the navigation bar. To stop the navigation bar from showing on this page I using the following code at the start of

NavigationPage.SetHasNavigationBar (this, false);

From here when using
to go to another page I get a "jump" (movement?) at the bottom of
. Its like it adds on the height for the navigation bar on the next page.

On iOS it causes the obvious jump if you set the background color on
to anything but white.

On Android it seems to only cause this "jump" when navigating back to the

This is the code I am using to push to the next page.

btn.Clicked += async (sender, e) => await Navigation.PushAsync (new TestPage ());

I have tried to remove all padding.margins from the pages but this has not helped. As I started a new project to test this there isn't anything else for me to change so I cannot think of any other changes that would solve this.

Gif below:
Tried to show the jump in this gif

Note: Keep an eye on the
(Grey) page.

Answer Source

After a lot of looking around I have found this to be a bug in Xmarin.Forms. No news on when there will be a fix or any work around.

Please keep an eye on the bug report here:

Work Around (ish?)

As a workaround I have stopped the animation from happening at all. Adding false as a second parameter will disable the animation. This doesnt look great but maybe better then seeing the little "jump" problem.

btn.Clicked += async (sender, e) => await Navigation.PushAsync (new TestPage (), false);