Fix ContentUnavailableView centering on Apple TV

On tvOS, ContentUnavailableView inside a Group doesn't expand to fill
available space — it sizes to content and aligns top-leading. Add
.frame(maxWidth: .infinity, maxHeight: .infinity) to all instances
so they center correctly in their parent containers.
This commit is contained in:
Arkadiusz Fal
2026-02-25 21:48:59 +01:00
parent f14ed4c2cb
commit 0fdac499bb
28 changed files with 62 additions and 6 deletions

View File

@@ -180,12 +180,14 @@ struct BookmarksListView: View {
private var emptyView: some View {
if !searchText.isEmpty {
ContentUnavailableView.search(text: searchText)
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else {
ContentUnavailableView {
Label(String(localized: "home.bookmarks.title"), systemImage: "bookmark")
} description: {
Text(String(localized: "home.bookmarks.empty"))
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}

View File

@@ -108,6 +108,7 @@ struct ContinueWatchingView: View {
} description: {
Text(String(localized: "home.continueWatching.empty"))
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
private var listContent: some View {

View File

@@ -206,12 +206,14 @@ struct HistoryListView: View {
private var emptyView: some View {
if !searchText.isEmpty {
ContentUnavailableView.search(text: searchText)
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else {
ContentUnavailableView {
Label(String(localized: "home.history.title"), systemImage: "clock")
} description: {
Text(String(localized: "home.history.empty"))
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}

View File

@@ -76,6 +76,7 @@ struct PlaylistsListView: View {
}
.buttonStyle(.borderedProminent)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
// MARK: - List Content