🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

expo-react-native-toastify

Package Overview
Dependencies
Maintainers
0
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expo-react-native-toastify

expo-react-native-toastify allows you to add notifications to your expo react-native app (ios, android, web) with ease.

1.0.19
latest
npm
Version published
Weekly downloads
87
-35.56%
Maintainers
0
Weekly downloads
 
Created
Source

expo-react-native-toastify

npm version

expo-react-native-toastify allows you to add notifications to your expo react-native app (ios, android, web) with ease.

A demo is worth 1000 words

Features

  • Smooth enter/exit animations

  • Plain simple and flexible APIs

  • Resize itself correctly on device rotation

  • Swipeable

  • Easy to set up for real, you can make it work in less than 10sec!

  • Super easy to customize

  • RTL support

  • Swipe to close 👌

  • Can choose swipe direction

  • Super easy to use an animation of your choice. Works well with animate.css for example

  • Define behavior per toast

  • Pause toast on hover (web) or touch (mobile) 🖱️

  • Fancy progress bar to display the remaining time

  • Progress bar pauses with toast

  • Static Toasts (duration: 0)

  • Possibility to update a toast

  • You can control the progress bar a la nprogress 😲

  • You can display multiple toast at the same time

  • Dark and light mode 🌒

  • Custom component support

  • Flexible icon system using Ionicons

  • And much more!

Installation

Using npm:

npm install expo-react-native-toastify

Using yarn:

yarn add expo-react-native-toastify

Pause Behavior

The toast notification and its progress bar will pause:

  • On web: When hovering over the toast with mouse
  • On mobile: When touching the toast
  • The timer and progress bar will resume when the interaction ends
  • Static toasts (duration: 0) are not affected by pause

Example with pause:

// Toast will pause on hover (web) or touch (mobile)
Toast.info("Pausable message", { 
  duration: 5000,  // 5 seconds
  position: "top"
});

// Static toast - won't pause
Toast.info("Static message", { 
  duration: 0,  // Static toast
  position: "top"
});

Quick Start

import React from "react";
import { StyleSheet, View, TouchableOpacity, Text } from "react-native";
import ToastManager, { Toast } from "expo-react-native-toastify";


const App = () => {
  const showToasts = () => {
    Toast.info("This is a toast.",{position:'top'});
  };

  return (
    <View style={styles.container}>
      <ToastManager />
      <TouchableOpacity
        onPress={showToasts}
        style={{
          backgroundColor: "white",
          borderColor: "green",
          borderWidth: 1,
          padding: 10,
        }}
      >
        <Text>SHOW SOME AWESOMENESS!</Text>
      </TouchableOpacity>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "center",
  },
});

export default App;

Basic Usage

Toast Types

// Basic toasts
Toast.success("Success message");
Toast.error("Error message");
Toast.info("Info message");
Toast.warn("Warning message");

// Custom toast
Toast.custom("Custom message", {
  barColor: "#FF5733",
  icon: "heart",
  position: "top",
  theme: "dark"
});

Positions

Toast.success("Top position", { position: "top" });
Toast.success("Center position", { position: "center" });
Toast.success("Bottom position", { position: "bottom" });

Durations

// Show for 2 seconds
Toast.info("Quick message", { duration: 2000 });

// Show for 5 seconds
Toast.info("Longer message", { duration: 5000 });

// Static toast (won't auto-hide)
Toast.info("Static message", { duration: 0 });

Themes

// Light theme (default)
Toast.success("Light theme", { theme: "light" });

// Dark theme
Toast.success("Dark theme", { theme: "dark" });

Available Props

NameTypeDefaultDescription
widthnumber256Width of toast
heightnumber68Height of the toast
styleanynullStyle applied to the toast
positiontop, center or bottomtopPosition of toast
positionValuenumber50position value of toast
durationnumber3000The display time of toast
animationStyleupInUpOut, rightInOut or zoomInOutupInUpOutThe animation style of toast
animationInstring or object'slideInRight'Toast show animation
animationOutstring or object'slideOutLeft'Toast hide animation
animationInTimingnumber300Timing for the Toast show animation (in ms)
animationOutTimingnumber300Timing for the toast hide animation (in ms)
backdropTransitionInTimingnumber300The backdrop show timing (in ms)
backdropTransitionOutTimingnumber300The backdrop hide timing (in ms)
hasBackdropboolfalseRender the backdrop
backdropColorstring'black'The backdrop background color
backdropOpacitynumber0.2The backdrop opacity when the toast is visible
iconstringinformation-circleIonicon name for toast icon
themestringlightToast theme (light/dark)
barColorstringBased on typeProgress bar color

Icons

This package uses Ionicons for toast icons. You can browse all available icons at: https://oblador.github.io/react-native-vector-icons/

Some commonly used icons:

  • information-circle
  • checkmark-circle
  • alert-circle
  • warning
  • close-circle
  • heart
  • star

Available Animations

Take a look at react-native-animatable to see the dozens of animations available out-of-the-box.

See in Action

image.gif

image.png

image.png

Try the Demo

Want to see all features in action? Try our interactive demo: Live Demo on Expo Snack

Credits

This package is inspired by toastify-react-native.

License

expo-react-native-toastify is [MIT licensed] by geeek.

Keywords

react

FAQs

Package last updated on 06 Mar 2025

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