I have the following code where I create a simple modal window with a textArea. When I click on the screen outside the textArea I want that the keyboard hides. Does anyone have a hint why this does not work?
//file1.js calls the modal window var modalWindow = Ti.UI.createWindow({ }); var req = require('ui/common/services/messagesSendView'); var messagesSendView = new req(); var navGroup = Ti.UI.iPhone.createNavigationGroup({ window : messagesSendView }); messagesSendView.navGroup = navGroup; modalWindow.add(navGroup); modalWindow.open({ modal: true, modalTransitionStyle: Ti.UI.iPhone.MODAL_TRANSITION_STYLE_COVER_VERTICAL, modalStyle: Ti.UI.iPhone.MODAL_PRESENTATION_FORMSHEET, navBarHidden: true });
//messagesSendView.js: modal window code function messagesSendView(){ var self = Ti.UI.createWindow({ title: 'Send Message', }); self.addEventListener("click", function(e){ Ti.API.info("clicked"); //this is called when I click textArea.blur(); // this should clear the keyboard }); var textArea = Ti.UI.createTextArea({ top: 15, width: Ti.UI.FILL, height : 140, left: 20, right: 20 }); self.add(textArea); return self; }; module.exports = messagesSendView;SDK 3.1.1 GA iOS 6 iPad Simulator