fix(dark-mode): formatted string and html view text color (#8031)

This commit is contained in:
Vasil Chimev
2019-11-07 11:43:27 +00:00
committed by Manol Donev
parent eb33ede5a7
commit 0c7f8383a3
2 changed files with 16 additions and 1 deletions

View File

@ -1,9 +1,12 @@
import {
HtmlViewBase, View, layout, htmlProperty
} from "./html-view-common";
import { ios } from "../../utils/utils";
export * from "./html-view-common";
const majorVersion = ios.MajorVersion;
export class HtmlView extends HtmlViewBase {
nativeViewProtected: UITextView;
@ -50,6 +53,14 @@ export class HtmlView extends HtmlViewBase {
[htmlProperty.setNative](value: string) {
const htmlString = NSString.stringWithString(value + "");
const nsData = htmlString.dataUsingEncoding(NSUnicodeStringEncoding);
this.nativeViewProtected.attributedText = NSAttributedString.alloc().initWithDataOptionsDocumentAttributesError(nsData, <any>{ [NSDocumentTypeDocumentAttribute]: NSHTMLTextDocumentType }, null);
this.nativeViewProtected.attributedText = NSAttributedString.alloc().initWithDataOptionsDocumentAttributesError(
nsData,
<any>{ [NSDocumentTypeDocumentAttribute]: NSHTMLTextDocumentType },
null
);
if (majorVersion >= 13) {
this.nativeViewProtected.textColor = UIColor.labelColor;
}
}
}