Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin.Forms.Navigation.PopAsync() Does Not Pop Page

In Xamarin.Forms, when we use Navigation.PopAsync(), the page does not pop in iOS.

After PopAsync() the same page remains.

like image 909
Chetan Rawat Avatar asked Jan 21 '17 06:01

Chetan Rawat


1 Answers

Call the Proper Pop Method

If you pushed the page onto the Navigation Stack using Navigation.PushAsync(), use Navigation.PopAsync() to pop the page off of the Navigation Stack.

If you pushed the page on to the Navigation Stack using Navigation.PushModalAsync(), use Navigation.PopModalAsync() to pop the page off of the Navigation Stack.

Use BeginInvokeOnMainThread

All UI updates must be done on the main thread. To ensure that this request is happening on the main thread, use BeginInvokeOnMainThread:

Device.BeginInvokeOnMainThread(async () => await Navigation.PopAsync());

or

Device.BeginInvokeOnMainThread(async () => await Navigation.PopModalAsync());
like image 185
Brandon Minnick Avatar answered Nov 05 '22 00:11

Brandon Minnick