Skip to content

Commit

Permalink
Disable the console UI’s scroll clipping on tvOS
Browse files Browse the repository at this point in the history
This ensures the focused states of the cells are not clipped
  • Loading branch information
ejensen committed Sep 19, 2024
1 parent 29c1ad5 commit 34ed5b0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Sources/PulseUI/Features/Console/ConsoleView-tvos.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public struct ConsoleView: View {
.onAppear { listViewModel.isViewVisible = true }
.onDisappear { listViewModel.isViewVisible = false }
}
.disableScrollClip()
.injecting(environment)
.environmentObject(listViewModel)
}
Expand Down Expand Up @@ -92,6 +93,17 @@ private struct ConsoleMenuView: View {
}
}

extension View {
@available(tvOS, obsoleted: 17.0, renamed: "scrollClipDisabled")
@ViewBuilder func disableScrollClip() -> some View {
if #available(tvOS 17.0, *) {
scrollClipDisabled()
} else {
self
}
}
}

#if DEBUG
struct ConsoleView_Previews: PreviewProvider {
static var previews: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct NetworkInspectorView: View {
Form { lhs }.frame(width: 740)
Form { rhs }
}
.disableScrollClip()
}

@ViewBuilder
Expand Down

0 comments on commit 34ed5b0

Please sign in to comment.