SwiftUI navigation bar items going haywire when swipe back fails

I have a

ListView
,
TasksView
and then
EditView
.

The flow goes like this: you have a list cell, you tap that which takes you to

TasksView
When a row is tapped in
TasksView
it takes you to
EditView
.

When I half swipe back to navigate to previous view the navigation bar go bezerk and overlaps. It happens mainly if I use a navigationBarItem - (button).

In

TasksView (detailView)
there is a list and some navigation bar modifiers:


ZStack {
  List {
  // code here
 }

}
.onAppear { UITableView.appearance().separatorStyle = .none }
.onDisappear { UITableView.appearance().separatorStyle = .none }
.background(Color("primaryBackground"))
.edgesIgnoringSafeArea(.bottom)
.navigationBarTitle("\(listItem.name ?? "")", displayMode: .inline)
.navigationBarItems(trailing:
  Button(action: {self.deleteList()}) {
  Image(systemName: "trash.circle.fill")
  }
  )


Same can be said for

EditView
, that when you half swipe on
EditView
to get back to
TasksView
, the same thing happens.

Here is the bug in action


Any idea how to go about fixing this error?

Replies

I'm experiencing the same issue. It is semi-random. It would appear to be a a SwiftUI bug as I can reproduce it in a variety of applications, with and without stacks, etc.

imgur.com/mfNcqDt
Same here. Any Solutions available for this?
It seems that .navigationViewStyle(StackNavigationViewStyle()) fixes the Issue.
But it disables all the nice Sidebar Features on iPad so its also just a temporary workaround.
I had the same issue, so I decided to make a custom nav bar with a view modifier.
But now, I think I found another solution.
If you're using a NavigationLink of SwiftUI, try this:
Code Block Swift
NavigationLink("Link Title", destination: ChildView())
.isDetailLink(false) // << This


Add a Comment