mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(android): dialogs activity usage (#10246)
This commit is contained in:
37
apps/toolbox/src/pages/dialogs.ts
Normal file
37
apps/toolbox/src/pages/dialogs.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { Page, Observable, EventData, Dialogs } from '@nativescript/core';
|
||||
|
||||
let page: Page;
|
||||
|
||||
export function navigatingTo(args: EventData) {
|
||||
page = <Page>args.object;
|
||||
page.bindingContext = new SampleData();
|
||||
}
|
||||
|
||||
export class SampleData extends Observable {
|
||||
dialogAlert() {
|
||||
Dialogs.alert('Hello');
|
||||
}
|
||||
dialogAlertWithOptions() {
|
||||
Dialogs.alert({
|
||||
title: 'Hello',
|
||||
message: 'Oh hi!',
|
||||
okButtonText: 'Nice',
|
||||
});
|
||||
}
|
||||
dialogConfirm() {
|
||||
Dialogs.confirm('Is it?').then((ok) => {
|
||||
Dialogs.alert('Ok then!');
|
||||
});
|
||||
}
|
||||
|
||||
dialogLogin() {
|
||||
Dialogs.login('Login').then((result) => {
|
||||
console.log(result);
|
||||
});
|
||||
}
|
||||
dialogAction() {
|
||||
Dialogs.action('Actions', 'Cancel', ['Test', 'Testing']).then((result) => {
|
||||
console.log(result);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user