mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00
fix(dark-mode): formatted string and html view text color (#8031)
This commit is contained in:

committed by
Manol Donev

parent
eb33ede5a7
commit
0c7f8383a3
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user