Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 23fc488

Browse files
visiblePassword uses ASCII keyboard on iOS (#50293)
Fixes flutter/flutter#129113 The documentation states that the `visiblePassword` input type > Requests a keyboard with ready access to both letters and numbers. `UIKeyboardTypeASCIICapable` seems to be the closest match. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
1 parent f8e24c0 commit 23fc488

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ static UIKeyboardType ToUIKeyboardType(NSDictionary* type) {
137137
if ([inputType isEqualToString:@"TextInputType.url"]) {
138138
return UIKeyboardTypeURL;
139139
}
140+
if ([inputType isEqualToString:@"TextInputType.visiblePassword"]) {
141+
return UIKeyboardTypeASCIICapable;
142+
}
140143
return UIKeyboardTypeDefault;
141144
}
142145

shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.mm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,20 @@ - (void)testKeyboardType {
307307
XCTAssertEqual(inputView.keyboardType, UIKeyboardTypeURL);
308308
}
309309

310+
- (void)testVisiblePasswordUseAlphanumeric {
311+
NSDictionary* config = self.mutableTemplateCopy;
312+
[config setValue:@{@"name" : @"TextInputType.visiblePassword"} forKey:@"inputType"];
313+
[self setClientId:123 configuration:config];
314+
315+
// Find all the FlutterTextInputViews we created.
316+
NSArray<FlutterTextInputView*>* inputFields = self.installedInputViews;
317+
318+
FlutterTextInputView* inputView = inputFields[0];
319+
320+
// Verify keyboardType is set to the value specified in config.
321+
XCTAssertEqual(inputView.keyboardType, UIKeyboardTypeASCIICapable);
322+
}
323+
310324
- (void)testSettingKeyboardTypeNoneDisablesSystemKeyboard {
311325
NSDictionary* config = self.mutableTemplateCopy;
312326
[config setValue:@{@"name" : @"TextInputType.none"} forKey:@"inputType"];

0 commit comments

Comments
 (0)