Q-Mobile / QGrid

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

Warning on macOS: Invalid frame dimension (negative or non-finite) #47

Open patrick-fu opened 3 years ago

patrick-fu commented 3 years ago

On macOS 11.1, when a View is loaded for the first time, the size obtained by GeometryReader is incorrect, resulting in a negative frame value, causing this warning. The real size can only be obtained the second time, as shown in the screenshot.

Screenshot2020-12-17 15 31 46

keylook commented 3 years ago

Same on tvOS

shywoody commented 2 years ago

try this, it works for me ~

.frame(width:abs(self.contentWidthFor(geometry)))