Skip to content
This repository was archived by the owner on Apr 2, 2018. It is now read-only.

Commit 0f9ea49

Browse files
committed
deprecate native.showkeyboard native.hidekeyboard
1 parent 93d05ef commit 0f9ea49

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/android/IonicKeyboard.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,16 @@ public void onGlobalLayout() {
3636
int pixelHeightDiff = (int)(heightDiff / density);
3737
if (pixelHeightDiff > 100 && pixelHeightDiff != previousHeightDiff) { // if more than 100 pixels, its probably a keyboard...
3838
appView.sendJavascript("cordova.plugins.Keyboard.isVisible = true");
39+
appView.sendJavascript("cordova.fireWindowEvent('native.keyboardshow', { 'keyboardHeight':" + Integer.toString(pixelHeightDiff)+"});");
40+
41+
//deprecated
3942
appView.sendJavascript("cordova.fireWindowEvent('native.showkeyboard', { 'keyboardHeight':" + Integer.toString(pixelHeightDiff)+"});");
4043
}
4144
else if ( pixelHeightDiff != previousHeightDiff && ( previousHeightDiff - pixelHeightDiff ) > 100 ){
4245
appView.sendJavascript("cordova.plugins.Keyboard.isVisible = false");
46+
appView.sendJavascript("cordova.fireWindowEvent('native.keyboardhide')");
47+
48+
//deprecated
4349
appView.sendJavascript("cordova.fireWindowEvent('native.hidekeyboard')");
4450
}
4551
previousHeightDiff = pixelHeightDiff;

src/ios/IonicKeyboard.m

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,20 @@ - (void)pluginInitialize {
2626
CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
2727
keyboardFrame = [self.viewController.view convertRect:keyboardFrame fromView:nil];
2828

29-
[weakSelf.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.plugins.Keyboard.isVisible = true; cordova.fireWindowEvent('native.showkeyboard', { 'keyboardHeight': %@ }); ", [@(keyboardFrame.size.height) stringValue]]];
30-
31-
29+
[weakSelf.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.plugins.Keyboard.isVisible = true; cordova.fireWindowEvent('native.keyboardshow', { 'keyboardHeight': %@ }); ", [@(keyboardFrame.size.height) stringValue]]];
30+
31+
//deprecated
32+
[weakSelf.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireWindowEvent('native.showkeyboard', { 'keyboardHeight': %@ }); ", [@(keyboardFrame.size.height) stringValue]]];
3233
}];
3334

3435
_keyboardHideObserver = [nc addObserverForName:UIKeyboardWillHideNotification
3536
object:nil
3637
queue:[NSOperationQueue mainQueue]
3738
usingBlock:^(NSNotification* notification) {
38-
[weakSelf.commandDelegate evalJs:@"cordova.plugins.Keyboard.isVisible = false; cordova.fireWindowEvent('native.hidekeyboard'); "];
39+
[weakSelf.commandDelegate evalJs:@"cordova.plugins.Keyboard.isVisible = false; cordova.fireWindowEvent('native.keyboardhide'); "];
40+
41+
//deprecated
42+
[weakSelf.commandDelegate evalJs:@"cordova.fireWindowEvent('native.hidekeyboard'); "];
3943
}];
4044
}
4145
- (BOOL)disableScroll {

0 commit comments

Comments
 (0)