Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@ public InputType(@NonNull TextInputType type, boolean isSigned, boolean isDecima
public enum TextInputType {
TEXT("TextInputType.text"),
DATETIME("TextInputType.datetime"),
NAME("TextInputType.name"),
POSTAL_ADDRESS("TextInputType.address"),
NUMBER("TextInputType.number"),
PHONE("TextInputType.phone"),
MULTILINE("TextInputType.multiline"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ private static int inputTypeFromTextInputType(
textType |= InputType.TYPE_TEXT_VARIATION_URI;
} else if (type.type == TextInputChannel.TextInputType.VISIBLE_PASSWORD) {
textType |= InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
} else if (type.type == TextInputChannel.TextInputType.NAME) {
textType |= InputType.TYPE_TEXT_VARIATION_PERSON_NAME;
} else if (type.type == TextInputChannel.TextInputType.POSTAL_ADDRESS) {
textType |= InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS;
}

if (obscureText) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@

static UIKeyboardType ToUIKeyboardType(NSDictionary* type) {
NSString* inputType = type[@"name"];
if ([inputType isEqualToString:@"TextInputType.text"])
if ([inputType isEqualToString:@"TextInputType.address"])
Copy link
Contributor Author

@LongCatIsLooong LongCatIsLooong May 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type of keyboard does not trigger address autofill (tested on iOS 13.5). Developers would have to use TextInputType.name instead to trigger address autofill, that seems really counterintuitive. But the TextInputType.name (UIKeyboardTypeNamePhonePad) keyboard doesn't have punctuation so it's not perfect for entering addresses.

Instead of returning UIKeyboardTypeNamePhonePad here, I feel it's better to document the behavior in the framework so developers know what keyboard type to use, if they value address autofill more than having punctuations on the keyboard.

return UIKeyboardTypeDefault;
if ([inputType isEqualToString:@"TextInputType.datetime"])
return UIKeyboardTypeNumbersAndPunctuation;
if ([inputType isEqualToString:@"TextInputType.emailAddress"])
return UIKeyboardTypeEmailAddress;
if ([inputType isEqualToString:@"TextInputType.multiline"])
return UIKeyboardTypeDefault;
if ([inputType isEqualToString:@"TextInputType.name"])
return UIKeyboardTypeNamePhonePad;
if ([inputType isEqualToString:@"TextInputType.number"]) {
if ([type[@"signed"] boolValue])
return UIKeyboardTypeNumbersAndPunctuation;
Expand All @@ -26,8 +32,8 @@ static UIKeyboardType ToUIKeyboardType(NSDictionary* type) {
}
if ([inputType isEqualToString:@"TextInputType.phone"])
return UIKeyboardTypePhonePad;
if ([inputType isEqualToString:@"TextInputType.emailAddress"])
return UIKeyboardTypeEmailAddress;
if ([inputType isEqualToString:@"TextInputType.text"])
return UIKeyboardTypeDefault;
if ([inputType isEqualToString:@"TextInputType.url"])
return UIKeyboardTypeURL;
return UIKeyboardTypeDefault;
Expand Down Expand Up @@ -194,6 +200,10 @@ static UITextContentType ToUITextContentType(NSArray<NSString*>* hints) {
if ([hint isEqualToString:@"oneTimeCode"]) {
return UITextContentTypeOneTimeCode;
}

if ([hint isEqualToString:@"newPassword"]) {
return UITextContentTypeNewPassword;
}
}

return hints[0];
Expand Down