Skip to content

Commit 06970d0

Browse files
committed
Mass replace fontAttributes with fontWeight and fontStyle
1 parent 0f819be commit 06970d0

5 files changed

Lines changed: 22 additions & 22 deletions

File tree

apps/app/cuteness.io/details-page.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
<StackLayout orientation="horizontal" row="1">
1010
<Label margin="2">
1111
<Label.formattedText>
12-
<FormattedString fontSize="20" foregroundColor="#C6C6C6">
12+
<FormattedString fontSize="20" color="#C6C6C6">
1313
<FormattedString.spans>
1414
<Span text="{{ author ? 'by ' + author : '' }}"/>
1515
<Span text="{{ num_comments ? ' | ' : '' }}" />
16-
<Span text="{{ num_comments ? num_comments + ' comments' : '' }}" foregroundColor="#10C2B0"/>
16+
<Span text="{{ num_comments ? num_comments + ' comments' : '' }}" color="#10C2B0"/>
1717
</FormattedString.spans>
1818
</FormattedString>
1919
</Label.formattedText>

apps/app/ui-tests-app/css/decoration-transform-formattedtext.xml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<Label.formattedText>
77
<FormattedString>
88
<FormattedString.spans>
9-
<Span text="label" fontAttributes="Bold" foregroundColor="#0000ff" />
10-
<Span text="Label" fontAttributes="Italic" foregroundColor="#00ff00" />
9+
<Span text="label" fontWeight="bold" color="#0000ff" />
10+
<Span text="Label" fontStyle="italic" color="#00ff00" />
1111
</FormattedString.spans>
1212
</FormattedString>
1313
</Label.formattedText>
@@ -16,8 +16,8 @@
1616
<Label.formattedText>
1717
<FormattedString>
1818
<FormattedString.spans>
19-
<Span text="label" fontAttributes="Bold" foregroundColor="#0000ff" />
20-
<Span text="Label" fontAttributes="Italic" foregroundColor="#00ff00" />
19+
<Span text="label" fontWeight="bold" color="#0000ff" />
20+
<Span text="Label" fontStyle="italic" color="#00ff00" />
2121
</FormattedString.spans>
2222
</FormattedString>
2323
</Label.formattedText>
@@ -28,8 +28,8 @@
2828
<Button.formattedText>
2929
<FormattedString>
3030
<FormattedString.spans>
31-
<Span text="button" fontAttributes="Bold" foregroundColor="#0000ff" />
32-
<Span text="Button" fontAttributes="Italic" foregroundColor="#00ff00" />
31+
<Span text="button" fontWeight="bold" color="#0000ff" />
32+
<Span text="Button" fontStyle="italic" color="#00ff00" />
3333
</FormattedString.spans>
3434
</FormattedString>
3535
</Button.formattedText>
@@ -38,8 +38,8 @@
3838
<Button.formattedText>
3939
<FormattedString>
4040
<FormattedString.spans>
41-
<Span text="button" fontAttributes="Bold" foregroundColor="#0000ff" />
42-
<Span text="Button" fontAttributes="Italic" foregroundColor="#00ff00" />
41+
<Span text="button" fontWeight="bold" color="#0000ff" />
42+
<Span text="Button" fontStyle="italic" color="#00ff00" />
4343
</FormattedString.spans>
4444
</FormattedString>
4545
</Button.formattedText>
@@ -50,8 +50,8 @@
5050
<TextField.formattedText>
5151
<FormattedString>
5252
<FormattedString.spans>
53-
<Span text="text" fontAttributes="Bold" foregroundColor="#0000ff" />
54-
<Span text="Field" fontAttributes="Italic" foregroundColor="#00ff00" />
53+
<Span text="text" fontWeight="bold" color="#0000ff" />
54+
<Span text="Field" fontStyle="italic" color="#00ff00" />
5555
</FormattedString.spans>
5656
</FormattedString>
5757
</TextField.formattedText>
@@ -60,8 +60,8 @@
6060
<TextField.formattedText>
6161
<FormattedString>
6262
<FormattedString.spans>
63-
<Span text="text" fontAttributes="Bold" foregroundColor="#0000ff" />
64-
<Span text="Field" fontAttributes="Italic" foregroundColor="#00ff00" />
63+
<Span text="text" fontWeight="bold" color="#0000ff" />
64+
<Span text="Field" fontStyle="italic" color="#00ff00" />
6565
</FormattedString.spans>
6666
</FormattedString>
6767
</TextField.formattedText>
@@ -72,8 +72,8 @@
7272
<TextView.formattedText>
7373
<FormattedString>
7474
<FormattedString.spans>
75-
<Span text="text" fontAttributes="Bold" foregroundColor="#0000ff" />
76-
<Span text="View" fontAttributes="Italic" foregroundColor="#00ff00" />
75+
<Span text="text" fontWeight="bold" color="#0000ff" />
76+
<Span text="View" fontStyle="italic" color="#00ff00" />
7777
</FormattedString.spans>
7878
</FormattedString>
7979
</TextView.formattedText>
@@ -82,8 +82,8 @@
8282
<TextView.formattedText>
8383
<FormattedString>
8484
<FormattedString.spans>
85-
<Span text="text" fontAttributes="Bold" foregroundColor="#0000ff" />
86-
<Span text="View" fontAttributes="Italic" foregroundColor="#00ff00" />
85+
<Span text="text" fontWeight="bold" color="#0000ff" />
86+
<Span text="View" fontStyle="italic" color="#00ff00" />
8787
</FormattedString.spans>
8888
</FormattedString>
8989
</TextView.formattedText>

apps/app/ui-tests-app/pages/i86.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<StackLayout>
33
<Label margin="2">
44
<Label.formattedText>
5-
<FormattedString foregroundColor="White">
5+
<FormattedString color="White">
66
<FormattedString.spans>
77
<Span text="FormattedString foregroundColor cannot be set to named color" />
88
<Span text="https://github.com/NativeScript/cross-platform-modules/issues/86"/>

tests/app/xml-declaration/xml-declaration-tests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ export function test_parse_NestedRepeaters() {
696696
}
697697

698698
export function test_parseSpansDirectlyOnLabel() {
699-
var p = <Page>builder.parse('<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatedTo="pageNavigated"><StackLayout><Label id="testLabel"><Span text="We are" fontSize="10"/><Span text="Awesome" fontAttributes="Bold"/></Label></StackLayout></Page>');
699+
var p = <Page>builder.parse('<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatedTo="pageNavigated"><StackLayout><Label id="testLabel"><Span text="We are" fontSize="10"/><Span text="Awesome" fontWeight="bold"/></Label></StackLayout></Page>');
700700
function testAction(views: Array<viewModule.View>) {
701701
var page = <Page>views[0];
702702
var testLabel = <Label>page.getViewById("testLabel");
@@ -709,7 +709,7 @@ export function test_parseSpansDirectlyOnLabel() {
709709
}
710710

711711
export function test_parseSpansDirectlyOnButton() {
712-
var p = <Page>builder.parse('<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatedTo="pageNavigated"><StackLayout><Button id="testButton"><Span text="We are" fontSize="10"/><Span text="Awesome" fontAttributes="Bold"/></Button></StackLayout></Page>');
712+
var p = <Page>builder.parse('<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatedTo="pageNavigated"><StackLayout><Button id="testButton"><Span text="We are" fontSize="10"/><Span text="Awesome" fontWeight="bold"/></Button></StackLayout></Page>');
713713
function testAction(views: Array<viewModule.View>) {
714714
var page = <Page>views[0];
715715
var testButton = <Button>page.getViewById("testButton");

tns-core-modules/ui/core/view.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ declare module "ui/core/view" {
660660
*/
661661
export interface ApplyXmlAttributes {
662662
/**
663-
* Called for every attribute in xml declaration. <... fontAttributes="bold" ../>
663+
* Called for every attribute in xml declaration. <... fontWeight="bold" ../>
664664
* @param attributeName - the name of the attribute (fontAttributes)
665665
* @param attrValue - the value of the attribute (bold)
666666
* Should return true if this attribute is handled and there is no need default handler to process it.

0 commit comments

Comments
 (0)