swiftui-wrapping-stack
swiftui-wrapping-stack copied to clipboard
Strange behaviour after WrappingStack out of screen
See attached video.
https://user-images.githubusercontent.com/2090084/127798187-fb63ef7f-f967-47ff-8a00-394df584235e.mp4
By the way, I'm using the latest version on iOS 14 (Xcode 12.5)
Thanks for sharing this issue. I'll check what happens here in the next couple of days
any potential update? Thanks
@skywalkerlw it seems that there could be lots of the rows here and you are using List view. Is that about right?
Here is the code that reproduces the issue:
import SwiftUI
import WrappingStack
private struct Item {
var title: String
var subtitle: String
var content: [String]
}
struct ContentView: View {
private let items = (0 ..< 100).map { index in
Item(
title: "\(index): \(Int.random(in: 100_000 ... 200_000))",
subtitle: String(Int.random(in: 100_000 ... 200_000)),
content: (0 ..< Int.random(in: 2 ..< 10)).map { _ in
String(Int.random(in: 100_000 ... 200_000))
}
)
}
var body: some View {
List(Array(items.enumerated()), id: \.offset) { i in
VStack {
Text(i.element.title).font(.headline)
Text(i.element.subtitle).font(.body)
WrappingHStack(id: \.self) {
ForEach(i.element.content, id: \.self) {
Text($0)
.padding()
.background(Color.gray.opacity(0.5))
}
}
}
.padding()
.cornerRadius(8)
.background(Color.white)
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
@skywalkerlw it seems that there could be lots of the rows here and you are using
Listview. Is that about right?
I'm using ScrollView + LazyVStack, and yes, it comes lots of list items