I have a very simple login page (login + password).
My users are french, so their keyboard are French (azerty).
Since iOS 12, when they click on the password
I had the same issue in React Native when I set the keyboardType to "numeric-pad".
It's a native IOS issue due to default language set in info.plist
file.
I found the solution here : https://github.com/facebook/react-native/issues/27972
Delete these 2 lines to unset the default language :
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
You could also just modify <string>en</string>
to <string>fr</string>
but then you will have the same issue with english users who will have a switch to azerty keyboard :/
Same solution in Swiftui now :
TextField("placeholder",text: $YourTextBinding)
.textContentType(.oneTimeCode)
.keyboardType(.default)
just need to add :
.textContentType(.oneTimeCode)
.keyboardType(.default)
to a TextField
or a SecureField
.
hope it helps !
This was truly an iOS bug => corrected in iOS 12.1
The lamer a bug is, the lamer the solution should be, i mean what a lame work by Apple.
My solution was to force a focus on the password field and then focus on the first field, in my case it was the usernameField.
- (void) viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self.passwordTextField becomeFirstResponder];
[self.usernameTextField becomeFirstResponder];
}
Just in case, I corrected this by simply adding this to my main viewController :
func passwordSignUpViewController(forAuthUI authUI: FUIAuth, email: String, requireDisplayName: Bool) -> FUIPasswordSignUpViewController {
return CustomPasswordSignUpViewController(authUI: authUI, email: email, requireDisplayName: true)
}
And I created the subclass of FUIPasswordSignUpViewController
import Foundation
import FirebaseUI
class CustomPasswordSignUpViewController : FUIPasswordSignUpViewController, UITextFieldDelegate {
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?, authUI: FUIAuth, email: String?, requireDisplayName: Bool) {
super.init(nibName: "FUIPasswordSignUpViewController", bundle: nibBundleOrNil, authUI: authUI, email: email, requireDisplayName: requireDisplayName)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override func viewDidLoad() {
super.viewDidLoad()
}
func textFieldDidBeginEditing(_ textField: UITextField) {
if #available(iOS 12.0, *) {
textField.textContentType = .oneTimeCode
}
}
}
iOS 12.1 fixed the problem for me.
You also have to set the parameter textContentType
of the password textfield to .oneTimeCode