npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@amitsolanki1409/react-native-toast-message

v1.0.1

Published

A customizable and lightweight toast component for React Native.

Readme

@amitsolanki1409/react-native-toast-message

A customizable and lightweight Toast notification component for React Native.

@amitsolanki1409/react-native-toast-message provides a fully configurable toast message system for your React Native app. You can show success, error, info, or warning toasts with optional icons, custom durations, and custom styling.


✨ Features

  • 🧩 Fully customizable styles
  • ⏱ Configurable duration
  • 🔁 Optional icons
  • 📦 Lightweight and framework-agnostic
  • 🧠 Written in TypeScript
  • 📐 Supports top, center, and bottom positions
  • 🎯 Easy to integrate with a single line

📦 Installation

npm install @amitsolanki1409/react-native-toast-message
# or
yarn add @amitsolanki1409/react-native-toast-message

⚙️ Usage

1. Wrap your app with Toast.ToastContainer()

In your root component (usually App.tsx or MainLayout.tsx):

import React from "react";
import { View } from "react-native";
import Toast from "@amitsolanki1409/react-native-toast-message";

export default function App() {
  return (
    <View style={{ flex: 1 }}>
      {/* Your app's UI */}
      <Toast.ToastContainer />
    </View>
  );
}

2. Show a toast

Anywhere in your app:

import Toast from "@amitsolanki1409/react-native-toast-message";

Toast.show({
  message: "Profile updated successfully!",
  type: "success", // success | error | info | warning
});

3. With optional title and position

Toast.show({
  title: "Success",
  message: "Data saved!",
  type: "success",
  position: "bottom", // top | center | bottom
});

4. Custom Icon

Pass in any valid React element as the Icon:

import Icon from "react-native-vector-icons/MaterialCommunityIcons";

Toast.show({
  message: "No internet connection",
  type: "error",
  Icon: <Icon name="wifi-off" size={24} color="#fff" />,
});

5. Custom Styles

Toast.show({
  message: "Custom styled toast",
  title: "Notice",
  type: "info",
  titleStyle: { fontSize: 20, fontWeight: "bold" },
  messageStyle: { color: "#333" },
  containerStyle: { borderWidth: 2, borderColor: "#000" },
  alertColor: "#0af", // overrides icon background color
});

🧩 Props Reference

| Prop | Type | Default | Description | | ---------------- | --------------------------------------------- | ------------ | ------------------------------------------ | | title | string | type value | Title of the toast | | message | string | Required | Message text | | type | "success" \| "error" \| "info" \| "warning" | "success" | Type of toast, determines background color | | position | "top" \| "center" \| "bottom" | "top" | Position of toast on screen | | duration | number | 3000 | Duration in milliseconds | | onClose | () => void | No | Callback when toast is dismissed | | Icon | ReactNode | No | Custom React icon component | | titleStyle | TextStyle | No | Custom style for title | | messageStyle | TextStyle | No | Custom style for message | | containerStyle | ViewStyle | No | Custom style for the toast container | | alertColor | ColorValue | No | Background color of the icon container |


🧪 Example

import React from "react";
import { Button, View } from "react-native";
import Toast from "@amitsolanki1409/react-native-toast-message";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";

export default function DemoScreen() {
  return (
    <View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
      <Button
        title="Show Toast"
        onPress={() =>
          Toast.show({
            title: "Error",
            message: "Something went wrong!",
            type: "error",
            position: "bottom",
            Icon: <Icon name="alert-circle" size={24} color="#fff" />,
          })
        }
      />
    </View>
  );
}

🧼 Manual Hide

You can manually hide the toast by calling:

Toast.hide();

🧠 Best Practices

  • Make sure to include Toast.ToastContainer at the root level of your app. like: <ToastManager.ToastContainer />
  • Customize the Icon and styles per your app’s theme.
  • Avoid showing multiple toasts rapidly—this library is intended to display one toast at a time.

📁 Folder Structure Suggestion

You can keep the components like this if you're building your own:

components/
  └── Toast/
      ├── Toast.tsx          # Singleton logic
      ├── ToastService.tsx   # UI renderer

📜 License

MIT © 2025 [Amitkumar Solanki]