Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The subtitle line gets cut off on iOS banners #67

Open
gbe-trackunit opened this issue Mar 28, 2023 · 3 comments
Open

The subtitle line gets cut off on iOS banners #67

gbe-trackunit opened this issue Mar 28, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@gbe-trackunit
Copy link

Describe the bug
Banner subtitle line goes off the screen instead of wrapping to the next line on iOS

To Reproduce
Steps to reproduce the behavior:

  1. Make a long subtitle in an iOS banner
  2. Observe the subtitle gets cut off

Expected behavior
The subtitle should wrap to the next line

Screenshots
Screenshot 2023-03-28 at 4 12 58 PM

Smartphone (please complete the following information):

  • Device: iPhone 14 Pro simulator
  • OS: iOS 16.2
  • Version 1.3.9
@gbe-trackunit gbe-trackunit added the bug Something isn't working label Mar 28, 2023
@leoull
Copy link

leoull commented Oct 23, 2023

break up the text by new line using /n as a workaround:

AlertToast(displayMode: .banner(.pop), type: .systemImage("checkmark.circle.fill", .green), title: "Password Reset Instruction Sent", subTitle: "If you don't receive the email, please ensure the \nemail is correct and check your spam folder.") 

@nsuinteger-momatu
Copy link

break up the text by new line using /n as a workaround:

AlertToast(displayMode: .banner(.pop), type: .systemImage("checkmark.circle.fill", .green), title: "Password Reset Instruction Sent", subTitle: "If you don't receive the email, please ensure the \nemail is correct and check your spam folder.") 

Not always possible if the message is not static or provided from a backend

@nsuinteger-momatu
Copy link

nsuinteger-momatu commented Aug 28, 2024

I know it's an older issue here without resolution, but I thought of leaving a comment. I had a similar issue that I was facing and I realised that the presenting view of the alertToast can limit it's size and make the content truncate. So for example,

if you're doing this

Button("title") { 
}
.toast(isPresenting ... ) 

then the chances are the size of the button can have an impact on the AlertToast's size. If your situation is similar, trying moving the .toast modifier to the parent level where there is more screen space available or perhaps embed the Button inside a large container. I did something like this for mine but your layout might not permit in which case make appropriate changes and see if it works.

VStack { 
Button("title") { 
}
Spacer() 
}
.toast(isPresenting ... ) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants