@vladimir-vovk/react-native-toast

1.0.3 • Public • Published

React Native Toast Library

Simple toast library for both iOS and Android.

Usage

  1. yarn add @vladimir-vovk/react-native-toast
  2. Add ToastProvider and Toast to your App.tsx:
...
import { ToastProvider, Toast } from '@vladimir-vovk/react-native-toast'

export default function App() {
  return (
    <ToastProvider config={{ timeout: 2000 }}>
      ...
      <Toast />
    </ToastProvider>
  )
}
  1. Show toast in your code with useToast hook:
...
import { useToast } from '@vladimir-vovk/react-native-toast'


const Demo = () => {
  const { showToast } = useToast()

  const _onShowToast = () => {
    showToast('Hey, I am toast!')
  }

  return (
    <View style={styles.container}>
      <Button title="Show toast" onPress={_onShowToast} />
    </View>
  )
}

...

See Demo App for more details.

Expo

You could run demo with Expo Client or Expo Snack in your browser.

Readme

Keywords

Package Sidebar

Install

npm i @vladimir-vovk/react-native-toast

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

1.13 MB

Total Files

7

Last publish

Collaborators

  • vladimir-vovk