Wrap View Options sheet in NavigationStack on tvOS for picker labels

The .pickerStyle(.menu) hid labels. Instead, wrap the Form in a
NavigationStack on tvOS so the default navigation picker style works
and shows both labels and values.
This commit is contained in:
Arkadiusz Fal
2026-04-13 21:31:15 +02:00
parent 338127c692
commit 58c3bdc0b6

View File

@@ -32,6 +32,16 @@ struct ViewOptionsSheet: View {
} }
var body: some View { var body: some View {
#if os(tvOS)
NavigationStack {
formContent
}
#else
formContent
#endif
}
private var formContent: some View {
Form { Form {
// Single section with all options // Single section with all options
Section { Section {
@@ -55,9 +65,6 @@ struct ViewOptionsSheet: View {
Text("viewOptions.rowSize.regular").tag(VideoRowStyle.regular) Text("viewOptions.rowSize.regular").tag(VideoRowStyle.regular)
Text("viewOptions.rowSize.large").tag(VideoRowStyle.large) Text("viewOptions.rowSize.large").tag(VideoRowStyle.large)
} }
#if os(tvOS)
.pickerStyle(.menu)
#endif
} }
// Grid-specific options // Grid-specific options
@@ -68,7 +75,6 @@ struct ViewOptionsSheet: View {
Text("\(count)").tag(count) Text("\(count)").tag(count)
} }
} }
.pickerStyle(.menu)
#else #else
Stepper( Stepper(
"viewOptions.columns \(effectiveColumns)", "viewOptions.columns \(effectiveColumns)",
@@ -90,9 +96,6 @@ struct ViewOptionsSheet: View {
Text(size.displayName).tag(size) Text(size.displayName).tag(size)
} }
} }
#if os(tvOS)
.pickerStyle(.menu)
#endif
} }
} }
} }