nativescript-sweet-alert
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

SweetAlert library for NativeScript Android.

Based on:

Install

NativeScript 6x

tns plugin add nativescript-sweet-alert

Android Specifications

Usage Examples

NOTE: "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    
});
 

NativeScript SweetAlert - Methods

  • 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>

How can I change the colors?

App_Resources/Android/src/main/res/values/colors.xml add to Color Properties

Why the TNS prefixed name?

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.

Demo

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

License

MIT

Package Sidebar

Install

npm i nativescript-sweet-alert

Weekly Downloads

0

Version

1.0.4

License

Apache-2.0

Unpacked Size

44.9 kB

Total Files

12

Last publish

Collaborators

  • nazimmertbilgi