mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(text-base): apply dynamic text color change on button for ios (#8635)
This commit is contained in:
@@ -21,3 +21,22 @@
|
||||
color: yellow;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
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 { unsetValue } from "tns-core-modules/ui/core/view";
|
||||
|
||||
@@ -31,3 +32,10 @@ export function resetStyles(args) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<Button text="left" style="text-align: left" />
|
||||
<Button text="center" style="text-align: center" />
|
||||
<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>
|
||||
<Button text="RESET" tap="resetStyles"/>
|
||||
|
||||
@@ -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;
|
||||
if (style.lineHeight) {
|
||||
const paragraphStyle = NSMutableParagraphStyle.alloc().init();
|
||||
|
||||
Reference in New Issue
Block a user