diff --git a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm index 1e04170da2159..afc341f5ed5dc 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm @@ -461,7 +461,6 @@ - (void)configureWithDictionary:(NSDictionary*)configuration { self.secureTextEntry = [configuration[kSecureTextEntry] boolValue]; self.keyboardType = ToUIKeyboardType(inputType); - self.keyboardType = UIKeyboardTypeNamePhonePad; self.returnKeyType = ToUIReturnKeyType(configuration[kInputAction]); self.autocapitalizationType = ToUITextAutoCapitalizationType(configuration); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.m b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.m index 7f69a19664de1..cb64ba1d44765 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.m @@ -145,6 +145,9 @@ - (void)testSecureInput { // Verify secureTextEntry is set to the correct value. XCTAssertTrue(inputView.secureTextEntry); + // Verify keyboardType is set to the default value. + XCTAssertEqual(inputView.keyboardType, UIKeyboardTypeDefault); + // We should have only ever created one FlutterTextInputView. XCTAssertEqual(inputFields.count, 1); @@ -448,6 +451,20 @@ - (void)testPasswordAutofillHack { XCTAssertNotEqual([inputView performSelector:@selector(font)], nil); } +- (void)testKeyboardType { + NSDictionary* config = self.mutableTemplateCopy; + [config setValue:@{@"name" : @"TextInputType.url"} forKey:@"inputType"]; + [self setClientId:123 configuration:config]; + + // Find all the FlutterTextInputViews we created. + NSArray* inputFields = self.installedInputViews; + + FlutterTextInputView* inputView = inputFields[0]; + + // Verify keyboardType is set to the value specified in config. + XCTAssertEqual(inputView.keyboardType, UIKeyboardTypeURL); +} + - (void)testAutocorrectionPromptRectAppears { FlutterTextInputView* inputView = [[FlutterTextInputView alloc] initWithFrame:CGRectZero]; inputView.textInputDelegate = engine;