Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27927] Android: Changing currently selected row's color in picker does not update shown color

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2020-07-28T20:43:09.000+0000
Affected Version/sn/a
Fix Version/sRelease 9.1.0
ComponentsAndroid
Labelsandroid, picker
ReporterSatyam Sekhri
AssigneeJoshua Quick
Created2020-06-02T20:40:05.000+0000
Updated2021-02-23T11:42:30.000+0000

Description

Setting the color of a picker row dynamically does not show up the changed color. To show up the changed color we need to select another option and reselect the first one. *Steps to reproduce:*

Create a project using the app.js as below. Run on android device

Select an option in the picker. The selected option should change text color but it does not show up the color change.

Click on the picker again. The last selected option shows changed color in the drop down.

Select another option and again the option selected in step 2. The changed color is shown now.

Note: On iOS calling the picker.reloadColumn() method reloads the picker and shows the changed color of the selected option.
var window = Ti.UI.createWindow({ backgroundColor: "gray" });
var picker = Ti.UI.createPicker({ width: "50%" });
picker.add([
	Ti.UI.createPickerRow({ title: "Red", color: "red" }),
	Ti.UI.createPickerRow({ title: "Green", color: "green" }),
	Ti.UI.createPickerRow({ title: "Blue", color: "blue" }),
]);
picker.addEventListener("change", function(e) {
	Ti.API.info("### Selected row: " + e.rowIndex);
	picker.getSelectedRow(0).color = "purple";
});
window.add(picker);
window.open();
*Expected Result:* On android the color change of the option should show on the first time it is selected. *Work-Around:* Set the row's title text after setting the color. This force picker's text field to update.
picker.addEventListener("change", function(e) {
	Ti.API.info("### Selected row: " + e.rowIndex);
	var row = picker.getSelectedRow(0);
	row.color = "purple";
	row.title = row.title;   // <- This updates the picker's TextField.
});

Comments

  1. Joshua Quick 2020-06-03

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/11747
  2. Satyam Sekhri 2020-07-08

    FR Passed
  3. Satyam Sekhri 2020-07-28

    Verified on: Mac OS: 10.15.4 SDK: 9.1.0.v20200727104531 Appc CLI: 8.1.0-master.7 JDK: 11.0.4 Node: 10.17.0 Studio: 6.0.0.202005141803 Device: Nexus4(v5.1.1) device, Pixel3(v10.0) emulator

JSON Source