Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13173] Android: TableView: Softkeyboard appears on clicking any tableviewrow but immediately disappear

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionInvalid
Resolution Date2013-03-25T23:38:11.000+0000
Affected Version/sRelease 3.1.0
Fix Version/s2013 Sprint 07 API, 2013 Sprint 07
ComponentsAndroid
Labelsqe-sdk3.1.0, regression
ReporterDhirendra Jha
AssigneePing Wang
Created2013-03-23T10:43:01.000+0000
Updated2013-11-07T17:56:02.000+0000

Description

This is regression. The issue does not exist on 3.0.2. But the textfield in tableviewrow is never editable on any build. Steps to Reproduce: 1. Create an application with code below and launch the application 2. Click on any row in the tableview Actual: Softkeyboard appears but disappears immediately. Expected: Softkeyboard should not disappear immediately. It should disappear when click return on the keyboard.
var _window = Ti.UI.createWindow();
_window.fullscreen = false;
        _window.backgroundColor = 'white';
         
        var tableView = Ti.UI.createTableView({
            top : '0dp',
            bottom : '0dp',
            left : '0dp',
            right : '0dp'
        });
         
        var numRows = 15;
        var rows = [];
        for (var i = 0; i < numRows; i++){
            var tableViewRow = Ti.UI.createTableViewRow({
                height : 'auto'
            });
             
            var textField = Ti.UI.createTextField({
                top:'0dp',
                left : '5dp',
                right : '5dp',
                borderColor : '#CCCCCC',
                borderStyle : Ti.UI.INPUT_BORDERSTYLE_BEZEL
            });
             
            tableViewRow.add(textField);
             
            rows.push(tableViewRow);
        }
        tableView.data = rows;
        _window.add(tableView);
        _window.open();

Comments

  1. Ping Wang 2013-03-25

    This is not a regression bug. This behavior change is due to the [PR#3515](https://github.com/appcelerator/titanium_mobile/pull/3515) which fixed TIMOB-6367. When the textfield is clicked, it gains the focus so the softkeyboard shows and the table view needs to re-layout. After re-layout, everything is re-drawn and the textfield loses the focus so the softkeyboard hides. If we want to edit the textfield in the tableview, we need to set "windowSoftInputMode: Ti.UI.Android.SOFT_INPUT_ADJUST_PAN" when creating the window. An example is attached at the end. This is a native android behavior. Similar discussion is [here](http://stackoverflow.com/questions/5615436/when-the-soft-keyboard-appears-it-makes-my-edittext-field-lose-focus).
       var _window = Ti.UI.createWindow({
       	windowSoftInputMode : Ti.UI.Android.SOFT_INPUT_ADJUST_PAN
       });
       _window.fullscreen = false;
       _window.backgroundColor = 'white';
       
       var tableView = Ti.UI.createTableView({
       	top : '0dp',
       	bottom : '0dp',
       	left : '0dp',
       	right : '0dp'
       });
       
       var numRows = 15;
       var rows = [];
       for (var i = 0; i < numRows; i++) {
       	var tableViewRow = Ti.UI.createTableViewRow({
       		height : 'auto'
       	});
       
       	var textField = Ti.UI.createTextField({
       		top : '0dp',
       		left : '5dp',
       		right : '5dp',
       		borderColor : '#CCCCCC',
       		softKeyboardOnFocus : Titanium.UI.Android.SOFT_KEYBOARD_SHOW_ON_FOCUS,
       		borderStyle : Ti.UI.INPUT_BORDERSTYLE_BEZEL
       	});
       
       	tableViewRow.add(textField);
       
       	rows.push(tableViewRow);
       }
       tableView.data = rows;
       _window.add(tableView);
       _window.open(); 
       
  2. Dhirendra Jha 2013-03-26

    As per the comment, this is invalid issue. Hence closing this issue.

JSON Source