New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

nativescript-snackbar

Package Overview
Dependencies
Maintainers
4
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nativescript-snackbar

A NativeScript plugin for the Material Design SnackBar.

latest
Source
npmnpm
Version
4.1.2
Version published
Maintainers
4
Created
Source

NativeScript-Snackbar 🍭 🍫 🍦

NativeScript plugin for Material Design Floating Action Button UI component.

npm npm travis build stars donate

Demo

Snackbar

Installation

tns plugin add nativescript-snackbar

Changelog

Usage

TS

import { SnackBar, SnackBarOptions } from "nativescript-snackbar";

// Create an instance of SnackBar
const snackbar = new SnackBar();

/// Show a simple snackbar with no actions
public showSimple() {
    snackbar.simple('Snackbar', 'red', '#fff', 3, false).then((args) => {
         this.set('jsonResult', JSON.stringify(args));
   })
}

/// Show an Action snack bar
public showAction() {
  const options: SnackBarOptions = {
    actionText: this.get('actionText'),
    actionTextColor: '#ff4081', // Optional, Android only
    snackText: this.get('snackText'),
    textColor: '#346db2', // Optional, Android only
    hideDelay: 3500,
    backgroundColor: '#eaeaea', // Optional, Android only
    maxLines: 3, // Optional, Android Only
    isRTL: false, // Optional, Android Only
    view: <View>someView // Optional, Android Only, default to topmost().currentPage
  };

  snackbar.action(options).then((args) => {
    if (args.command === "Action") {
      this.set('jsonResult', JSON.stringify(args));
    } else {
      this.set('jsonResult', JSON.stringify(args));
    }
  });
}

API

Show a simple SnackBar (color args will only work on Android)

  • simple(snackText: string, textColor?: string, backgroundColor?: string, maxLines?: number, isRTL?: boolean, view?: View): Promise

Show a SnackBar with Action.

  • action(options: SnackBarOptions): Promise

Manually dismiss an active SnackBar

  • dismiss(): Promise

SnackBarOptions Interface

  • actionText: string
  • actionTextColor: string
  • snackText: string
  • hideDelay: number
  • textColor: string
  • backgroundColor: string
  • maxLines: number
  • isRTL: boolean
  • view: View

Keywords

NativeScript

FAQs

Package last updated on 12 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts