Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behaviour after WrappingStack out of screen #6

Open
skywalkerlw opened this issue Aug 2, 2021 · 5 comments
Open

Strange behaviour after WrappingStack out of screen #6

skywalkerlw opened this issue Aug 2, 2021 · 5 comments

Comments

@skywalkerlw
Copy link

See attached video.

Kapture.2021-08-02.at.12.50.34.mp4

By the way, I'm using the latest version on iOS 14 (Xcode 12.5)

@diniska
Copy link
Owner

diniska commented Aug 2, 2021

Thanks for sharing this issue. I'll check what happens here in the next couple of days

@skywalkerlw
Copy link
Author

any potential update? Thanks

@diniska
Copy link
Owner

diniska commented Oct 6, 2021

@skywalkerlw it seems that there could be lots of the rows here and you are using List view. Is that about right?

@diniska
Copy link
Owner

diniska commented Oct 6, 2021

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
Copy link
Author

@skywalkerlw it seems that there could be lots of the rows here and you are using List view. Is that about right?

I'm using ScrollView + LazyVStack, and yes, it comes lots of list items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants