Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-19940] iOS: AlertDialog add support for keyboard appearance #7435

Merged
merged 1 commit into from Nov 16, 2015
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions apidoc/Titanium/UI/AlertDialog.yml
Expand Up @@ -219,6 +219,18 @@ properties:
constants: Titanium.UI.KEYBOARD_*
default: <Titanium.UI.KEYBOARD_DEFAULT>

- name: keyboardAppearance
summary: Keyboard appearance to be displayed when the text field inside the dialog is focused.
description: |
Note that this property is only available if dialog `style` property is defined as
<Titanium.UI.iPhone.AlertDialogStyle.PLAIN_TEXT_INPUT> or
<Titanium.UI.iPhone.AlertDialogStyle.SECURE_TEXT_INPUT>.
type: Number
since: 5.2.0
platforms: [iphone, ipad]
constants: Titanium.UI.KEYBOARD_APPEARANCE_*
default: <Titanium.UI.KEYBOARD_APPEARANCE_DEFAULT>

- name: loginPlaceholder
summary: Placeholder of the login text field inside the dialog.
description: |
Expand Down
18 changes: 16 additions & 2 deletions apidoc/Titanium/UI/UI.yml
Expand Up @@ -1418,13 +1418,27 @@ properties:
type: Number
permission: read-only
platforms: [iphone, ipad]

- name: KEYBOARD_APPEARANCE_DEFAULT
summary: Use the platform-specific default keyboard appearance.
type: Number
permission: read-only
platforms: [iphone, ipad]


- name: KEYBOARD_APPEARANCE_DARK
summary: Use the platform-specific dark keyboard appearance.
type: Number
permission: read-only
platforms: [iphone, ipad]
since: 5.2.0

- name: KEYBOARD_APPEARANCE_LIGHT
summary: Use the platform-specific light keyboard appearance.
type: Number
permission: read-only
platforms: [iphone, ipad]
since: 5.2.0

- name: KEYBOARD_ASCII
summary: Use an ASCII keyboard, with the standard keyboard layout.
description: |
Expand Down
3 changes: 3 additions & 0 deletions iphone/Classes/TiUIAlertDialogProxy.m
Expand Up @@ -167,16 +167,19 @@ -(void)show:(id)args
textField.placeholder = [TiUtils stringValue:[self valueForKey:@"placeholder"]] ?: @"";
textField.keyboardType = [TiUtils intValue:[self valueForKey:@"keyboardType"] def:UIKeyboardTypeDefault];
textField.returnKeyType = [TiUtils intValue:[self valueForKey:@"returnKeyType"] def:UIReturnKeyDefault];
textField.keyboardAppearance = [TiUtils intValue:[self valueForKey:@"keyboardAppearance"] def:UIKeyboardAppearanceDefault];
}];
} else if ((style == UIAlertViewStyleLoginAndPasswordInput)) {
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.keyboardType = [TiUtils intValue:[self valueForKey:@"loginKeyboardType"] def:UIKeyboardTypeDefault];
textField.returnKeyType = [TiUtils intValue:[self valueForKey:@"loginReturnKeyType"] def:UIReturnKeyNext];
textField.keyboardAppearance = [TiUtils intValue:[self valueForKey:@"keyboardAppearance"] def:UIKeyboardAppearanceDefault];
textField.placeholder = [TiUtils stringValue:[self valueForKey:@"loginPlaceholder"]] ?: @"Login";
}];
[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.keyboardType = [TiUtils intValue:[self valueForKey:@"passwordKeyboardType"] def:UIKeyboardTypeDefault];
textField.returnKeyType = [TiUtils intValue:[self valueForKey:@"passwordReturnKeyType"] def:UIReturnKeyDone];
textField.keyboardAppearance = [TiUtils intValue:[self valueForKey:@"keyboardAppearance"] def:UIKeyboardAppearanceDefault];
textField.placeholder = [TiUtils stringValue:[self valueForKey:@"passwordPlaceholder"]] ?: @"Password";
textField.secureTextEntry = YES;
}];
Expand Down
2 changes: 2 additions & 0 deletions iphone/Classes/UIModule.m
Expand Up @@ -142,6 +142,8 @@ -(NSNumber*)RETURNKEY_CONTINUE

MAKE_SYSTEM_PROP(KEYBOARD_APPEARANCE_DEFAULT,UIKeyboardAppearanceDefault);
MAKE_SYSTEM_PROP(KEYBOARD_APPEARANCE_ALERT,UIKeyboardAppearanceAlert);
MAKE_SYSTEM_PROP(KEYBOARD_APPEARANCE_DARK,UIKeyboardAppearanceDark);
MAKE_SYSTEM_PROP(KEYBOARD_APPEARANCE_LIGHT,UIKeyboardAppearanceLight);

MAKE_SYSTEM_PROP(TEXT_AUTOCAPITALIZATION_NONE,UITextAutocapitalizationTypeNone);
MAKE_SYSTEM_PROP(TEXT_AUTOCAPITALIZATION_WORDS,UITextAutocapitalizationTypeWords);
Expand Down