@ionic-native/toast

  • Version 5.36.0
  • Published
  • 35.7 kB
  • 1 dependency
  • MIT license

Install

npm i @ionic-native/toast
yarn add @ionic-native/toast
pnpm add @ionic-native/toast

Overview

Ionic Native - Native plugins for ionic apps

Index

Variables

variable Toast

const Toast: ToastOriginal;

    Classes

    class ToastOriginal

    class ToastOriginal extends IonicNativePlugin {}
    • Toast This plugin allows you to show a native Toast (a little text popup) on iOS, Android and WP8. It's great for showing a non intrusive native notification which is guaranteed always in the viewport of the browser.

      Requires Cordova plugin: cordova-plugin-x-toast. For more info, please see the [Toast plugin docs](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin).

      import { Toast } from '@ionic-native/toast/ngx';
      constructor(private toast: Toast) { }
      ...
      this.toast.show(`I'm a toast`, '5000', 'center').subscribe(
      toast => {
      console.log(toast);
      }
      );

      ToastOptions

    method hide

    hide: () => Promise<any>;
    • Manually hide any currently visible toast.

      Returns

      {Promise} Returns a Promise that resolves on success.

    method show

    show: (message: string, duration: string, position: string) => Observable<any>;
    • Show a native toast for the given duration at the specified position.

      Parameter message

      The message to display.

      Parameter duration

      Duration to show the toast, either 'short', 'long' or any number of milliseconds: '1500'.

      Parameter position

      Where to position the toast, either 'top', 'center', or 'bottom'.

      Returns

      {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.

    method showLongBottom

    showLongBottom: (message: string) => Observable<any>;
    • Shorthand for show(message, 'long', 'bottom').

      Parameter message

      Returns

      {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.

    method showLongCenter

    showLongCenter: (message: string) => Observable<any>;
    • Shorthand for show(message, 'long', 'center').

      Parameter message

      Returns

      {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.

    method showLongTop

    showLongTop: (message: string) => Observable<any>;
    • Shorthand for show(message, 'long', 'top').

      Parameter message

      Returns

      {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.

    method showShortBottom

    showShortBottom: (message: string) => Observable<any>;
    • Shorthand for show(message, 'short', 'bottom').

      Parameter message

      Returns

      {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.

    method showShortCenter

    showShortCenter: (message: string) => Observable<any>;
    • Shorthand for show(message, 'short', 'center').

      Parameter message

      Returns

      {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.

    method showShortTop

    showShortTop: (message: string) => Observable<any>;
    • Shorthand for show(message, 'short', 'top').

      Parameter message

      Returns

      {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.

    method showWithOptions

    showWithOptions: (options: ToastOptions) => Observable<any>;
    • Show a native toast with the given options.

      Parameter options

      Options for showing a toast. Available options: message The message to display. duration Duration to show the toast, either 'short', 'long' or any number of milliseconds: '1500'. position Where to position the toast, either 'top', 'center', or 'bottom'. addPixelsY Offset in pixels to move the toast up or down from its specified position.

      Returns

      {Observable} Returns an Observable that notifies first on success and then when tapped, rejects on error.

    Interfaces

    interface ToastOptions

    interface ToastOptions {}

      property addPixelsY

      addPixelsY?: number;
      • Add negative value to move it up a bit

      property data

      data?: any;
      • Pass JSON object to be sent back in success callback

      property duration

      duration?: number;
      • Duration in ms to show

      property message

      message?: string;
      • Message to display

      property position

      position?: string;
      • Position

      property styling

      styling?: {
      opacity?: number;
      backgroundColor?: string;
      textColor?: string;
      cornerRadius?: number;
      horizontalPadding?: number;
      verticalPadding?: number;
      };
      • Styling

      Package Files (1)

      Dependencies (1)

      Dev Dependencies (0)

      No dev dependencies.

      Peer Dependencies (2)

      Badge

      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@ionic-native/toast.

      • Markdown
        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@ionic-native/toast)
      • HTML
        <a href="https://www.jsdocs.io/package/@ionic-native/toast"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>