Skip to content

Commit

Permalink
Merge pull request #220 from moneymanagerex/view-15-keyboard
Browse files Browse the repository at this point in the history
dismiss keyboard
  • Loading branch information
georgeef authored Nov 7, 2024
2 parents 2b38fec + 6c46e63 commit b36eae6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
8 changes: 4 additions & 4 deletions MMEX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
A3C142A22C90267F00D3CEC0 /* CategoryRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142A12C90267F00D3CEC0 /* CategoryRepository.swift */; };
A3C142A42C9033E300D3CEC0 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142A32C9033E300D3CEC0 /* SettingsView.swift */; };
A3C142A62C90417700D3CEC0 /* EnterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142A52C90417700D3CEC0 /* EnterView.swift */; };
A3C142A82C906E0A00D3CEC0 /* CustomNumberPadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142A72C906E0A00D3CEC0 /* CustomNumberPadView.swift */; };
A3C142A82C906E0A00D3CEC0 /* Keyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142A72C906E0A00D3CEC0 /* Keyboard.swift */; };
A3C142AA2C90721800D3CEC0 /* JournalView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142A92C90721800D3CEC0 /* JournalView.swift */; };
A3C142AC2C909C1C00D3CEC0 /* EnterEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142AB2C909C1C00D3CEC0 /* EnterEditView.swift */; };
A3C142AE2C9134DD00D3CEC0 /* InsightsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142AD2C9134DD00D3CEC0 /* InsightsView.swift */; };
Expand Down Expand Up @@ -351,7 +351,7 @@
A3C142A12C90267F00D3CEC0 /* CategoryRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryRepository.swift; sourceTree = "<group>"; };
A3C142A32C9033E300D3CEC0 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
A3C142A52C90417700D3CEC0 /* EnterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnterView.swift; sourceTree = "<group>"; };
A3C142A72C906E0A00D3CEC0 /* CustomNumberPadView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomNumberPadView.swift; sourceTree = "<group>"; };
A3C142A72C906E0A00D3CEC0 /* Keyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Keyboard.swift; sourceTree = "<group>"; };
A3C142A92C90721800D3CEC0 /* JournalView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JournalView.swift; sourceTree = "<group>"; };
A3C142AB2C909C1C00D3CEC0 /* EnterEditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnterEditView.swift; sourceTree = "<group>"; };
A3C142AD2C9134DD00D3CEC0 /* InsightsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InsightsView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -810,7 +810,7 @@
A39B1B3B2C9A66CB003E5562 /* Transaction */,
925EAC182CDA8F0C003CEAB3 /* Tag */,
925EAC252CDAB11C003CEAB3 /* Attachment */,
A3C142A72C906E0A00D3CEC0 /* CustomNumberPadView.swift */,
A3C142A72C906E0A00D3CEC0 /* Keyboard.swift */,
);
path = View;
sourceTree = "<group>";
Expand Down Expand Up @@ -990,7 +990,7 @@
A3C142AE2C9134DD00D3CEC0 /* InsightsView.swift in Sources */,
925EAB9B2CCDB60B003CEAB3 /* CategoryList.swift in Sources */,
925EABA32CCF8146003CEAB3 /* CurrencyValidation.swift in Sources */,
A3C142A82C906E0A00D3CEC0 /* CustomNumberPadView.swift in Sources */,
A3C142A82C906E0A00D3CEC0 /* Keyboard.swift in Sources */,
924353372CCD2DDA0052E4BC /* PayeeGroup.swift in Sources */,
924353492CCD36890052E4BC /* CurrencyList.swift in Sources */,
924352FA2CB355CF0052E4BC /* SettingsThemeView.swift in Sources */,
Expand Down
3 changes: 3 additions & 0 deletions MMEX/View/Enter/EnterEditView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ struct EnterEditView: View {
Spacer() // Push the contents to the top
}
.padding(.horizontal)
.onTapGesture {
hideKeyboard()
}
.onAppear {
// Initialize state variables from the txn object when the view appears
let dateFormatter = DateFormatter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@

import SwiftUI

extension View {
func hideKeyboard() {
let resign = #selector(UIResponder.resignFirstResponder)
UIApplication.shared.sendAction(resign, to: nil, from: nil, for: nil)
}
}

struct CustomNumberPadView: View {
@Binding var input: String

Expand Down
1 change: 1 addition & 0 deletions MMEX/View/Repository/RepositoryUpdateView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct RepositoryUpdateView<
editView($data, true)
}
.textSelection(.enabled)
.scrollDismissesKeyboard(.immediately)
.navigationTitle(title)
.toolbar {
ToolbarItem(placement: .cancellationAction) {
Expand Down

0 comments on commit b36eae6

Please sign in to comment.