Post

Replies

Boosts

Views

Activity

Reply to NavigationView is messing up with .prefersDefaultFocus(in:) in tvOS
Not sure if this gives you what you are looking for. I've found that you run into problems when a NavigationView is too global. import SwiftUI struct TestSelectionView: View { @FocusState var focused: Bool? var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundColor(.accentColor) Text("Hello, world!") HStack { NavigationView { VStack { NavigationLink(destination: Text("gone to left 1").focusable(), label: { Text("Left 1").focusable() }) } } NavigationView { VStack { NavigationLink(destination: Text("gone to right 1").focusable(), label: { Text("right 1").focusable() }) NavigationLink(destination: Text("gone to right 2").focusable(), label: { Text("right 2").focusable() }) .focused($focused, equals: true) .onAppear { self.focused = true } NavigationLink(destination: Text("gone to right 3").focusable(), label: { Text("right 3").focusable() }) } } } .padding(.top, 50) } .padding() } } #Preview { TestSelectionView() } code-block
Sep ’23
Reply to NavigationLink is clipped on the left side
Further clarification: Any construct of the following (tvOS, iOS 17) var body: some View { VStack { Form { NavigationLink("Show Nothing 01", destination: Text("Nothing").focusable()) } List { NavigationLink("Show Nothing 02", destination: Text("Nothing").focusable()) } } } Where the NavigationLink is occupying less than the entire screen, causes the navigation button to get clipped off. Depending on the other container the above is in.
Aug ’23