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

react-native-toast-next

v0.2.0

Published

Toast Component for React Native

Readme

// ...existing code...

react-native-toast-next

Toast component for React Native.

Installation

yarn add react-native-toast-next
# or
npm install react-native-toast-next

Usage

Below are examples showing how to mount the Toast component, use the declarative API (props) and the programmatic API (static methods).

  1. Mount a Toast instance in your app root (required for static methods to work):
// Language: tsx
import React from 'react';
import { View } from 'react-native';
import Toast from 'react-native-toast-next';

export default function App() {
  return (
    <View style={{ flex: 1 }}>
      {/* your app UI */}
      <Toast />
    </View>
  );
}
  1. Show / hide toasts programmatically:
// Language: tsx
import Toast from 'react-native-toast-next';

// show a simple toast
Toast.show({ text: 'Hello world' });

// convenience methods
Toast.success('Saved successfully');
Toast.error('An error occurred');

// hide current toast
Toast.hide();
  1. Customize behavior via props (type, position, visibilityTime, autoHide, etc.):
// Language: tsx
import React from 'react';
import { View, Button } from 'react-native';
import Toast from 'react-native-toast-next';

export default function Example() {
  return (
    <View>
      <Button
        title="Show custom toast"
        onPress={() =>
          Toast.show({
            text: 'Short message, bottom position',
            position: 'bottom',
            visibilityTime: 2000,
            autoHide: true,
          })
        }
      />
      {/* You can also set defaults via props on the mounted Toast */}
      <Toast position="center" />
    </View>
  );
}
  1. Add or override toast types via the config prop

Pass a config object to the mounted Toast to provide custom toast renderers. Each type is a function receiving runtime props (text, show, hide, props, etc.) and should return a React element.

// Language: tsx
import React from 'react';
import { View, Text } from 'react-native';
import Toast from 'react-native-toast-next';

const customConfig = {
  myType: ({ text, show, hide, props }) => (
    <View style={{ padding: 12, backgroundColor: 'purple', borderRadius: 8 }}>
      <Text style={{ color: 'white' }}>{text}</Text>
    </View>
  ),
};

export default function App() {
  return (
    <View style={{ flex: 1 }}>
      <Toast config={customConfig} />
    </View>
  );
}

// usage:
Toast.show({ type: 'myType', text: 'Custom toast' });

Types & Source

See the library source and type definitions for available props and hooks:

  • Main entry: src/index.ts
  • Toast wrapper: src/Toast.tsx
  • Toast implementation: src/ToastComponent.tsx
  • Types: src/types/index.tsx (e.g. ToastProps, ToastConfig)
  • Built-in toast components:
    • src/components/success-toast/index.tsx
    • src/components/error-toast/index.tsx
    • src/components/base-toast/index.tsx

Development

  • Type check: yarn typecheck
  • Run tests: yarn test

License

MIT


Made with create-react-native-library