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

react-native-toast-pro

v1.0.8

Published

A beautiful and customizable toast notification component for React Native

Readme

React Native Toast Alert

A beautiful and customizable toast notification component for React Native with smooth animations powered by react-native-reanimated and TypeScript support.

Features

  • 🎨 Beautiful animations with react-native-reanimated (spring and timing effects)
  • 📱 Safe area aware positioning
  • 🎯 Multiple alert types (success, error, warning)
  • ⚡ Lightweight and performant
  • 🔧 Fully customizable colors and styling
  • 📦 TypeScript support with full IntelliSense
  • 🎭 Context-based API for easy usage
  • 🎬 Smooth GIF animations for visual feedback
  • 🔍 Auto-suggestions: Full IDE support with auto-completion and type hints
  • 📦 Smart Dependencies: Uses peer dependencies to avoid version conflicts

Demo

Installation

npm install react-native-toast-pro

Peer Dependencies

This library uses peer dependencies to avoid version conflicts and ensure compatibility with your existing project setup. Make sure you have these peer dependencies installed:

npm install react-native-safe-area-context react-native-reanimated

Important Notes:

  • No Version Conflicts: The library now properly shares your existing dependencies instead of installing its own
  • Better Compatibility: Works with any compatible version of the peer dependencies
  • Smaller Bundle: No duplicate dependencies in your project
  • ⚠️ react-native-reanimated: You may need to follow additional setup instructions based on your React Native version. Please refer to the react-native-reanimated documentation for detailed setup instructions.

Usage

1. Wrap your app with AlertProvider

import React from 'react';
import { AlertProvider } from 'react-native-toast-pro';
import { SafeAreaProvider } from 'react-native-safe-area-context';

export default function App() {
  return (
    <SafeAreaProvider>
      <AlertProvider>
        {/* Your app components */}
      </AlertProvider>
    </SafeAreaProvider>
  );
}

2. Use the hook in your components

import React from 'react';
import { View, Button } from 'react-native';
import { useAlert } from 'react-native-toast-pro';

export default function MyComponent() {
  const { showSuccess, showError, showWarning } = useAlert();

  const handleSuccess = () => {
    showSuccess('Operation completed successfully!');
  };

  const handleError = () => {
    showError('Something went wrong!');
  };

  const handleWarning = () => {
    showWarning('Please check your input!');
  };

  return (
    <View>
      <Button title="Show Success" onPress={handleSuccess} />
      <Button title="Show Error" onPress={handleError} />
      <Button title="Show Warning" onPress={handleWarning} />
    </View>
  );
}

💡 Pro Tip: Your IDE will now provide auto-suggestions when importing from react-native-toast-pro! Just start typing import { } and you'll see all available exports.

3. Alternative: Use the static service

import { AlertService } from 'react-native-toast-pro';

// Show success toast
AlertService.showSuccess('Data saved successfully!');

// Show error toast
AlertService.showError('Failed to save data!');

// Show warning toast
AlertService.showWarning('Please review your data!');

Customization

Custom Colors

You can customize the colors by modifying the commonColors object:

import { commonColors } from 'react-native-toast-pro';

// The default colors are:
// success: '#00A13A'
// error: '#FF0000'
// warning: '#FFA500'
// white: '#ffffff'

Custom Styling

The component uses responsive scaling with the moderateScale function. You can adjust the scaling behavior by modifying the scaling configuration.

API Reference

AlertProvider Props

| Prop | Type | Description | |------|------|-------------| | children | ReactNode | Your app components |

useAlert Hook

Returns an object with the following methods:

| Method | Type | Description | |--------|------|-------------| | showSuccess | (message: string) => void | Shows a success toast | | showError | (message: string) => void | Shows an error toast | | showWarning | (message: string) => void | Shows a warning toast |

AlertService

Static service with the same methods as the hook:

| Method | Type | Description | |--------|------|-------------| | showSuccess | (message: string) => void | Shows a success toast | | showError | (message: string) => void | Shows an error toast | | showWarning | (message: string) => void | Shows a warning toast |

Configuration

Toast Duration

By default, toasts are displayed for 1.5 seconds. You can modify this in the AlertComponent.tsx file by changing the timeout value in the useEffect hook.

Animation Settings

The component uses react-native-reanimated with the following default settings:

  • Scale Animation: Spring animation with damping: 4, stiffness: 100
  • Slide Animation: Timing animation with duration: 500ms and Easing.out(Easing.exp)
  • Auto-dismiss: 1500ms (1.5 seconds)
  • Exit Animation: Timing animation with Easing.in(Easing.exp) for smooth removal

Requirements

  • React Native >= 0.60.0
  • React >= 16.8.0
  • react-native-safe-area-context >= 4.0.0
  • react-native-reanimated >= 3.0.0

Troubleshooting

Version Conflicts

If you encounter version conflicts with react-native-safe-area-context, this is now resolved! The library uses peer dependencies, so it will use your project's existing version instead of installing its own.

Auto-suggestions Not Working

Make sure you're using a TypeScript-enabled IDE (VS Code, WebStorm, etc.) and that your project has TypeScript support enabled. The library now provides full IntelliSense support with auto-completion and type hints.

License

MIT

Contributing

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

👨‍💻 Author

Arslan Khan

🙏 Acknowledgments

  • Expo team for the amazing development platform
  • React Native community for continuous improvements
  • All contributors who help make this project better

📞 Support

If you have any questions or need help, feel free to reach out:


⭐ If you found this project helpful, please give it a star on GitHub!