[Feature Request] ShowToast can return handle to toast instance in order to close or update it.
See original GitHub issueSCENARIO
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:
- Created 3 years ago
- Reactions:2
- Comments:7 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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