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

rn-lean-toast

v1.0.3

Published

A blazing fast, zero-config, edge-to-edge toast library for React Native.

Readme

rn-lean-toast 🍞

A blazing fast, zero-config, edge-to-edge toast library for React Native.

npm version TypeScript license

✨ Features

  • Zero-Config: No massive Context Providers wrapping your app. Trigger toasts imperatively.
  • Edge-to-Edge Safe: Automatically respects notches, Dynamic Islands, and home indicators without overlapping system UI.
  • Smart Position Selection: Choose whether your toast appears at the top (default) or the bottom of the screen.
  • Smart Queue System: Prevents overlapping. If multiple toasts fire at once, they queue up sequentially.
  • Accessible: Native screen-reader support out of the box (accessibilityRole="alert").
  • Trigger Anywhere: Call toasts from outside React entirely—perfect for Redux thunks, Axios interceptors, or background tasks.
  • Blazing Fast: Uses pure Animated with useNativeDriver: true for buttery smooth 60fps animations.

📦 Installation

This library relies on react-native-safe-area-context to calculate native edge-to-edge layouts. You must install both:

Using npm:

npm install rn-lean-toast react-native-safe-area-context

Using yarn:

yarn add rn-lean-toast react-native-safe-area-context

🚀 Setup

⚠️ IMPORTANT: Your app must be wrapped in a <SafeAreaProvider> from react-native-safe-area-context for the edge-to-edge positioning to work.

Place the <ToastHost/> component once at the very root of your application (usually in App.tsx or your root layout file).

import React from 'react';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { ToastHost } from 'rn-lean-toast';
import { AppNavigator } from './navigation/AppNavigator';

export default function App() {
  return (
    <SafeAreaProvider>
      {/* Your App Navigation / Components */}
      <AppNavigator />

      {/* Mount the toast host once at the root */}
      <ToastHost />
    </SafeAreaProvider>
  );
}

🛠 Usage

Import Toast and call it from anywhere in your codebase. No hooks required!

Basic Usage

import { Toast } from 'rn-lean-toast';

// Success Toast (Defaults to Top)
Toast.success('Profile saved successfully!');

// Error Toast
Toast.error('Network request failed. Please try again.');

Bottom Position & Custom Styling

You can easily change the position to bottom and override default styles by passing an options object as the second parameter.

// Bottom Toast
Toast.info('Downloading update...', {
  position: 'bottom',
  duration: 4000,
});

// Custom Styled Bottom Toast
Toast.success('Custom Theme Applied!', {
  position: 'bottom',
  duration: 5000,
  backgroundColor: '#8b5cf6', // Custom Purple Background
  textColor: '#fef08a', // Custom Yellow Text
});

Calling Outside of React Components

Because rn-lean-toast uses a Singleton event controller, you can safely trigger toasts inside standard JavaScript files.

// api/axiosInstance.ts
import axios from 'axios';
import { Toast } from 'rn-lean-toast';

const api = axios.create({ baseURL: 'https://api.example.com' });

api.interceptors.response.use(
  (response) => response,
  (error) => {
    // Fire a toast directly from your API interceptor!
    Toast.error('An unexpected error occurred.', { position: 'bottom' });
    return Promise.reject(error);
  }
);

export default api;

📖 API Reference

Methods

  • Toast.success(message: string, options?: ToastOptions)
  • Toast.error(message: string, options?: ToastOptions)
  • Toast.info(message: string, options?: ToastOptions)
  • Toast.hide() - Programmatically dismisses the currently visible toast.

ToastOptions

| Property | Type | Default | Description | | :---------------- | :------------------ | :----------- | :--------------------------------------------------------------------------- | | message | string | Required | The text displayed inside the toast. | | position | 'top' \| 'bottom' | 'top' | Controls whether the toast appears at the top or bottom of the screen. | | duration | number | 3000 | How long (in milliseconds) the toast stays on screen before auto-dismissing. | | backgroundColor | string | undefined | Overrides default colors (#4ade80 for success, #f87171 for error). | | textColor | string | #ffffff | Overrides the default text color. |


🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page on GitHub.

📄 License

This project is MIT licensed.