Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (keyboard)
Viewing all articles
Browse latest Browse all 352

Keyboard hides the text fields

$
0
0

I have a window that contains more than one text field, 3 of them are considered at the end of the view, the problem is that when any of those 3 text field is onFocus, the keyboard hides it in iPhone, while in Android, the window goes up for appropriate height to put the text field just above the keyboard.

I searched a lot for solutions and here are the most common solutions and there problems with me:

1. Using a scrollView instead of view:

The problem is my window doesn't need a scrollView, so by changing a normal view to a needn't scrollView, on iOS I can scroll up and down on nothing, this is the same result on android if the scrollView wasn't full screen, this solution gives bad user experience.

2. Adding animation for the window:

Add animation on events blur and focus for each text field to animate the window up on focus and down on blur, the code looks like this...

textField.addEventListener('focus', function(){
        $.win.animate({bottom: '30%', duration:500});
    });
    textField.addEventListener('blur', function() { 
        $.win.animate({bottom: 0, duration:500});
    });
The problem here is that I must add 6 eventListeners for 3 textfields !

I think there's a smarter solution than both solutions, so please help me.

Thanks in advance !


Viewing all articles
Browse latest Browse all 352

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>