Fast Cross-platform Toast Component For React Native

Author:arnnis
Views Total:7 views
Official Page:Go to website
Publish Date:September 15, 2020
License:MIT

A fast and cross-platform toast notification component that supports Android, iOS, Web, Windows.

More Features:

  • Normal, Success, Danger, and Warning toast types
  • Supports icons.
  • Smooth animations.

Install & Import:

# Yarn
$ yarn add react-native-fast-toast

# NPM
$ npm i react-native-fast-toast --save
import React, { useEffect, useRef } from "react";
import Toast from "react-native-fast-toast";

Basic usage:

export default function App() {
  const toast = useRef(null);
  useEffect(() => {
    toast.current.show("Toast Notification");
  }, []);
  return (
    <>
      <RestOfYourApp />
      <Toast ref={toast} />
    </>
);

Available options:

toast.current.show("Toast Notification",{
  icon: <Icon />,
  type: "normal" | "success" | "danger" | "warning",
  duration: 5000,
  style: { padding: 0 },
  textStyle: { padding: 0 },
  successIcon?: <successIcon />,
  dangerIcon?: <dangerIcon />,
  warningIcon?: <warningIcon />,
});

Preview:

Fast Cross-platform Toast Component For React Native

You Might Be Interested In:

Leave a Reply