FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

rename clickable to tappable in Span · NativeScript/NativeScript@8fc42ff · GitHub

Commit 8fc42ff

Browse files
committed
rename clickable to tappable in Span
1 parent cca70cc commit 8fc42ff

6 files changed

Lines changed: 29 additions & 29 deletions

File tree

‎apps/app/ui-tests-app/css/main-page.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ export function loadExamples() {
4444
examples.set("background-shorthand", "css/background-shorthand");
4545
examples.set("background-image-linear-gradient", "css/background-image-linear-gradient");
4646
examples.set("background-image", "css/background-image");
47-
examples.set("clickable-span", "css/clickable-span");
47+
examples.set("tappable-span", "css/tappable-span");
4848
return examples;
4949
}
File renamed without changes.

apps/app/ui-tests-app/css/clickable-span.xml renamed to apps/app/ui-tests-app/css/tappable-span.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<FormattedString>
66
<FormattedString.spans>
77
<Span text="The quick brown " style="font-weight: bold; color: green;" />
8-
<Span text="fox" style="font-weight: italic; color: green;" linkClick="foxTap"/>
8+
<Span text="fox" style="font-weight: italic; color: green;" linkTap="foxTap"/>
99
<Span text=" jumps over the lazy " style="font-weight: bold; color: red;" />
10-
<Span text="dog" style="font-weight: bold; color: blue;" linkClick="dogTap"/>
10+
<Span text="dog" style="font-weight: bold; color: blue;" linkTap="dogTap"/>
1111
<Span text="." style="font-weight: bold; color: green;" />
1212
</FormattedString.spans>
1313
</FormattedString>

‎tns-core-modules/text/span.d.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ export class Span extends ViewBase {
5252
public text: string;
5353

5454
/**
55-
* String value used when hooking to linkClicked event.
55+
* String value used when hooking to linkTap event.
5656
*/
57-
public static linkClickedEvent: string;
57+
public static linkTapEvent: string;
5858

5959
/**
60-
* Gets if the span is clickable or not.
60+
* Gets if the span is tappable or not.
6161
*/
62-
public readonly clickable: boolean;
62+
public readonly tappable: boolean;
6363

6464
//@private
6565
/**

‎tns-core-modules/text/span.ts‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { FontStyle, FontWeight, } from "../ui/styling/font";
55
import { TextDecoration, EventData } from "../ui/text-base";
66

77
export class Span extends ViewBase implements SpanDefinition {
8-
static linkClickEvent = "linkClick";
8+
static linkTapEvent = "linkTap";
99
private _text: string;
10-
private _clickable: boolean = false;
10+
private _tappable: boolean = false;
1111

1212
get fontFamily(): string {
1313
return this.style.fontFamily;
@@ -70,28 +70,28 @@ export class Span extends ViewBase implements SpanDefinition {
7070
}
7171
}
7272

73-
get clickable(): boolean {
74-
return this._clickable;
73+
get tappable(): boolean {
74+
return this._tappable;
7575
}
7676

7777
addEventListener(arg: string, callback: (data: EventData) => void, thisArg?: any) {
7878
super.addEventListener(arg, callback, thisArg);
79-
this._setClickable(this.hasListeners(Span.linkClickEvent));
79+
this._setTappable(this.hasListeners(Span.linkTapEvent));
8080
}
8181

8282
removeEventListener(arg: string, callback?: any, thisArg?: any) {
8383
super.removeEventListener(arg, callback, thisArg);
84-
this._setClickable(this.hasListeners(Span.linkClickEvent));
84+
this._setTappable(this.hasListeners(Span.linkTapEvent));
8585
}
8686

8787
_setTextInternal(value: string): void {
8888
this._text = value;
8989
}
9090

91-
private _setClickable(value: boolean): void {
92-
if (this._clickable !== value) {
93-
this._clickable = value;
94-
this.notifyPropertyChange("clickable", value);
91+
private _setTappable(value: boolean): void {
92+
if (this._tappable !== value) {
93+
this._tappable = value;
94+
this.notifyPropertyChange("tappable", value);
9595
}
9696
}
9797
}

‎tns-core-modules/ui/text-base/text-base.android.ts‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function initializeClickableSpan(): void {
7272
onClick(view: android.view.View): void {
7373
const owner = this.owner.get();
7474
if (owner) {
75-
owner._emit(Span.linkClickEvent);
75+
owner._emit(Span.linkTapEvent);
7676
}
7777
view.clearFocus();
7878
view.invalidate();
@@ -94,7 +94,7 @@ export class TextBase extends TextBaseCommon {
9494
private _maxHeight: number;
9595
private _minLines: number;
9696
private _maxLines: number;
97-
private _clickable: boolean = false;
97+
private _tappable: boolean = false;
9898
private _defaultMovementMethod: android.text.method.MovementMethod;
9999

100100
public initNativeView(): void {
@@ -148,7 +148,7 @@ export class TextBase extends TextBaseCommon {
148148
if (!reset && this.formattedText) {
149149
return;
150150
}
151-
this._setClickableState(false);
151+
this._setTappableState(false);
152152

153153
this._setNativeText(reset);
154154
}
@@ -169,7 +169,7 @@ export class TextBase extends TextBaseCommon {
169169

170170
const spannableStringBuilder = createSpannableStringBuilder(value);
171171
nativeView.setText(<any>spannableStringBuilder);
172-
this._setClickableState(isStringClickable(value));
172+
this._setTappableState(isStringTappable(value));
173173

174174
textProperty.nativeValueChange(this, (value === null || value === undefined) ? "" : value.toString());
175175

@@ -353,10 +353,10 @@ export class TextBase extends TextBaseCommon {
353353
this.nativeTextViewProtected.setText(<any>transformedText);
354354
}
355355

356-
_setClickableState(clickable: boolean) {
357-
if (this._clickable !== clickable) {
358-
this._clickable = clickable;
359-
if (this._clickable) {
356+
_setTappableState(tappable: boolean) {
357+
if (this._tappable !== tappable) {
358+
this._tappable = tappable;
359+
if (this._tappable) {
360360
this.nativeViewProtected.setMovementMethod(android.text.method.LinkMovementMethod.getInstance());
361361
this.nativeViewProtected.setHighlightColor(null);
362362
}
@@ -396,13 +396,13 @@ export function getTransformedText(text: string, textTransform: TextTransform):
396396
}
397397
}
398398

399-
function isStringClickable(formattedString: FormattedString) {
399+
function isStringTappable(formattedString: FormattedString) {
400400
if (!formattedString) {
401401
return false;
402402
}
403403
for (let i = 0, length = formattedString.spans.length; i < length; i++) {
404404
const span = formattedString.spans.getItem(i);
405-
if (span.clickable) {
405+
if (span.tappable) {
406406
return true;
407407
}
408408
}
@@ -507,8 +507,8 @@ function setSpanModifiers(ssb: android.text.SpannableStringBuilder, span: Span,
507507
}
508508
}
509509

510-
const clickable = span.clickable;
511-
if (clickable) {
510+
const tappable = span.tappable;
511+
if (tappable) {
512512
initializeClickableSpan();
513513
ssb.setSpan(new ClickableSpan(span), start, end, android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
514514
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL