{ "id": "175725", "key": "AC-6629", "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": "2020-11-26T15:02:42.000+0000", "created": "2020-11-17T01:38:12.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2020-11-26T15:03:01.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": [], "description": "Hi,\r\n\r\nI am trying to apply an attributedString of type \"strikethrough\" as documented here\r\n\r\nhttps://docs.appcelerator.com/platform/latest/#!/guide/Attributed_Strings-section-src-37538231_AttributedStrings-Strikethrough\r\n\r\nI've tested the code in my app as well as separately in a sample app. It seems that the strikethrough can only be applied to the full string, and not parts of the string via the range of the attributedString.\r\n\r\nTo reproduce, create a sample app with the following. range: [0, text.length] should show the full strikethrough. \r\n\r\nChanging the range to what is in the documentation example range: [text.indexOf('hyperloop'), ('hyperloop').length] does not show the strikethrough, and adding manual values like [0,13] does not create the strikethrough.\r\n\r\nIssue is iOS only, and all other attribute types work.\r\n\r\n\r\n{code:java}\r\n// index.xml\r\n\r\n\t\r\n\t\t\r\n\r\n\r\n// index.js\r\nvar text = \"Have you tried hyperloop ti.next yet?\";\r\nvar attr = Ti.UI.createAttributedString({\r\n text: text,\r\n attributes: [\r\n {\r\n type: Ti.UI.ATTRIBUTE_STRIKETHROUGH_STYLE,\r\n value: Ti.UI.ATTRIBUTE_UNDERLINE_STYLE_THICK, \r\n range: [0, text.length]\r\n }\r\n ]\r\n});\r\n\r\n$.myLabel.attributedString = attr\r\n\r\n$.index.open();\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "AttributedString type \"strikethrough\" not working on portions, only full length of strings", "creator": { "name": "eric.harms@gmail.com", "key": "eric.harms@gmail.com", "displayName": "eric harms", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "eric.harms@gmail.com", "key": "eric.harms@gmail.com", "displayName": "eric harms", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Catalina 10.15.7 (19H2)\r\nAppc SDK 9.0.0.GA\r\n CLI Version = 5.2.5\r\n node-appc Version = 1.1.2\r\n Node.js Version = 12.19.0\r\n npm Version = 6.14.8\r\n\r\nbuilding to \r\niphone 12, iOS 14.1\r\niphone X, ios 14.0.1", "comment": { "comments": [ { "id": "457523", "author": { "name": "eric.harms@gmail.com", "key": "eric.harms@gmail.com", "displayName": "eric harms", "active": true, "timeZone": "America/Los_Angeles" }, "body": "If I do something like this, the strikethrough is applied. It does not if i use text1 and text2 in the attributes\r\n\r\n{code:java}\r\nvar text1 = \"Have you tried \"\r\nvar text2 = \"hyperloop\"\r\nvar text3 = \" ti.next yet?\"\r\nvar text = text1 + text2 + text3;\r\nvar attr = Ti.UI.createAttributedString({\r\n text: text,\r\n attributes: [\r\n {\r\n type: Ti.UI.ATTRIBUTE_STRIKETHROUGH_STYLE,\r\n value: Ti.UI.ATTRIBUTE_UNDERLINE_STYLE_THICK, // Ignored by Android only displays a single line\r\n range: [text.indexOf(text2), (text2).length]\r\n },\r\n {\r\n type: Ti.UI.ATTRIBUTE_STRIKETHROUGH_STYLE,\r\n value: Ti.UI.ATTRIBUTE_UNDERLINE_STYLE_THICK, // Ignored by Android only displays a single line\r\n range: [text.indexOf(text3), (text3).length]\r\n }\r\n ]\r\n});\r\n{code}\r\n", "updateAuthor": { "name": "eric.harms@gmail.com", "key": "eric.harms@gmail.com", "displayName": "eric harms", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-11-17T02:06:19.000+0000", "updated": "2020-11-17T02:06:19.000+0000" }, { "id": "457635", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi, {{ATTRIBUTE_UNDERLINE_STYLE_THICK}} is an iOS and MacOS only property I'm afraid, not supported on Android. [Link to docs|https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI-property-ATTRIBUTE_UNDERLINE_STYLE_THICK]\r\n\r\nedit: ignore this comment as I misread it being an android issue :) ", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-11-18T16:19:38.000+0000", "updated": "2020-11-19T11:19:05.000+0000" }, { "id": "457728", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~eric.harms@gmail.com]\r\n \r\nThis is iOS 14 bug, which got fixed in iOS 14.2 . See https://developer.apple.com/forums/thread/657015. In iOS < 14.0, it is working fine.\r\n\r\nAs a workaround for 14.0 <= iOS < 14.2, https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI-property-ATTRIBUTE_BASELINE_OFFSET can be used in combination with https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI-property-ATTRIBUTE_STRIKETHROUGH_STYLE .\r\n\r\nSee following example - \r\n{code:java}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#ddd',\r\n});\r\n \r\nvar text = \"Have you tried hyperloop ti.next yet?\";\r\nvar attr = Ti.UI.createAttributedString({\r\n text: text,\r\n attributes: [\r\n {\r\n type: Ti.UI.ATTRIBUTE_STRIKETHROUGH_STYLE,\r\n value: Ti.UI.ATTRIBUTE_UNDERLINE_STYLE_THICK,\r\n range: [text.indexOf('hyperloop'), ('hyperloop').length]\r\n },\r\n {\r\n type: Ti.UI.ATTRIBUTE_BASELINE_OFFSET,\r\n value: 0, // default value\r\n range: [text.indexOf('hyperloop'), ('hyperloop').length]\r\n }\r\n ]\r\n});\r\n \r\nvar label = Ti.UI.createLabel({\r\n attributedString: attr\r\n});\r\n \r\nwin.add(label);\r\nwin.open();\r\n{code}\r\n", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-11-25T20:44:20.000+0000", "updated": "2020-11-25T20:44:20.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }