nativescript-dialog
A NativeScript plugin for iOS and Android that allows you to create custom dialog.
npm i --save nativescript-dialog
- Version: 0.1.0
- GitHub:
- NPM: https://www.npmjs.com/package/nativescript-dialog
- Downloads:
- Last Day: 0
- Last Week: 0
- Last Month: 0
NativeScript Dialog
A NativeScript plugin for iOS and Android that allows you to create custom dialog.
Installation
tns plugin add nativescript-dialog
Usage
<Page>
<StackLayout>
<Button text="Show dialog" tap="buttonTap" />
</StackLayout>
</Page>
var platform = require("platform");
var application = require("application");
var dialog = require("nativescript-dialog");
exports.buttonTap = function(args){
var nativeView;
if(platform.device.os === platform.platformNames.ios){
nativeView = UIActivityIndicatorView.alloc().initWithActivityIndicatorStyle(UIActivityIndicatorViewStyle.UIActivityIndicatorViewStyleGray);
nativeView.startAnimating();
} else if(platform.device.os === platform.platformNames.android){
nativeView = new android.widget.ProgressBar(application.android.currentContext);
nativeView.setIndeterminate(true);
}
dialog.show({
title: "Loading...",
message: "Please wait!",
cancelButtonText: "Cancel",
nativeView: nativeView}
).then(function(r){ console.log("Result: " + r); },
function(e){console.log("Error: " + e)});
}
iOS | Android |
---|---|