Problem description
TableView textField loses focus when typing in.
Steps to reproduce
Create a tableView and a tableViewRow with a textField.
Click on the textField and start typing some text
Result: after the first character, focus on the textField is lost.
var win = Ti.UI.createWindow({
backgroundColor:'black'
});
var data = [];
var tableview;
var row = Ti.UI.createTableViewRow({
clickName: 'row'
});
var textfield = Titanium.UI.createTextField({
width: '80%',
height: 80,
color: '#000',
returnKeyType: Titanium.UI.RETURNKEY_DONE,
enableReturnKey: true,
keyboardType: Titanium.UI.KEYBOARD_ASCII,
autocorrect: false,
hintText: 'Enter text Field',
textAlign: 'left',
clearOnEdit: false,
borderStyle: Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
clearButtonMode: Titanium.UI.INPUT_BUTTONMODE_ONFOCUS,
leftButtonMode: Titanium.UI.INPUT_BUTTONMODE_ALWAYS
});
textfield.font = {
fontSize: '15sp',
fontFamily: 'Arial'
};
textfield.autocorrect = true;
textfield.borderStyle = Titanium.UI.INPUT_BORDERSTYLE_NONE;
row.add(textfield);
data = [row];
tableview = Titanium.UI.createTableView({
data: data,
rowBackgroundColor: 'white',
});
win.add(tableview);
win.open();
Additional notes
Ticket associated:
http://support-admin.appcelerator.com/display/APP-682796
TIMOB-3451 appears to be fixed as well and is probably a duplicate of this issue. Please test to verify.
A possible workaround would be to use [SOFT_INPUT_ADJUST_PAN](http://docs.appcelerator.com/titanium/2.0/index.html#!/api/Titanium.UI.Android-property-SOFT_INPUT_ADJUST_PAN) mode when creating the window. This will prevent a resize of the window when the keyboard appears. Focus will be lost if a resize occurs and it is not clear yet if we can fully fix this in platform. We will continue investigating before coming to a final conclusion.
After evaluating this issue we have decided not to support placing textfield/textarea inside a table row on Android. It is not well supported and considered bad practice on Android. Please see TIMOB-8869 for a possible alternative path.
See TIMOB-8869 for a possible work around.
On Android using TextField or TextArea inside a TableViewRow is not well supported and considered bad practice.
Is there any docs stating that TextFields inside TableViews (List Views) are a bad practice on Android? I can understand that TextAreas are indeed a bad practice inside Lists as they are both scrolling views, but I see no reason at all that TextFields should be considered bad practice inside any kind of scroll views. Google itself does use textfield inside scrollable views and native List Views (TableViews) on many of their apps.
Closing due to inactivity. If this issue still exists, please raise a new ticket.