GridStack icon indicating copy to clipboard operation
GridStack copied to clipboard

cellWidth is negative

Open chatsopond opened this issue 4 years ago • 1 comments

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

chatsopond avatar Mar 12 '21 11:03 chatsopond

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

Khronoss avatar Mar 16 '21 13:03 Khronoss