Skip to content

Commit 5cacc25

Browse files
authored
fix(text-base): apply dynamic text color change on button for ios (NativeScript#8635)
1 parent c73952f commit 5cacc25

4 files changed

Lines changed: 28 additions & 6 deletions

File tree

e2e/ui-tests-app/app/app.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,22 @@
2121
color: yellow;
2222
margin-left: 30;
2323
}
24+
25+
.ui-tests-app-issue-ng-1453-yellow {
26+
color: yellow;
27+
background-color: black;
28+
}
29+
30+
.ui-tests-app-issue-ng-1453-pink {
31+
color: pink;
32+
}
33+
34+
.ui-tests-app-issue-ng-1453-base {
35+
font-family: Roboto;
36+
font-style: normal;
37+
font-weight: 500;
38+
font-size: 14;
39+
text-align: center;
40+
letter-spacing: 0.2px;
41+
text-transform: uppercase;
42+
}

e2e/ui-tests-app/app/fonts-tests/button-page.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as stack from "tns-core-modules/ui/layouts/stack-layout";
2+
import { Button } from "@nativescript/core/ui/button";
23
import * as view from "tns-core-modules/ui/core/view";
34
import { unsetValue } from "tns-core-modules/ui/core/view";
45

@@ -31,3 +32,10 @@ export function resetStyles(args) {
3132
return true;
3233
});
3334
}
35+
36+
export function issue_ng_1453_loaded(args) {
37+
var btn = <Button>args.object;
38+
setTimeout(() => {
39+
btn.className = "ui-tests-app-issue-ng-1453-base ui-tests-app-issue-ng-1453-yellow";
40+
}, 2000);
41+
}

e2e/ui-tests-app/app/fonts-tests/button-page.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<Button text="left" style="text-align: left" />
55
<Button text="center" style="text-align: center" />
66
<Button text="right" style="text-align: right" />
7+
<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" />
78

89
<WrapLayout>
910
<Button text="RESET" tap="resetStyles"/>

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,6 @@ export class TextBase extends TextBaseCommon {
293293
}
294294
}
295295

296-
if (style.color) {
297-
dict.set(NSForegroundColorAttributeName, style.color.ios);
298-
} else if (majorVersion >= 13 && UIColor.labelColor) {
299-
dict.set(NSForegroundColorAttributeName, UIColor.labelColor);
300-
}
301-
302296
const isTextView = this.nativeTextViewProtected instanceof UITextView;
303297
if (style.lineHeight) {
304298
const paragraphStyle = NSMutableParagraphStyle.alloc().init();

0 commit comments

Comments
 (0)