Closed Rspoon3 closed 3 years ago
Hi Ricky,
Thanks for opening the issue. This looks like some default SwiftUI behaviour unrelated to ASCollectionView. Try setting a non-empty navigation title and you'll see where this space is coming from 👍
SwiftUI defaults to using the 'large title' style, which is visible even when the nav-bar is hidden. To fix this simply use .navigationBarTitle("", displayMode: .inline)
Hope that helps!
Thanks for being super responsive👊🏽
I've tried your suggestion and unfortunately that doesn't fix it. You were right that the extra space is due to the large title being the default behavior, however by changing it to be inline, the navigation view is still there, just smaller.
I'm also not sure that it is entirely SwiftUI behavior because if you comment out the ASCollectionView it works as expected. I have included additional screenshots below.
With the collection view
Without the collection view
I'm not sure why this would be happening! Perhaps you have nested multiple NavigationViews? It's a long shot, but try setting .navigationBarHidden(true)
outside your NavigationView { ... }
as well.
Setting it outside of the navigation view (by itself and as well as inside) have no effect. There is also only one Navigation View, so its not a nesting problem.
I'm wondering if it has to do with the fact that AS_CollectionViewController is a view controller and the navigation menu needs to be hidden in that as well.
have the same issue as well
@Rspoon3 @mengdun Strangely I can't get this to happen locally, which is making debugging hard. Is this happening only in when presented in a sheet
modal? Or all of the time?
@apptekstudios for me it happens all the time, tried to hide the navigation bar in the example app (the AdjustableGridScreen view), it doesn't work, it works to hide navigationbar title or back button, but not hiding the entire nav bar, thanks
@apptekstudios Yes, I ams presenting it in a sheet. In addition to my earlier screenshot, this is the only other code.
I too am seeing this behavior with hidden navigation being un-hidden on data load. See that there is fix in place (YES!). Will this fix be in 1.7.2 release?
Adding .navigationBarTitle("", displayMode: .inline).navigationBarHidden(true).navigationBarBackButtonHidden(true)
to the item layout can solve this problem.
eg:
ASCollectionView(data: dataExample, dataID: \.self) { item, _ in
Color.blue
.overlay(Text("\(item)"))
.navigationBarTitle("", displayMode: .inline)
.navigationBarHidden(true)
.navigationBarBackButtonHidden(true)
}
So it seems like it's a SwiftUI issue as it for some reason tries to access parent's view controller's navigation controller. Which happens on ACCollectionView cell will appear, (when it adds internal cell hosting view controller as a child)
Describe the bug If you try to hide the navigation bar on a view with ASCollectionView, the navigation bar always shows to some degree.
To Reproduce Steps to reproduce the behavior: On the TagsScreen of the demo project add the following to the outermost VStack:
.navigationBarTitle("") .navigationBarHidden(true) .navigationBarBackButtonHidden(true)
Expected behaviour The navigation bar should be completely hidden, and there should be not available space for it.
Screenshots I colored the outer most VStack red to show that its not taking but the full height.
Simulator, Device, Both? Tested on Xcode 11.5 simulator