{ "id": "172142", "key": "TIMOB-26341", "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": "19882", "name": "Release 8.0.0", "archived": false, "released": true, "releaseDate": "2019-03-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-12-10T16:52:01.000+0000", "created": "2018-08-28T22:08:51.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "breaking-change", "buttonbar", "ios" ], "versions": [], "issuelinks": [], "assignee": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-12-11T11:21:14.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "*Summary:*\r\nThe {{Ti.UI.ButtonBar}} is a row of buttons on does not display a \"selection\" state when a button is tapped like {{Ti.UI.TabbedBar}}. Because of this, the {{Ti.UI.ButtonBar}} \"index\" property should be removed since it isn't relevant.\r\n\r\n*Issue 1:*\r\nSetting the \"index\" property should not put a button in the \"selected\" state.\r\n# Run the below code on iOS.\r\n# Note that the middle button \"Two\" is selected. (See attached \"Screenshot.png\".)\r\n# Tap on the middle button.\r\n# Notice the selection state is removed.\r\n# Tap on the left button.\r\n# Notice the left button is not selected. (It shouldn't be selected.)\r\n\r\n*Issue 2:*\r\nFetching the value of property \"index\" always returns -1 unless fetched during the \"click\" event\r\n# Run the below code on iOS.\r\n# Tap on the right-most button.\r\n# Notice the 1st logged message \"(1) buttonBar.index: 2\" has the correct index.\r\n# Notice the 2nd message \"(2) buttonBar.index: -1\" has the incorrect index.\r\nIn this case, it would be better to use the \"click\" event's \"index\" property.\r\n\r\n{code:javascript}\r\nvar window = Ti.UI.createWindow();\r\nvar buttonBar = Ti.UI.createButtonBar({\r\n\tlabels: [\"One\", \"Two\", \"Three\"],\r\n\tindex: 1,\r\n});\r\nbuttonBar.addEventListener(\"click\", function(e) {\r\n\tTi.API.info(\"@@@ (1) buttonBar.index: \" + buttonBar.index);\r\n\tsetTimeout(function() {\r\n\t\tTi.API.info(\"@@@ (2) buttonBar.index: \" + buttonBar.index);\r\n\t}, 10);\r\n});\r\nwindow.add(buttonBar);\r\nwindow.open();\r\n{code}\r\n\r\n*Recommended Solution:*\r\nRemove the \"index\" property. It is not appropriate for this type of UI control. It would be better to use the \"click\" event's \"index\" property to identify which button was clicked on.\r\n\r\n*Note:*\r\nI think the \"index\" property exists for this UI control because it shares the same Objective-C code as {{Ti.UI.TabbedBar}}. An \"index\" property makes sense for {{TabbedBar}} since it has a selection state.\r\n\r\nThis issue is being raised since we want to add {{ButtonBar}} to Android and Windows and we don't think the \"index\" property will make sense on those platforms either.\r\n", "attachment": [ { "id": "65488", "filename": "Screenshot.png", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-28T17:56:32.000+0000", "size": 22120, "mimeType": "image/png" } ], "flagged": false, "summary": "iOS: Remove Ti.UI.ButtonBar \"index\" property", "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": "441172", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Oh, the {{ButtonBar}} uses a segmented control as well? We do we even have that? It's a duplicate of the {{Ti.UI.[iOS].TabbedBar}}. Let's deprecate the whole API.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-08-29T08:23:24.000+0000", "updated": "2018-08-29T08:23:24.000+0000" }, { "id": "441196", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I'm okay with us keeping the {{ButtonBar}} feature (why break it if we don't have to), but I do question its value. If we were to implement it on Android and Windows, then it would simply be a horizontal layout of buttons. Not particularly interesting.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-29T18:12:51.000+0000", "updated": "2018-08-29T18:12:51.000+0000" }, { "id": "443632", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR - https://github.com/appcelerator/titanium_mobile/pull/10473\r\n\r\nTest case 1 -\r\n\r\n{code:java}\r\n// Should not log deprecation message\r\nvar window = Ti.UI.createWindow({\r\n backgroundColor: 'white'\r\n});\r\nvar tabbedBar = Titanium.UI.iOS.createTabbedBar({\r\n labels: [\"One\", \"Two\", \"Three\"],\r\n index: 1,\r\n});\r\ntabbedBar.addEventListener(\"click\", function(e) {\r\n Ti.API.info(\"@@@ (1) tabbedBar.index: \" + tabbedBar.index);\r\n Ti.API.info(\"@@@ (2) tabbedBar.index: \" + e.index);\r\n setTimeout(function() {\r\n Ti.API.info(\"@@@ (3) tabbedBar.index: \" + tabbedBar.index);\r\n }, 10);\r\n});\r\nwindow.add(tabbedBar);\r\nwindow.open();\r\n{code}\r\n\r\nTest Case 2 -\r\n\r\n{code:java}\r\n// Should log deprecation message\r\nvar window = Ti.UI.createWindow({\r\n backgroundColor: 'white'\r\n});\r\nvar buttonBar = Titanium.UI.createButtonBar({\r\n labels: [\"One\", \"Two\", \"Three\"],\r\n index: 1,\r\n});\r\nbuttonBar.addEventListener(\"click\", function(e) {\r\n Ti.API.info(\"@@@ (1) Should result (-1): \" + buttonBar.index);\r\n Ti.API.info(\"@@@ (2) Should give selected value: \" + e.index);\r\n setTimeout(function() {\r\n Ti.API.info(\"@@@ (3) Should result (-1): \" + buttonBar.index);\r\n }, 10);\r\n});\r\nwindow.add(buttonBar);\r\nwindow.open();\r\n{code}\r\n", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-11-15T08:45:47.000+0000", "updated": "2018-11-15T08:45:47.000+0000" }, { "id": "443743", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed. Waiting on CR and Jenkins build.", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-11-19T12:20:36.000+0000", "updated": "2018-11-19T12:20:36.000+0000" }, { "id": "444466", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket, fix verified in SDK version {{8.0.0.v20181210172243}}.\r\n\r\nTest and other information can be found at: \r\nhttps://github.com/appcelerator/titanium_mobile/pull/10473", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-12-11T11:21:08.000+0000", "updated": "2018-12-11T11:21:08.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }