Navigation.PopAsync(true) shows blank page

Mdt87Mdt87 DEMember ✭✭

Hello everyone,

i'm currently fighting with a very strange behavior on Android devices. My app is developed with Xamarin Forms and should be available on iOS and Android. I'm using a Master-Detail-Layout and I have a Page which shows a list of sensors and if I click on one of them, then I want to open a page with detailed information about the sensor.
Therefore if you click on a cell, the following code is executed:

private void SensorsListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
{
    ISensor sensor = e.SelectedItem as ISensor;

    if (sensor != null)
    {
        Navigation.PushAsync(new SensorDetailPage(sensor));

        this.SensorsListView.SelectedItem = null;
    }
}

This works perfect, it opens the DetailPage and everything works fine.
On the DetailPage I have a Button which does something and if it is successful it should return to the SensorPage (not the DetailPage). Therefore the following code is used:

private async void DoSomethingButtonPressed(object sender, SelectedItemChangedEventArgs e)
{
    if (Sensor != null)
    {
        bool result = await DoSomethingCall(Sensor);

        if (result)
        {
            await this.Navigation.PopAsync(true);
        }
    }
}

If I use await this.Navigation.PopAsync(false); with animated=false, then everything works fine. But if I use animated=true, then it just opens a blank (black) view with no navigation bar, no status bar, nothing. If then the device is rotated (orientation is changed), then the screen I would expect is visible and it works, but not directly after the await this.Navigation.PopAsync(true);.

I just tested it on Android with Android 5.0.2 and 4.4.2 on a Samsung SM-T230 and a Nexus 7 (ME370T) with Xamarin.Forms 1.4.3 and 1.5.0.

Does someone has an idea what's going wrong? or what I do wrong?

Thanks in advance.

Martin

Best Answers

Answers

  • LucaPisanoLucaPisano ITMember ✭✭

    Hi Martin, any update on this? I'm facing the same issue with Lollipop 5.0.1 with Xamarin.Forms 2.0.1.6495
    Randomly, the layout appears only if I rotate the screen, otherwise the ContentPage shows blank

  • MatPagMatPag USMember ✭✭
    edited April 2016

    i'm facing the same problem and i think this is a Xamarin Forms bug.

    i have a master-detail layout and when popping up the last page with PopAsync the page remains blank with title only instead of going back to the previous page

  • LucaPisanoLucaPisano ITMember ✭✭

    @MatPag said:
    i'm facing the same problem and i think this is a Xamarin Forms bug.

    i have a master-detail layout and when popping up the last page with PopAsync the page remains blank with title only instead of going back to the previous page

    Hi MatPag, please ensure that any UI component (in the destination page) is created and drawn in the Main UI thread by using Device.BeginInvokeOnMainThread(...){}

  • BenjaminRiveroBenjaminRivero USMember ✭✭
    edited November 2016

    I can "confirm" the Issue but I am using Xamarin.Forms.Maps, when I am in a Page that contains a Map and I try to PushAsync to a second page (without Map) this second page appears empty, the funny part is that if I rotate the screen of the device all the UI elements appear as you mention @Mdt87 , its a very strange behavior. I am using XAML, the second page only create a simple Form, very basic.


    Find a patch or solution to the problem:

    On the page that shows the Map when I am going to Push the next Page I use the next code:

    App.Current.MainPage = new NavigationPage(new MyNewPage());

    Obviusly this is not the best solution, but it Works. No more blank pages!!!!

  • @BenjaminRivero said:
    I can "confirm" the Issue but I am using Xamarin.Forms.Maps, when I am in a Page that contains a Map and I try to PushAsync to a second page (without Map) this second page appears empty, the funny part is that if I rotate the screen of the device all the UI elements appear as you mention @Mdt87 , its a very strange behavior. I am using XAML, the second page only create a simple Form, very basic.


    Find a patch or solution to the problem:

    On the page that shows the Map when I am going to Push the next Page I use the next code:

    App.Current.MainPage = new NavigationPage(new MyNewPage());

    Obviusly this is not the best solution, but it Works. No more blank pages!!!!

    Is there any news on it? i have the same problem.

    Thank you

Sign In or Register to comment.