在我的 ScrollView 中,其他 View 的顶部有 LazyVGrid 视图。滚动到底部后,当我慢慢滚动到顶部时,我注意到 LazyVGrid 视图消失了一段时间。这是我的快照(https://imgur.com/gallery/kFsgvgv)
struct ContentView: View {
var body: some View {
NavigationView {
GeometryReader { proxy in
ScrollView(.vertical) {
LazyVGrid(columns: proxy.size.width > proxy.size.height ? Array(repeating: GridItem(.flexible(), spacing: 15, alignment: .top), count: 2) : Array(repeating: GridItem(.flexible(), alignment: .top), count: 1)) {
ForEach(0..<6, id: \.self) { index in
Color(red: Double.random(in: 0...1), green: Double.random(in: 0...1), blue: Double.random(in: 0...1))
.frame(height: 300)
.id(index)
}
}
Color(red: Double.random(in: 0...1), green: Double.random(in: 0...1), blue: Double.random(in: 0...1))
.frame(height: 600)
}
}
}
}
}
我的问题是如何让 LazyVGrid 在滚动到顶部后出现。谢谢。