diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm index 1e04170da2..afc341f5ed 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm @@ -461,7 +461,6 @@ static FlutterAutofillType autofillTypeOf(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/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.m b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.m index 7f69a19664..cb64ba1d44 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.m +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPluginTest.m @@ -145,6 +145,9 @@ FLUTTER_ASSERT_ARC // 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 @@ FLUTTER_ASSERT_ARC 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;