NativeScript-Toasty
Install
tns plugin add nativescript-toasty
Usage
TypeScript
;;// Toasty accepts an object for customizing its behavior/appearance. The only REQUIRED value is `text` which is the message for the toast.const toast = text: 'Toast message' ;toast; // you can also chain the methods together and there's no need to create a reference to the Toasty instance with this approach text: 'Some Message' ; // or you can set the properties of the Toasty instanceconst toasty = text: 'Somethign something...' position: ToastPositionTOP yAxisOffset: 100 xAxisOffset: 10 ios: displayShadow: true shadowColor: '#fff000' cornerRadius: 24 anchorView: someButtonnativeView // must be the native iOS/Android view instance (button, page, action bar, tabbar, etc.); toastyduration = ToastDurationSHORT;toastytextColor = '#fff';toastybackgroundColor = 'purple';toasty;
JavaScript
var toasty = Toasty;var toast = text: 'Toast message' ;toast;
API
constructoropts: ToastyOptions; position: ToastPosition; duration: ToastDuration; textColor: Color | string; backgroundColor: Color | string; yAxisOffset?: Length | number; xAxisOffset?: Length | number; readonly width: number; readonly height: number; /** * Show the Toasty */ show; /** * Cancels the Toasty */ cancel; /** * Sets the Toast position. */ setToastPositionvalue: ToastPosition: Toasty; /** * Sets the Toast duration. */ setToastDurationvalue: ToastDuration: Toasty; /** * Set the text color of the toast. * @param value [Color | string] - Color of the string message. */ setTextColorvalue: Color | string: Toasty; /** * Set the background color of the toast. * @param value [Color | string] - Color of the background. * On Android this currently removes the default Toast rounded borders. */ setBackgroundColorvalue: Color | string: Toasty;