Fix iOS menu text disappearing in navigation headers

Extended the ZStack overlay fix to all iOS navigation header menus
where text labels would disappear when tapping the menu:

- HomeView: "Home" title menu
- PopularView: "Popular" title with icon menu
- TrendingView: Country/flag title menu
- PlaylistsView: Playlist title with thumbnail menu
- ChannelPlaylistView: Playlist title with thumbnail menu
- OpenVideosView: Playback mode picker menu

All menus now use the same pattern as PlaybackSettings:
- Visible static label layer in ZStack
- Invisible Menu overlay with .opacity(0)
- Prevents text disappearing and resizing animations
This commit is contained in:
Arkadiusz Fal
2025-11-23 14:16:21 +01:00
parent 65e86d30ec
commit 9177abb0ec
6 changed files with 189 additions and 99 deletions

View File

@@ -109,6 +109,24 @@ struct ChannelPlaylistView: View {
#if os(iOS) #if os(iOS)
private var playlistMenu: some View { private var playlistMenu: some View {
ZStack {
HStack(spacing: 12) {
if let url = store.item?.thumbnailURL ?? playlist.thumbnailURL {
ThumbnailView(url: url)
.frame(width: 60, height: 30)
.clipShape(RoundedRectangle(cornerRadius: 2))
}
Text(playlist.title)
.font(.headline)
.foregroundColor(.primary)
Image(systemName: "chevron.down.circle.fill")
.foregroundColor(.accentColor)
.imageScale(.small)
}
.frame(maxWidth: 320)
Menu { Menu {
playButtons playButtons
@@ -141,9 +159,11 @@ struct ChannelPlaylistView: View {
.imageScale(.small) .imageScale(.small)
} }
.frame(maxWidth: 320) .frame(maxWidth: 320)
.transaction { t in t.animation = nil } .opacity(0)
} }
} }
.transaction { t in t.animation = nil }
}
#endif #endif
private var playlistButtonsPlacement: ToolbarItemPlacement { private var playlistButtonsPlacement: ToolbarItemPlacement {

View File

@@ -211,6 +211,17 @@ struct HomeView: View {
#if os(iOS) #if os(iOS)
var homeMenu: some View { var homeMenu: some View {
ZStack {
HStack(spacing: 12) {
Text("Home")
.foregroundColor(.primary)
.font(.headline)
Image(systemName: "chevron.down.circle.fill")
.foregroundColor(.accentColor)
.imageScale(.small)
}
Menu { Menu {
Section { Section {
HideWatchedButtons() HideWatchedButtons()
@@ -233,9 +244,11 @@ struct HomeView: View {
.foregroundColor(.accentColor) .foregroundColor(.accentColor)
.imageScale(.small) .imageScale(.small)
} }
.transaction { t in t.animation = nil } .opacity(0)
} }
} }
.transaction { t in t.animation = nil }
}
#endif #endif
} }

View File

@@ -190,7 +190,24 @@ struct PlaylistsView: View {
#if os(iOS) #if os(iOS)
var playlistsMenu: some View { var playlistsMenu: some View {
let title = currentPlaylist?.title ?? "Playlists" let title = currentPlaylist?.title ?? "Playlists"
return Menu { return ZStack {
HStack(spacing: 12) {
HStack(spacing: 6) {
Image(systemName: "list.and.film")
Text(title)
.font(.headline)
}
.foregroundColor(.primary)
Image(systemName: "chevron.down.circle.fill")
.foregroundColor(.accentColor)
}
.imageScale(.small)
.lineLimit(1)
.frame(maxWidth: 320)
Menu {
Menu { Menu {
selectPlaylistButton selectPlaylistButton
} label: { } label: {
@@ -239,10 +256,12 @@ struct PlaylistsView: View {
.imageScale(.small) .imageScale(.small)
.lineLimit(1) .lineLimit(1)
.frame(maxWidth: 320) .frame(maxWidth: 320)
.transaction { t in t.animation = nil } .opacity(0)
} }
.disabled(!accounts.signedIn) .disabled(!accounts.signedIn)
} }
.transaction { t in t.animation = nil }
}
#endif #endif
func hintText(_ text: String) -> some View { func hintText(_ text: String) -> some View {

View File

@@ -168,6 +168,18 @@ struct TrendingView: View {
#if os(iOS) #if os(iOS)
var trendingMenu: some View { var trendingMenu: some View {
ZStack {
HStack(spacing: 12) {
Text("\(country.flag) \(country.name)")
.font(.headline)
.foregroundColor(.primary)
Image(systemName: "chevron.down.circle.fill")
.foregroundColor(.accentColor)
.imageScale(.small)
}
.frame(maxWidth: 320)
Menu { Menu {
countryButton countryButton
@@ -194,6 +206,8 @@ struct TrendingView: View {
.imageScale(.small) .imageScale(.small)
} }
.frame(maxWidth: 320) .frame(maxWidth: 320)
.opacity(0)
}
} }
} }
#endif #endif

View File

@@ -144,10 +144,15 @@ struct OpenVideosView: View {
Spacer() Spacer()
#endif #endif
#if os(iOS) #if os(iOS)
ZStack {
Text(playbackMode.description)
Menu { Menu {
playbackModePicker playbackModePicker
} label: { } label: {
Text(playbackMode.description) Text(playbackMode.description)
.opacity(0)
}
} }
#else #else
playbackModePicker playbackModePicker

View File

@@ -90,6 +90,23 @@ struct PopularView: View {
#if os(iOS) #if os(iOS)
private var popularMenu: some View { private var popularMenu: some View {
ZStack {
HStack(spacing: 12) {
HStack(spacing: 6) {
Image(systemName: "chart.bar.fill")
.foregroundColor(.primary)
.imageScale(.small)
Text("Popular")
.font(.headline)
.foregroundColor(.primary)
}
Image(systemName: "chevron.down.circle.fill")
.foregroundColor(.accentColor)
.imageScale(.small)
}
Menu { Menu {
ListingStyleButtons(listingStyle: $popularListingStyle) ListingStyleButtons(listingStyle: $popularListingStyle)
@@ -117,9 +134,11 @@ struct PopularView: View {
.foregroundColor(.accentColor) .foregroundColor(.accentColor)
.imageScale(.small) .imageScale(.small)
} }
.transaction { t in t.animation = nil } .opacity(0)
} }
} }
.transaction { t in t.animation = nil }
}
#endif #endif
var shouldDisplayHeader: Bool { var shouldDisplayHeader: Bool {