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,9 +9,6 @@ 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
|
||||
@ -34,14 +31,7 @@ struct VideosCellsHorizontal: View {
|
||||
.padding(.vertical, 20)
|
||||
#endif
|
||||
}
|
||||
.onChange(of: videos) { [videos] newVideos in
|
||||
guard !videos.isEmpty else {
|
||||
return
|
||||
}
|
||||
|
||||
scrollView.scrollTo("cellsTop", anchor: .leading)
|
||||
}
|
||||
}
|
||||
.id(UUID())
|
||||
#if os(tvOS)
|
||||
.frame(height: 560)
|
||||
#else
|
||||
|
@ -9,9 +9,6 @@ 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
|
||||
@ -23,17 +20,10 @@ struct VideosCellsVertical: View {
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
.onChange(of: videos) { [videos] newVideos in
|
||||
guard !videos.isEmpty else {
|
||||
return
|
||||
}
|
||||
|
||||
scrollView.scrollTo("cellsTop", anchor: .top)
|
||||
}
|
||||
.id(UUID())
|
||||
#if os(tvOS)
|
||||
.padding(.horizontal, 10)
|
||||
#endif
|
||||
}
|
||||
.edgesIgnoringSafeArea(.horizontal)
|
||||
#if os(macOS)
|
||||
.background()
|
||||
|
Loading…
Reference in New Issue
Block a user