Created
November 6, 2024 15:43
-
-
Save VAndrJ/a96869b173da323748ea9b9eb3504be1 to your computer and use it in GitHub Desktop.
interactiveDismissDisabled issue.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
@State private var isSheetPresented = false | |
var body: some View { | |
NavigationStack { | |
Button("Present sheet") { | |
isSheetPresented = true | |
} | |
.sheet(isPresented: $isSheetPresented) { | |
DismissMeSheetView() | |
} | |
} | |
} | |
} | |
struct DismissMeSheetView: View { | |
@Environment(\.dismiss) private var dismiss | |
var body: some View { | |
NavigationStack { | |
NavigationLink("Next") { | |
Text("Dismiss me interactively") | |
.toolbar { | |
ToolbarItem { | |
Button("Dismiss") { | |
dismiss() | |
} | |
} | |
} | |
.interactiveDismissDisabled() | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment