mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(TabStrip): add itemTap event (#7711)
This commit is contained in:
committed by
Manol Donev
parent
caca2b82a2
commit
55c9cc9072
@@ -1,27 +0,0 @@
|
||||
import * as pages from "tns-core-modules/ui/page";
|
||||
import * as frame from "tns-core-modules/ui/frame";
|
||||
import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
|
||||
import * as button from "tns-core-modules/ui/button";
|
||||
import * as text from "tns-core-modules/ui/text-field";
|
||||
|
||||
export function createPage() {
|
||||
var page = new pages.Page();
|
||||
var stack = new stackModule.StackLayout();
|
||||
|
||||
var btn = new button.Button();
|
||||
btn.text = "Page B new activity";
|
||||
btn.on(button.Button.tapEvent, function () {
|
||||
var nextPage = "tests/pages/navigation/pageB-new-activity";
|
||||
frame.topmost().navigate(nextPage);
|
||||
});
|
||||
stack.addChild(btn);
|
||||
|
||||
var txt = new text.TextField();
|
||||
txt.text = "text new A";
|
||||
stack.addChild(txt);
|
||||
|
||||
page.content = stack;
|
||||
|
||||
return page;
|
||||
}
|
||||
//export var Page = page;
|
||||
@@ -1,56 +0,0 @@
|
||||
import * as pages from "tns-core-modules/ui/page";
|
||||
import * as frame from "tns-core-modules/ui/frame";
|
||||
import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
|
||||
import * as button from "tns-core-modules/ui/button";
|
||||
import * as text from "tns-core-modules/ui/text-field";
|
||||
import * as color from "tns-core-modules/color";
|
||||
import * as list from "tns-core-modules/ui/list-view";
|
||||
|
||||
export function createPage() {
|
||||
var page = new pages.Page();
|
||||
var stack = new stackModule.StackLayout();
|
||||
stack.style.backgroundColor = new color.Color("#FF8833FF");
|
||||
|
||||
var btn = new button.Button();
|
||||
btn.text = "Page B";
|
||||
btn.on(button.Button.tapEvent, function () {
|
||||
var nextPage = "tests/pages/navigation/pageB";
|
||||
frame.topmost().navigate(nextPage);
|
||||
});
|
||||
stack.addChild(btn);
|
||||
|
||||
var btnActivity = new button.Button();
|
||||
btnActivity.text = "start activity";
|
||||
btnActivity.on(button.Button.tapEvent, function () {
|
||||
var newPage = "tests/pages/navigation/pageA-new-activity";
|
||||
|
||||
var newFrame = new frame.Frame();
|
||||
newFrame.navigate(newPage);
|
||||
});
|
||||
stack.addChild(btnActivity);
|
||||
|
||||
var txt = new text.TextField();
|
||||
txt.text = "text A";
|
||||
stack.addChild(txt);
|
||||
|
||||
var lv = new list.ListView();
|
||||
var data = [];
|
||||
for (var i = 0; i < 100; i++) {
|
||||
data[i] = "here is item " + i;
|
||||
}
|
||||
lv.height = 200;
|
||||
lv.items = data;
|
||||
lv.on(list.ListView.itemLoadingEvent, (args: list.ItemEventData) => {
|
||||
var btn = <button.Button> args.view;
|
||||
if (!btn) {
|
||||
btn = new button.Button();
|
||||
args.view = btn;
|
||||
}
|
||||
btn.text = data[args.index];
|
||||
});
|
||||
stack.addChild(lv);
|
||||
|
||||
page.content = stack;
|
||||
|
||||
return page;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
import * as pages from "tns-core-modules/ui/page";
|
||||
import * as frame from "tns-core-modules/ui/frame";
|
||||
import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
|
||||
import * as button from "tns-core-modules/ui/button";
|
||||
import * as text from "tns-core-modules/ui/text-field";
|
||||
|
||||
export function createPage() {
|
||||
var page = new pages.Page();
|
||||
var stack = new stackModule.StackLayout();
|
||||
|
||||
var btn = new button.Button();
|
||||
btn.text = "Page C new activity";
|
||||
btn.on(button.Button.tapEvent, function () {
|
||||
var nextPage = "tests/pages/navigation/pageC-new-activity";
|
||||
frame.topmost().navigate(nextPage);
|
||||
});
|
||||
stack.addChild(btn);
|
||||
|
||||
var backBtn = new button.Button();
|
||||
backBtn.text = "BACK";
|
||||
backBtn.on(button.Button.tapEvent, function () {
|
||||
frame.topmost().goBack();
|
||||
});
|
||||
stack.addChild(backBtn);
|
||||
|
||||
var txt = new text.TextField();
|
||||
txt.text = "text new B";
|
||||
stack.addChild(txt);
|
||||
|
||||
page.content = stack;
|
||||
|
||||
return page;
|
||||
}
|
||||
//export var Page = page;
|
||||
@@ -1,58 +0,0 @@
|
||||
import * as pages from "tns-core-modules/ui/page";
|
||||
import * as frame from "tns-core-modules/ui/frame";
|
||||
import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
|
||||
import * as button from "tns-core-modules/ui/button";
|
||||
import * as text from "tns-core-modules/ui/text-field";
|
||||
import * as color from "tns-core-modules/color";
|
||||
import * as scroll from "tns-core-modules/ui/scroll-view";
|
||||
|
||||
export function createPage() {
|
||||
var page = new pages.Page();
|
||||
var stack = new stackModule.StackLayout();
|
||||
stack.style.backgroundColor = new color.Color("#FFFFFF00");
|
||||
|
||||
var btn = new button.Button();
|
||||
btn.text = "Page C";
|
||||
btn.on(button.Button.tapEvent, function () {
|
||||
var nextPage = "tests/pages/navigation/pageC";
|
||||
frame.topmost().navigate(nextPage);
|
||||
});
|
||||
stack.addChild(btn);
|
||||
|
||||
var btnActivity = new button.Button();
|
||||
btnActivity.text = "start activity";
|
||||
btnActivity.on(button.Button.tapEvent, function () {
|
||||
var newFrame = new frame.Frame();
|
||||
var newPage = "tests/pages/navigation/pageA-new-activity";
|
||||
newFrame.navigate(newPage);
|
||||
});
|
||||
stack.addChild(btnActivity);
|
||||
|
||||
var backBtn = new button.Button();
|
||||
backBtn.text = "BACK";
|
||||
backBtn.on(button.Button.tapEvent, function () {
|
||||
frame.topmost().goBack();
|
||||
});
|
||||
stack.addChild(backBtn);
|
||||
|
||||
var txt = new text.TextField();
|
||||
txt.text = "text B";
|
||||
stack.addChild(txt);
|
||||
|
||||
var sv = new scroll.ScrollView();
|
||||
sv.height = 200;
|
||||
stack.addChild(sv);
|
||||
|
||||
var content = new stackModule.StackLayout();
|
||||
sv.content = content;
|
||||
for (var i = 0; i < 50; i++) {
|
||||
var b = new button.Button();
|
||||
b.text = "button " + i;
|
||||
content.addChild(b);
|
||||
}
|
||||
|
||||
page.content = stack;
|
||||
|
||||
return page;
|
||||
}
|
||||
//export var Page = page;
|
||||
@@ -1,34 +0,0 @@
|
||||
import * as pages from "tns-core-modules/ui/page";
|
||||
import * as frame from "tns-core-modules/ui/frame";
|
||||
import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
|
||||
import * as button from "tns-core-modules/ui/button";
|
||||
import * as text from "tns-core-modules/ui/text-field";
|
||||
|
||||
export function createPage() {
|
||||
var page = new pages.Page();
|
||||
var stack = new stackModule.StackLayout();
|
||||
|
||||
var btn = new button.Button();
|
||||
btn.text = "Page A ???";
|
||||
btn.on(button.Button.tapEvent, function () {
|
||||
var newPage = "tests/pages/navigation/pageA";
|
||||
frame.topmost().navigate(newPage);
|
||||
});
|
||||
stack.addChild(btn);
|
||||
|
||||
var backBtn = new button.Button();
|
||||
backBtn.text = "BACK";
|
||||
backBtn.on(button.Button.tapEvent, function () {
|
||||
frame.topmost().goBack();
|
||||
});
|
||||
stack.addChild(backBtn);
|
||||
|
||||
var txt = new text.TextField();
|
||||
txt.text = "text new C";
|
||||
stack.addChild(txt);
|
||||
|
||||
page.content = stack;
|
||||
|
||||
return page;
|
||||
}
|
||||
//export var Page = page;
|
||||
@@ -1,43 +0,0 @@
|
||||
import * as pages from "tns-core-modules/ui/page";
|
||||
import * as frame from "tns-core-modules/ui/frame";
|
||||
import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
|
||||
import * as button from "tns-core-modules/ui/button";
|
||||
import * as text from "tns-core-modules/ui/text-field";
|
||||
|
||||
export function createPage() {
|
||||
var page = new pages.Page();
|
||||
var stack = new stackModule.StackLayout();
|
||||
|
||||
var newActivity = new button.Button();
|
||||
newActivity.text = "start activity";
|
||||
newActivity.on(button.Button.tapEvent, function () {
|
||||
var newFrame = new frame.Frame();
|
||||
var newPage = "tests/pages/navigation/pageA-new-activity";
|
||||
newFrame.navigate(newPage);
|
||||
});
|
||||
stack.addChild(newActivity);
|
||||
|
||||
var btn = new button.Button();
|
||||
btn.text = "Page A ???";
|
||||
btn.on(button.Button.tapEvent, function () {
|
||||
var nextPage = "tests/pages/navigation/pageA";
|
||||
frame.topmost().navigate(nextPage);
|
||||
});
|
||||
stack.addChild(btn);
|
||||
|
||||
var backBtn = new button.Button();
|
||||
backBtn.text = "BACK";
|
||||
backBtn.on(button.Button.tapEvent, function () {
|
||||
frame.topmost().goBack();
|
||||
});
|
||||
stack.addChild(backBtn);
|
||||
|
||||
var txt = new text.TextField();
|
||||
txt.text = "text C";
|
||||
stack.addChild(txt);
|
||||
|
||||
page.content = stack;
|
||||
|
||||
return page;
|
||||
}
|
||||
//export var Page = page;
|
||||
Reference in New Issue
Block a user