SwiftUI toolbar not showing on a NavigationLink view

I'm trying to show a toolbar on a view that is inside to navigation links. When I navigate to the third view I get the following message:

"2020-09-15 23:09:31.097289-0500 CountTime[35018:3542166] [Assert] displayModeButtonItem is internally managed and not exposed for DoubleColumn style. Returning an empty, disconnected UIBarButtonItem to fulfill the non-null contract."

And the toolbar is not shown. This happens only on iPhone, not iPad. I'm using Xcode 12 GM.

Here is the code:
Code Block
struct ContentView: View {
var body: some View {
NavigationView {
NavigationLink(
destination: SecondView(),
label: {
Text("Navigate")
})
}
}
}
struct SecondView: View {
var body: some View {
ZStack {
NavigationLink(
destination: Text("Destination")
.toolbar {
ToolbarItem(placement: ToolbarItemPlacement.bottomBar) {
Button(action: {
print("sharing")
}) {
Image(systemName: "square.and.arrow.up")
}
}
},
label: {
Text("Navigate")
})
}
}
}


Try adding the navigationViewStyle modifier with StackNavigationViewStyle() on your NavigationView (instead of using the DefaultNavigationViewStyle() or DoubleColumnNavigationViewStyle() ) and see if the issue goes away.

Should look something like this in code:

Code Block
NavigationView{
/*other embedded views*/
}
.navigationViewStyle(StackNavigationViewStyle())

If this navigation style suits you for navigating across your views, especially on larger screens, you should be good
SwiftUI toolbar not showing on a NavigationLink view
 
 
Q