FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(view): added iOS parameter for modal presentation style (#6409) · NativeScript/NativeScript@540b2b4 · GitHub

Commit 540b2b4

Browse files
authored andcommitted
feat(view): added iOS parameter for modal presentation style (#6409)
* feat(view): added iOS parameter for modal presentation style * Now passing options to showModal in one argument * refactor: Move context and close in modal options * chore: Comments added for UIModalPresentationStyle.Popover case * refactor: Use modalOptions in e2e demo * chore: fix pbroken test
1 parent 44dba1a commit 540b2b4

6 files changed

Lines changed: 263 additions & 107 deletions

File tree

‎apps/app/ui-tests-app/modal-view/modal-view.ts‎

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,61 @@
11
import { Page } from "tns-core-modules/ui/page";
22
import { Label } from "tns-core-modules/ui/label";
33

4+
function createCloseCallback(label: Label, context?: string): (username: string, password: string) => void {
5+
return function (username: string, password: string) {
6+
let result = username + "/" + password;
7+
result = context ? context + "/" + result : result;
8+
console.log(result);
9+
label.text = result;
10+
}
11+
}
12+
13+
function openModal(page: Page, label: Label, context: string) {
14+
page.showModal("ui-tests-app/modal-view/login-page", {
15+
context,
16+
closeCallback: createCloseCallback(label, context),
17+
fullscreen: false,
18+
});
19+
}
20+
421
export function onTap(args) {
522
const page = <Page>args.object.page;
623
const label = page.getViewById<Label>("label");
724
var fullscreen = (<any>args.object).text.indexOf("(full-screen)") !== -1;
8-
page.showModal("ui-tests-app/modal-view/login-page", "context", function (username: string, password: string) {
9-
console.log(username + "/" + password);
10-
label.text = username + "/" + password;
11-
}, fullscreen);
25+
26+
page.showModal("ui-tests-app/modal-view/login-page", {
27+
context: "context",
28+
closeCallback: createCloseCallback(label),
29+
fullscreen
30+
});
1231
}
1332

1433
export function onTapStretched(args) {
1534
const page = <Page>args.object.page;
1635
const label = page.getViewById<Label>("label");
17-
var fullscreen = false;
18-
var stretched = true;
19-
20-
page.showModal("ui-tests-app/modal-view/login-page", "context", function (username: string, password: string) {
21-
console.log(username + "/" + password);
22-
label.text = username + "/" + password;
23-
}, fullscreen, false, stretched);
24-
}
2536

26-
function openModal(page: Page, label: Label, context: string) {
27-
page.showModal("ui-tests-app/modal-view/login-page", context, function (username: string, password: string) {
28-
const result = context + "/" + username + "/" + password;
29-
console.log(result);
30-
label.text = result;
31-
}, false);
37+
page.showModal("ui-tests-app/modal-view/login-page", {
38+
context: "context",
39+
closeCallback: createCloseCallback(label),
40+
fullscreen: false,
41+
animated: false,
42+
stretched: true
43+
});
3244
}
3345

3446
export function onTapSecondModalInCB(args) {
3547
const page = <Page>args.object.page;
3648
const label = page.getViewById<Label>("label");
37-
page.showModal("ui-tests-app/modal-view/login-page", "First", function (username: string, password: string) {
38-
const result = "First/" + username + "/" + password;
39-
console.log(result);
40-
label.text = result;
49+
page.showModal("ui-tests-app/modal-view/login-page", {
50+
context: "First",
51+
closeCallback: (username: string, password: string) => {
52+
const result = "First/" + username + "/" + password;
53+
console.log(result);
54+
label.text = result;
4155

42-
// Open second modal in the close callback of the first one.
43-
openModal(page, label, "Second");
56+
// Open second modal in the close callback of the first one.
57+
openModal(page, label, "Second");
58+
}
4459
});
4560
}
4661

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL