Skip to content

Programmatically hide keyboard - useful when having multiple textfields on a page

License

Notifications You must be signed in to change notification settings

macasfaj/ti.keyboard

 
 

Repository files navigation

Ti.Keyboard for Appcelerator Titanium SDK 6.2.2.GA+

Because with Appcelerator Titanium you have to call the blur() function on a specific Ti.UI.TextField or Ti.UI.TextArea element, it can be a bit difficult and over-complicated to keep track of the latest active element where the virtual keyboard has been triggered from and call manually blur() on it in order to hide any virtual keyboard.

This helps to hide any visible/active keyboard from anywhere for iOS and Android.

Example

var win = Ti.UI.createWindow({
	backgroundColor : 'white'
});
var textfield = Ti.UI.createTextField({
	hintText : "Text"
});
win.add(textfield);
win.open();

var button = Ti.UI.createButton({
	title : "Hide",
	top : 10
});
button.addEventListener("click", function() {
	var keyboard = require('ti.keyboard');
	keyboard.hide();
});
win.add(button);

About

Programmatically hide keyboard - useful when having multiple textfields on a page

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 63.3%
  • JavaScript 13.5%
  • Java 11.9%
  • Objective-C 11.3%