{ "id": "165957", "key": "AC-4787", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "11", "description": "Is not a bug in our product", "name": "Not Our Bug" }, "resolutiondate": "2017-02-12T17:26:59.000+0000", "created": "2017-02-12T12:27:01.000+0000", "labels": [ "ios" ], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2017-02-13T08:21:59.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "The textAlign property for a button on iOS seems to behave the wrong way around:\r\n\r\n{code:javascript}\r\nvar button = Ti.UI.createButton({\r\n width: Ti.UI.SIZE\r\n , height: '30dp'\r\n , text: 'Update status'\r\n , textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT // or 'left'\r\n , backgroundColor: '#DCB5FF'\r\n});\r\n{code}\r\n\r\nCauses image attached. If the textAlign is set to right, then it justifies to left\r\n", "attachment": [ { "id": "61557", "filename": "Button_LEFT.png", "author": { "name": "lawrence.wilson@abannan.com", "key": "lawrence.wilson@abannan.com", "displayName": "Lawrence Wilson", "active": true, "timeZone": "Europe/London" }, "created": "2017-02-13T08:21:48.000+0000", "size": 10056, "mimeType": "image/png" }, { "id": "61556", "filename": "Label_LEFT.png", "author": { "name": "lawrence.wilson@abannan.com", "key": "lawrence.wilson@abannan.com", "displayName": "Lawrence Wilson", "active": true, "timeZone": "Europe/London" }, "created": "2017-02-13T08:21:48.000+0000", "size": 10131, "mimeType": "image/png" }, { "id": "61552", "filename": "Screen Shot 2017-02-12 at 12.24.54.png", "author": { "name": "lawrence.wilson@abannan.com", "key": "lawrence.wilson@abannan.com", "displayName": "Lawrence Wilson", "active": true, "timeZone": "Europe/London" }, "created": "2017-02-12T12:25:11.000+0000", "size": 11818, "mimeType": "image/png" } ], "flagged": false, "summary": "iOS Button textAlign is wrong way round", "creator": { "name": "lawrence.wilson@abannan.com", "key": "lawrence.wilson@abannan.com", "displayName": "Lawrence Wilson", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "lawrence.wilson@abannan.com", "key": "lawrence.wilson@abannan.com", "displayName": "Lawrence Wilson", "active": true, "timeZone": "Europe/London" }, "environment": "Titanium SDK 6.0.1", "comment": { "comments": [ { "id": "406847", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "You should always specify a width when setting the text-alignment for buttons. Working example:\r\n{code:js}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\n\r\nvar button = Ti.UI.createButton({\r\n height: 30,\r\n width: 300,\r\n title: 'Update status',\r\n textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,\r\n backgroundColor: '#DCB5FF'\r\n});\r\n\r\nwin.add(button);\r\nwin.open();\r\n{code}\r\nThe reason is that the text-alignments also specifes a button inset. So using left produces the insets {left: 10, right: 0} and right produces {right: 10, left: 0}. So when you use, the left insets are 10 and the right are 0, but because you don't specify a fixed width, it auto-sizes and results in this behavior. ", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-02-12T17:24:12.000+0000", "updated": "2017-02-12T17:26:55.000+0000" }, { "id": "406851", "author": { "name": "lawrence.wilson@abannan.com", "key": "lawrence.wilson@abannan.com", "displayName": "Lawrence Wilson", "active": true, "timeZone": "Europe/London" }, "body": "So this is different to the way a label works then as the label adds no insets and justifies correctly.\r\n\r\nI have added two more images to show this:\r\n* Button_LEFT - using a button with text align left\r\n* Label_LEFT - using a label with text align left\r\n\r\nAny idea why the button adds an inset?\r\n", "updateAuthor": { "name": "lawrence.wilson@abannan.com", "key": "lawrence.wilson@abannan.com", "displayName": "Lawrence Wilson", "active": true, "timeZone": "Europe/London" }, "created": "2017-02-13T08:21:59.000+0000", "updated": "2017-02-13T08:21:59.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }