Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ cordova plugin add cordova-plugin-ionic-keyboard --save

## Preferences

### KeyboardDelayDuration (for IOS Only)

When styling your app like the Login page with (vh). The keyboard open delay might not be desirable. So this option can be used to configure the delay in which the keyboard is open.

> Double (0.2 by default)

```xml
<preference name="KeyboardDelayDuration" value="0.2" />
```

### KeyboardResize (for iOS only)

> Boolean (true by default)
Expand Down
11 changes: 10 additions & 1 deletion src/ios/CDVIonicKeyboard.m
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,19 @@ - (void)onKeyboardWillShow:(NSNotification *)note
}
CGRect rect = [[note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
double height = rect.size.height;
double delayedDuration = 0.2;

NSDictionary *settings = self.commandDelegate.settings;
NSString *delayDurationString = [settings cordovaSettingForKey:@"KeyboardDelayDuration"];

if (delayDurationString) {
// convert string into double
delayedDuration = [delayDurationString doubleValue];
}

if (self.isWK) {
double duration = [[note.userInfo valueForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
[self setKeyboardHeight:height delay:duration+0.2];
[self setKeyboardHeight:height delay:duration+delayedDuration];
[self resetScrollView];
}

Expand Down