-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(ios): Added support for css gradients. * feat(android): Added support for css gradients. * fix: Fixed gradient borders on ios * fix(gradient): added backgroundGradient to View and Style. * fix(ios-gradients): fixed ios gradients covering view content. * test(gradient): Added ui app tests for background gradients. * test(gradient): Added a test ensuring background gradient property is applied to style. * style(gradient): Fixed tslint errors. * fix(gradient): Removed the background-gradient property and added the gradient to background-image. * style: fixed a consecutive blank line tslint error. * fix(tests): fixed the bug that was causing tests to fail. * chore(linear-gradient): fix equality comparer * test(gradient): add linear gradients test app * chore(tslint): update with latest tslint rules
- Loading branch information
1 parent
72fa5c9
commit 5a83a1c
Showing
19 changed files
with
397 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
apps/app/ui-tests-app/css/background-image-linear-gradient.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import * as pages from "tns-core-modules/ui/page"; | ||
import { EventData } from "tns-core-modules/data/observable"; | ||
import * as button from "tns-core-modules/ui/button"; | ||
|
||
import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout"; | ||
|
||
let testIndex = 0; | ||
const tests = [ | ||
{ name: "black-blue only", backgroundImage: "linear-gradient(to bottom, black, blue)"}, | ||
{ name: "to bottom green-blue", backgroundImage: "linear-gradient(to bottom, green, blue)"}, | ||
{ name: "to left yellow-blue", backgroundImage: "linear-gradient(to left, yellow, green)"}, | ||
{ name: "to right yellow-blue", backgroundImage: "linear-gradient(to right, yellow, green)"}, | ||
{ name: "-45deg green-blue", backgroundImage: "linear-gradient(-45deg, green, blue)"}, | ||
{ name: "45deg green-blue", backgroundImage: "linear-gradient(45deg, green, blue)"}, | ||
|
||
{ name: "black-blue-pink only", backgroundImage: "linear-gradient(to bottom, black, blue, pink)"}, | ||
{ name: "to bottom green-blue-pink", backgroundImage: "linear-gradient(to bottom, green, blue, pink)"}, | ||
{ name: "to left yellow-blue-pink", backgroundImage: "linear-gradient(to left, yellow, green, pink)"}, | ||
{ name: "to right yellow-blue-pink", backgroundImage: "linear-gradient(to right, yellow, green, pink)"}, | ||
{ name: "-45deg green-blue-pink", backgroundImage: "linear-gradient(-45deg, green, blue, pink)"}, | ||
{ name: "45deg green-blue-pink", backgroundImage: "linear-gradient(45deg, green, blue, pink)"}, | ||
] | ||
|
||
export function onLoaded(args) { | ||
applyNextStyle(args); | ||
} | ||
|
||
export function onButtonTap(args) { | ||
applyNextStyle(args); | ||
} | ||
|
||
function applyNextStyle(args) { | ||
let page = <pages.Page>args.object.page; | ||
let btn = <button.Button>args.object; | ||
let gridElement = <GridLayout>page.getViewById("Container"); | ||
|
||
btn.text = tests[testIndex].name; | ||
gridElement.backgroundImage = tests[testIndex].backgroundImage; | ||
|
||
testIndex = testIndex < tests.length - 1 ? ++testIndex : 0; | ||
} |
7 changes: 7 additions & 0 deletions
7
apps/app/ui-tests-app/css/background-image-linear-gradient.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="onLoaded"> | ||
<GridLayout rows="*, 7*"> | ||
<Button row="0" text="a1" tap="onButtonTap"/> | ||
|
||
<GridLayout id="Container" fontSize="12" borderColor="black" margin="5" borderWidth="1" row="1"/> | ||
</GridLayout> | ||
</Page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
StackLayout { | ||
width: 80; | ||
height: 80; | ||
background: linear-gradient(to top, green, blue); | ||
} | ||
|
||
#s0 { | ||
border-width: 5; | ||
} | ||
|
||
#s1 { | ||
border-width: 5; border-color: red; | ||
} | ||
|
||
#s2 { | ||
border-width: 5; border-color: red red red green; | ||
} | ||
|
||
#s3 { | ||
border-width: 5; border-color: red; border-radius: 5; | ||
} | ||
|
||
#s4 { | ||
border-width: 5; border-color: red; border-radius: 50; | ||
} | ||
|
||
#s5 { | ||
border-width: 5 10 15 20; border-color: red; | ||
} | ||
|
||
#s6 { | ||
border-width: 5; border-color: red green blue yellow; | ||
} | ||
|
||
#s7 { | ||
border-width: 5 10 15 20; border-color: red green blue yellow; | ||
} | ||
|
||
#s8 { | ||
border-width: 5 10; border-color: red green; | ||
} | ||
|
||
#s9 { | ||
border-width: 15 10 5; border-color: red green blue; | ||
} | ||
|
||
#s10 { | ||
border-width: 5 0; border-color: black; | ||
} | ||
|
||
#s11 { | ||
background-color: magenta; | ||
} | ||
|
||
#s12 { | ||
border-width: 5 10 15 20; border-color: red green blue yellow; border-radius: 5 10 15 20; | ||
} | ||
|
||
#s13 { | ||
border-width: 5 10 15 20; border-color: red green blue yellow; border-radius: 5; | ||
} | ||
|
||
#s14 { | ||
border-width: 5 10 15 20; border-color: red green blue yellow; background-color: magenta; | ||
} | ||
|
||
#s15 { | ||
border-width: 5 10 15 20; border-color: red green blue yellow; background-image: url('~/ui-tests-app/resources/images/test2.png'); | ||
} | ||
|
||
#s16 { | ||
border-width: 5; border-color: red; padding: 5; | ||
} | ||
|
||
#s17 { | ||
border-width: 5 6 7 8; border-color: red green blue yellow; padding: 5 6 7 8; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Page> | ||
<GridLayout rows="*,*,*,*,*,*" columns="*,*,*"> | ||
<StackLayout id="s0" row="0" col="0"/> | ||
<StackLayout id="s1" row="0" col="1"/> | ||
<StackLayout id="s2" row="0" col="2"/> | ||
<StackLayout id="s3" row="1" col="0"/> | ||
<StackLayout id="s4" row="1" col="1"/> | ||
<StackLayout id="s5" row="1" col="2"/> | ||
<StackLayout id="s6" row="2" col="0"/> | ||
<StackLayout id="s7" row="2" col="1"/> | ||
<StackLayout id="s8" row="2" col="2"/> | ||
<StackLayout id="s9" row="3" col="0"/> | ||
<StackLayout id="s10" row="3" col="1"/> | ||
<StackLayout id="s11" row="3" col="2"/> | ||
<StackLayout id="s12" row="4" col="0"/> | ||
<StackLayout id="s13" row="4" col="1"/> | ||
<StackLayout id="s14" row="4" col="2"/> | ||
<StackLayout id="s15" row="5" col="0"/> | ||
<StackLayout id="s16" row="5" col="1"/> | ||
<StackLayout id="s17" row="5" col="2"/> | ||
</GridLayout> | ||
</Page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.