Implemented setting keyboard auto capitalization type
This commit is contained in:
parent
9dc6c0c5c0
commit
5f8e5463e5
|
@ -10,6 +10,7 @@ struct LabelledUIKitTextField: View {
|
|||
var placeholder: String = ""
|
||||
|
||||
var keyboardType: UIKeyboardType = .default
|
||||
var autocapitalizationType: UITextAutocapitalizationType = .sentences
|
||||
var isPasswordField: Bool = false
|
||||
|
||||
var focusOnStart = false
|
||||
|
@ -45,7 +46,7 @@ struct LabelledUIKitTextField: View {
|
|||
|
||||
Spacer()
|
||||
|
||||
UIKitTextField(placeholder, text: $text, keyboardType: keyboardType, isPasswordField: isPasswordField,
|
||||
UIKitTextField(placeholder, text: $text, keyboardType: keyboardType, autocapitalizationType: autocapitalizationType, isPasswordField: isPasswordField,
|
||||
focusOnStart: focusOnStart, focusNextTextFieldOnReturnKeyPress: focusNextTextFieldOnReturnKeyPress, focusTextField: focusTextFieldBinding,
|
||||
isFocussedChanged: isFocussedChanged, textAlignment: .right, isUserInputEnabled: isUserInputEnabled,
|
||||
actionOnReturnKeyPress: actionOnReturnKeyPress, textChanged: textChanged)
|
||||
|
|
|
@ -11,6 +11,7 @@ struct UIKitTextField: UIViewRepresentable {
|
|||
private var placeholder: String
|
||||
|
||||
private var keyboardType: UIKeyboardType = .default
|
||||
private var autocapitalizationType: UITextAutocapitalizationType = .sentences
|
||||
private var isPasswordField: Bool = false
|
||||
|
||||
private var focusOnStart = false
|
||||
|
@ -27,8 +28,8 @@ struct UIKitTextField: UIViewRepresentable {
|
|||
private var textChanged: ((String) -> Void)? = nil
|
||||
|
||||
|
||||
init(_ titleKey: String, text: Binding<String>, keyboardType: UIKeyboardType = .default, isPasswordField: Bool = false,
|
||||
focusOnStart: Bool = false, focusNextTextFieldOnReturnKeyPress: Bool = false, focusTextField: Binding<Bool> = .constant(false),
|
||||
init(_ titleKey: String, text: Binding<String>, keyboardType: UIKeyboardType = .default, autocapitalizationType: UITextAutocapitalizationType = .sentences,
|
||||
isPasswordField: Bool = false, focusOnStart: Bool = false, focusNextTextFieldOnReturnKeyPress: Bool = false, focusTextField: Binding<Bool> = .constant(false),
|
||||
isFocussedChanged: ((Bool) -> Void)? = nil,
|
||||
textAlignment: NSTextAlignment = .natural, isUserInputEnabled: Bool = true,
|
||||
actionOnReturnKeyPress: (() -> Bool)? = nil, textChanged: ((String) -> Void)? = nil) {
|
||||
|
@ -36,6 +37,7 @@ struct UIKitTextField: UIViewRepresentable {
|
|||
_text = text
|
||||
|
||||
self.keyboardType = keyboardType
|
||||
self.autocapitalizationType = autocapitalizationType
|
||||
self.isPasswordField = isPasswordField
|
||||
|
||||
self.focusOnStart = focusOnStart
|
||||
|
@ -57,6 +59,7 @@ struct UIKitTextField: UIViewRepresentable {
|
|||
textField.placeholder = placeholder.localize()
|
||||
|
||||
textField.keyboardType = keyboardType
|
||||
textField.autocapitalizationType = autocapitalizationType
|
||||
textField.isSecureTextEntry = isPasswordField
|
||||
|
||||
textField.delegate = context.coordinator
|
||||
|
|
|
@ -38,10 +38,10 @@ struct AddAccountDialog: View {
|
|||
|
||||
Section {
|
||||
LabelledUIKitTextField(label: "Online banking login name", text: $customerId, placeholder: "Enter Online banking login name",
|
||||
focusNextTextFieldOnReturnKeyPress: true, actionOnReturnKeyPress: handleReturnKeyPress)
|
||||
autocapitalizationType: .none, focusNextTextFieldOnReturnKeyPress: true, actionOnReturnKeyPress: handleReturnKeyPress)
|
||||
|
||||
LabelledUIKitTextField(label: "Online banking login password", text: $password, placeholder: "Enter Online banking login password",
|
||||
isPasswordField: true, actionOnReturnKeyPress: handleReturnKeyPress)
|
||||
autocapitalizationType: .none, isPasswordField: true, actionOnReturnKeyPress: handleReturnKeyPress)
|
||||
}
|
||||
|
||||
Section {
|
||||
|
|
|
@ -31,7 +31,7 @@ struct BankAccountSettingsDialog: View {
|
|||
var body: some View {
|
||||
Form {
|
||||
Section {
|
||||
LabelledUIKitTextField(label: "Name", text: $displayName)
|
||||
LabelledUIKitTextField(label: "Name", text: $displayName, autocapitalizationType: .none)
|
||||
}
|
||||
|
||||
Section {
|
||||
|
|
|
@ -53,9 +53,9 @@ struct BankSettingsDialog: View {
|
|||
}
|
||||
|
||||
Section(header: Text("Credentials")) {
|
||||
LabelledUIKitTextField(label: "Online banking login name", text: $customerId)
|
||||
LabelledUIKitTextField(label: "Online banking login name", text: $customerId, autocapitalizationType: .none)
|
||||
|
||||
LabelledUIKitTextField(label: "Online banking login password", text: $password, isPasswordField: true)
|
||||
LabelledUIKitTextField(label: "Online banking login password", text: $password, autocapitalizationType: .none, isPasswordField: true)
|
||||
}
|
||||
|
||||
Section {
|
||||
|
|
|
@ -105,7 +105,7 @@ struct EnterTanDialog: View {
|
|||
.padding(.vertical, 2)
|
||||
|
||||
Section {
|
||||
LabelledUIKitTextField(label: "Enter TAN:", text: $enteredTan, keyboardType: tanChallenge.tanProcedure.isNumericTan ? .numberPad : .default, actionOnReturnKeyPress: {
|
||||
LabelledUIKitTextField(label: "Enter TAN:", text: $enteredTan, keyboardType: tanChallenge.tanProcedure.isNumericTan ? .numberPad : .default, autocapitalizationType: .none, actionOnReturnKeyPress: {
|
||||
if self.isRequiredDataEntered() {
|
||||
self.enteringTanDone()
|
||||
return true
|
||||
|
|
|
@ -123,7 +123,7 @@ struct TransferMoneyDialog: View {
|
|||
}
|
||||
}
|
||||
|
||||
LabelledUIKitTextField(label: "Remittee IBAN", text: $remitteeIban, focusNextTextFieldOnReturnKeyPress: true, isFocussedChanged: validateRemitteeIbanOnFocusLost,
|
||||
LabelledUIKitTextField(label: "Remittee IBAN", text: $remitteeIban, autocapitalizationType: .allCharacters, focusNextTextFieldOnReturnKeyPress: true, isFocussedChanged: validateRemitteeIbanOnFocusLost,
|
||||
actionOnReturnKeyPress: handleReturnKeyPress, textChanged: validateRemitteeIban)
|
||||
|
||||
remitteeIbanValidationResult.map { validationError in
|
||||
|
|
Loading…
Reference in New Issue