Estou trabalhando em um aplicativo SwiftUI para tvOS. Tenho um NavigationLink com uma imagem e uma linha de texto. O item funciona como esperado, quando em foco ele cresce. No entanto, se eu alterar o raio do canto (o padrão é muito), mesmo que o raio do canto seja menor e a imagem e o texto cresçam, a imagem é cortada (a imagem cresce, mas seus limites permanecem os mesmos). Como posso consertar isso?
NavigationStack {
ScrollView {
VStack(alignment: .leading, spacing: 20) {
ForEach(sections) { section in
VStack(alignment: .leading, spacing: 20) {
// Section title
Text(section.title)
.font(.title)
.padding(.horizontal)
// Items
ScrollView(.horizontal) {
LazyHStack(spacing: 50) {
ForEach(section.items) { item in
NavigationLink {
VideoDetailView(mediaItem: item)
} label: {
AsyncImage(url: item.imageURL) { phase in
switch phase {
case .empty:
// This shows while the image is loading
ProgressView()
.aspectRatio(700/500, contentMode: .fit)
.containerRelativeFrame(.horizontal, count: 6, spacing: 50)
case .success(let image):
// This shows the successfully loaded image
image
.resizable()
.aspectRatio(700/500, contentMode: .fit)
.containerRelativeFrame(.horizontal, count: 6, spacing: 50)
case .failure(_):
// This shows if the image fails to load
Image(systemName: "photo")
.resizable()
.aspectRatio(700/500, contentMode: .fit)
.containerRelativeFrame(.horizontal, count: 6, spacing: 50)
@unknown default:
// Any other
EmptyView()
}
} .cornerRadius(5) // WHen I add this, the image gets clipped
Text(item.title)
//Text(item.subtitle)
}
.buttonStyle(.borderless)
}
}
}
.scrollClipDisabled()
}
}
}
}
}