Skip to content

nativescript-forks/nativescript-cfalert-dialog

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nativescript-cfalert-dialog npm

Twitter URL Twitter URL

NPM

This plugin is a wrapper around CFAlertDialog for Android and CFAlertViewController.

Screenshots

Android

iOS

Installation

tns plugin add nativescript-cfalert-dialog

Configuration

no configuration step involved

Usage

NativeScript Core with { TypeScript } (works on Core, Angular and Vue as well)

import { CFAlertDialog,
         DialogOptions,
         CFAlertGravity,
         CFAlertActionAlignment,
         CFAlertActionStyle,
         CFAlertStyle } from 'nativescript-cfalert-dialog';

let cfalertDialog = new CFAlertDialog();

let options: DialogOptions = {
      // Options go here
      dialogStyle: CFAlertStyle.ALERT,
      title: "This is cool!",
    }

cfalertDialog.show(options); // That's about it ;)

API

show(options): void;

Shows the CFAlert Dialog based on the options provided

Options format

// Everything that has '?' is optional
export interface DialogOptions {
    dialogStyle: CFAlertStyle;
    title: string;
    titleColor?: string,
    message?: string;
    messageColor?: string;
    textColor?: string;
    textAlignment?: CFAlertGravity;
    backgroundColor?: string,
    backgroundBlur?: string, // iOS only
    cancellable?: boolean,
    headerView?: any, // nativeView
    footerView?: any, // nativeView
    onDismiss?: Function, // calback for dismiss, function (dialog)
    buttons?: [{
        text: string, // title
        buttonStyle: CFAlertActionStyle,
        buttonAlignment?: CFAlertActionAlignment,
        textColor?: string,
        backgroundColor?: string,
        onClick: Function // function (buttonName)
    }],    
    simpleList?: { // android only
        items: [string],
        onClick: Function // function(dialogInterface, index)
    },
    singleChoiceList?: { // android only
        items: [string],
        selectedItem: number,
        onClick: Function // function(dialogInterface, index)
    },
    multiChoiceList?: { // android only
        items: [string],
        selectedItems: [boolean], // should have same number of elements as 'items'
        onClick: Function // function (dialogInterface, index, b)
    }
}

License

Apache License Version 2.0, January 2004

About

CFAlertDialog Wrapper for NativeScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 89.6%
  • Shell 8.6%
  • Ruby 1.8%