Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sencha Touch 2.1: Form Panel Keyboard hides active Textfield on Android

When I tap a textfield at the bottom of the screen, the keyboard appears and hides the active element. On iOS, it works perfect.

I'm able to scroll the form, so the textfield is in the visible area, but that's not nice at all. Am I doing something wrong or is this a known bug as I have the same behaviour in this example from Sencha Touch itself: docs.sencha.com/touch/2-1/touch-build/examples/forms/

If on this form:

enter image description here

I tap in the textfield of "Bio", the keyboard hides the textfield, instead of scrolling the textfield up to have it visible while typing:

enter image description here

like image 818
swalkner Avatar asked Mar 24 '13 07:03

swalkner


1 Answers

This is definitively a known-issue, I've seen this many times on Android. The only thing you can try to do is listen for a focus event on the input field and then scroll to the element. You might have to play around with the right Y-value, which suits your situation best.

{
    xtype: 'textareafield',
    name: 'bio',
    label: 'Bio',
    maxRows: 10,
    listeners: {
        focus: function(comp, e, eopts) {
            var ost = comp.element.dom.offsetTop;
            this.getParent().getParent().getScrollable().getScroller().scrollTo(0, ost);
        }
    }
},

This works for me. If you need any help implementing this, let me know!

enter image description here

like image 164
Rob Avatar answered Oct 06 '22 02:10

Rob