ToastUI: dismissAfter not dismissing on iOS13
Pre-requisites:
- Yes, I looked through both open and closed issues looking for what I needed
- No, I did not find what I was looking for
I am trying to switch from my basic alerts to using ToastUI but I’m running into an issue. For some reason my toast won’t dismiss even after the set dismissAfter
time. Funny enough this is only an issue when running on a device with iOS <14. Seems like the dismissAfter
functionality only works with the beta.
Expected Behavior
Should dismiss after the pre-defined time.
Current Behavior
Toast stays on the screen and dismiss is never called.
Possible Solution
Steps to Reproduce (for bugs)
@State var showWarning = false // this is set to true when a warning is triggered
var body: some View {
VStack {
...
}.toast(isPresented: $showWarning, dismissAfter: 5.0, onDismiss: {
print("Dismissing") // this never prints and the toast never goes away.
}) {
ToastView(self.messageContent).toastViewStyle(WarningToastViewStyle())
}
}
Context
Your Environment
- Swift Version: 5.3 & 5.1
- Xcode Version: 12.0 Beta 4 & 11.4
- Operating System and Version: macOS Big Sur 11 and macOS Catalina 10.15
- Device or Simulator: Device - iPhone 7 Plus iOS 13.6.1
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (17 by maintainers)
@quanshousio fyi, I have not found out what the problem was yet but it has nothing to do with your code. I must be doing something strange with my views and not realizing it. I used the toast in a different location and it works fine out of the box. Just thought you should know.
Also I love this project thanks for putting it together.
I’ll give that a shot but no need to keep this open. I would just close this when that hotfix is merged.
Also no worries on response, you have actually been responding very quickly! 👍
Yeah the view itself is just a simple VStack it is being shown by a parent NavigationView (app drawer). To rule out any possible conflict there I also tried starting the app with that simple view as the main content view of the app and it still happens.
Just to clarify I have tried this in the following ways:
✅ = it worked ❌ = it didn’t work
The only common thing I can tell is iOS13 vs iOS14.