elai950 / AlertToast

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

No linebreaks in subtitle? #37

Closed GrosserStuhl closed 1 year ago

GrosserStuhl commented 2 years ago

Describe the bug I assume it is a bug and not intention. I cannot present a message that is longer than X characters. I am using a Banner type but it seems to behave similar with HUD too.

My assumption was that using a subtitle, it would show multiple lines and the banner would grow bigger in vertical size.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots image

Smartphone (please complete the following information):

aledebla03 commented 2 years ago

Same here, also in title

AnmolMalpani commented 2 years ago

Title going out of the screen

Screenshot 2022-03-10 at 5 22 59 PM

.

RudraSen2 commented 2 years ago

Try Adding <br> to the text if you're using SwiftUI 3.

elai950 commented 1 year ago

Hey @GrosserStuhl , I tried to reproduce the issue on my side with no luck.

As you can see in the picture this very long string does linebreak where it needs to. I'll close this issue for that reason but please keep me updated if you find the cause of this problem. I'm curious.

.toast(isPresenting: $showBannerRegular, duration: 4){
                    AlertToast(displayMode: .banner(.slide), type: .regular, title: "Welcome! 👋", subTitle: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", style: .style(backgroundColor: .blue))
                }
צילום מסך 2023-01-31 ב-10 21 43
harleylovitos commented 1 year ago

I'm having this issue here. It was working last 2nd or 1st week of January but now it showing like this. IMG_1886

elai950 commented 1 year ago

I'm having this issue here. It was working last 2nd or 1st week of January but now it showing like this.

IMG_1886

From previous tests, it might be because you didn't specified width to the view that the toast modifier is on him. Try give him a frame width of even infinity in a vstack and see if it solved.

Usually this problem occurring when there is so width to the view. Generally speaking in SwiftUI I mean.

harleylovitos commented 1 year ago

I added this code and same problem. ZStack {VStack{ some code.... }.padding(20) .frame(maxWidth: .infinity) .toast(isPresenting: self.$showToast,duration: 5, tapToDismiss: true, alert: { AlertToast(displayMode: .banner(.slide),type: self.toastType, title: self.toastMessage) }, onTap: { some codes... }, completion: { some codes... }) }

I also tried .frame(width: .infinity)

IMG_1889

elai950 commented 1 year ago

This bug was fixed in 1.3.9. Please check.

harleylovitos commented 1 year ago

Thank you :)