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

cellWidth is negative #16

Open
chatsopond opened this issue Mar 12, 2021 · 1 comment
Open

cellWidth is negative #16

chatsopond opened this issue Mar 12, 2021 · 1 comment

Comments

@chatsopond
Copy link

Screen Shot 2564-03-12 at 17 58 13

struct ContentView: View {
    
    // Setup
    init() {
        UITableView.appearance().backgroundColor = .clear
        // UITableViewCell.appearance().backgroundColor = .clear
    }
    
    var body: some View {
        NavigationView{
            Sidebar()
                .navigationTitle("Recon")
            GridStack(minCellWidth: 300, spacing: 2, numItems: 15) { (index, cellWidth) in
                Text("\(index)")
                    .frame(width: cellWidth, height: 100)
                    .background(Color.blue)
            } 
        }
    }
}
@Khronoss
Copy link

Hi!

Seems like a guard is missing for when the calculated size is lower than 0

There is also a flaw in your code under the NavigationView, you cannot just add your Sidebar and your GridStack under the NavigationView, you have to put them under either a Vstack or a HStack depending of what's your intention

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