How to use nativescript-fancyalert - 10 common examples

To help you get started, we’ve selected a few nativescript-fancyalert examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NathanWalker / ShoutOutPlay / app / shared / core / services / fancyalert.service.ts View on Github external
// angular
import {Injectable, NgZone} from '@angular/core';

// libs
import {Store} from '@ngrx/store';

// nativescript
import {Color} from 'color';
import {isIOS} from 'platform';
import * as dialogs from 'ui/dialogs';

var TNSFancyAlert, TNSFancyAlertButton;

if (isIOS) {
  var fAlerts = require('nativescript-fancyalert');
  TNSFancyAlert = fAlerts.TNSFancyAlert;
  TNSFancyAlertButton = fAlerts.TNSFancyAlertButton;
} else {
  // android
  TNSFancyAlertButton = (function () {
    function TNSFancyAlertButton(model) {
        if (model) {
            this.label = model.label;
            this.action = model.action;
        }
    }
    return TNSFancyAlertButton;
  }());
}

// app
import {ColorService} from './color.service';
github NathanWalker / nativescript-fancyalert / demo / app / main-view-model.ts View on Github external
public showCustomButtons() {
    let buttons = [
      new TNSFancyAlertButton({
        label: "One",
        action: () => {
          console.log("One");
        }
      }),
      new TNSFancyAlertButton({
        label: "Two",
        action: () => {
          console.log("Two");
        }
      }),
      new TNSFancyAlertButton({
        label: "Three",
        action: () => {
          console.log("Three");
        }
      }),
      new TNSFancyAlertButton({
        label: "Four",
        action: () => {
          console.log("Four");
        }
github NathanWalker / nativescript-fancyalert / demo / app / main-view-model.ts View on Github external
let underline = nsString.rangeOfStringOptions(
        "too!",
        NSCaseInsensitiveSearch
      );
      subTitle.addAttributeValueRange(
        NSUnderlineStyleAttributeName,
        NSUnderlineStyleSingle,
        underline
      );

      return subTitle;
    };
    TNSFancyAlert.showCustomTextAttributes(
      textAttribution,
      new TNSFancyAlertButton({
        label: "Wow, ok.",
        action: (value: any) => {
          console.log(`Clicked ok.`);
        }
      }),
      undefined,
      undefined,
      "Custom text color?",
      `Yep, that can be done too!`,
      null
    );
  }
github EddyVerbruggen / nativescript-pluginshowcase / app / feedback / helpers / fancyalert-helper.ts View on Github external
showSwitch(): void {
    TNSFancyAlert.showSwitch("Don't ask me again", '#58B136', new TNSFancyAlertButton({
      label: "Save",
      action: (isSelected: boolean) => {
        console.log(`Don't ask again was selected? ${isSelected}`);
      }
    }), 'switch.png', '#B3714F', 'Need a switch?', `It can be useful.`, 'Got it.');
  }
}
github NathanWalker / nativescript-fancyalert / demo / app / main-view-model.ts View on Github external
public showTextField() {
    TNSFancyAlert.showTextField(
      "Enter your name",
      "",
      new TNSFancyAlertButton({
        label: "Save",
        action: (value: any) => {
          console.log(`User entered ${value}`);
        }
      }),
      undefined,
      undefined,
      "User Input?",
      `Yeah, sure we can.`,
      "Ok, lots of options."
    );
  }
github NathanWalker / nativescript-fancyalert / demo / app / main-view-model.ts View on Github external
public showSwitch() {
    TNSFancyAlert.showSwitch(
      `Don't show again`,
      "#58B136",
      new TNSFancyAlertButton({
        label: "Save",
        action: (isSelected: boolean) => {
          console.log(`Don't show again was selected: ${isSelected}`);
        }
      }),
      "switch.png",
      "#B3714F",
      "Need a switch?",
      `It can be useful.`,
      "Got it."
    );
  }
github NathanWalker / nativescript-fancyalert / demo / app / main-view-model.ts View on Github external
public showSwitch() {
    TNSFancyAlert.showSwitch(
      `Don't show again`,
      "#58B136",
      new TNSFancyAlertButton({
        label: "Save",
        action: (isSelected: boolean) => {
          console.log(`Don't show again was selected: ${isSelected}`);
        }
      }),
      "switch.png",
      "#B3714F",
      "Need a switch?",
      `It can be useful.`,
      "Got it."
    );
  }
github NathanWalker / nativescript-fancyalert / demo / app / main-view-model.ts View on Github external
public showTextField() {
    TNSFancyAlert.showTextField(
      "Enter your name",
      "",
      new TNSFancyAlertButton({
        label: "Save",
        action: (value: any) => {
          console.log(`User entered ${value}`);
        }
      }),
      undefined,
      undefined,
      "User Input?",
      `Yeah, sure we can.`,
      "Ok, lots of options."
    );
  }
github NathanWalker / nativescript-fancyalert / demo / app / main-view-model.ts View on Github external
}
      }),
      new TNSFancyAlertButton({
        label: "Four",
        action: () => {
          console.log("Four");
        }
      }),
      new TNSFancyAlertButton({
        label: "Really? More?",
        action: () => {
          console.log("more");
        }
      })
    ];
    TNSFancyAlert.showCustomButtons(
      buttons,
      undefined,
      undefined,
      "Got Buttons?",
      `Add as many as you'd like.`,
      "Ok"
    );
  }
github NathanWalker / nativescript-fancyalert / demo / app / main-view-model.ts View on Github external
greenRange
      );

      let underline = nsString.rangeOfStringOptions(
        "too!",
        NSCaseInsensitiveSearch
      );
      subTitle.addAttributeValueRange(
        NSUnderlineStyleAttributeName,
        NSUnderlineStyleSingle,
        underline
      );

      return subTitle;
    };
    TNSFancyAlert.showCustomTextAttributes(
      textAttribution,
      new TNSFancyAlertButton({
        label: "Wow, ok.",
        action: (value: any) => {
          console.log(`Clicked ok.`);
        }
      }),
      undefined,
      undefined,
      "Custom text color?",
      `Yep, that can be done too!`,
      null
    );
  }