-
Notifications
You must be signed in to change notification settings - Fork 473
Description
Is there an existing issue for this?
- I have searched the existing issues
Did you read the "Reporting a bug" section on Contributing file?
- I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
Current Behavior
I have an application using CommunityToolkit.Maui.Alerts.Toast displaying important information for the user. In my case it's mandatory to dismiss the current showig Toast when a new Toast is ready to be shown.
From docs:
You can display only one Toast at a time. If you call the Show method a second time, the first Toast will automatically be dismissed.
The problem seems to be having a maximum time to dismiss a Toast. If that time passes, that Toast won't be dismissed. Even if you manually try to:
if (Toast != null)
{
await Toast.Dismiss();
Toast.Dispose();
}
Toast = CommunityToolkit.Maui.Alerts.Toast.Make($"Clicked {NumberOfClicks} times!", ToastDuration.Short);
await Toast.Show();Here a gif showing the current behaviour from my sample application:
The sample just counts the number of clicks and displays it using Toast. When I hit 119 clicks, I wait long enough to not be able to dismiss the Toast. Not even manually.
Expected Behavior
To be able to dismiss the current Toast whenever I need to show a new one.
Steps To Reproduce
- Open solution from reproduction project repository.
- You'll find just a page with two buttons.
Show toast(just shows a newToast) andManually dismiss and show toast(manually dismiss currentToastand shows a new one). - Follow the attached gif. Just click one button and wait long enough to click it again. After that you will be able to click multiple times either one of them and new
Toastwon't show.
Link to public reproduction project repository
https://github.com/nk-alex/CameraView/tree/feature/Toast_Bug
Environment
- .NET MAUI CommunityToolkit: 13.0.0
- OS: Windows 11
- .NET MAUI: .net 10Anything else?
No response
