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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@chain1/toast-service

v1.0.1

Published

Toast notification service for React Native with queue management and history

Downloads

5

Readme

@chain1/toast-service

Toast notification service for React Native with queue management and persistent history.

Installation

npm install @chain1/toast-service
npm install @react-native-async-storage/async-storage i18next

Features

  • 🔔 Queue Management - Sequential toast display with automatic queuing
  • 📝 Persistent History - Save and retrieve toast history
  • 🌍 i18n Support - Internationalization ready
  • 🎨 Multiple Types - Success, error, warning, info, and custom types
  • 💰 Reward Toasts - Built-in support for referral, level, and weekly rewards

Usage

Basic Usage

import toastService from '@chain1/toast-service';

// Show simple messages
toastService.showSuccess('Operation completed!');
toastService.showError('Something went wrong');
toastService.showInfo('New update available');
toastService.showWarning('Please check your input');

// Custom toast
toastService.showToast('Title', 'Message content', 'info');

Reward Notifications

// Referral reward
toastService.showReferralReward(1000, 'user123');

// Level achievement reward
toastService.showLevelReward(5, 500);

// Weekly reward
toastService.showWeeklyReward(2000, 'Week 42');

Queue Management

// Multiple toasts will be queued and shown sequentially
toastService.showSuccess('First message');
toastService.showInfo('Second message');
toastService.showWarning('Third message');

// Clear pending queue
toastService.clearToastQueue();

// Check status
const status = toastService.getStatus();
console.log(status);
// {
//   isShowingToast: false,
//   queueLength: 0,
//   historyLength: 5,
//   lastToast: { ... }
// }

History Management

// Get toast history (default: last 20)
const history = toastService.getToastHistory(20);

// Get all history
const allHistory = toastService.getToastHistory(50);

// Clear history
await toastService.clearToastHistory();

// Load history from storage
await toastService.loadToastHistory();

API Reference

Methods

showToast(title, message, type)

Display a custom toast message.

Parameters:

  • title (string) - Toast title
  • message (string) - Toast message
  • type (ToastType) - Toast type (optional, default: 'info')

showSuccess(message)

Show a success toast.

showError(message)

Show an error toast.

showInfo(message)

Show an info toast.

showWarning(message)

Show a warning toast.

showReferralReward(amount, referrerId?)

Show a referral reward toast.

showLevelReward(level, amount)

Show a level achievement reward toast.

showWeeklyReward(amount, weekInfo?)

Show a weekly reward toast.

getToastHistory(limit?)

Get toast history.

Parameters:

  • limit (number) - Number of items to return (default: 20)

Returns: ToastData[]

clearToastHistory()

Clear all toast history.

loadToastHistory()

Load toast history from AsyncStorage.

getStatus()

Get current toast service status.

Returns: ToastStatus

clearToastQueue()

Clear pending toast queue.

Types

type ToastType =
  | 'info'
  | 'success'
  | 'error'
  | 'warning'
  | 'referral_reward'
  | 'level_reward'
  | 'weekly_reward';

interface ToastData {
  title: string;
  message: string;
  type: ToastType;
  timestamp: string;
  id: string;
}

interface ToastStatus {
  isShowingToast: boolean;
  queueLength: number;
  historyLength: number;
  lastToast: ToastData | null;
}

Peer Dependencies

  • react-native >= 0.60.0
  • @react-native-async-storage/async-storage >= 1.0.0
  • i18next >= 20.0.0

License

MIT

Author

webcgi