Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Getting a white screen while navigating.

$
0
0

Hi.

I am building a Xamarin.Forms app using PRISM and I am getting the weirdest behavior.
I am pretty sure that it started right after I updated PRISM when the made their IInitialize breaking change.

Here is the flow of my app.
The first screen is the Login page and I am navigating to it in my OnInitialized method in App.xaml.cs

await NavigationService.NavigateAsync("NavigationPage/MainPage");

Once the user is logged in I am using the following line to navigate to the "home" page:

await NavigationService.NavigateAsync("/MainMasterPage/NavigationPage/PlayersHomePage");

This is where I get the white screen for a second and then the tabbed page loads up OK.
I notices that if I remove the Navigation page the white screen does not show up, but I cant do without it.

the PlayersHomePage is a TabbedPage with 3 tabs:

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
            xmlns:views="clr-namespace:FplMatchdayLive.Views"
            prism:ViewModelLocator.AutowireViewModel="True"
            Title="{Binding Title}"
            x:Class="xxx.Views.PlayersHomePage">
    <TabbedPage.Children>
        <views:TeamPage></views:TeamPage>
        <views:LeaguesPage></views:LeaguesPage>
        <views:FixturesPage></views:FixturesPage>
    </TabbedPage.Children>
</TabbedPage>

in the PlayersHomePage code behinde I am using IInitalize to initialize all the tabs:

public partial class PlayersHomePage : TabbedPage, IInitialize
{
    public PlayersHomePage()
    {
        InitializeComponent();
    }
    public void Initialize(INavigationParameters parameters)
    {
        if (parameters.GetNavigationMode() == NavigationMode.New)
        {
            // Prism always raises OnNavigatedTo on 1st tabbed page so this prevents the first tab being initialised twice
            if (Children.Count == 1)
            {
                return;
            }
            for (var pageIndex = 1; pageIndex < Children.Count; pageIndex++)
            {
                var page = Children[pageIndex];
                (page?.BindingContext as INavigationAware)?.OnNavigatedTo(parameters);
            }
        }
    }
}

I tried removing all the tabs from the TabbedPage thinking its the initialization that is causing this but it did not help.

Any ideas as to how to solve it?


Viewing all articles
Browse latest Browse all 204402


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