Files
yattee/Shared/Videos/ListView.swift
Arkadiusz Fal a0a54bced9 Improve layout stability and disable unwanted animations
Added height reservation to FavoriteItemView to prevent layout shifts during content loading. Changed HomeView to use LazyVStack for better performance. Converted QueueView from LazyVStack to VStack. Disabled animations on content count changes across multiple views to prevent jarring layout transitions. Added width constraint to stream button in PlaybackSettings.
2025-11-14 20:02:07 +01:00

29 lines
740 B
Swift

import SwiftUI
struct ListView: View {
var items: [ContentItem]
var limit: Int?
var body: some View {
LazyVStack(alignment: .leading) {
ForEach(limitedItems) { item in
ContentItemView(item: item)
.environment(\.listingStyle, .list)
.environment(\.noListingDividers, limit == 1)
.transition(.identity)
}
}
.animation(nil, value: limitedItems.count)
}
var limitedItems: [ContentItem] {
Array(items.prefix(limit ?? items.count))
}
}
struct ListView_Previews: PreviewProvider {
static var previews: some View {
ListView(items: [.init(video: .fixture)], limit: 10)
}
}