Skip to content

(WIP) feat: TappableSpan support#7076

Closed
edusperoni wants to merge 8 commits into
NativeScript:masterfrom
edusperoni:clickablespan
Closed

(WIP) feat: TappableSpan support#7076
edusperoni wants to merge 8 commits into
NativeScript:masterfrom
edusperoni:clickablespan

Conversation

@edusperoni

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

There is no way to add links to Labels/TextViews.

What is the new behavior?

Span now has a linkClick event which, when bound, makes it possible for it to be interacted with via tap.

Implements #3671.

Initial support for clickable span on Android
@cla-bot cla-bot Bot added the cla: yes label Mar 26, 2019
@ghost ghost added the ♥ community PR label Mar 26, 2019
@edusperoni

edusperoni commented Mar 26, 2019

Copy link
Copy Markdown
Contributor Author

If possible, I'd like that the core team test this implementation on Android and validate it's styling, so I can replicate it on iOS.

Challenges:

  1. On iOS, making a Label clickable requires a dirty hack. This is only a problem with UILabel.
  2. I have no idea if this works when the parent is a button (further testing needed).

There's an option to use the usual link highlighting (some adaptations are needed, or we could depend on https://github.com/saket/Better-Link-Movement-Method) to get this effect:

image

We could accomplish it by setting something like android.highlightColor, but when you override the span's background color, the highlight color never appears. This means we would not be able to create a span with a background that highlights.

This is also not possible on iOS (at least not in a trivial way). If our goal is to have the same style on both platforms, we can skip this step.

@ghost ghost assigned manoldonev Apr 5, 2019
@ghost ghost added in progress and removed ♥ community PR labels Apr 5, 2019
@shiv19

shiv19 commented May 6, 2019

Copy link
Copy Markdown
Member

Hi @edusperoni!
Can we please rename this to TappableSpan,
and change the name of the event to linktap since "click" is not a term that is used on mobile. :)

@edusperoni

Copy link
Copy Markdown
Contributor Author

@shiv19 Absolutely, I used CliackableSpan because Android actually defines it like that (https://developer.android.com/reference/android/text/style/ClickableSpan). I'll update it to match TappableSpan

@edusperoni edusperoni changed the title (WIP) feat: ClickableSpan support (WIP) feat: TappableSpan support May 6, 2019
@bgrand-ch

Copy link
Copy Markdown

Hello ! Great improvement, look forward to it being implemented :) Thank you very much for your work.

@edusperoni

Copy link
Copy Markdown
Contributor Author

Closing in favor of #8256

@edusperoni edusperoni closed this Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants