mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Redraw cells on change of videos
This commit is contained in:
parent
3a37ea656a
commit
d6b3c6637d
@ -7,7 +7,7 @@
|
||||
<key>Pearvidious (iOS).xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>2</integer>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>Pearvidious (macOS).xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
@ -17,7 +17,7 @@
|
||||
<key>Pearvidious (tvOS).xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
<key>Periphery (iOS).xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
|
@ -9,39 +9,29 @@ struct VideosCellsHorizontal: View {
|
||||
var videos = [Video]()
|
||||
|
||||
var body: some View {
|
||||
EmptyView().id("cellsTop")
|
||||
|
||||
ScrollViewReader { scrollView in
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
LazyHStack(spacing: 20) {
|
||||
ForEach(videos) { video in
|
||||
VideoView(video: video)
|
||||
.environment(\.horizontalCells, true)
|
||||
#if os(tvOS)
|
||||
.frame(width: 580)
|
||||
.padding(.trailing, 20)
|
||||
.padding(.bottom, 40)
|
||||
#else
|
||||
.frame(width: 300)
|
||||
#endif
|
||||
}
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
LazyHStack(spacing: 20) {
|
||||
ForEach(videos) { video in
|
||||
VideoView(video: video)
|
||||
.environment(\.horizontalCells, true)
|
||||
#if os(tvOS)
|
||||
.frame(width: 580)
|
||||
.padding(.trailing, 20)
|
||||
.padding(.bottom, 40)
|
||||
#else
|
||||
.frame(width: 300)
|
||||
#endif
|
||||
}
|
||||
#if os(tvOS)
|
||||
.padding(.horizontal, 40)
|
||||
.padding(.vertical, 30)
|
||||
#else
|
||||
.padding(.horizontal, 15)
|
||||
.padding(.vertical, 20)
|
||||
#endif
|
||||
}
|
||||
.onChange(of: videos) { [videos] newVideos in
|
||||
guard !videos.isEmpty else {
|
||||
return
|
||||
}
|
||||
|
||||
scrollView.scrollTo("cellsTop", anchor: .leading)
|
||||
}
|
||||
#if os(tvOS)
|
||||
.padding(.horizontal, 40)
|
||||
.padding(.vertical, 30)
|
||||
#else
|
||||
.padding(.horizontal, 15)
|
||||
.padding(.vertical, 20)
|
||||
#endif
|
||||
}
|
||||
.id(UUID())
|
||||
#if os(tvOS)
|
||||
.frame(height: 560)
|
||||
#else
|
||||
|
@ -9,31 +9,21 @@ struct VideosCellsVertical: View {
|
||||
var videos = [Video]()
|
||||
|
||||
var body: some View {
|
||||
EmptyView().id("cellsTop")
|
||||
|
||||
ScrollViewReader { scrollView in
|
||||
ScrollView(.vertical, showsIndicators: scrollViewShowsIndicators) {
|
||||
LazyVGrid(columns: items, alignment: .center) {
|
||||
ForEach(videos) { video in
|
||||
VideoView(video: video)
|
||||
#if os(tvOS)
|
||||
.padding(.horizontal)
|
||||
#endif
|
||||
}
|
||||
ScrollView(.vertical, showsIndicators: scrollViewShowsIndicators) {
|
||||
LazyVGrid(columns: items, alignment: .center) {
|
||||
ForEach(videos) { video in
|
||||
VideoView(video: video)
|
||||
#if os(tvOS)
|
||||
.padding(.horizontal)
|
||||
#endif
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
.onChange(of: videos) { [videos] newVideos in
|
||||
guard !videos.isEmpty else {
|
||||
return
|
||||
}
|
||||
|
||||
scrollView.scrollTo("cellsTop", anchor: .top)
|
||||
}
|
||||
#if os(tvOS)
|
||||
.padding(.horizontal, 10)
|
||||
#endif
|
||||
.padding()
|
||||
}
|
||||
.id(UUID())
|
||||
#if os(tvOS)
|
||||
.padding(.horizontal, 10)
|
||||
#endif
|
||||
.edgesIgnoringSafeArea(.horizontal)
|
||||
#if os(macOS)
|
||||
.background()
|
||||
|
Loading…
Reference in New Issue
Block a user