elai950 / AlertToast

Create Apple-like alerts & toasts using SwiftUI
https://elai950.github.io/AlertToast/
MIT License
2.08k stars 187 forks source link

AlertToast hangs on iOS 13. Alert text is clipped #46

Closed megakoko closed 2 years ago

megakoko commented 2 years ago

Hello!

First of all thank you for the great lib, we find it really helpful.

We stumbled upon an issue on iOS 13 where the app would hang when we tried to display an alert. Here's the code we used:

.toast(isPresenting: $viewModel.showToast) {
    AlertToast(type: .complete(Color.tangemGreen), title: "contract_address_copied_message".localized)
}

Whenever we set showToast to true it would freeze and the CPU would go to 100%. Our investigation showed that the library was repeatedly calling onAppearAction from onReceive.

Upon fixing that problem we encountered a different one — the text in the .alert mode was not wrapped by SwiftUI. Removing .fixedSize fixed the issue and did not seem to introduce any side effects.

Attaching the screenshot of the clipping.

Thanks again,

Andy

Screenshot 2022-04-14 at 17 04 25