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

@onesamket/rn-toast

v0.1.1

Published

A beautiful toast notification library for React Native

Readme

@onesamket/rn-toast

A beautiful toast notification library for React Native and Expo applications.

Features

  • 🎨 Beautiful, customizable toast notifications
  • 🔄 Promise-based API for async operations
  • 🌓 Dark mode support
  • 🎯 Multiple toast variants (success, error, warning, info, loading)
  • 👆 Swipe to dismiss
  • ♿ Accessibility support
  • 📱 Safe area aware
  • 🔄 Animated transitions

Installation

npm install @onesamket/rn-toast
# or
yarn add @onesamket/rn-toast

Peer Dependencies

This library requires the following peer dependencies:

npm install expo-blur expo-haptics @expo/vector-icons react-native-safe-area-context
# or
yarn add expo-blur expo-haptics @expo/vector-icons react-native-safe-area-context

Usage

Setup Provider

Wrap your application with the ToastProvider:

import { ToastProvider } from '@onesamket/rn-toast';

export default function App() {
  return (
    <ToastProvider>
      <YourApp />
    </ToastProvider>
  );
}

Basic Usage

import { useToast } from '@onesamket/rn-toast';

function MyComponent() {
  const toast = useToast();
  
  const showToast = () => {
    toast.toast({
      description: 'This is a toast notification',
      duration: 3000, // milliseconds
    });
  };
  
  return (
    <Button title="Show Toast" onPress={showToast} />
  );
}

Toast Variants

// Success toast
toast.success({
  description: 'Successfully saved!',
});

// Error toast
toast.error({
  description: 'An error occurred',
});

// Warning toast
toast.warning({
  description: 'Warning: Low battery',
});

// Info toast
toast.info({
  description: 'New message received',
});

// Loading toast
const toastId = toast.loading({
  description: 'Loading data...',
  duration: 0, // Won't auto-dismiss
});

// Later, dismiss the toast manually
toast.dismissToast(toastId);

Promise Toast

const fetchData = async () => {
  return toast.promise(
    fetch('https://api.example.com/data'),
    {
      description: 'Fetching data',
      promise: {
        loading: 'Loading data...',
        success: 'Data loaded successfully!',
        error: 'Failed to load data',
      },
    }
  );
};

Toast with Action

toast.info({
  description: 'Your file is ready',
  action: {
    label: 'Download',
    onPress: () => {
      // Handle action
      downloadFile();
    },
  },
});

API Reference

ToastProvider

The ToastProvider component is required to use the toast functionality.

useToast

The useToast hook returns an object with the following methods:

  • toast(options): Show a default toast
  • success(options): Show a success toast
  • error(options): Show an error toast
  • warning(options): Show a warning toast
  • info(options): Show an info toast
  • loading(options): Show a loading toast
  • custom(options): Show a custom toast
  • promise(promise, options): Show a toast for a promise
  • dismissToast(id): Dismiss a toast by ID

Toast Options

| Property | Type | Description | |----------|------|-------------| | description | string | The content of the toast | | variant | 'default' \| 'destructive' \| 'success' \| 'warning' \| 'info' \| 'loading' \| 'custom' \| 'error' | The visual style of the toast | | duration | number | Duration in milliseconds before auto-dismissing (default: 3000, 0 for no auto-dismiss) | | action | { label: string, onPress: () => void } | Optional action button | | promise | { loading: string, success: string, error: string } | Messages for promise states | | swipeToClose | boolean | Whether the toast can be dismissed by swiping (default: true) | | position | 'top' \| 'bottom' | Position of the toast (default: 'bottom') |

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Acknowledgements

This library was built with React Native and Expo, and was inspired by the need for a simple, customizable toast notification system for React Native applications.

Version History

0.1.0

  • Initial release
  • Basic toast functionality with various variants
  • Support for promise-based toasts
  • Customizable appearance and behavior