mirror of
https://github.com/yattee/yattee.git
synced 2025-04-26 08:36:29 +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>
|
<key>Pearvidious (iOS).xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>2</integer>
|
<integer>1</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>Pearvidious (macOS).xcscheme_^#shared#^_</key>
|
<key>Pearvidious (macOS).xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
@ -17,7 +17,7 @@
|
|||||||
<key>Pearvidious (tvOS).xcscheme_^#shared#^_</key>
|
<key>Pearvidious (tvOS).xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>1</integer>
|
<integer>2</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>Periphery (iOS).xcscheme_^#shared#^_</key>
|
<key>Periphery (iOS).xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
@ -9,9 +9,6 @@ struct VideosCellsHorizontal: View {
|
|||||||
var videos = [Video]()
|
var videos = [Video]()
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
EmptyView().id("cellsTop")
|
|
||||||
|
|
||||||
ScrollViewReader { scrollView in
|
|
||||||
ScrollView(.horizontal, showsIndicators: false) {
|
ScrollView(.horizontal, showsIndicators: false) {
|
||||||
LazyHStack(spacing: 20) {
|
LazyHStack(spacing: 20) {
|
||||||
ForEach(videos) { video in
|
ForEach(videos) { video in
|
||||||
@ -34,14 +31,7 @@ struct VideosCellsHorizontal: View {
|
|||||||
.padding(.vertical, 20)
|
.padding(.vertical, 20)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
.onChange(of: videos) { [videos] newVideos in
|
.id(UUID())
|
||||||
guard !videos.isEmpty else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
scrollView.scrollTo("cellsTop", anchor: .leading)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.frame(height: 560)
|
.frame(height: 560)
|
||||||
#else
|
#else
|
||||||
|
@ -9,9 +9,6 @@ struct VideosCellsVertical: View {
|
|||||||
var videos = [Video]()
|
var videos = [Video]()
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
EmptyView().id("cellsTop")
|
|
||||||
|
|
||||||
ScrollViewReader { scrollView in
|
|
||||||
ScrollView(.vertical, showsIndicators: scrollViewShowsIndicators) {
|
ScrollView(.vertical, showsIndicators: scrollViewShowsIndicators) {
|
||||||
LazyVGrid(columns: items, alignment: .center) {
|
LazyVGrid(columns: items, alignment: .center) {
|
||||||
ForEach(videos) { video in
|
ForEach(videos) { video in
|
||||||
@ -23,17 +20,10 @@ struct VideosCellsVertical: View {
|
|||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
.onChange(of: videos) { [videos] newVideos in
|
.id(UUID())
|
||||||
guard !videos.isEmpty else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
scrollView.scrollTo("cellsTop", anchor: .top)
|
|
||||||
}
|
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
.padding(.horizontal, 10)
|
.padding(.horizontal, 10)
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
.edgesIgnoringSafeArea(.horizontal)
|
.edgesIgnoringSafeArea(.horizontal)
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
.background()
|
.background()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user