diff --git a/FirebaseSwiftUI/FirebaseAuthUIComponents/Sources/Components/VerificationCodeInputField.swift b/FirebaseSwiftUI/FirebaseAuthUIComponents/Sources/Components/VerificationCodeInputField.swift index cc226a33c32..0092ee04963 100644 --- a/FirebaseSwiftUI/FirebaseAuthUIComponents/Sources/Components/VerificationCodeInputField.swift +++ b/FirebaseSwiftUI/FirebaseAuthUIComponents/Sources/Components/VerificationCodeInputField.swift @@ -334,6 +334,7 @@ private struct SingleDigitField: View { textField.font = .systemFont(ofSize: 24, weight: .medium) textField.textAlignment = .center textField.keyboardType = .numberPad + textField.returnKeyType = .done textField.textContentType = .oneTimeCode textField.autocapitalizationType = .none textField.autocorrectionType = .no @@ -457,6 +458,12 @@ private struct BackspaceAwareTextField: UIViewRepresentable { } } + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + // iPad hardware keyboard: never delete/hide fields on Return. + textField.resignFirstResponder() + return false + } + func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {