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

@@ -47,6 +47,7 @@ struct ContributorsView: View {
}
.buttonStyle(.borderedProminent)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else {
contributorsList
}

View File

@@ -138,6 +138,7 @@ struct ImportPlaylistsView: View {
}
.buttonStyle(.bordered)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.accessibilityIdentifier(AccessibilityID.errorMessage)
}
@@ -147,6 +148,7 @@ struct ImportPlaylistsView: View {
systemImage: "list.bullet.rectangle",
description: Text(String(localized: "import.playlists.emptyDescription"))
)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.accessibilityIdentifier(AccessibilityID.emptyState)
}

View File

@@ -109,6 +109,7 @@ struct ImportSubscriptionsView: View {
}
.buttonStyle(.bordered)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.accessibilityIdentifier(AccessibilityID.errorMessage)
}
@@ -118,6 +119,7 @@ struct ImportSubscriptionsView: View {
systemImage: "person.2.slash",
description: Text(String(localized: "import.subscriptions.emptyDescription"))
)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.accessibilityIdentifier(AccessibilityID.emptyState)
}

View File

@@ -38,6 +38,7 @@ struct LegacyDataImportView: View {
systemImage: "doc.questionmark",
description: Text(String(localized: "migration.noDataFoundDescription"))
)
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else {
importContent
}

View File

@@ -109,6 +109,7 @@ struct LogViewerView: View {
Text(String(localized: "settings.advanced.logs.disabled"))
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else {
List(loggingService.filteredEntries) { entry in
LogEntryRow(entry: entry)

View File

@@ -81,6 +81,7 @@ struct NetworkShareDiscoverySheet: View {
service.startDiscovery()
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
} else {
// Group shares by type
@@ -124,6 +125,7 @@ struct NetworkShareDiscoverySheet: View {
} description: {
Text(String(localized: "discovery.unavailable.description"))
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}

View File

@@ -182,6 +182,7 @@ struct ManageChannelNotificationsView: View {
} description: {
Text(errorMessage)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else if subscriptions.isEmpty {
ContentUnavailableView {
Label(
@@ -191,6 +192,7 @@ struct ManageChannelNotificationsView: View {
} description: {
Text(String(localized: "settings.notifications.noSubscriptions.description"))
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else {
ForEach(subscriptions, id: \.channelID) { subscription in
ChannelNotificationToggle(subscription: subscription)

View File

@@ -117,12 +117,14 @@ struct PeerTubeInstancesExploreView: View {
}
.buttonStyle(.borderedProminent)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else if displayedInstances.isEmpty {
ContentUnavailableView {
Label(String(localized: "peertube.explore.noResults"), systemImage: "magnifyingglass")
} description: {
Text(String(localized: "peertube.explore.noResults.description"))
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else {
instancesList
}

View File

@@ -72,6 +72,7 @@ struct ButtonConfigurationView: View {
String(localized: "settings.playerControls.buttonNotFound"),
systemImage: "exclamationmark.triangle"
)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}

View File

@@ -283,6 +283,7 @@ struct MiniPlayerButtonConfigurationView: View {
String(localized: "settings.playerControls.buttonNotFound"),
systemImage: "exclamationmark.triangle"
)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}

View File

@@ -41,6 +41,7 @@ struct PillButtonConfigurationView: View {
String(localized: "settings.playerControls.buttonNotFound"),
systemImage: "exclamationmark.triangle"
)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}

View File

@@ -90,6 +90,7 @@ struct SourcesListView: View {
}
.buttonStyle(.borderedProminent)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.accessibilityIdentifier("sources.view")
}

View File

@@ -30,6 +30,7 @@ struct TranslationContributorsView: View {
ContentUnavailableView {
Label(String(localized: "settings.translators.empty"), systemImage: "globe")
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else {
contributorsList
}