diff --git a/Shared/Videos/HorizontalCells.swift b/Shared/Videos/HorizontalCells.swift index 129a57d4..296d0a90 100644 --- a/Shared/Videos/HorizontalCells.swift +++ b/Shared/Videos/HorizontalCells.swift @@ -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))