1
- import { Color , colorProperty , fontInternalProperty , Length , paddingBottomProperty , paddingLeftProperty , paddingRightProperty , paddingTopProperty , View , lineHeightProperty } from '@nativescript/core/ui/page/page' ;
2
- import { Font } from '@nativescript/core/ui/styling/font' ;
3
- import { borderBottomWidthProperty , borderLeftWidthProperty , borderRightWidthProperty , borderTopWidthProperty , FormattedString , formattedTextProperty , TextTransform , WhiteSpace , whiteSpaceProperty , letterSpacingProperty , textAlignmentProperty } from '@nativescript/core/ui/text-base' ;
1
+ import { Color , colorProperty , fontInternalProperty , Length , paddingBottomProperty , paddingLeftProperty , paddingRightProperty , paddingTopProperty , View } from '@nativescript/core/ui/page/page' ;
2
+ import { lineHeightProperty } from '@nativescript/core/ui/text-base/text-base' ;
3
+ import {
4
+ borderBottomWidthProperty ,
5
+ borderLeftWidthProperty ,
6
+ borderRightWidthProperty ,
7
+ borderTopWidthProperty ,
8
+ TextTransform ,
9
+ WhiteSpace ,
10
+ whiteSpaceProperty ,
11
+ letterSpacingProperty ,
12
+ textAlignmentProperty
13
+ } from '@nativescript/core/ui/text-base' ;
4
14
import { isString } from '@nativescript/core/utils/types' ;
5
15
import { layout } from '@nativescript/core/utils/utils' ;
6
16
import { TextShadow , VerticalTextAlignment , verticalTextAlignmentProperty } from './label' ;
@@ -318,13 +328,13 @@ export class Label extends LabelBase {
318
328
htmlString = `<style>body{ color: ${ this . color } ;font-family: '${ font . familyName } '; font-size:${ font . pointSize } px;}</style>${ htmlString } ` ;
319
329
const nsString = NSString . stringWithString ( htmlString ) ;
320
330
const nsData = nsString . dataUsingEncoding ( NSUTF16StringEncoding ) ;
321
- const attrText = this . attributedString = NSMutableAttributedString . alloc ( ) . initWithDataOptionsDocumentAttributesError (
331
+ const attrText = ( this . attributedString = NSMutableAttributedString . alloc ( ) . initWithDataOptionsDocumentAttributesError (
322
332
nsData ,
323
333
< any > {
324
334
[ NSDocumentTypeDocumentAttribute ] : NSHTMLTextDocumentType
325
335
} ,
326
336
null
327
- ) ;
337
+ ) ) ;
328
338
329
339
// TODO: letterSpacing should be applied per Span.
330
340
if ( this . letterSpacing !== 0 ) {
@@ -347,7 +357,6 @@ export class Label extends LabelBase {
347
357
attrText . addAttributeValueRange ( NSParagraphStyleAttributeName , paragraphStyle , { location : 0 , length : attrText . length } ) ;
348
358
}
349
359
350
-
351
360
this . _requestLayoutOnTextChanged ( ) ;
352
361
}
353
362
if ( this . nativeViewProtected ) {
@@ -357,15 +366,16 @@ export class Label extends LabelBase {
357
366
[ colorProperty . setNative ] ( value : Color | UIColor ) {
358
367
const color = value instanceof Color ? value . ios : value ;
359
368
// if (!this.formattedText && !this.html) {
360
- const nativeView = this . nativeTextViewProtected ;
361
- nativeView . textColor = color ;
369
+ const nativeView = this . nativeTextViewProtected ;
370
+ nativeView . textColor = color ;
362
371
// }
363
372
}
364
373
@needFormattedStringComputation
365
374
[ htmlProperty . setNative ] ( value : string ) {
366
- if ( ! this . style . fontInternal ) {
375
+ console . log ( 'htmlProperty' , value ) ;
376
+ // if (!this.style.fontInternal) {
367
377
this . updateHTMLString ( ) ;
368
- }
378
+ // }
369
379
}
370
380
@needFormattedStringComputation
371
381
[ letterSpacingProperty . setNative ] ( value : number ) {
@@ -380,8 +390,8 @@ export class Label extends LabelBase {
380
390
super [ lineHeightProperty . setNative ] ( value ) ;
381
391
}
382
392
_setNativeText ( ) {
383
- if ( ! this . html ) {
384
- this . updateHTMLString ( ) ;
393
+ if ( this . html ) {
394
+ this . updateHTMLString ( ) ;
385
395
} else {
386
396
super . _setNativeText ( ) ;
387
397
}
0 commit comments