fix(text-base): apply dynamic text color change on button for ios (#8635)

This commit is contained in:
dosomder
2020-06-16 21:45:23 +02:00
committed by GitHub
parent c73952f364
commit 5cacc25aa7
4 changed files with 28 additions and 6 deletions

View File

@@ -21,3 +21,22 @@
color: yellow; color: yellow;
margin-left: 30; margin-left: 30;
} }
.ui-tests-app-issue-ng-1453-yellow {
color: yellow;
background-color: black;
}
.ui-tests-app-issue-ng-1453-pink {
color: pink;
}
.ui-tests-app-issue-ng-1453-base {
font-family: Roboto;
font-style: normal;
font-weight: 500;
font-size: 14;
text-align: center;
letter-spacing: 0.2px;
text-transform: uppercase;
}

View File

@@ -1,4 +1,5 @@
import * as stack from "tns-core-modules/ui/layouts/stack-layout"; import * as stack from "tns-core-modules/ui/layouts/stack-layout";
import { Button } from "@nativescript/core/ui/button";
import * as view from "tns-core-modules/ui/core/view"; import * as view from "tns-core-modules/ui/core/view";
import { unsetValue } from "tns-core-modules/ui/core/view"; import { unsetValue } from "tns-core-modules/ui/core/view";
@@ -31,3 +32,10 @@ export function resetStyles(args) {
return true; return true;
}); });
} }
export function issue_ng_1453_loaded(args) {
var btn = <Button>args.object;
setTimeout(() => {
btn.className = "ui-tests-app-issue-ng-1453-base ui-tests-app-issue-ng-1453-yellow";
}, 2000);
}

View File

@@ -4,6 +4,7 @@
<Button text="left" style="text-align: left" /> <Button text="left" style="text-align: left" />
<Button text="center" style="text-align: center" /> <Button text="center" style="text-align: center" />
<Button text="right" style="text-align: right" /> <Button text="right" style="text-align: right" />
<Button text="Yellow text / black bg after 2s" class="ui-tests-app-issue-ng-1453-base ui-tests-app-issue-ng-1453-pink" loaded="issue_ng_1453_loaded" />
<WrapLayout> <WrapLayout>
<Button text="RESET" tap="resetStyles"/> <Button text="RESET" tap="resetStyles"/>

View File

@@ -293,12 +293,6 @@ export class TextBase extends TextBaseCommon {
} }
} }
if (style.color) {
dict.set(NSForegroundColorAttributeName, style.color.ios);
} else if (majorVersion >= 13 && UIColor.labelColor) {
dict.set(NSForegroundColorAttributeName, UIColor.labelColor);
}
const isTextView = this.nativeTextViewProtected instanceof UITextView; const isTextView = this.nativeTextViewProtected instanceof UITextView;
if (style.lineHeight) { if (style.lineHeight) {
const paragraphStyle = NSMutableParagraphStyle.alloc().init(); const paragraphStyle = NSMutableParagraphStyle.alloc().init();