You found a bug! We've classified it as TOUCH-4249 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #21
    Sencha User
    Join Date
    May 2012
    Posts
    32
    Vote Rating
    1
    A.Tyshchyk is on a distinguished road

      0  

    Default


    This is fix my problem. Could you pls. test it.

    Code:
    if (Ext.os.is.Android4 && Ext.os.version.getMinor() >= 2) {
    	(function() {
    		var inputEl = null;
    		var onKeyboardShow = function() {
    			setTimeout(function() {
    				if (!inputEl) {
    					return;
    				}
    				var currentClientHeight = window.document.body.clientHeight;
    				var elRect = inputEl.getBoundingClientRect();
    				var elOffset = elRect.top + elRect.height;
    				if (elOffset <= currentClientHeight) {
    					return;
    				}
    				var offset = currentClientHeight - elOffset;
    				setOffset(offset);
    			}, 100);
    		};
    		var onKeyboardHide = function() {
    			setOffset(0);
    		};
    		var setOffset = function(offset) {
    			var el = Ext.Viewport.innerElement.dom.childNodes[0];
    			if (el) {
    				el.style.setProperty('top', offset + 'px');
    			}
    		};
    		document.addEventListener('deviceready', function() {
    			document.addEventListener("hidekeyboard", onKeyboardHide, false);
    			document.addEventListener("showkeyboard", onKeyboardShow, false);
    		}, false);
    		Ext.define('Ext.field.Input.override', {
    			override: 'Ext.field.Input',
    			onFocus: function(e){
    				inputEl = e.target;
    				this.callParent(arguments);
    			},
    			onBlur: function(e){
    				inputEl = null;
    				this.callParent(arguments);
    			}
    		})
    	})();
    }

  2. #22
    Sencha User debianw's Avatar
    Join Date
    Mar 2012
    Location
    Costa Rica
    Posts
    49
    Vote Rating
    2
    debianw is on a distinguished road

      0  

    Default


    Quote Originally Posted by A.Tyshchyk View Post
    This is fix my problem. Could you pls. test it.
    I tested the code, but cordova is not firing the events `hidekeyboard` and `showkeyboard`.

  3. #23
    Sencha User
    Join Date
    Jul 2013
    Posts
    99
    Vote Rating
    10
    tt88 will become famous soon enough

      0  

    Default


    Quote Originally Posted by debianw View Post
    I tested the code, but cordova is not firing the events `hidekeyboard` and `showkeyboard`.
    I've been experiencing this problem as well & came across this stackoverflow answer:
    Hi if you need showkeyboard and hidekeyboard events in phonegap based application you need to remove fullscreen option , then only these events will trigger.
    http://stackoverflow.com/a/23490557/363469

    I removed the fullscreen preference that I had in my config.xml & it seems to have fixed it - although I have not tested this extensively.
    Code:
    <preference name="Fullscreen" value="true" /> <!-- remove this line -->

  4. #24
    Sencha User
    Join Date
    Oct 2012
    Posts
    71
    Vote Rating
    2
    Tioecomp is on a distinguished road

      0  

    Default


    This solution almost solved my problem but the thing is, when I click on a field it is only ajusted when I start typing and it does not come back to the same position, this is causing scroll problems.