mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Merge pull request #1079 from NativeScript/white-space
white-space CSS support added
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
var obj;
|
||||
|
||||
export function loaded(args) {
|
||||
obj = args.object;
|
||||
}
|
||||
import view = require("ui/core/view");
|
||||
import observable = require("data/observable");
|
||||
import label = require("ui/label");
|
||||
|
||||
export function butonTap(args) {
|
||||
if (obj.style.textDecoration === "underline") {
|
||||
obj.style.textDecoration = "line-through";
|
||||
} else if (obj.style.textDecoration === "line-through") {
|
||||
obj.style.textDecoration = "line-through underline";
|
||||
} else if (obj.style.textDecoration === "line-through underline") {
|
||||
obj.style.textDecoration = "none";
|
||||
} else if (obj.style.textDecoration === "none") {
|
||||
obj.style.textDecoration = "underline";
|
||||
var btn = <view.View>args.object;
|
||||
var lbl = <label.Label>btn.parent.getViewById("Label1");
|
||||
|
||||
if (lbl.style.textDecoration === "underline") {
|
||||
lbl.style.textDecoration = "line-through";
|
||||
} else if (lbl.style.textDecoration === "line-through") {
|
||||
lbl.style.textDecoration = "line-through underline";
|
||||
} else if (lbl.style.textDecoration === "line-through underline") {
|
||||
lbl.style.textDecoration = "none";
|
||||
} else if (lbl.style.textDecoration === "none") {
|
||||
lbl.style.textDecoration = "underline";
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<ScrollView>
|
||||
<StackLayout>
|
||||
<Button text="Change" tap="butonTap" />
|
||||
<Label text="Text" style.textDecoration="underline" loaded="loaded"/>
|
||||
<Label id="Label1" text="Text" style.textDecoration="underline" />
|
||||
|
||||
<Label text="Label" style="text-decoration:none" />
|
||||
<Label text="Label" style="text-decoration:underline" />
|
||||
|
||||
14
apps/ui-tests-app/css/white-space.ts
Normal file
14
apps/ui-tests-app/css/white-space.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import view = require("ui/core/view");
|
||||
import observable = require("data/observable");
|
||||
import label = require("ui/label");
|
||||
|
||||
export function butonTap(args: observable.EventData) {
|
||||
var btn = <view.View>args.object;
|
||||
var lbl = <label.Label>btn.parent.getViewById("Label1");
|
||||
|
||||
if (lbl.style.whiteSpace === "normal") {
|
||||
lbl.style.whiteSpace = "nowrap";
|
||||
} else if (lbl.style.whiteSpace === "nowrap") {
|
||||
lbl.style.whiteSpace = "normal";
|
||||
}
|
||||
}
|
||||
20
apps/ui-tests-app/css/white-space.xml
Normal file
20
apps/ui-tests-app/css/white-space.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<Page >
|
||||
<ScrollView>
|
||||
<StackLayout width="50">
|
||||
<Button text="Change" tap="butonTap" />
|
||||
<Label id="Label1" text="Text Text" style.whiteSpace="normal" />
|
||||
|
||||
<Label text="Label Normal" style="white-space:normal" />
|
||||
<Label text="Label Nowrap" style="white-space:nowrap" />
|
||||
|
||||
<TextField text="TextField Normal" style="white-space:normal" />
|
||||
<TextField text="TextField Nowrap" style="white-space:nowrap" />
|
||||
|
||||
<TextView text="TextView Normal" style="white-space:normal" />
|
||||
<TextView text="TextView Nowrap" style="white-space:nowrap" />
|
||||
|
||||
<Button text="Button Normal" style="white-space:normal" />
|
||||
<Button text="Button Nowrap" style="white-space:nowrap" />
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
</Page>
|
||||
@@ -90,4 +90,6 @@ examples.set("webview", "web-view/web-view");
|
||||
examples.set("webtest", "web-view/web-view-test");
|
||||
|
||||
examples.set("decoration", "css/text-decoration");
|
||||
examples.set("whitespace", "css/white-space");
|
||||
|
||||
//VM.set("selected", "tabAll");
|
||||
Reference in New Issue
Block a user