Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Low
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: Release 9.1.0
-
Component/s: Android
-
Environment:
Mac OS: 10.15.4
SDK: 9.0.2.GA
Appc CLI: 8.0.0
JDK: 11.0.4
Node: 10.17.0
Studio: 6.0.0.202005141803
Device: Pixel3(v10.0) emulator
-
Story Points:3
-
Sprint:2020 Sprint 11, 2020 Sprint 12, 2020 Sprint 13
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. |
});
|