Request
Customer is asking to add keyboardType support to createAlertDialog in iOS.
When an AlertDialog is created in iOS with PLAIN_TEXT_INPUT is showing UIKeyboardTypeDefault, in certain use cases is required to use other keyboards like the numberPad (Zip Code search, PIN code).
Additional info
This behaviour is possible in native iOS projects like this:
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Hello!" message:@"Please enter your name:" delegate:self cancelButtonTitle:@"Continue" otherButtonTitles:nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField * alertTextField = [alert textFieldAtIndex:0];
alertTextField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
alertTextField.placeholder = @"Enter your name";
[alert show];
* Introducing the
placeholder
property ofUIAlertViewStylePlainTextInput
* Introducing theloginPlaceholder
andpasswordPlaceholder
properties ofUIAlertViewStyleLoginAndPasswordInput
with default value to "Login" and "Password" (as it was static before). * Introducing thekeyboardType
property using the existingTitanium.UI.KEYBOARD_*
constants to be used in the alert dialog * Introducing thereturnKeyType
property using the existingTitanium.UI.RETURNKEY_*
constants to be used in the alert dialog Everything covered?*PR pending*: https://github.com/appcelerator/titanium_mobile/pull/7155 Demo code:
CR and FT passed. PR merged.
[~hansknoechel] Everything looks good except that I am unable to set the keyboard type or returnkey type when the style of the alert is LOGIN_AND_PASSWORD_INPUT. It seems to default to the standard keyboard and return key. Is this intentional? Since many logins use an email address for the username, it would be nice to be able to set the keyboard to the email style. Tested using: MacOS 10.11 (15A284) Studio 4.4.0.201510092420 Ti SDK 5.1.0.v20151013151603 Appc NPM 4.2.1-1 Appc CLI 5.1.0-38 Ti CLI 5.0.5 Alloy 1.7.16 Arrow 1.3.13 Xcode 7.0.1 (7A1001) Node v4.1.0 Java 1.7.0_80 production
PR (master): https://github.com/appcelerator/titanium_mobile/pull/7308 PR (5_1_X): https://github.com/appcelerator/titanium_mobile/pull/7309 Updated the example to support dynamic configuration of keyboard and returnkey using the
Ti.UI.iPhone.AlertDialogStyle.LOGIN_AND_PASSWORD_INPUT
style:PR's Approved and Merged. Thanks!
Verified fixed, using: MacOS 10.11 (15A284) Studio 4.4.0.201510161811 Ti SDK 5.2.0.v20151018201232 Appc NPM 4.2.1-5 Appc CLI 5.1.0-38 Ti CLI 5.0.5 Alloy 1.7.16 Arrow 1.3.13 Xcode 7.0.1 (7A1001) Node v0.12.7 Java 1.7.0_80 production In addition to previous tests the keyboards and return keys are now customizable as well.