Skip to content

Commit 1976c28

Browse files
author
Nedyalko Nikolov
committed
Fixed span for ios. Fixes issue NativeScript#452.
1 parent dea2e69 commit 1976c28

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

text/formatted-string.ios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class FormattedString extends formattedStringCommon.FormattedString {
2121
for (p = 0; p < span.spanModifiers.length; p++) {
2222
attrDict.setObjectForKey(span.spanModifiers[p].value, span.spanModifiers[p].key);
2323
}
24-
var nsAttributedString = NSMutableAttributedString.alloc().initWithStringAttributes(spanText, attrDict);
24+
var nsAttributedString = NSMutableAttributedString.alloc().initWithStringAttributes(String(spanText), attrDict);
2525
mas.insertAttributedStringAtIndex(nsAttributedString, spanStart);
2626
spanStart += spanLength;
2727
}

text/span.ios.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ export class Span extends spanCommon.Span {
2222
if (realFontFamily) {
2323
font = UIFont.fontWithNameSize(realFontFamily, realFontSize);
2424
}
25-
else {
25+
26+
if (!font) {
2627
var fontDescriptor = UIFontDescriptor.new();
2728
var symbolicTraits;
2829
if (realFontAttributes & enums.FontAttributes.Bold) {
@@ -33,12 +34,11 @@ export class Span extends spanCommon.Span {
3334
}
3435
font = UIFont.fontWithDescriptorSize(fontDescriptor.fontDescriptorWithSymbolicTraits(symbolicTraits), realFontSize);
3536
}
36-
if (font) {
37-
this.spanModifiers.push({
38-
key: NSFontAttributeName,
39-
value: font
40-
});
41-
}
37+
38+
this.spanModifiers.push({
39+
key: NSFontAttributeName,
40+
value: font
41+
});
4242
}
4343

4444
var realForegroundColor = this.foregroundColor ||

0 commit comments

Comments
 (0)