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
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.
Pull pending.
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
Re-opening to edit label