{ "id": "176175", "key": "TIMOB-28434", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "21199", "description": "", "name": "Release 10.0.1", "archived": false, "released": true, "releaseDate": "2021-07-28" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2021-05-24T15:00:44.000+0000", "created": "2021-05-01T03:04:12.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "material-theme", "toolbar" ], "versions": [ { "id": "21050", "name": "Release 10.0.0", "archived": false, "released": true, "releaseDate": "2021-05-17" } ], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2021-05-24T15:00:44.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "*Summary:*\r\nChild views added to {{Ti.UI.Toolbar}} via its \"items\" property will not update themselves when changing the dark/light theme on Android.\r\n\r\n*Steps to reproduce:*\r\n# Build and run the below code on Android 10 or higher.\r\n# Tap on the \"Home\" button after app launches. _(Do NOT back out.)_\r\n# Go to the Android system Settings -> Display screen.\r\n# Toggle the dark/light theme switch.\r\n# Resume the app.\r\n# Notice app UI changed colors *except* for the button text color in toolbar.\r\n# Back out of the app and then relaunch it.\r\n# Notice the button text color in the toolbar uses the correct color.\r\n\r\n{code:javascript}\r\nfunction createButton(name) {\r\n\tconst button = Ti.UI.createButton({\r\n\t\ttitle: name,\r\n\t\tstyle: Ti.UI.BUTTON_STYLE_OPTION_NEUTRAL,\r\n\t});\r\n\tbutton.addEventListener(\"click\", function() {\r\n\t\talert(name + \" was clicked on.\");\r\n\t});\r\n\treturn button;\r\n}\r\n\r\nconst window = Ti.UI.createWindow();\r\nconst toolbar = Ti.UI.createToolbar({\r\n\titems: [\r\n\t\tcreateButton(\"Button 1\"),\r\n\t\tcreateButton(\"Button 2\"),\r\n\t\tcreateButton(\"Button 3\")\r\n\t],\r\n\televation: 2,\r\n\ttop: 0,\r\n\twidth: Ti.UI.FILL,\r\n});\r\nwindow.add(toolbar);\r\nwindow.open();\r\n{code}\r\n\r\n*Result:*\r\nNotice the toolbar button text colors did not change when switching themes.\r\n !Toolbar-Light.png|thumbnail! !Toolbar-Dark-Bad.png|thumbnail! \r\n\r\n*Expected Result:*\r\nThe button text color should be light blue when using the dark theme.\r\n !Toolbar-Dark-Good.png|thumbnail! \r\n\r\n*Notes:*\r\n# This is only an issue when changing theme dynamically. Backing out of the app/window and then relaunching it will show the correct colors.\r\n# This doesn't appear to be an issue in Alloy when adding child views to toolbar via XML. I've tested for this in our kitchensink-v2 app and it works fine.\r\n\r\n*Work-Around:*\r\nAdd child views to {{Ti.UI.Toolbar}} via its {{add()}} method instead of the \"items\" property. However, adding views like this on iOS will have layout issues making this an Android-only solution.\r\n\r\n{code:javascript}\r\nconst toolbar = Ti.UI.createToolbar({\r\n\televation: 2,\r\n\ttop: 0,\r\n\twidth: Ti.UI.FILL,\r\n});\r\ntoolbar.add(createButton(\"Button 1\"));\r\ntoolbar.add(createButton(\"Button 2\"));\r\ntoolbar.add(createButton(\"Button 3\"));\r\n{code}\r\n", "attachment": [ { "id": "67920", "filename": "Toolbar-Dark-Bad.png", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-05-01T02:59:46.000+0000", "size": 409639, "mimeType": "image/png" }, { "id": "67921", "filename": "Toolbar-Dark-Good.png", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-05-01T02:59:46.000+0000", "size": 410051, "mimeType": "image/png" }, { "id": "67919", "filename": "Toolbar-Light.png", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-05-01T02:59:46.000+0000", "size": 412896, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: Toolbar \"items\" do not update when changing dark/light theme", "creator": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "458644", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/12765", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-05-03T22:20:48.000+0000", "updated": "2021-05-03T22:20:48.000+0000" }, { "id": "458706", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "merged to master and 10_0_X branch for 10.0.1 target", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2021-05-24T15:00:40.000+0000", "updated": "2021-05-24T15:00:40.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }