[TIMOB-28540] Android: allowSelection does not select the table row
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | None |
| Status | Closed |
| Resolution | Invalid |
| Resolution Date | 2021-09-24T20:24:50.000+0000 |
| Affected Version/s | Release 10.1.0 |
| Fix Version/s | n/a |
| Components | Android |
| Labels | regression |
| Reporter | Lokesh Choudhary |
| Assignee | Unknown |
| Created | 2021-09-24T00:02:24.000+0000 |
| Updated | 2021-09-24T20:44:34.000+0000 |
Description
Works with SDK 10.0.2.GA.
Steps to reproduce:
1. Create an android app & use the below code in the app.js:
var win = Ti.UI.createWindow();
var createRow = function(title) {
var row = Ti.UI.createTableViewRow({
className: 'test',
height: 80,
selectedBackgroundColor: '#ff0000'
});
var titleLabel = Ti.UI.createLabel({
font: {
fontFamily: 'Helvetica-Bold',
fontSize: 20
},
height: 24,
highlightedColor: '#fff',
left: 10,
text: title,
touchEnabled: false
});
row.add(titleLabel);
return row;
};
var tableData = [];
for (var i = 0, l = 100; i < l; i++) {
var row = createRow('Row Index # ' + i);
tableData.push(row);
}
var tableView = Ti.UI.createTableView({
allowsSelection: true,
data: tableData,
rowHeight: 80,
top: 0
});
win.add(tableView);
win.open();
2. After the app launches tap and hold any tablerow.
Just to clarify some things... Titanium has never supported the "allowSelection" property on Android. For example, setting this property to
falsedoes nothing in the above example code. https://titaniumsdk.com/api/titanium/ui/tableview.html#allowsselection If you tap-and-hold aTableViewrow with Titanium 9.3.0 - 10.0.2, the row will stay highlighted and it effectively enables a selection mode... but this was actually +unintentional+ when we transitionedTableViewto use the JavaRecyclerView. This behavior was corrected in 10.1.0 which supports selection when in edit mode and now supports the "allowsSelectionDuringEditing" property on Android.