Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
3e9436791a
commit
fb5260f603
@ -109,6 +109,8 @@ struct BusinessCardApp: App {
|
||||
RootTabView()
|
||||
.environment(appState)
|
||||
.preferredColorScheme(appState.preferredColorScheme)
|
||||
.autocorrectionDisabled(true)
|
||||
.textInputAutocapitalization(.never)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,3 +196,23 @@ extension Color {
|
||||
/// Legacy alias - use AppText instead
|
||||
typealias Text = AppText
|
||||
}
|
||||
|
||||
// MARK: - Keyboard Dismiss Helpers
|
||||
|
||||
private struct KeyboardDismissModifier: ViewModifier {
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.autocorrectionDisabled(true)
|
||||
.textInputAutocapitalization(.never)
|
||||
.scrollDismissesKeyboard(.interactively)
|
||||
}
|
||||
}
|
||||
|
||||
extension View {
|
||||
/// Adds standard iOS keyboard dismissal behavior:
|
||||
/// - interactive scroll-to-dismiss
|
||||
/// - keyboard accessory Done button
|
||||
func keyboardDismissable() -> some View {
|
||||
modifier(KeyboardDismissModifier())
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,6 +240,7 @@ struct CardEditorView: View {
|
||||
.safeAreaInset(edge: .bottom) {
|
||||
PreviewCardButton { showingPreview = true }
|
||||
}
|
||||
.keyboardDismissable()
|
||||
.navigationTitle(isEditing ? String.localized("Edit Card") : String.localized("New Card"))
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
@ -1048,17 +1049,28 @@ private struct AccreditationsRow: View {
|
||||
|
||||
private struct PreviewCardButton: View {
|
||||
let action: () -> Void
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
|
||||
var body: some View {
|
||||
Button(action: action) {
|
||||
Text("Preview card")
|
||||
.typography(.heading)
|
||||
.foregroundStyle(.white)
|
||||
.foregroundStyle(Color.AppText.inverted)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(Design.Spacing.medium)
|
||||
.background(Color.Text.primary)
|
||||
.background(AppThemeAccent.primary)
|
||||
.clipShape(.rect(cornerRadius: Design.CornerRadius.large))
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: Design.CornerRadius.large)
|
||||
.stroke(
|
||||
colorScheme == .dark
|
||||
? Color.white.opacity(Design.Opacity.subtle)
|
||||
: Color.black.opacity(Design.Opacity.light),
|
||||
lineWidth: Design.LineWidth.thin
|
||||
)
|
||||
)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.padding(.horizontal, Design.Spacing.large)
|
||||
.padding(.vertical, Design.Spacing.medium)
|
||||
.background(.ultraThinMaterial)
|
||||
|
||||
@ -13,7 +13,7 @@ struct ContactFieldPickerView: View {
|
||||
HStack {
|
||||
Text("Tap a field below to add it")
|
||||
.typography(.subheading)
|
||||
.foregroundStyle(Color.Text.primary)
|
||||
.foregroundStyle(Color.Text.secondary)
|
||||
|
||||
Spacer()
|
||||
|
||||
@ -23,7 +23,7 @@ struct ContactFieldPickerView: View {
|
||||
}
|
||||
.padding(.horizontal, Design.Spacing.medium)
|
||||
.padding(.vertical, Design.Spacing.small)
|
||||
.background(Color.AppBackground.accent)
|
||||
.background(Color.AppBackground.secondary)
|
||||
.clipShape(.rect(cornerRadius: Design.CornerRadius.medium))
|
||||
|
||||
LazyVGrid(columns: columns, spacing: Design.Spacing.large) {
|
||||
@ -35,7 +35,12 @@ struct ContactFieldPickerView: View {
|
||||
}
|
||||
}
|
||||
.padding(Design.Spacing.large)
|
||||
.background(Color.AppBackground.elevated)
|
||||
.background(Color.AppBackground.secondary)
|
||||
.clipShape(.rect(cornerRadius: Design.CornerRadius.large))
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: Design.CornerRadius.large)
|
||||
.stroke(Color.Text.tertiary.opacity(Design.Opacity.subtle), lineWidth: Design.LineWidth.thin)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -606,6 +606,7 @@ private struct AddNoteSheet: View {
|
||||
.padding(Design.Spacing.medium)
|
||||
.navigationTitle(String.localized("Notes"))
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.keyboardDismissable()
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .cancellationAction) {
|
||||
Button(String.localized("Cancel")) {
|
||||
|
||||
@ -187,6 +187,7 @@ struct AddContactSheet: View {
|
||||
}
|
||||
.navigationTitle(String.localized("New contact"))
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.keyboardDismissable()
|
||||
.sheet(isPresented: $showingPhotoSourcePicker, onDismiss: {
|
||||
guard let action = pendingAction else { return }
|
||||
pendingAction = nil
|
||||
|
||||
@ -190,6 +190,7 @@ struct ContactFieldEditorSheet: View {
|
||||
.background(Color.AppBackground.base)
|
||||
.navigationTitle(isEditing ? "Edit \(fieldType.displayName)" : "Add \(fieldType.displayName)")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.keyboardDismissable()
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .cancellationAction) {
|
||||
Button {
|
||||
|
||||
@ -35,6 +35,7 @@ struct RecordContactSheet: View {
|
||||
}
|
||||
.navigationTitle(String.localized("Track Share"))
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.keyboardDismissable()
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .cancellationAction) {
|
||||
Button(String.localized("Cancel")) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user