Should I always use Navigation.PopAsync ()?

2

I'm starting learning using Xamarin Forms. In my case, I'm doing some tests with an Android application.

By paralleling Windows Phone, when I navigate from page A to page B, and then press the Back button of WP, it removes the page from the stack correctly.

In android there is this concept of Push and Pop in the pages. My question is: should I always use the Navigation.PopAsync () method? Or is it enough to use the navigation buttons on the device to turn the pages? In case I have to use Navigation.PopAsync (), should I put it in the OnDisappearing () event?

Hugs.

    
asked by anonymous 29.03.2017 / 15:44

1 answer

4

It depends. In Android and UWP we have physical buttons that can navigate and that navigation pops pages. In iOS we do not have this button, so if you are not in a container NavigationPage , the navigation arrow at the top left of the screen will not appear, and you should use% with%.

About events triggered at the time a PopAsync is invoked (Taken from the documentation itself):

When the PopAsync method is invoked, the following events occur:

  • The page calling PopAsync has its OnDisappearing override invoked.
  • The page being returned to has its OnAppearing override invoked.
  • The PopAsync task returns.

The documentation is very complete, it's worth a look: link

    
17.04.2017 / 22:41