Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion tns-core-modules/ui/text-base/text-base.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ export class TextBase extends TextBaseCommon {
paragraphStyle.lineBreakMode = this.nativeTextViewProtected.lineBreakMode;
}
attrText.addAttributeValueRange(NSParagraphStyleAttributeName, paragraphStyle, { location: 0, length: attrText.length });
} else if (this.nativeTextViewProtected instanceof UITextView) {
const paragraphStyle = NSMutableParagraphStyle.alloc().init();
paragraphStyle.alignment = (<UITextView>this.nativeTextViewProtected).textAlignment;
attrText.addAttributeValueRange(NSParagraphStyleAttributeName, paragraphStyle, { location: 0, length: attrText.length });
}

if (this.nativeTextViewProtected instanceof UIButton) {
Expand Down Expand Up @@ -174,6 +178,7 @@ export class TextBase extends TextBaseCommon {
dict.set(NSKernAttributeName, style.letterSpacing * this.nativeTextViewProtected.font.pointSize);
}

const isTextView = this.nativeTextViewProtected instanceof UITextView;
if (style.lineHeight) {
const paragraphStyle = NSMutableParagraphStyle.alloc().init();
paragraphStyle.lineSpacing = style.lineHeight;
Expand All @@ -184,9 +189,12 @@ export class TextBase extends TextBaseCommon {
paragraphStyle.lineBreakMode = this.nativeTextViewProtected.lineBreakMode;
}
dict.set(NSParagraphStyleAttributeName, paragraphStyle);
} else if (isTextView) {
const paragraphStyle = NSMutableParagraphStyle.alloc().init();
paragraphStyle.alignment = (<UITextView>this.nativeTextViewProtected).textAlignment;
dict.set(NSParagraphStyleAttributeName, paragraphStyle);
}

const isTextView = this.nativeTextViewProtected instanceof UITextView;
if (style.color && (dict.size > 0 || isTextView)) {
dict.set(NSForegroundColorAttributeName, style.color.ios);
}
Expand Down