Multiline Text
in a NavigationLink
inside of a List
does not seem to work.
Here is the code:
struct ContentView : View {
var body: some View {
List(1...5) { _ in
NavigationLink(destination: EmptyView()) {
Text("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
.lineLimit(nil)
}
}
}
}
Removing the NavigationLink
, the Text
behaves as expected.
Is there a way to fix this, or is this a bug?
In the current XCode 13.1 Beta I still have an issue with this when the Text view is inside a container view. I could solve this giving the row (the container) a minimum height:
UPDATE
It seems Beta 5 has solved this bug!
Workaround for Beta 4 and previous versions:
It seems NavigationLink is "broken". But you can use DynamicNavigationDestinationLink instead. I know it's too verbose, but if you need a way out, here you have it. At least until NavigationLink works better.