nativescript-material-snackbar
by farfromrefuge | v3.3.2
Material snackbar component
npm i --save nativescript-material-snackbar
  • Version: 3.3.2
  • GitHub:
  • Downloads:
    • Last Day:   0
    • Last Week:  1
    • Last Month: 209

npm npm GitHub forks GitHub stars

Nativescript Material SnackBar

Use the Material Design Snackbars in your {N} app

Material Design Spec

Installation

If using @nativescript :

  • tns plugin add nativescript-material-snackbar

If using tns-core-modules

  • tns plugin add nativescript-material-snackbar@2.5.4

Be sure to run a new build after adding plugins to avoid any issues.

Usage

TS

import { SnackBar } from 'nativescript-material-snackbar';

const snackbar = new SnackBar();

export function showSimpleSnackbar() {
snackbar.simple(`I'm a simple snackbar`).then(result => console.log('Simple Snackbar:', result));
}

export function showActionSnackbar() {
snackbar
.action({
message: `I'm a snackbar with an action`,
actionText: 'Dismiss',
hideDelay: 2000
})
.then(result => console.log('Action Snackbar:', result));
}

export function showColorfulSnackbar() {
snackbar
.action({
message: `I'm a colorful snackbar`,
textColor: 'blue',
actionTextColor: 'yellow',
backgroundColor: 'green',
actionText: 'Dismiss',
hideDelay: 2000
})
.then(result => console.log('Action Snackbar:', result));
}