.sheet no longer dismissable in WatchOS 7?

In WatchOS 6 a presented .sheet could be dismissed by swiping down or tapping on the navigationBarTitle. In the WatchOS 7 beta, presented sheets are no longer dismissible by either method...forcing the addition of a button to dismiss.

It appears as if .sheet is now acting as .fullScreenCover within WatchOS 7.

Anyone else running into this? Wondering if this is now expected behavior on WatchOS or if it's a bug...

Replies

I am having exactly the same problem, only since watchOS 7 beta 5. My sheet no longer has the "Cancel" button in the top-left corner, it's just disappeared! Hopefully it's just a bug that will be gone in the next beta. I had no problem in beta 4.
Sounds like a bug. Please do file Feedback!
In the latest beta (watchOS 7 Beta 6), it now appears that the "Cancel" button has reappeared on sheets and tapping on it will close the sheet.

However, .sheet is still not dismissable in WatchOS 7 when the sheet .navigationBarTitle is set (e.g. to something more fitting for the context like "Back" or "Close").

Feedback has been filed (FB8535588)
I also have this same issue. on WatchOS7 when use navigationBarTitle(or navigiationTitle) change the title to "Done", it will show on top left corner but can not clickable.
If I use
Code Block
navigiationTitle{
button("Done"){
//Dismis the .sheet
}
}

the title bar will show a button after "cancle"?

What is the progress of this bug?
Not fixed in release watchOS 7. Sheets not dismissible when we have a custom navigationBarTitle set.

As of now, the only option is to remove the title or have a custom button for the dismiss action.

Has anyone found any other solution/workaround?


Seems to continue in watchOS 8. I have filed feedback about this with the release of watchOS 7 already. (FB9055341)

EDIT: On Stackoverflow I found out that this issue is actually due to a SwiftUI change. The title of a sheet on watchOS is no longer an actual title, but a button in a toolbar. To change it you can overwrite the toolbar:

MySheet().toolbar {

                ToolbarItem(placement: .cancellationAction) {

                    Button(title, action: action)

                }

            }

In the action you can use the environment value for presentationMode to close the sheet.

The button will be clickable and it will replace the cancel title. So this is more a documentation and restructuring issue that almost no one caught.

Source: https://stackoverflow.com/a/64194674/1203713

The fix is actually much simpler (at least for me running watchOS 10). If you embed your sheet view in a navigation stack like this, there will be a little circular "X" button at the top left of your sheet.

MyMainView()
  .sheet {
    NavigationStack {
      MySheetView()
    }
  }

As it turns out, the default cancel button is embedded in the toolbar, and the toolbar doesn't show up at all unless your view is embedded in a navigation stack