Skip to content

Commit c5fa922

Browse files
Tsenov/issue 3714 (NativeScript#5610)
* test: added test case for issue 3714 * refactor: update remove grid layout element
1 parent a316e53 commit c5fa922

3 files changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { EventData } from 'tns-core-modules/data/observable';
2+
import { Page } from 'tns-core-modules/ui/page';
3+
import { Button } from "tns-core-modules/ui/button";
4+
import { Label } from "tns-core-modules/ui/label";
5+
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
6+
import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout";
7+
8+
export function toggle(args: EventData) {
9+
const page = <Page>((<any>args.object).page);
10+
11+
const getElementById = id => { return page.getViewById(id); }
12+
13+
const toggleBtn = <Button>getElementById("toggleUserInteraction");
14+
const isEnabled = toggleBtn.text === "disable" ? true : false;
15+
toggleBtn.text = !isEnabled ? "disable" : "enable";
16+
17+
(<Button>getElementById("testBtn")).isUserInteractionEnabled = !isEnabled;
18+
(<Button>getElementById("testLabel")).isUserInteractionEnabled = !isEnabled;
19+
(<StackLayout>getElementById("testStackLayout")).isUserInteractionEnabled = !isEnabled;
20+
}
21+
22+
export function test() {
23+
console.log("onTap");
24+
alert("onTap");
25+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Page
2+
xmlns="http://schemas.nativescript.org/tns.xsd" class="page">
3+
<StackLayout class="p-20">
4+
<Button text="disable" tap="toggle" id="toggleUserInteraction" automationText="toggleUserInteraction"/>
5+
<GridLayout rows="100 50 100" id="layoutid">
6+
<Button id="testBtn" automationText="testBtn" row="0" isUserInteractionEnabled="{{userinteraction}}" text="test" tap="test" />
7+
<Label id="testLabel" automationText="testLabel" row="1" text="test" isUserInteractionEnabled="{{userinteraction}}" tap="test"/>
8+
<StackLayout id="testStackLayout" automationText="testStackLayout" row="2" isUserInteractionEnabled="{{userinteraction}}" backgroundColor="red" tap="test"></StackLayout>
9+
</GridLayout>
10+
</StackLayout>
11+
</Page>

apps/app/ui-tests-app/issues/main-page.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export function loadExamples() {
2121
examples.set("3175", "issues/issue-3175");
2222
examples.set("3211", "issues/issue-3211");
2323
examples.set("1639", "issues/issue-1639");
24+
examples.set("3714", "issues/issue-3714");
2425
examples.set("1657-ios", "issues/issue-1657-ios");
2526
examples.set("tabview-with-scrollview_4022","issues/tabview-with-scrollview_4022");
2627
examples.set("3354-ios", "issues/issue-3354");

0 commit comments

Comments
 (0)