SweetAlert library for NativeScript Android.
Based on:
- Android F0RIS/sweet-alert-dialog
tns plugin add nativescript-sweet-alertNOTE: "options" may vary according to each method.
import { SweetAlert } from 'nativescript-sweet-alert';
import { ShowSuccess , ShowError } from 'nativescript-sweet-alert/classes';
// showSuccess
const options: ShowSuccess = {
text: "Hello",
contentText: "Alert Content Text",
confirmButtonText: "Ok",
cancelButtonText: "Close"
}
SweetAlert.showSuccess(options).then(value => {
// result: true, false, CLOSED
});
// showError
const options: ShowError = {
text: "Hello",
contentText: "Alert Content Text",
confirmButtonText: "Ok",
cancelButtonText: "Close"
}
SweetAlert.showError(options).then(value => {
// result: true, false, CLOSED
});showNormal(options: ShowNormal): Promise<any>showError(options: ShowError): Promise<any>showSuccess(options: ShowSuccess): Promise<any>showWarning(options: ShowWarning): Promise<any>showCustomImage(options: ShowCustomImage): Promise<any>showText(options: ShowText): Promise<any>showCheckbox(options: ShowCheckbox): Promise<any>
App_Resources/Android/src/main/res/values/colors.xml add to Color Properties
TNS stands for Telerik NativeScript
iOS uses classes prefixed with NS (stemming from the NeXTSTEP days of old):
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/
To avoid confusion with iOS native classes, TNS is used instead.
Need extra help getting these SweetAlert working in your application? Check out these tutorials that make use of the plugin:
SweetAlert in a NativeScript Core Demo
SweetAlert in a NativeScript Angular Demo
MIT
