[TIMOB-23887] iOS: Attributed string link on a TextArea doesn't fire link event
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-05-09T18:06:06.000+0000 |
Affected Version/s | Release 5.4.0 |
Fix Version/s | Release 6.1.0 |
Components | iOS |
Labels | merge-6.1.0 |
Reporter | youri hanssens |
Assignee | Vijay Singh |
Created | 2016-07-30T11:15:01.000+0000 |
Updated | 2017-05-10T16:14:41.000+0000 |
Description
I use non-editable textarea's for multi-line text sections in my app. For setting the value I use attributed strings because some parts are links. Visually the clickable parts look like they are processed correctly because they turn blue and underlined. But when I click on one of the links I expect the 'link' event to be triggered but all it does is select the word I just clicked, the listener get's nothing.
When replacing textarea with label the link event works fine. Unfortunately labels are not an option for me because they do not handle Ti.UI.ATTRIBUTE_BASELINE_OFFSET, which I use to create a better looking line sacing, very well. Using that attribute on a label makes the it clip the text or unwanted ellipsis.
Hello, Can uou share a sample test code that regenerates the issue. Also please update your ticket with effected SDK version and your platform information. We will look into your testcode. Thanks.
This problem is due to TIMOB-19165 . In this NSLinkAttributeName attribute is removed in order to fulfill the requirement of ticket. The UITextView recognize URL on basis of NSLinkAttributeName and delegates get called , which is handled by UITextView itself. So link event is not getting fired.
There are two solutions - 1. Revert changes of TIMOB-19165 then UITextView's native link recognizer will be called. 2. Made changes similar to UILabel's link recognizer which is custom. In this PR, I have followed solution 2. PR: https://github.com/appcelerator/titanium_mobile/pull/8923 Test Case :
Backport for 6.1.0 please
Backport PR (6_1_X):https://github.com/appcelerator/titanium_mobile/pull/9013
FR Passed, using: MacOS 10.12 (16A323) Studio 4.9.0.201704061825 Ti SDK 6.1.0.v20170503211832 Appc NPM 4.2.9 Appc CLI 6.2.0 Alloy 1.9.11 Xcode 8.3.2 (8E2002) Attributed strings, inside non-editable text areas, with links now correctly fire the link event when clicked. Tested using the sample code and modified it to fully apply to the test case.
Fixes verified in builds: 6.1.0.v20170509170935 6.2.0.v20170510084833