Multi-Line Text in a NavigationButton in a List

If I have a VStack with two Text elements, and I want the second to display multiple lines, adding .lineLimit(nil) to it works fine. But when I embed this VStack in a NavigationButton in a List, it refuses to grow to fit the text. Is there a supported way to achieve this?

Replies

You could try adding .multilineTextAlignment(.leading||center||trailing) and see if that triggers it to render properly. That worked for me in a few similar cases.


I also have this probelm, except with an HStack - text (a number), text (most of the row), and a button on the right. The text in the middle should have a line limit of 3, but it always remains on one line and weirdly stretches/warps the text size (still truncating with ...). I've yet to find a solution to that, and it seems kinda like an extension of the issue you're describing.


Edit: Adding the modifier .layoutPriority(1) to my big text view fixed that issue, in case that helps at all.