Location notes: add close (x) button in sheet header (upper-right) using @Environment(\.dismiss)

This commit is contained in:
jack
2025-09-13 00:55:47 +02:00
parent abeab5ae94
commit 52933568d7
+10
View File
@@ -6,6 +6,7 @@ struct LocationNotesView: View {
let geohash: String
@Environment(\.colorScheme) var colorScheme
@Environment(\.dismiss) private var dismiss
@State private var draft: String = ""
init(geohash: String) {
@@ -53,6 +54,15 @@ struct LocationNotesView: View {
.foregroundColor(secondaryTextColor)
}
Spacer()
Button(action: { dismiss() }) {
Image(systemName: "xmark")
.font(.system(size: 13, weight: .semibold, design: .monospaced))
.foregroundColor(textColor)
.frame(width: 32, height: 32)
.contentShape(Rectangle())
}
.buttonStyle(.plain)
.accessibilityLabel("Close")
}
.frame(height: 44)
.padding(.horizontal, 12)