Having issues with .sheet and .dismiss()

Hello

When I dismiss my .sheet it is very slow and sometimes it doesn't work

Code Block
.sheet(isPresented: $myViewi) {
        MyView()      
}

Code Block
@Environment(\.presentationMode) var presentationMode

Code Block
.navigationBarItems(trailing:
          Button(action: {
   presentationMode.wrappedValue.dismiss()
                                        }) {
                                            Image(systemName: "xmark").font(.title).foregroundColor(.blue)
                                        }
                )

How do I fix it?
Thank You
I created a simple project and tried your code.
The sheet dismissed immediately when I tap ×.

So, the cause of the issue might exist in a hidden part of your code.
Can you create a project which can reproduce the same issue and show whole code of it?

Were you able to find a solution to this? Thank you

Having issues with .sheet and .dismiss()
 
 
Q