diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/UIKit/LabelledUIKitTextField.swift b/ui/BankingiOSApp/BankingiOSApp/ui/UIKit/LabelledUIKitTextField.swift index 9253f9cf..75fcd9e7 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/UIKit/LabelledUIKitTextField.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/UIKit/LabelledUIKitTextField.swift @@ -17,8 +17,8 @@ struct LabelledUIKitTextField: View { var focusOnStart = false var focusNextTextFieldOnReturnKeyPress = false - - var focusTextField: Binding = .constant(false) + + @State var focusTextField: Bool = false var isFocusedChanged: ((Bool) -> Void)? = nil @@ -37,9 +37,7 @@ struct LabelledUIKitTextField: View { HStack(alignment: .center) { Text(label) .onTapGesture { - DispatchQueue.main.async { - self.focusTextField.wrappedValue = true - } + self.focusTextField = true } Spacer() @@ -60,7 +58,7 @@ struct LabelledUIKitTextField: View { UIKitTextField(placeholder, text: $text, keyboardType: keyboardType, autocapitalizationType: autocapitalizationType, addDoneButton: addDoneButton, isPasswordField: isPasswordField, - focusOnStart: focusOnStart, focusNextTextFieldOnReturnKeyPress: focusNextTextFieldOnReturnKeyPress, focusTextField: focusTextField, + focusOnStart: focusOnStart, focusNextTextFieldOnReturnKeyPress: focusNextTextFieldOnReturnKeyPress, focusTextField: $focusTextField, isFocusedChanged: isFocusedChanged, textAlignment: .right, isUserInputEnabled: isUserInputEnabled, actionOnReturnKeyPress: actionOnReturnKeyPress, textChanged: textChanged) @@ -78,7 +76,7 @@ struct LabelledUIKitTextField: View { ) .onTapGesture { DispatchQueue.main.async { - self.focusTextField.wrappedValue = true + self.focusTextField = true } } } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/AddAccountDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/AddAccountDialog.swift index f274097e..e3975cb4 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/AddAccountDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/AddAccountDialog.swift @@ -44,7 +44,7 @@ struct AddAccountDialog: View { Section(header: Text("Online banking login data")) { LabelledUIKitTextField(label: "Online banking login name", text: $userName, placeholder: "Enter Online banking login name", autocapitalizationType: .none, - focusNextTextFieldOnReturnKeyPress: true, focusTextField: $focusLoginNameTextField, actionOnReturnKeyPress: handleReturnKeyPress) + focusNextTextFieldOnReturnKeyPress: true, focusTextField: focusLoginNameTextField, actionOnReturnKeyPress: handleReturnKeyPress) BankCredentialsPasswordView($password, $savePassword, handleReturnKeyPress) }