mirror of
https://github.com/yattee/yattee.git
synced 2025-11-15 22:48:43 +00:00
Fix horizontal content extending behind sidebar on iPad
Modified HorizontalCells to conditionally apply edgesIgnoringSafeArea based on navigation style. In sidebar mode (iPad), content now respects safe areas and won't overlap with the sidebar. In tab mode (iPhone), content maintains full-width scrolling behavior.
This commit is contained in:
@@ -5,6 +5,7 @@ struct HorizontalCells: View {
|
||||
var items = [ContentItem]()
|
||||
|
||||
@Environment(\.loadMoreContentHandler) private var loadMoreContentHandler
|
||||
@Environment(\.navigationStyle) private var navigationStyle
|
||||
|
||||
@Default(.channelOnThumbnail) private var channelOnThumbnail
|
||||
|
||||
@@ -33,7 +34,7 @@ struct HorizontalCells: View {
|
||||
#endif
|
||||
}
|
||||
.frame(height: cellHeight)
|
||||
.edgesIgnoringSafeArea(.horizontal)
|
||||
.modifier(ConditionalEdgeIgnoringSafeArea(navigationStyle: navigationStyle))
|
||||
.animation(nil, value: contentItems.count)
|
||||
}
|
||||
|
||||
@@ -57,6 +58,18 @@ struct HorizontalCells: View {
|
||||
}
|
||||
}
|
||||
|
||||
struct ConditionalEdgeIgnoringSafeArea: ViewModifier {
|
||||
let navigationStyle: NavigationStyle
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
if navigationStyle == .tab {
|
||||
content.edgesIgnoringSafeArea(.horizontal)
|
||||
} else {
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct HorizontalCells_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
HorizontalCells(items: ContentItem.array(of: Video.allFixtures))
|
||||
|
||||
Reference in New Issue
Block a user