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.

[Feature Request] ShowToast can return handle to toast instance in order to close or update it.

See original GitHub issue

SCENARIO

I would like to show toasts instead of wait overlays in different scenarios.

For example when user click a button, I’m sending some emails in the background and during the process I would like to show a toast with messing “Sending emails…”. When done sending, I would like to either close the toast, or update it to “Emails sent”.

Example

var toastReference = await toastService.ShowToastAsync(ToastLevel.Info, "Sending emails");
await Task.Delay(1000);
toastReference.Timeout = TimeSpan.MaxValue; //or TimeSpan.Zero or null?
toastReference.Level = ToastLevel.Success;
toastReference.Message = "Emails sent!";
toastReference.ResetTimeout(TimeSpan.FromSeconds(2));
toastReference.Close();

I can do PR once agreed on the design

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
chrissaintycommented, Nov 26, 2020

Thanks for raising this @Liero. It is actually already being worked on as part of the next major version! I’ll tag this issue as part of that milestone so we make sure we don’t overlook anything.

0reactions
Lierocommented, Feb 27, 2023

I’ve already done it, see ToastService.cs and ToastReference.cs.

I use the same approach for updating the toast (for example I change title, content, severity etc of existing toast)

Feel free to inspire

Read more comments on GitHub >

github_iconTop Results From Across the Web

Show a Toast with a New JavaScript Function
Show a toast with the sforce.one.showToast() function. A toast displays a message below the header at the top of a view. Where: This...
Read more >
How to avoid a Toast if there's one Toast already being ...
I've tried a variety of things to do this. At first I tried using the cancel() , which had no effect for me...
Read more >
How to create a custom toast component with React
Learn how to create a custom toast component in React using popular React hooks such as useState and useEffect.
Read more >
Using React-Toastify to style your toast messages
In this article, we will learn about React-Toastify and how we can use it to create notifications, messages, and pop-ups in our React...
Read more >
Display a popup toast
Learn how to create a toast popup in an Expo project. ... App() { function showToast() { ToastAndroid.show('Request sent successfully!', ToastAndroid.
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