Q-Mobile / QGrid

🎛 QGrid: The missing SwiftUI collection view.
MIT License
1.64k stars 104 forks source link

MacOS build does not scroll #6

Closed alancook closed 4 years ago

alancook commented 4 years ago

MacOS build does not scroll works fine for IOS

alancook commented 4 years ago

Looks like this is a Apple bug in SwitIUI

jhoughjr commented 4 years ago

any ideas on a workaround?

jhoughjr commented 4 years ago

I can add that it does bounce vertically but doesn't scroll downward.

jhoughjr commented 4 years ago

in QGrid.swift by enabling the scroll indicators and making no other changes macOS version scrolls properly. This would lead me to believe it is not an OS bug but some side effect.

public var body : some View { GeometryReader { geometry in ScrollView(showsIndicators: true) { VStack(spacing: self.vSpacing) { ForEach((0..<self.rows).map { QGridIndex(id: $0) }) { row in self.rowAtIndex(row.id * self.cols, geometry: geometry) } // Handle last row if (self.data.count % self.cols > 0) { self.rowAtIndex(self.cols * self.rows, geometry: geometry, isLastRow: true) } } } .padding(.horizontal, self.hPadding) .padding(.vertical, self.vPadding) } }

nogginbox commented 4 years ago

I'm having this issue too.

I don't understand @jhoughjr's suggestion. Are you wrapping QGrid in a scroll view? Or is that a suggested fix to the QGrid code?