Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28424] Android: Drop-down picker text color does not change when switching dark/light theme

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2021-04-23T11:42:01.000+0000
Affected Version/sRelease 10.0.0
Fix Version/sRelease 10.0.0
ComponentsAndroid
Labelsandroid, color, picker, regression, theme
ReporterJoshua Quick
AssigneeJoshua Quick
Created2021-04-20T22:04:27.000+0000
Updated2021-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" });

Comments

  1. Joshua Quick 2021-04-20

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/12734
  2. Christopher Williams 2021-04-23

    merged to master and 10_0_X branches

JSON Source