Skip to content

Commit afd6acb

Browse files
ikoevskarigor789
authored andcommitted
Updated confirm dialog (#116)
* Updated confirm dialog * Update confirm.md * Update confirm.md
1 parent b415527 commit afd6acb

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed
Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
---
22
title: ConfirmDialog
33
apiRef: https://docs.nativescript.org/api-reference/modules/_ui_dialogs_#confirm
4-
contributors: [MisterBrownRSA, rigor789]
4+
contributors: [MisterBrownRSA, rigor789, ikoevska]
55
---
66

7-
The ConfirmDialog acts as a boolean (Yes/No) input dialog.
7+
The `confirm()` method shows a confirmation message and Cancel and OK buttons.
8+
9+
The method is part of the [`dialogs` module](https://docs.nativescript.org/api-reference/modules/_ui_dialogs_).
810

911
---
1012

13+
## Basic use
14+
15+
The `confirm()` method is available globally. You can call it anywhere in your app.
16+
1117
```javascript
12-
const dialogs = require('tns-core-modules/ui/dialogs')
13-
14-
module.exports = {
15-
mounted() {
16-
dialogs.confirm('Are you ready?')
17-
.then(result => {
18-
console.log(result)
19-
})
20-
}
21-
}
18+
confirm('Your message')
19+
.then(result => {
20+
console.log(result);
21+
});
2222
```
2323

24-
The ConfirmDialog is also available globally, so instead of importing it from the dialogs module, you can simply call
24+
## Configure dialog options
2525

2626
```javascript
27-
confirm('Are you ready?')
28-
.then(result => {
29-
console.log(result)
30-
})
27+
confirm({
28+
title: "Your title",
29+
message: "Your message",
30+
okButtonText: "Your OK button text",
31+
cancelButtonText: "Your Cancel text"
32+
}).then(result => {
33+
console.log(result);
34+
});
3135
```
3236

33-
anywhere in your code.
34-
35-
[> screenshots for=ConfirmDialog <]
37+
[> screenshots for=ConfirmDialog <]

0 commit comments

Comments
 (0)