[TIMOB-13434] iOS: TableViewRow .hasCheck bug when used in combination with highlightedColor
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-04-17T23:19:07.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2013 Sprint 08 API, 2013 Sprint 08, Release 3.1.1, Release 3.2.0 |
Components | iOS |
Labels | qe-closed-3.1.1, qe-testadded, regression, triage |
Reporter | Neil Gupta |
Assignee | Vishal Duggal |
Created | 2012-12-15T20:29:46.000+0000 |
Updated | 2013-09-16T12:43:22.000+0000 |
Description
If you set the hasCheck property on a tableViewRow on a click event, then the highlightedColor on any labels within that tableViewRow gets stuck.
tableview.addEventListener('click', function(e) {
currRow.setHasCheck(false);
currRow.label.setColor('#000');
currRow = e.row;
e.row.setHasCheck(true);
e.row.label.setColor('#324f85');
});
The label within that row has a highlightedColor of #fff. When clicking on a row, the label turns permanently white. Selecting it again fixes the problem.
A workaround is to call setHasCheck twice, while setting the font color explicitly in between the two calls:
tableview.addEventListener('click', function(e) {
currRow.setHasCheck(false);
currRow.label.setColor('#000');
currRow = e.row;
e.row.setHasCheck(true);
e.row.label.setColor('#324f85');
// need to set hasCheck again to get around Titanium 3.0.0 bug
e.row.setHasCheck(true);
});
This will still cause the same bug if the row is selected twice in a row now. To work around that, you have to make sure that this row isn't already selected.
This bug was introduced in Titanium 3.0.0. I am building using the iOS 6 sdk with Titanium Studio 3.0. The problem exists in both the simulator and on a physical iPhone 5 device.
@Neil Gupta : could you provide us with better test case(a more detailed one). We are having a tough time testing this code. It would be good if we can understand the case that you are trying to do.
Basically, the problem occurs when tapping a row and setting hasCheck to true. However, the color of the label gets stuck to whatever highlightedColor is. Here is the full code block I am using. I haven't tested if this code works without the workaround in 3.0.2.
row.hasCheck triggers row update and should be called last.
This the code I am using for testing
Pull pending https://github.com/appcelerator/titanium_mobile/pull/4163
FR
Backport to 3_1_X https://github.com/appcelerator/titanium_mobile/pull/4204
Tested with: Mac 10.8.3 Mountain Lion Appcelerator Studio, build: 3.1.1.201304281105 SDK, build: 3.1.1.v20130429105103 Devices: iPhone5 iOS 6.1.3 iPad mini iOS iOS 6.0 Actual result: Clicking table view row, highlights it, and check mark is visible.