[TIMOB-28424] Android: Drop-down picker text color does not change when switching dark/light theme
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2021-04-23T11:42:01.000+0000 |
Affected Version/s | Release 10.0.0 |
Fix Version/s | Release 10.0.0 |
Components | Android |
Labels | android, color, picker, regression, theme |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2021-04-20T22:04:27.000+0000 |
Updated | 2021-04-23T11:42:01.000+0000 |
Description
*Summary:*
As of Titanium 10.0.0, a "plain"
Ti.UI.Picker
with "useSpinner" set to false
(aka: a drop-down picker) won't update its row text colors when switching dark/light theme. You have to force-quit the app to make it use the system's current default text color.
*Steps to reproduce:*
Build and run the below on an Android 10 or newer device.
Verify that you can see text in the picker.
Go to System Settings -> Display
Toggle the Dark/Light theme switch.
Go back to the app.
Notice that the picker's text color has not changed.
const window = Ti.UI.createWindow();
const rows = [];
for (let index = 1; index <= 5; index++) {
rows.push(Ti.UI.createPickerRow({ title: Item ${index}
}));
}
const picker = Ti.UI.createPicker({
columns: [Ti.UI.createPickerColumn({ rows: rows })],
width: "50%",
});
picker.addEventListener("change", (e) => {
Ti.API.info(@@@ Selected rowIndex: ${e.rowIndex}, rowTitle: "${e.row.title}"
);
});
window.add(picker);
window.open();
*Work-Around:*
Set the picker's row text color as shown below.
Ti.UI.createPickerRow({ title: Item ${index}
, color: "?attr/colorOnSurface" });
PR (master): https://github.com/appcelerator/titanium_mobile/pull/12734
merged to master and 10_0_X branches