question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Navigation is not done when showing Alert in the Init() method

See original GitHub issue

Hello.

When I try to show an alert from the PageModel’s Init() method (if there is any exception I want to show any UI alert), not only the navigation to the page is not done, but the navigation is “broken” for the all the application (so I can’t do push to anywhere).

    public override void Init(object initData)
    {
        base.Init(initData);
        ...
        UserDialogs.Instance.Alert("Message", "Message content", "Close");            
    }

I have already tried without the UserDialogs plugin, and the error persists:

    ((MasterPage)Application.Current.MainPage).DisplayAlert("Message", "Message content", "Close");

Is this a bug? Any workaround?

Waiting for your replies. Thanks.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lloydkevincommented, Mar 9, 2017

I’m had similar issues with Init().

Since this get’s called before the view model is set as the BindingContext on the page, then you can’t perform any UI activities here.

I’ve had to resort to saving the parameter as a member variable, then doing any of my real work in the ViewIsAppearing()

0reactions
rid00zcommented, May 23, 2016

Task.Factory.StartNew(() => DownloadDataFromInternet(), TaskCreationOptions.LongRunning);

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular, Show Success alert after rooter navigate
4 Answers. You need to add the alert popup event in the ngOnInit method of the component which is linked to the route...
Read more >
Using router.navigate to navigate to another component ...
Hi I am implementing a project in angular . and i am using the version ng-version="4.3.0" Here i am redirecting the app to...
Read more >
React Native Navigation: Tutorial with examples
In this tutorial, we'll go through the basics of React Native navigation, show you how to get started using React Navigation in a...
Read more >
Navigate with named routes
The solution is to define a named route, and use the named route for navigation. To work with named routes, use the Navigator.pushNamed()...
Read more >
UIAlertView | Apple Developer Documentation
Use the show() method to display an alert view after it's configured. ... The view hierarchy for this class is private and must...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found