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

v1.2.2 [Android]: Weird issue where my Modal Page is displaying as a NavigationPage.

$
0
0

I've got a MasterDetail page that uses PushModalAsync(new AuthPage()); to push my login page over top of my main page.

The auth page is a TabbedPage with two ContentViews (one for Sign In and one for Register).

I've searched my entire source code to see if I'm setting anything as a NavigationPage and the only spot is definitely the Detail portion of the MD Page.

Now the issue comes in that when that AuthPage is pushed as a Modal, it still has a navigation bar in android (it's fine in iOS). The navigation bar has the left carret and no text. When pressed, nothing happens. This was not the case (with the same code) in v1.1.1

I'm not filing this as a bug (yes) because I'm having a hard time creating a Repro.

App.cs

    public static Page GetMainPage(IContainer container)
    {
        Container = container;

        RegisterCurrentUser(Container.Resolve<UserModel>());
        RunMigrations();
        RegisterCurrentUser();

        var rootPage = Container.Resolve<MainPage>();
        return rootPage;
    }

MainPage.cs

    public MainPage()
    {
        Title = Strings.app_title;
        var master = new MainMenu(OnAfterDeauthenticated, OnToggleRequest());
        var detail = new NavigationPage(new ModulePage { Title = Strings.app_title });

        if (App.Navigation == null)
        {
            App.Navigation = detail.Navigation;
        }

        Master = master;
        Detail = detail;
    }

    protected override async void OnAppearing()
    {
        base.OnAppearing();
        if (App.CurrentUser.Id == Migration001.GuestUserId || App.CurrentUser == null)
        {
            await App.Navigation.PushModalAsync(new AuthPage(OnAfterAuthenticated));
        }
        else
        {
            await SyncWithServerAsync();
            Master.BindingContext = await FetchModuleListAsync();
        }
    }

AuthPage.cs

    public AuthPage(Action afterAuthenticated)
    {
        var signInCommand = App.Container.Resolve<ISignInCommand>();
        var signInViewModel = new SignInViewModel(signInCommand, afterAuthenticated);
        var signInPage = new SignInTab(signInViewModel) { Title = Strings.sign_in_button_text };

        var registerCommand = App.Container.Resolve<IRegisterCommand>();
        var registerViewModel = new RegisterViewModel(registerCommand, afterAuthenticated);
        var registerPage = new RegisterTab(registerViewModel) { Title = Strings.register_button_text };

        Children.Add(signInPage);
        Children.Add(registerPage);
    }

Viewing all articles
Browse latest Browse all 58056

Trending Articles



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