Q-Mobile / QGrid

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

Safe Area causing some problems when contained in a NavigationView #14

Closed andreas-braun-parship closed 4 years ago

andreas-braun-parship commented 4 years ago

I noticed that the QGrid only works well when not contained in a NavigationView.

It seems to not correctly respect the safe area and cuts off part of the UI that seem to have the hight of the navigation bar.

Here are some examples of what I mean:

Simulator Screen Shot - iPhone 11 Pro Max - 2019-10-22 at 11 22 03

As you can see part of the UI underneath the navigation bar is cut out. Also the lower part of the grid is cut out due to the home indicator.

NavigationView {
    QGrid(profiles, columns: 2) { profile in
        ProfileCardView(profile: profile)
    }
}

If I add the .edgesIgnoringSafeArea([.all]) to the grid, this is what happens:

Simulator Screen Shot - iPhone 11 Pro Max - 2019-10-22 at 11 24 24

NavigationView {
    QGrid(profiles, columns: 2) { profile in
        ProfileCardView(profile: profile)
    }
    .edgesIgnoringSafeArea(.all)
}
karolkulesza commented 4 years ago

Thanks for the feedback.

By default, QGrid specifies non-zero values for its vPadding and hPadding parameters. Specifying no padding (vPadding: 0) in this precise use case should address this issue. (It's not related to safe areas)