Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

How to prevent overlapping navigation in NavigationPage?

$
0
0

I am currently trying to fix an annoying problem in my Xamarin Forms app (iOS and Android).

Assume a NavigationPage that currently has two pages on the stack:

Page2 (topmost, currently displayed)
Page1

Page2 has a Button "Go to Page3", that binds to a Command which in turn executes the following method:

Task Navigate()
{
    return navigationPage.PushAsync(new Page3(), true);
}

Now what I do is the following:
I tap the "< BACK" button in the navigation bar, and then immediately tap "Go to Page3" before Page2 has a chance to disappear.

This causes Page2 to animate away and Page1 to appear. Then as soon as Page1 has appeared, the app navigates to Page3, leading to the following navigation stack:

Page3 (topmost, currently displayed)
Page1

This is more or less correct from the point of view of the NavigationPage I suppose, but I do not want my app to be able to get into this state.
I would be able to prevent this if there was a way to detect back navigation as soon as it starts, but I can't see how to detect that.

How do you solve this issue?


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>