@nativescript-community/text 1.5.17 → 1.5.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index-common.d.ts CHANGED
@@ -9,6 +9,7 @@ export interface ObjectSpans extends Partial<Pick<LightFormattedString, keyof Li
9
9
  spans: any;
10
10
  }
11
11
  export declare function computeBaseLineOffset(align: any, fontAscent: any, fontDescent: any, fontBottom: any, fontTop: any, fontSize: any, maxFontSize: any): number;
12
+ export declare function getTransformedText(text: string, textTransform: CoreTypes.TextTransformType): string;
12
13
  export declare const cssProperty: (target: Object, key: string | symbol) => void;
13
14
  export declare type VerticalTextAlignment = 'initial' | 'top' | 'middle' | 'bottom' | 'center';
14
15
  export declare const verticalTextAlignmentConverter: (value: any) => VerticalTextAlignment;
package/index-common.js CHANGED
@@ -37,6 +37,31 @@ export function computeBaseLineOffset(align, fontAscent, fontDescent, fontBottom
37
37
  }
38
38
  return result;
39
39
  }
40
+ function getCapitalizedString(str) {
41
+ const words = str.split(' ');
42
+ const newWords = [];
43
+ for (let i = 0, length = words.length; i < length; i++) {
44
+ const word = words[i].toLowerCase();
45
+ newWords.push(word.substring(0, 1).toUpperCase() + word.substring(1));
46
+ }
47
+ return newWords.join(' ');
48
+ }
49
+ export function getTransformedText(text, textTransform) {
50
+ if (!text || !isString(text)) {
51
+ return '';
52
+ }
53
+ switch (textTransform) {
54
+ case 'uppercase':
55
+ return text.toUpperCase();
56
+ case 'lowercase':
57
+ return text.toLowerCase();
58
+ case 'capitalize':
59
+ return getCapitalizedString(text);
60
+ case 'none':
61
+ default:
62
+ return text;
63
+ }
64
+ }
40
65
  export const cssProperty = (target, key) => {
41
66
  // property getter
42
67
  const getter = function () {
@@ -267,120 +292,28 @@ export function overrideSpanAndFormattedString(useLightFormatString = true) {
267
292
  };
268
293
  //@ts-ignore
269
294
  TextBase.prototype.setFormattedTextDecorationAndTransform = function () {
295
+ const nativeView = this.nativeTextViewProtected;
270
296
  const attrText = this.createFormattedTextNative(this.formattedText);
271
- if (this.letterSpacing !== 0) {
272
- attrText.addAttributeValueRange(NSKernAttributeName, this.letterSpacing * this.nativeTextViewProtected.font.pointSize, { location: 0, length: attrText.length });
273
- }
274
- if (this.style.lineHeight) {
275
- const paragraphStyle = NSMutableParagraphStyle.alloc().init();
276
- paragraphStyle.minimumLineHeight = this.lineHeight;
277
- // make sure a possible previously set text alignment setting is not lost when line height is specified
278
- if (this.nativeTextViewProtected instanceof UIButton) {
279
- paragraphStyle.alignment = this.nativeTextViewProtected.titleLabel.textAlignment;
280
- }
281
- else {
282
- paragraphStyle.alignment = this.nativeTextViewProtected.textAlignment;
283
- }
284
- if (this.nativeTextViewProtected instanceof UILabel) {
285
- // make sure a possible previously set line break mode is not lost when line height is specified
286
- paragraphStyle.lineBreakMode = this.nativeTextViewProtected.lineBreakMode;
287
- }
288
- attrText.addAttributeValueRange(NSParagraphStyleAttributeName, paragraphStyle, { location: 0, length: attrText.length });
289
- }
290
- else if (this.nativeTextViewProtected instanceof UITextView) {
291
- const paragraphStyle = NSMutableParagraphStyle.alloc().init();
292
- paragraphStyle.alignment = this.nativeTextViewProtected.textAlignment;
293
- attrText.addAttributeValueRange(NSParagraphStyleAttributeName, paragraphStyle, { location: 0, length: attrText.length });
294
- }
295
- if (this.nativeTextViewProtected instanceof UIButton) {
296
- this.nativeTextViewProtected.setAttributedTitleForState(attrText, 0 /* UIControlState.Normal */);
297
- }
298
- else {
299
- if (majorVersion >= 13 && UIColor.labelColor) {
300
- this.nativeTextViewProtected.textColor = UIColor.labelColor;
301
- }
302
- this.nativeTextViewProtected.attributedText = attrText;
297
+ // we override parent class behavior because we apply letterSpacing and lineHeight on a per Span basis
298
+ if (majorVersion >= 13 && UIColor.labelColor) {
299
+ this.nativeTextViewProtected.textColor = UIColor.labelColor;
303
300
  }
301
+ nativeView.attributedText = attrText;
304
302
  };
305
303
  //@ts-ignore
306
304
  TextBase.prototype.setTextDecorationAndTransform = function () {
307
305
  const style = this.style;
308
- const dict = new Map();
309
- switch (style.textDecoration) {
310
- case 'none':
311
- break;
312
- case 'underline':
313
- dict.set(NSUnderlineStyleAttributeName, 1 /* NSUnderlineStyle.Single */);
314
- break;
315
- case 'line-through':
316
- dict.set(NSStrikethroughStyleAttributeName, 1 /* NSUnderlineStyle.Single */);
317
- break;
318
- case 'underline line-through':
319
- dict.set(NSUnderlineStyleAttributeName, 1 /* NSUnderlineStyle.Single */);
320
- dict.set(NSStrikethroughStyleAttributeName, 1 /* NSUnderlineStyle.Single */);
321
- break;
322
- default:
323
- throw new Error(`Invalid text decoration value: ${style.textDecoration}. Valid values are: 'none', 'underline', 'line-through', 'underline line-through'.`);
324
- }
325
- if (style.letterSpacing !== 0 && this.nativeTextViewProtected.font) {
326
- const kern = style.letterSpacing * this.nativeTextViewProtected.font.pointSize;
327
- dict.set(NSKernAttributeName, kern);
328
- if (this.nativeTextViewProtected instanceof UITextField) {
329
- this.nativeTextViewProtected.defaultTextAttributes.setValueForKey(kern, NSKernAttributeName);
330
- }
331
- }
332
- const isTextView = this.nativeTextViewProtected instanceof UITextView;
333
- if (style.lineHeight) {
334
- const paragraphStyle = NSMutableParagraphStyle.alloc().init();
335
- paragraphStyle.lineSpacing = style.lineHeight;
336
- // make sure a possible previously set text alignment setting is not lost when line height is specified
337
- if (this.nativeTextViewProtected instanceof UIButton) {
338
- paragraphStyle.alignment = this.nativeTextViewProtected.titleLabel.textAlignment;
339
- }
340
- else {
341
- paragraphStyle.alignment = this.nativeTextViewProtected.textAlignment;
342
- }
343
- if (this.nativeTextViewProtected instanceof UILabel) {
344
- // make sure a possible previously set line break mode is not lost when line height is specified
345
- paragraphStyle.lineBreakMode = this.nativeTextViewProtected.lineBreakMode;
346
- }
347
- dict.set(NSParagraphStyleAttributeName, paragraphStyle);
348
- }
349
- else if (isTextView) {
350
- const paragraphStyle = NSMutableParagraphStyle.alloc().init();
351
- paragraphStyle.alignment = this.nativeTextViewProtected.textAlignment;
352
- dict.set(NSParagraphStyleAttributeName, paragraphStyle);
353
- }
354
- const source = getTransformedText(isNullOrUndefined(this.text) ? '' : `${this.text}`, this.textTransform);
355
- if (dict.size > 0 || isTextView) {
356
- if (isTextView && this.nativeTextViewProtected.font) {
357
- // UITextView's font seems to change inside.
358
- dict.set(NSFontAttributeName, this.nativeTextViewProtected.font);
359
- }
360
- const result = NSMutableAttributedString.alloc().initWithString(source);
361
- result.setAttributesRange(dict, {
362
- location: 0,
363
- length: source.length
364
- });
365
- if (this.nativeTextViewProtected instanceof UIButton) {
366
- this.nativeTextViewProtected.setAttributedTitleForState(result, 0 /* UIControlState.Normal */);
367
- }
368
- else {
369
- this.nativeTextViewProtected.attributedText = result;
370
- }
371
- }
372
- else {
373
- if (this.nativeTextViewProtected instanceof UIButton) {
374
- // Clear attributedText or title won't be affected.
375
- this.nativeTextViewProtected.setAttributedTitleForState(null, 0 /* UIControlState.Normal */);
376
- this.nativeTextViewProtected.setTitleForState(source, 0 /* UIControlState.Normal */);
377
- }
378
- else {
379
- // Clear attributedText or text won't be affected.
380
- this.nativeTextViewProtected.attributedText = undefined;
381
- this.nativeTextViewProtected.text = source;
306
+ const letterSpacing = style.letterSpacing ?? 0;
307
+ const lineHeight = style.lineHeight ?? -1;
308
+ let uiColor;
309
+ if (style.color) {
310
+ const color = !style.color || style.color instanceof Color ? style.color : new Color(style.color);
311
+ if (color) {
312
+ uiColor = color.ios;
382
313
  }
383
314
  }
315
+ const text = getTransformedText(isNullOrUndefined(this.text) ? '' : `${this.text}`, this.textTransform);
316
+ NSTextUtils.setTextDecorationAndTransformOnViewTextTextDecorationLetterSpacingLineHeightColor(this.nativeTextViewProtected, text, this.style.textDecoration || '', letterSpacing, lineHeight, uiColor);
384
317
  if (!style.color && majorVersion >= 13 && UIColor.labelColor) {
385
318
  this._setColor(UIColor.labelColor);
386
319
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index-common.js","sourceRoot":"../src/","sources":["index-common.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH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reTypes.TextAlignmentType;
31
31
  } | FormattedString | ObjectSpans, parent?: ViewBase, autoFontSizeEnabled?: boolean, fontSizeRatio?: number): any;
32
- export declare function createSpannable(span: any, parentView: any, parent?: any, maxFontSize?: number): any;
32
+ export declare function createSpannable(span: any, parentView: any, parent?: any, maxFontSize?: number): void;
package/index.android.js CHANGED
@@ -4,32 +4,36 @@ import { getTransformedText, textDecorationProperty } from '@nativescript/core/u
4
4
  import { LightFormattedString } from './index-common';
5
5
  export * from './index-common';
6
6
  function formattedStringToNativeString(formattedString) {
7
- let maxFontSize = formattedString?.fontSize || formattedString.parent?.fontSize || 0;
7
+ const parentView = formattedString.parent;
8
+ let maxFontSize = formattedString?.fontSize || parentView?.fontSize || 0;
8
9
  formattedString.spans.forEach((s) => {
9
10
  if (s.fontSize) {
10
11
  maxFontSize = Math.max(maxFontSize, s.fontSize);
11
12
  }
12
13
  });
13
14
  const options = [];
14
- formattedString.spans.forEach((s) => {
15
- if (!s.visibility || s.visibility === 'visible') {
16
- options.push(spanToNativeString(s, maxFontSize));
15
+ formattedString.spans.forEach((s, index) => {
16
+ const spanDetails = spanToNativeString(s, s.parent, parentView, maxFontSize, index);
17
+ if (spanDetails) {
18
+ options.push(spanDetails);
17
19
  }
18
20
  });
19
21
  return `[${options.join(',')}]`;
20
22
  }
21
- function spanToNativeString(span, maxFontSize) {
22
- const parent = span.parent;
23
- const grandParent = parent?.parent;
23
+ function spanToNativeString(span, parent, parentView, maxFontSize, index = -1) {
24
+ let text = span.text;
25
+ if (!text || (span.visibility && span.visibility !== 'visible')) {
26
+ return null;
27
+ }
24
28
  const spanStyle = span.style;
25
- const textTransform = span.textTransform || grandParent?.textTransform;
29
+ const textTransform = span.textTransform || parentView?.textTransform;
26
30
  let fontWeight = span.fontWeight;
27
31
  let fontStyle = span.fontStyle;
28
32
  let fontFamily = span.fontFamily;
29
33
  if (fontFamily || (fontWeight && fontWeight !== 'normal') || fontStyle) {
30
- fontFamily = fontFamily || (parent && parent.fontFamily) || (grandParent && grandParent.fontFamily);
31
- fontWeight = fontWeight || (parent && parent.fontWeight) || (grandParent && grandParent.fontWeight);
32
- fontStyle = fontStyle || (parent && parent.fontStyle) || (grandParent && grandParent.fontStyle);
34
+ fontFamily = fontFamily || (parent && parent.fontFamily) || (parentView && parentView.fontFamily);
35
+ fontWeight = fontWeight || (parent && parent.fontWeight) || (parentView && parentView.fontWeight);
36
+ fontStyle = fontStyle || (parent && parent.fontStyle) || (parentView && parentView.fontStyle);
33
37
  }
34
38
  let textDecoration;
35
39
  if (spanStyle && textDecorationProperty.isSet(spanStyle)) {
@@ -42,18 +46,17 @@ function spanToNativeString(span, maxFontSize) {
42
46
  // span.parent is FormattedString
43
47
  textDecoration = parent?.textDecoration;
44
48
  }
45
- else if (!!grandParent && textDecorationProperty.isSet(grandParent?.style)) {
49
+ else if (!!parentView && textDecorationProperty.isSet(parentView?.style)) {
46
50
  // span.parent.parent is TextBase
47
- textDecoration = grandParent?.style.textDecoration;
51
+ textDecoration = parentView?.style.textDecoration;
48
52
  }
49
- const textAlignment = span.textAlignment || (parent && parent.textAlignment) || (grandParent && grandParent.textAlignment);
53
+ const textAlignment = span.textAlignment || (parent && parent.textAlignment) || (parentView && parentView.textAlignment);
50
54
  const verticalTextAlignment = span.verticalAlignment || parent?.verticalAlignment;
51
55
  // We CANT use parent verticalTextAlignment. Else it would break line height
52
56
  // for multiple line text you want centered in the View
53
57
  // if (!verticalTextAlignment || verticalTextAlignment === 'stretch') {
54
- // verticalTextAlignment = grandParent?.verticalTextAlignment;
58
+ // verticalTextAlignment = parentView?.verticalTextAlignment;
55
59
  // }
56
- let text = span.text;
57
60
  if (text && textTransform != null && textTransform !== 'none') {
58
61
  text = getTransformedText(text, textTransform);
59
62
  }
@@ -74,6 +77,7 @@ function spanToNativeString(span, maxFontSize) {
74
77
  fontStyle: fontStyle !== 'normal' ? fontStyle : undefined,
75
78
  textDecoration,
76
79
  textAlignment,
80
+ tapIndex: span._tappable && index !== -1 ? index : undefined,
77
81
  maxFontSize: maxFontSize ? maxFontSize * density : undefined,
78
82
  relativeSize: span.relativeSize,
79
83
  verticalTextAlignment,
@@ -154,167 +158,143 @@ export function init() {
154
158
  }
155
159
  });
156
160
  Span.prototype.toNativeString = function (maxFontSize) {
157
- return spanToNativeString(this, maxFontSize);
161
+ const parent = this.parent;
162
+ const grandParent = parent?.parent;
163
+ return spanToNativeString(this, parent, grandParent, maxFontSize);
158
164
  };
159
165
  }
160
166
  function isBold(fontWeight) {
161
167
  return fontWeight === 'bold' || fontWeight === '700' || fontWeight === '800' || fontWeight === '900';
162
168
  }
163
- // type BaselineAdjustedSpan = new (fontSize, align: string, maxFontSize) => android.text.style.MetricAffectingSpan;
164
- // // eslint-disable-next-line no-redeclare
165
- // let BaselineAdjustedSpan: BaselineAdjustedSpan;
166
- // function initializeBaselineAdjustedSpan(): void {
167
- // if (BaselineAdjustedSpan) {
168
- // return;
169
- // }
170
- // @NativeClass
171
- // class BaselineAdjustedSpanImpl extends android.text.style.CharacterStyle {
172
- // align: string = 'baseline';
173
- // maxFontSize: number;
174
- // constructor(private fontSize, align: string, maxFontSize) {
175
- // super();
176
- // this.align = align;
177
- // this.maxFontSize = maxFontSize;
178
- // }
179
- // updateDrawState(paint: android.text.TextPaint) {
180
- // this.updateState(paint);
181
- // }
182
- // updateState(paint: android.text.TextPaint) {
183
- // const fontSize = this.fontSize;
184
- // paint.setTextSize(fontSize);
185
- // const metrics = paint.getFontMetrics();
186
- // let result = computeBaseLineOffset(this.align, metrics.ascent, metrics.descent, metrics.bottom, metrics.top, fontSize, this.maxFontSize);
187
- // result += metrics.bottom;
188
- // paint.baselineShift = result;
189
- // }
190
- // }
191
- // BaselineAdjustedSpan = BaselineAdjustedSpanImpl as any;
192
- // }
193
169
  export function createNativeAttributedString(data, parent, autoFontSizeEnabled = false, fontSizeRatio = 1 // used only on iOS
194
170
  ) {
195
171
  if (!context) {
196
172
  init();
197
173
  }
198
174
  if (data instanceof FormattedString || data instanceof LightFormattedString || data.hasOwnProperty('spans')) {
199
- return com.nativescript.text.Font.stringBuilderFromFormattedString(context, fontPath, parent?.['fontFamily'] || null, formattedStringToNativeString(data));
175
+ return com.nativescript.text.Font.stringBuilderFromFormattedString(context, fontPath, parent?.['fontFamily'] || null, formattedStringToNativeString(data), null);
200
176
  }
201
- const result = com.nativescript.text.Font.stringBuilderFromHtmlString(context, fontPath, parent?.['fontFamily'] || null, data.text);
177
+ const linkColor = parent?.['linkColor'];
178
+ const aLinkColor = linkColor ? android.graphics.Color.valueOf((linkColor instanceof Color ? linkColor : new Color(linkColor)).android) : null;
179
+ const result = com.nativescript.text.Font.stringBuilderFromHtmlString(context, fontPath, parent?.['fontFamily'] || null, data.text, parent?.['linkUnderline'] === false, aLinkColor);
202
180
  return result;
203
181
  }
204
- let lineSeparator;
205
- let Style;
206
- let Spanned;
207
182
  export function createSpannable(span, parentView, parent, maxFontSize) {
208
- let text = span.text;
209
- if (!text || (span.visibility && span.visibility !== 'visible')) {
210
- return null;
211
- }
212
- const fontSize = span.fontSize;
213
- let fontWeight = span.fontWeight;
214
- let fontStyle = span.fontStyle;
215
- let fontFamily = span.fontFamily;
216
- const color = span.color;
217
- const textDecorations = span.textDecoration || (parent && parent.textDecoration);
218
- const backgroundcolor = span.backgroundColor || (parent && parent.backgroundColor);
219
- const verticalTextAlignment = span.verticalTextAlignment;
220
- const letterSpacing = span.letterSpacing || (parent && parent.letterSpacing);
221
- const lineHeight = span.lineHeight || (parent && parent.lineHeight);
222
- const realMaxFontSize = Math.max(maxFontSize, parentView.fontSize || 0);
223
- if (typeof text === 'boolean' || typeof text === 'number') {
224
- text = text.toString();
225
- }
226
- const textTransform = span.textTransform || (parent && parent.textTransform);
227
- if (textTransform) {
228
- text = getTransformedText(text, textTransform);
229
- }
230
- if (typeof text === 'string') {
231
- if (text.indexOf('\n') !== -1) {
232
- if (!lineSeparator) {
233
- lineSeparator = java.lang.System.getProperty('line.separator');
234
- }
235
- text = text.replace(/\\n/g, lineSeparator);
183
+ const details = spanToNativeString(span, parent, parentView, maxFontSize);
184
+ if (details) {
185
+ const ssb = (span._ssb = com.nativescript.text.Font.stringBuilderFromFormattedString(context, fontPath, parentView?.['fontFamily'] || null, `[${details}]`, span._ssb));
186
+ if (span.tappable) {
187
+ initializeClickableSpan();
188
+ ssb.setSpan(new ClickableSpan(span), 0, length, android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
236
189
  }
237
190
  }
238
- const length = typeof text.length === 'function' ? text.length() : text.length;
239
- let ssb = span._ssb;
240
- if (!ssb) {
241
- span._ssb = ssb = new android.text.SpannableStringBuilder(text);
242
- }
243
- else {
244
- ssb.clear();
245
- ssb.clearSpans();
246
- ssb.append(text);
247
- }
248
- if (!Style) {
249
- Style = android.text.style;
250
- }
251
- if (!Spanned) {
252
- Spanned = android.text.Spanned;
253
- }
254
- const bold = isBold(fontWeight);
255
- const italic = fontStyle === 'italic';
256
- // if (getSDK() < 28) {
257
- if (bold && italic) {
258
- ssb.setSpan(new Style.StyleSpan(android.graphics.Typeface.BOLD_ITALIC), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
259
- }
260
- else if (bold) {
261
- ssb.setSpan(new Style.StyleSpan(android.graphics.Typeface.BOLD), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
262
- }
263
- else if (italic) {
264
- ssb.setSpan(new Style.StyleSpan(android.graphics.Typeface.ITALIC), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
265
- }
191
+ // let text = span.text;
192
+ // if (!text || (span.visibility && span.visibility !== 'visible')) {
193
+ // return null;
266
194
  // }
267
- if (fontFamily || fontWeight || fontStyle) {
268
- fontFamily = fontFamily || (parent && parent.fontFamily) || (parentView && parentView.fontFamily);
269
- fontWeight = fontWeight || (parent && parent.fontWeight) || (parentView && parentView.fontWeight);
270
- fontStyle = fontWeight || (parent && parent.fontStyle) || (parentView && parentView.fontStyle);
271
- const fontCacheKey = fontFamily + fontWeight + fontStyle;
272
- let typeface = typefaceCache[fontCacheKey];
273
- if (!typeface) {
274
- // for now we dont handle CSpan (from @nativescript-community/ui-canvaslabel)
275
- const font = new Font(fontFamily, 10, fontStyle, fontWeight);
276
- typeface = typefaceCache[fontCacheKey] = font.getAndroidTypeface();
277
- }
278
- const typefaceSpan = new com.nativescript.text.CustomTypefaceSpan(fontFamily, typeface);
279
- ssb.setSpan(typefaceSpan, 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
280
- }
281
- if (verticalTextAlignment && verticalTextAlignment !== 'initial') {
282
- ssb.setSpan(new com.nativescript.text.BaselineAdjustedSpan(fontSize, verticalTextAlignment, realMaxFontSize), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
283
- }
284
- if (fontSize) {
285
- ssb.setSpan(new Style.AbsoluteSizeSpan(fontSize), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
286
- }
287
- if (span.relativeSize) {
288
- ssb.setSpan(new Style.RelativeSizeSpan(span.relativeSize), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
289
- }
290
- if (letterSpacing) {
291
- ssb.setSpan(new Style.ScaleXSpan((letterSpacing + 1) / 10), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
292
- }
293
- if (lineHeight !== undefined) {
294
- ssb.setSpan(new com.nativescript.text.HeightSpan(lineHeight), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
295
- }
296
- if (color) {
297
- const ncolor = color instanceof Color ? color : new Color(color);
298
- ssb.setSpan(new Style.ForegroundColorSpan(ncolor.android), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
299
- }
300
- if (backgroundcolor) {
301
- const color = backgroundcolor instanceof Color ? backgroundcolor : new Color(backgroundcolor);
302
- ssb.setSpan(new Style.BackgroundColorSpan(color.android), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
303
- }
304
- if (textDecorations) {
305
- const underline = textDecorations.indexOf('underline') !== -1;
306
- if (underline) {
307
- ssb.setSpan(new Style.UnderlineSpan(), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
308
- }
309
- const strikethrough = textDecorations.indexOf('line-through') !== -1;
310
- if (strikethrough) {
311
- ssb.setSpan(new Style.StrikethroughSpan(), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
312
- }
313
- }
314
- if (span.tappable) {
315
- initializeClickableSpan();
316
- ssb.setSpan(new ClickableSpan(span), 0, length, android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
317
- }
318
- return ssb;
195
+ // const fontSize = span.fontSize;
196
+ // let fontWeight = span.fontWeight;
197
+ // let fontStyle = span.fontStyle;
198
+ // let fontFamily = span.fontFamily;
199
+ // const color = span.color;
200
+ // const textDecorations = span.textDecoration || (parent && parent.textDecoration);
201
+ // const backgroundcolor = span.backgroundColor || (parent && parent.backgroundColor);
202
+ // const verticalTextAlignment = span.verticalTextAlignment;
203
+ // const letterSpacing = span.letterSpacing || (parent && parent.letterSpacing);
204
+ // const lineHeight = span.lineHeight || (parent && parent.lineHeight);
205
+ // const realMaxFontSize = Math.max(maxFontSize, parentView.fontSize || 0);
206
+ // if (typeof text === 'boolean' || typeof text === 'number') {
207
+ // text = text.toString();
208
+ // }
209
+ // const textTransform = span.textTransform || (parent && parent.textTransform);
210
+ // if (textTransform) {
211
+ // text = getTransformedText(text, textTransform);
212
+ // }
213
+ // if (typeof text === 'string') {
214
+ // if (text.indexOf('\n') !== -1) {
215
+ // if (!lineSeparator) {
216
+ // lineSeparator = java.lang.System.getProperty('line.separator');
217
+ // }
218
+ // text = text.replace(/\\n/g, lineSeparator);
219
+ // }
220
+ // }
221
+ // const length = typeof text.length === 'function' ? text.length() : text.length;
222
+ // let ssb = span._ssb;
223
+ // if (!ssb) {
224
+ // span._ssb = ssb = new android.text.SpannableStringBuilder(text);
225
+ // } else {
226
+ // ssb.clear();
227
+ // ssb.clearSpans();
228
+ // ssb.append(text);
229
+ // }
230
+ // if (!Style) {
231
+ // Style = android.text.style;
232
+ // }
233
+ // if (!Spanned) {
234
+ // Spanned = android.text.Spanned;
235
+ // }
236
+ // const bold = isBold(fontWeight);
237
+ // const italic = fontStyle === 'italic';
238
+ // // if (getSDK() < 28) {
239
+ // if (bold && italic) {
240
+ // ssb.setSpan(new Style.StyleSpan(android.graphics.Typeface.BOLD_ITALIC), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
241
+ // } else if (bold) {
242
+ // ssb.setSpan(new Style.StyleSpan(android.graphics.Typeface.BOLD), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
243
+ // } else if (italic) {
244
+ // ssb.setSpan(new Style.StyleSpan(android.graphics.Typeface.ITALIC), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
245
+ // }
246
+ // // }
247
+ // if (fontFamily || fontWeight || fontStyle) {
248
+ // fontFamily = fontFamily || (parent && parent.fontFamily) || (parentView && parentView.fontFamily);
249
+ // fontWeight = fontWeight || (parent && parent.fontWeight) || (parentView && parentView.fontWeight);
250
+ // fontStyle = fontWeight || (parent && parent.fontStyle) || (parentView && parentView.fontStyle);
251
+ // const fontCacheKey = fontFamily + fontWeight + fontStyle;
252
+ // let typeface = typefaceCache[fontCacheKey];
253
+ // if (!typeface) {
254
+ // // for now we dont handle CSpan (from @nativescript-community/ui-canvaslabel)
255
+ // const font = new Font(fontFamily, 10, fontStyle, fontWeight);
256
+ // typeface = typefaceCache[fontCacheKey] = font.getAndroidTypeface();
257
+ // }
258
+ // const typefaceSpan = new com.nativescript.text.CustomTypefaceSpan(fontFamily, typeface);
259
+ // ssb.setSpan(typefaceSpan, 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
260
+ // }
261
+ // if (verticalTextAlignment && verticalTextAlignment !== 'initial') {
262
+ // ssb.setSpan(new com.nativescript.text.BaselineAdjustedSpan(fontSize, verticalTextAlignment, realMaxFontSize as any), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
263
+ // }
264
+ // if (fontSize) {
265
+ // ssb.setSpan(new Style.AbsoluteSizeSpan(fontSize), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
266
+ // }
267
+ // if (span.relativeSize) {
268
+ // ssb.setSpan(new Style.RelativeSizeSpan(span.relativeSize), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
269
+ // }
270
+ // if (letterSpacing) {
271
+ // ssb.setSpan(new Style.ScaleXSpan((letterSpacing + 1) / 10), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
272
+ // }
273
+ // if (lineHeight !== undefined) {
274
+ // ssb.setSpan(new com.nativescript.text.HeightSpan(lineHeight), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
275
+ // }
276
+ // if (color) {
277
+ // const ncolor = color instanceof Color ? color : new Color(color);
278
+ // ssb.setSpan(new Style.ForegroundColorSpan(ncolor.android), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
279
+ // }
280
+ // if (backgroundcolor) {
281
+ // const color = backgroundcolor instanceof Color ? backgroundcolor : new Color(backgroundcolor);
282
+ // ssb.setSpan(new Style.BackgroundColorSpan(color.android), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
283
+ // }
284
+ // if (textDecorations) {
285
+ // const underline = textDecorations.indexOf('underline') !== -1;
286
+ // if (underline) {
287
+ // ssb.setSpan(new Style.UnderlineSpan(), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
288
+ // }
289
+ // const strikethrough = textDecorations.indexOf('line-through') !== -1;
290
+ // if (strikethrough) {
291
+ // ssb.setSpan(new Style.StrikethroughSpan(), 0, length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
292
+ // }
293
+ // }
294
+ // if (span.tappable) {
295
+ // initializeClickableSpan();
296
+ // ssb.setSpan(new ClickableSpan(span), 0, length, android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
297
+ // }
298
+ // return ssb;
319
299
  }
320
300
  //# sourceMappingURL=index.android.js.map