Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8185] iOS: TextField loses focus if resized

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-07-12T04:59:29.000+0000
Affected Version/sRelease 2.0.0, Release 1.8.2
Fix Version/sRelease 2.1.0, Sprint 2012-08
ComponentsiOS
Labelsapi, module_textfield, qe-testadded
ReporterFederico Casali
AssigneeBlain Hamon
Created2012-03-22T10:47:49.000+0000
Updated2012-07-12T13:55:43.000+0000

Description

Problem

TextField in a TableViewRow loses focus if it has been resized after being focused

Code and steps to reproduce

var win = Ti.UI.createWindow({
	title:'pippo',
	backgroundColor:'white'
});

function addRow(addTextArea)
{
	var row = Ti.UI.createTableViewRow({height:200});
	
	
var $tTF = Ti.UI.createTextField({
		height: 30,
		top : 30,
		width: 100,
		borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
	});

		$tTF.addEventListener('focus',function(_e){
    	Ti.API.error("focus "+_e.source.height);
    	Ti.API.error(_e);
    	_e.source.animate({height:  _e.source.height*2});
	});
	
	
	
	row.add($tTF);
	row.selectionStyle = Ti.UI.iPhone.TableViewCellSelectionStyle.NONE;
	row.className = 'control';
	return row;
}

// create table view data object
var data = [];

for (var x=0;x<1;x++)
{
	if (x==1){
		data[x] = addRow(true);
	} else {
		data[x] = addRow();
	}

}

var tableView = Ti.UI.createTableView({
	data:data,
	style: Titanium.UI.iPhone.TableViewStyle.GROUPED
});
win.addEventListener('focus', function()
{
	Ti.API.info('window focus fired');
});
win.add(tableView);

win.open();

To reproduce: - Run the app and click the textField: textField is animated increasing in height. Result: focus on textField is lost.

Additional notes

Ticket associated: http://support-admin.appcelerator.com/display/APP-995689/conversation/read_all

Comments

  1. Blain Hamon 2012-04-11

    Okay, the good news is that it's not due to insertView. The bad news is that it's due to tableview. ChildWillResize leads to triggerRowUpdate, which starts an updateRow. This nukes the layout completely.
  2. Blain Hamon 2012-04-26

    Pull pending.
  3. Michael Pettiford 2012-06-23

    Closing issue Tested with Ti Studio build 2.1.0.201206211609 Ti Mobile SDK 2.1.0.v20120622174154 hash rdc9dfbe5 OSX Lion 10.7.3 iPhone 4S OS 5.1 Verified expected behavior is shown
  4. Shyam Bhadauria 2012-07-12

    Re-opening to edit label

JSON Source