QGrid
QGrid copied to clipboard
When opening app in landscape, wrong number of columns displayed
The wrong number of columns are displayed, when opening the app directly in landscape. The initial device orientation is not detected.
Cannot reproduce. Are you able to provide more details? Are you using the test app delivered within this repo? If not, please provide sample code. Which device/simulator are you testing on? (with exact iOS version).
The problem can be reproduced as follows:
- Use QGrid within a NavigationLink
struct DataPoint: Identifiable{
var id = UUID()
var name:String
}
struct ContentView: View {
var data:Array<DataPoint> = [DataPoint(name: "A"), DataPoint(name: "B"), DataPoint(name: "C"), DataPoint(name: "D"), DataPoint(name: "E"), DataPoint(name: "F"), DataPoint(name: "G"), DataPoint(name: "H"), DataPoint(name: "J"), DataPoint(name: "K"), DataPoint(name: "L"), DataPoint(name: "M")]
var body: some View {
NavigationView{
NavigationLink(destination:
QGrid(data,
columns: 1,
columnsInLandscape: 4,
content: { data in
VStack{
Text(data.name)
}
})
){
Text("navigate to QGrid")
}
}
}
}
-
Start simulator and rotate it to landscape.
-
Build and run application.
-
Navigate to QGrid.
:warning: This shows the wrong number of columns.
- Rotate device to portrait and back to landscape.

:heavy_check_mark: This shows the correct amount of columns.