0.0.5 • Published 8 months ago

react-native-toastbox v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

React-Native-Toastbox

A toast notification system for React Native applications. This system supports different types of toasts (info, error, and success) and has built-in animations to enhance user experience.

demo

Table of Contents

Installation

//To do

Usage

Wrap your App with ToastProvider

To get started, you must wrap the part of your application where you want to display toasts with the ToastProvider.

import { ToastProvider } from 'react-native-toastbox';

function Section() {
  return (
    <ToastProvider>
      {/* children */}
    </ToastProvider>
  );
}

Use the useToast hook

Wherever you want to display a toast, use the useToast hook.

import { useToast } from './path-to-your-toast-files';

function MyComponent() {
  const { showToast, hideToast } = useToast();

  const handleClick = () => {
    showToast({
      id: 'unique-id',
      text1: 'This is a toast!',
    });
  };

  return <Button onClick={handleClick}>Show Toast</Button>;
}

API

Toast Customization

Modifiable attributes of a toast.

type Toast = {
  id: string;
  type?: 'info' | 'error' | 'success';
  text1: string;
  text2?: string;
  autoHide?: boolean;
  visibilityTime?: number;
  animationConfig?: {
    duration?: number;
    tension?: number;
    friction?: number;
  };
};

Contributing

We welcome contributions! If you find a bug or want to add a feature, please open an issue or submit a pull request.

License

MIT

0.0.5

8 months ago

0.0.4

8 months ago

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago