4

Inside my ScrollView, there is LazyVGrid view on the top of other View. After scrolling to bottom, when I scroll to top slowly, I notice that LazyVGrid view disappears for a while. Here is my snapshot (https://i.stack.imgur.com/uDLZ2.jpg)

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)
                }
            }
        }
    }
}

My question is how to make LazyVGrid to appear after scrolling to top. Thanks.

Dscyre Scotti
  • 1,307
  • 10
  • 17
  • Having the same issue. I ended up building a UI to replace what LazyVGrid is supposed to make easy to do, but that is frustrating. Have you found a fix? – Kuringan Jul 25 '21 at 16:34
  • I didn't find anything. I just tested my code in Xcode 13.0 beta 3 again and it worked as I expected. Here is a [link](https://imgur.com/gallery/7Kms2Zj) that I recorded. – Dscyre Scotti Jul 26 '21 at 04:01

0 Answers0