1
- import { Frame } from '@nativescript/core'
1
+ import { action , login , confirm , prompt , Frame } from '@nativescript/core'
2
2
3
3
export const Dialogs = ( ) => {
4
4
5
+
6
+ function showAlert ( ) {
7
+ // #region example-alert
8
+ alert ( {
9
+ title : 'Alert!' ,
10
+ message : 'Please try again later.' ,
11
+ okButtonText : 'OK' ,
12
+ cancelable : true ,
13
+ } )
14
+ // #endregion example-alert
15
+ }
16
+
17
+ function showAction ( ) {
18
+ // #region example-action
19
+ action ( {
20
+ title : 'Action!' ,
21
+ message : 'Choose your language:' ,
22
+ cancelButtonText : 'Cancel' ,
23
+ actions : [ 'TypeScript' , 'JavaScript' , 'Neither' ] ,
24
+ cancelable : true ,
25
+ destructiveActionsIndexes : [ 2 ] ,
26
+ } )
27
+ // #endregion example-action
28
+ }
29
+
30
+ function showConfirm ( ) {
31
+ // #region example-confirm
32
+ confirm ( {
33
+ title : 'Confirm!' ,
34
+ message : 'Are you sure you want to do this?' ,
35
+ okButtonText : 'Yes' ,
36
+ cancelButtonText : 'No' ,
37
+ neutralButtonText : 'Cancel' ,
38
+ } )
39
+ // #endregion example-confirm
40
+ }
41
+
42
+ function showPrompt ( ) {
43
+ // #region example-prompt
44
+ prompt ( {
45
+ title : 'Prompt!' ,
46
+ message : 'Enter the name of this framework:' ,
47
+ defaultText : 'NativeScript' ,
48
+ okButtonText : 'OK' ,
49
+ neutralButtonText : 'Cancel' ,
50
+ // cancelable: true,
51
+ // cancelButtonText: 'Cancel',
52
+ // capitalizationType: 'none',
53
+ // inputType: 'email',
54
+ } ) ;
55
+ // #endregion example-prompt
56
+ }
57
+
58
+ function showLogin ( ) {
59
+ // #region example-login
60
+ login ( {
61
+ title : 'Login!' ,
62
+ message : 'Enter your credentials' ,
63
+ okButtonText : 'Login' ,
64
+ cancelButtonText : 'Cancel' ,
65
+ userName : 'NativeScript' ,
66
+ password : 'hunter2' ,
67
+ // neutralButtonText: 'Neutral',
68
+ // cancelable: true,
69
+ // passwordHint: 'Your password',
70
+ // userNameHint: 'Your username',
71
+ } ) ;
72
+ }
73
+ // #endregion example-login
5
74
function goBack ( ) {
6
75
Frame . goBack ( ) ;
7
76
@@ -12,6 +81,18 @@ export const Dialogs = () => {
12
81
</ actionitem >
13
82
</ actionbar >
14
83
{ /* @ts -ignore */ }
84
+ < gridlayout ios :visibility = "collapse" verticalAlignment = "center" horizontalAlignment = "center" >
85
+ < stacklayout >
86
+
87
+ < button on :tap = { showAlert } padding = "8" > Alert</ button >
88
+ < button on :tap = { showAction } padding = "8" > Action</ button >
89
+ < button on :tap = { showConfirm } padding = "8" > Confirm</ button >
90
+ < button on :tap = { showPrompt } padding = "8" > Prompt</ button >
91
+ < button on :tap = { showLogin } padding = "8" > Login</ button >
92
+
93
+ </ stacklayout >
94
+
95
+ </ gridlayout >
15
96
</ >
16
97
) ;
17
98
} ;
0 commit comments