Skip to content

Commit 0c7f838

Browse files
vchimevmanoldonev
authored andcommitted
fix(dark-mode): formatted string and html view text color (#8031)
1 parent eb33ede commit 0c7f838

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

‎nativescript-core/ui/html-view/html-view.ios.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import {
22
HtmlViewBase, View, layout, htmlProperty
33
} from "./html-view-common";
4+
import { ios } from "../../utils/utils";
45

56
export * from "./html-view-common";
67

8+
const majorVersion = ios.MajorVersion;
9+
710
export class HtmlView extends HtmlViewBase {
811
nativeViewProtected: UITextView;
912

@@ -50,6 +53,14 @@ export class HtmlView extends HtmlViewBase {
5053
[htmlProperty.setNative](value: string) {
5154
const htmlString = NSString.stringWithString(value + "");
5255
const nsData = htmlString.dataUsingEncoding(NSUnicodeStringEncoding);
53-
this.nativeViewProtected.attributedText = NSAttributedString.alloc().initWithDataOptionsDocumentAttributesError(nsData, <any>{ [NSDocumentTypeDocumentAttribute]: NSHTMLTextDocumentType }, null);
56+
this.nativeViewProtected.attributedText = NSAttributedString.alloc().initWithDataOptionsDocumentAttributesError(
57+
nsData,
58+
<any>{ [NSDocumentTypeDocumentAttribute]: NSHTMLTextDocumentType },
59+
null
60+
);
61+
62+
if (majorVersion >= 13) {
63+
this.nativeViewProtected.textColor = UIColor.labelColor;
64+
}
5465
}
5566
}

‎nativescript-core/ui/text-base/text-base.ios.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ export class TextBase extends TextBaseCommon {
153153
this.nativeTextViewProtected.setAttributedTitleForState(attrText, UIControlState.Normal);
154154
}
155155
else {
156+
if (majorVersion >= 13) {
157+
this.nativeTextViewProtected.textColor = UIColor.labelColor;
158+
}
159+
156160
this.nativeTextViewProtected.attributedText = attrText;
157161
}
158162
}

0 commit comments

Comments
 (0)