I have a simple list with a navigation view, where the navigation view is overlapping the list while scrolling.
Here is what I am getting with the overlap
Here is the code
struct MedicalDashboard: View {
let menuItemData = MenuItemList()
var body: some View {
NavigationView {
List(menuItemData.items, id: .id) { item in
MenuItemRow(menuItem: item)
}
.listStyle(.insetGrouped)
.navigationTitle("Dashboard")
.navigationBarItems(trailing:
Button(action: {
// TODO: - Pop up a sheet for the settings page.
print("User icon pressed...")
}) {
Image(systemName: "person.crop.circle").imageScale(.large)
}
)
.padding(.top)
}
}
}
when I add padding(.top) the overlap stops but I get a different color background on the navigation
2
Answers
Try this:
Swift
On Xcode 13.4, except a missing
}
, without the.padding(.top)
and with a customList
everything works like a charm for me.The problem might come from
MenuItemList()
.I have still updated your code by replacing
.navigationBarItems
and by adding the sheet for you:Edit your post and show us
MenuItemList()
.