๐ Deprecated! Please use cordova-plugin-ionic-keyboard
๐
See this comment for API changes needed to move to new plugin: #305 (comment)
- Installation, API docs: README_OLD.md
Ionic Keyboard Plugin for Cordova
License: Apache License 2.0
cordova-plugin-ionic-keyboard
๐See this comment for API changes needed to move to new plugin: #305 (comment)
For Android, this plugin calls appView.sendJavascript() which is a deprecated method. In turn, that method causes a CSP (Content-Security-Policy) violation unless 'unsafe-eval' is used in the policy rules. Updating the generation of the event would be helpful since I am trying to implement good security, plus that sendJavascript() call must eventually go away. I have not looked at iOS.
I want to implement below
When the input element is in the top half page , the page do not move top when the keyboard pop show. And when the input element is in the bottom half page, the page move top when the keyboard pop show. So the input element is always visible to user.
I finish some code , and it works a half
window.addEventListener('native.keyboardshow', keyboardShowHandler);
function keyboardShowHandler(e){
//TODO how can I get the focus Element's top?
document.getElementsByTagName('body')[0].className = 'slidekeyboardin';
document.getElementsByTagName('body')[0].style.marginTop = "-" + e.keyboardHeight + "px";
}
window.addEventListener('native.keyboardhide', keyboardHideHandler);
function keyboardHideHandler(e){
// alert('Goodnight, sweet prince');
document.getElementsByTagName('body')[0].style.marginTop = "0px";
}
Hi. I get the following error when trying to run the ionic app with this plugin in the Ripple emulator. Other plugins do not cause such error.
missing exec:Keyboard.hideKeyboardAccessoryBar ripple.js:34331
Array[1]
ripple.js:34332
TypeError
message: "Cannot read property 'hideKeyboardAccessoryBar' of undefined"
stack: (...)
get stack: function () { [native code] }
set stack: function () { [native code] }
__proto__: Error
ripple.js:34333
TypeError: Cannot read property 'hideKeyboardAccessoryBar' of undefined
at module.exports.exec (http://localhost:4400/ripple/assets/ripple.js:34328:30)
at Function.Keyboard.hideKeyboardAccessoryBar (http://localhost:4400/plugins/com.ionic.keyboard/www/keyboard.js:10:5)
at http://localhost:4400/js/app.js:14:42
at Array.<anonymous> (http://localhost:4400/vendor/ionic/js/ionic.bundle.js:36865:19)
at onPlatformReady (http://localhost:4400/vendor/ionic/js/ionic.bundle.js:2329:24)
at Channel.fire (http://localhost:4400/cordova.js:760:23)
at http://localhost:4400/cordova.js:223:49 ripple.js:34334
Keyboard ripple.js:50497
hideKeyboardAccessoryBar ripple.js:50498
I use autogenerated code on app run
.run(function ($ionicPlatform) {
$ionicPlatform.ready(function () {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
});
})
Looked through the issues and didn't see anything about this, but is it normal that when the keyboard opens there is a black flash before it pops up?
We really need a feature to allow an ionic application to select whether the return key on the iOS keyboard says "GO" or one of the other allowable values such as "Next" (see below for other options). I know others have requested this functionality in the ionic forums but it seems that this keyboard plugin is the proper target for such a request.
The allowable values are:
typedef enum : NSInteger { UIReturnKeyDefault , UIReturnKeyGo , UIReturnKeyGoogle , UIReturnKeyJoin , UIReturnKeyNext , UIReturnKeyRoute , UIReturnKeySearch , UIReturnKeySend , UIReturnKeyYahoo , UIReturnKeyDone , UIReturnKeyEmergencyCall , } UIReturnKeyType;
Thanks for your plugin. it is much better then org.apache.cordova.keyboard
I would like to ask:
How can I put the footer on top of keyboard when it is open?
just like Whatsapp message input box is on top of the keyboard.
hide event not firing
height is wrong
It's great that v1.0.3 added support to show the keyboard on Android and it resolves a number of issues I was having. However, phonegap build is complaining that it does not support v1.0.3.
Can you please fix that?
Is there a reason why show is not handles by the iOS plugin? Event if there is no way to open the keyboard, shouldn't the plugin still handle the function call with a warning message? At the moment, it results in ERROR: Method 'show' not defined in Plugin 'Keyboard'.
Hey guys, looking forward to trying beta4, but am a bit surprised to see a new keyboard plugin. Have you heard of org.apache.cordova.keyboard
(github)?
I understand you may want to present a different interface for your users, so I have a potentially suggestion:
org.apache.cordova.keyboard
as a <dependency>
for your pluginJust a suggestion!
It would be nice to be able to manipulate the positioning of the keypad during closing and showing to enable a "pull down to close" "pull up to show" feature as can be done on native.
Despite setting cordova.plugins.Keyboard.disableScroll(false); this plugin is disabling scrolling in iOS in our angular app (not using the ionic framework just yet).
Interestingly, there is a slight difference between toggling disableScroll using the JS call above. When it's enabled the scrollbar appears when attempting to scroll (it just doesn't move), and when it's disabled then no scroll bar appears at all (and no scrolling occurs either).
Thanks for this plugin guys!
When the input is right inside the footer and the input are focused.
The whole screen will be scrolled up in iOS 7.
Hi Guys,
Just tried ordova.plugins.Keyboard.close(), it is working fine on android,
but not working on IOS 8.1.2 , ionic beat 14, would you please check it.
thanks,
Jk
Hi,
on iOS8 I have a weird behaviour. If I change the keyboard language/switch to emoji or slide up/down the proposal-bar, it will fire native.keyboardshow all the time. Please fix this and instead of this, provide native.keyboardChanged if possible. It causes many problems which I hadn't before on iOS7 cause I'm changing contentHeight based on keyboardHeight in order to display everything properly in my chat application. Thank you very much!
Hi,
please provide a beforeShow and beforeClose event - sometimes it's just not enough to do some actions after the keyboard was shown/hidden.
Thanks!
Shaking the device after using the keyboard once and closing it will bring up the 'Undo Typing' alert even with the keyboard not present anymore.
So far I have tested this on an iPhone 4S iOS 7.1.1 prior to using the keyboard and after. Only happens after the keyboard has been used once. Test was done from within an Ionic based app using the popup. If it turns out to be an issue there I can submit it there instead.
Using this keyboard plugin, having some weird issues.
With the accessory bar removed, a weird gap appears below the end of the view.
The scroll bar indicator pictures is at the bottom of the view.
Tried disabling scrolling, and still had the same problem.
Thoughts?
iOS8 giving option to build custom third-party keyboard https://www.apple.com/uk/ios/ios8/quicktype/
Is it possible to build third party custom keyboard application for iOS8 with this cordova or phonegap ?
Actually I'm looking to build foreign language keyboard for iOS8, is there any solution or any plugin available for that ? https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/ExtensibilityPG/Keyboard.html
Hi,
the addon doesn't work on samsung galaxy tab 4 (Android 4.4.2, Chrome Webview 30.0.0.0)
any ideas?
Adding Amazon FireOS support would be really nice, especially since the OS is basically Android without the Google stuff. Adding support also seems to be very easy, as all it requires is to copy the section in plugin.xml and change the name to "amazon-fireos".
I've been running the Ionic keyboard for months on my Amazon releases with no problems, but it is a bit annoying to have to modify the plugin.xml by hand each time I update to the latest version of the plugin. Official support for Amazon would really make it easier to keep the plugin updated.
Other than copying the Android section in the plugin.xml, there doesn't appear to be any other changes needed to support the Amazon Appstore. Please add support for Amazon apps.
It looks like show is currently only available in master. Before release can we please rename it to "open" to be more consistent with "close"
Hi @tlancina Could you study the feasibility to include this functionality in the kb plugin?
http://stackoverflow.com/questions/19961103/uikeyboardappearance-in-uiwebview
It will be great to change returnKeyType & keyboardAppearance.
https://developer.apple.com/library/ios/documentation/uikit/reference/UITextInputTraits_Protocol/Reference/UITextInputTraits.html
Thanks and regards
After adding the plugin I bump into the following:
.../Plugins/com.ionic.keyboard/IonicKeyboard.m:100:12: error: ARC forbids explicit message send of 'dealloc' [super dealloc]; ~~~~~ ^ 1 error generated. ** BUILD FAILED **
Hello,
I'd like to use your plugin directly from PhonegapBuild, but it is not up-to-date, and I need v1.0.3 features (current version is 1.0.2).
Could you please update it ? I don't really know if I can/should do it by myself.
When cordova.plugins.Keyboard.show();
is called the plugin loads the text keyboard regardless of an input type.
For instance if an input has type set to tel
the plugin should show us only the numeric keyboard.
In config.xml,
(My app need the status bar ___)
In AndroidManifest.xml,
Both
android:windowSoftInputMode="adjustResize"
Or
android:windowSoftInputMode="adjustPan"
And with keyboard-attach in footer
<ion-footer-bar class="bar bar-stable item-input-inset" keyboard-attach>
<label id="telwrapper" class="item-input-wrapper">
<input type="tel" id="tel" placeholder="Telephone Number" ng-model="tel">
</label>
<button class="button button-icon icon ion-ios7-telephone-outline" ng-click="create()"></button>
</ion-footer-bar>
When the user focus on the input. The footer scroll up and detached from the keyboard.
In Android, the window is resized when keyboard go up in non-fullscreen mode.
We may need a native.beforeshowkeyboard event to record the screen height before and after keyboard shown up, in order to normalize the android and ios behaviour?
Thanks
When using a select, the fields ng-model
does not change when the user spins and then taps an available option. The ng-model
only updates AFTER the keyboard is lowered.
Right now, there is no way for the user to close a select keyboard except for tapping somewhere on the screen.
If the model updated on user selection, we could listen to the model change event to know when to call cordova.plugins.Keyboard.close
. This would be a much better UX than having to tap somewhere on the screen.
Alternatively, if there were some way to listen to taps on a selection, we could then close the keyboard.
Is there anything in this plugin that wouldn't work with cordova 3.1? The reason I ask is because my project and many others use ionic + steroids, the latter runs with cordova 3.1.
Hello,
I am seeing strange warning in my terminal logs while running my app with Keyboard plugin installed.
Can't find keyplane that supports type 5 for keyboard iPhone-PortraitTruffle-PhonePad; using 3008722378_PortraitTruffle_iPhone-Complex-Pad_Default
It happends when I tap onto my input field type='tel'
the number pad opens and app works fine but I thought I would ask.
Any idea what it means?
Thanks a lot.
This is a weird bug.
When using the plugin on an iPad (iOS 7.1) with the softkeyboard in undocked mode, if you fill in a form (that opens the undocked keyboard) and submit the form with the submit button on the keyboard, it totally breaks the ion-scroll on the next page.
Everything is fine if the plugin is uninstalled or if the keyboard is docked.
First of all, thanks for this wonderful plugin. I am using this plugin in my sample phonegap application.
In onDeviceReady()
, I am calling cordova.plugins.Keyboard.show();
for opening the keyboard, by default it is opening a keyboard contains of both alphabets, numbers. I am using my input as type='number'
. So when I click in to that text box, only numberpad
is displaying. So how can i display this number keyboard by using cordova.plugins.Keyboard.show();
. Please suggest.
Hi,
I would like to provide a patch for this plugin to support BlackBerry 10. Is there any interest for this? I will do this in conjunction with @https://github.com/FelipeGualberto.
Please, confirm.
Thanks,
Leandro.
So I've been having quite a few issues with the keyboard plugin for Android (whereas it works perfectly with iOS). There are instances where when the keyboard pops up, it shrinks the whole webview and moves the input in extremely weird manners. This used to happen on iOS but was fixed with the disableScroll(true). Is there an equivalent way to fix this an Android?
I was seeing weird issues when on both ios and android (emulated and actual device) when I had this plugin installed and tapped on an input/textarea:
Uninstalling the plugin fixes the issue, reinstalling it brings it back. I'm a newbie to ionic/cordova, so maybe I'm not using the right debug tools, but I haven't noticed any suspicious debug output. I've tried
debugging with chrome/safari remote debugging as well as the adb logcat and the xcode console window.
One suspicious thing is that everything was working fine on ios 2 days ago (not sure about android), but then I installed the latest xcode and os x command line updates yesterday. I wonder if they could be screwing with things. But I don't think that would explain the issues on android.
Did you forget to include that file?
/Users/driftyadmin/git/ionic-starter-login/platforms/ios/StarterApp/Plugins/com.ionic.keyboard/IonicKeyboard.m:2:9: fatal error:
'UIWebViewAccessoryHiding.h' file not found
#import "UIWebViewAccessoryHiding.h"
^
Hi! First of all, great work on the Ionic project!
It would be great if you could submit this plugin to the Phonegap Build plugin repository (https://build.phonegap.com/plugins), so it can be used in remote builds.
I could do it myself but I thought it would be nice for you to have ownership over your own plugins :)
Hello all,
As you can understand this is not the expected behavior.
What I did to solve it was to
Hope it helps anyone
If a physical keyboard is attached to an Android Device, like a barcode scanner, the soft keyboard does not appear until you disable the physical keyboard.
It would be great to have control over the soft keyboard even a physical one is connected.
Regards
I have a simple function that changes the text of a div on native.keyboardshow with cordova v. 3.5 on an ios app. The emulator has it working great on the iphone io 6.1 but its not firing on iphone retina io 7.1
Is there a reason that close() is not supported for android? Thanks.
Hi, are there any plans to add the shrinkView
method like the original cordova plugin has? https://github.com/apache/cordova-plugins/tree/master/keyboard
Hi,
I know windows 8 is not supported but for windows 8 I'm getting this error which causes the device to load as a blank white screen and the app to not respond.
my cordova build shows this as the error and I think the keyboard plugin is the issue for windows 8
The thread 0xae0 has exited with code 259 (0x103).
Error::Plugin not allowed in config.xml. Keyboard
The thread 0xc94 has exited with code 259 (0x103).
]
I love this plugin functionality. thanks for good work. I am wondering if we can add the functionality to change the "return" key labels to for example "Submit", "Search", "Done" ro whatever the custom text may be.
is it even possible?
When I use this plugin, the keyboard will take like 5-10 seconds on iPhone6 to show up the first time (maybe caused trough the native.event I'm look for)
After the first "boot up", the keyboards works fine and shows up immediatley.
Please guys, this is the only good keyboard plugin for Phonegap (because of the functions, events and especially the keyboardHeight) - but you need to support a bit more.
This plugins also break the keyboard on simulator. I'm quite not skilled enough on Objective-C to fix this kind of problems.
testing on a HUAWEI P6-U06 reports keyboardHeight with 177px (Android Keyboard, and 180px Huawai Keyboard) both values are wrong.
The height should be approximate 50px larger than reported by the event.
Does this only happen to me?
I'm receiving an exception on iOS when going in and our of focus on the input search textbox. [FATAL] [NONE] Uncaught Exception: TypeError: 'undefined' is not an object (evaluating 'cordova.plugins.Keyboard') at (compiled_code):1
However, I'm able to close the keyboard successfully.
//I added the 4 files to project
//config.xml
//In a javascript controller
closeKeyboard = function() {
try {
cordova.exec(null, null, "Keyboard", "close", []);
}
catch(err) {
alert("error occurred")
}
};
@tlancina Could you include this fix please?
apache/cordova-plugins#6
https://issues.apache.org/jira/browse/CB-6219
Also, you can found a lab version of this plugin with a new Method shrinkView and onshowing & onhiding Events here:
https://github.com/apache/cordova-plugins/tree/master/keyboard
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.