-
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathcomponent.ts
More file actions
90 lines (83 loc) Β· 2.19 KB
/
Copy pathcomponent.ts
File metadata and controls
90 lines (83 loc) Β· 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import { Dialogs } from '@nativescript/core'
import { Component, NO_ERRORS_SCHEMA } from '@angular/core'
import { NativeScriptCommonModule } from '@nativescript/angular';
@Component({
selector: 'ns-dialogs',
templateUrl: './component.html',
imports: [NativeScriptCommonModule],
schemas: [NO_ERRORS_SCHEMA]
})
export class DialogsComponent {
// #region example-alert
showAlert() {
Dialogs.alert({
title: 'Alert!',
message: 'Please try again later.',
okButtonText: 'OK',
cancelable: true,
})
}
// #endregion example-alert
// #region example-action
showAction() {
Dialogs.action({
title: 'Action!',
message: 'Choose your language:',
cancelButtonText: 'Cancel',
actions: ['TypeScript', 'JavaScript', 'Neither'],
cancelable: true,
destructiveActionsIndexes: [2],
}).then((result) => {
console.log(result)
})
}
// #endregion example-action
// #region example-confirm
showConfirm() {
Dialogs.confirm({
title: 'Confirm!',
message: 'Are you sure you want to do this?',
okButtonText: 'Yes',
cancelButtonText: 'No',
neutralButtonText: 'Cancel',
}).then((result) => {
console.log(result)
})
}
// #endregion example-confirm
// #region example-prompt
showPrompt() {
Dialogs.prompt({
title: 'Prompt!',
message: 'Enter the name of this framework:',
defaultText: 'NativeScript',
okButtonText: 'OK',
neutralButtonText: 'Cancel',
// cancelable: true,
// cancelButtonText: 'Cancel',
// capitalizationType: 'none',
// inputType: 'email',
}).then((result) => {
console.log(result)
})
}
// #endregion example-prompt
// #region example-login
showLogin() {
Dialogs.login({
title: 'Login!',
message: 'Enter your credentials',
okButtonText: 'Login',
cancelButtonText: 'Cancel',
userName: 'NativeScript',
password: 'hunter2',
// neutralButtonText: 'Neutral',
// cancelable: true,
// passwordHint: 'Your password',
// userNameHint: 'Your username',
}).then((result) => {
console.log(result)
})
}
// #endregion example-login
}