react-native-custom-toast-view
v1.0.4
Published
Animated toast notification component for react native
Downloads
4
Maintainers
Readme
Getting Started
Installation
npm i react-native-custom-toast-view --save
Usage
- Import package
import {ToastProvider} from 'react-native-custom-toast-view';
- Import the Provide and wrap the application component (in App.js)
const Root = () => (
<ToastProvider>
<App />
</ToastProvider>
);
- Now, you can use the package like this (on any action)
import {useToastProvider} from 'react-native-custom-toast-view'; // import package
const {showToast} = useToastProvider(); // use provider
showToast('Toast notification message', 'success') // use method direction
- The showToast() function accepts two arguments: the first is the message, and the second is the type (“success” or “error”).