AlertToast icon indicating copy to clipboard operation
AlertToast copied to clipboard

No linebreaks in subtitle?

Open GrosserStuhl opened this issue 3 years ago • 3 comments

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):

  • Device: Simulator - iPhone 11
  • OS: iOS 15
  • Version master branch

GrosserStuhl avatar Jan 25 '22 20:01 GrosserStuhl

Same here, also in title

aledebla03 avatar Feb 09 '22 20:02 aledebla03

Title going out of the screen Screenshot 2022-03-10 at 5 22 59 PM .

AnmolMalpani avatar Mar 10 '22 11:03 AnmolMalpani

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

RudraSen2 avatar Apr 27 '22 12:04 RudraSen2

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

elai950 avatar Jan 31 '23 08:01 elai950

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

harleylovitos avatar Feb 09 '23 16:02 harleylovitos

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.

elai950 avatar Feb 09 '23 16:02 elai950

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

harleylovitos avatar Feb 09 '23 17:02 harleylovitos

This bug was fixed in 1.3.9. Please check.

elai950 avatar Feb 12 '23 08:02 elai950

Thank you :)

harleylovitos avatar Feb 16 '23 19:02 harleylovitos