File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,8 @@ abstract class LabelBase extends View implements LabelViewDefinition {
121
121
122
122
public mIsSingleLine : boolean ;
123
123
124
- public text : string ;
124
+ //@ts -ignore
125
+ public text : string | java . lang . CharSequence | android . text . Spannable ;
125
126
//@ts -ignore
126
127
formattedText : FormattedString ;
127
128
@@ -369,7 +370,7 @@ export class Label extends LabelBase {
369
370
if ( typeof value === 'number' ) {
370
371
this . nativeTextViewProtected . setTextSize ( value ) ;
371
372
} else {
372
- this . nativeTextViewProtected . setTextSize ( android . util . TypedValue . COMPLEX_UNIT_PX , value . nativeSize ) ;
373
+ this . nativeTextViewProtected . setTextSize ( android . util . TypedValue . COMPLEX_UNIT_SP , value . nativeSize ) ;
373
374
}
374
375
if ( this . mAutoFontSize ) {
375
376
this . enableAutoSize ( ) ;
@@ -557,7 +558,6 @@ export class Label extends LabelBase {
557
558
this . nativeTextViewProtected . setText ( null ) ;
558
559
return ;
559
560
}
560
-
561
561
let transformedText : any = null ;
562
562
if ( this . html ) {
563
563
transformedText = this . createHTMLString ( ) ;
@@ -568,6 +568,8 @@ export class Label extends LabelBase {
568
568
this ,
569
569
this . formattedText === null || this . formattedText === undefined ? '' : this . formattedText . toString ( )
570
570
) ;
571
+ } else if ( this . text instanceof java . lang . CharSequence || this . text instanceof android . text . Spannable ) {
572
+ transformedText = this . text ;
571
573
} else {
572
574
const text = this . text ;
573
575
const stringValue = text === null || text === undefined ? '' : text . toString ( ) ;
Original file line number Diff line number Diff line change @@ -188,6 +188,9 @@ export class Label extends LabelBase {
188
188
189
189
isUsingNSTextView = false ;
190
190
191
+ //@ts -ignore
192
+ public text : string | NSAttributedString ;
193
+
191
194
@profile
192
195
public createNativeView ( ) {
193
196
if ( this . selectable ) {
@@ -705,6 +708,8 @@ export class Label extends LabelBase {
705
708
this . fontSizeRatio = 1 ;
706
709
if ( this . html ) {
707
710
this . updateHTMLString ( ) ;
711
+ } else if ( this . text instanceof NSAttributedString ) {
712
+ this . nativeViewProtected . attributedText = this . text ;
708
713
} else {
709
714
super . _setNativeText ( ) ;
710
715
}
You can’t perform that action at this time.
0 commit comments