@vladimir-vovk/react-native-toast
v1.0.3
Published
React Native toast library for both iOS and Android
Downloads
6
Readme
React Native Toast Library
Simple toast library for both iOS and Android.
Usage
yarn add @vladimir-vovk/react-native-toast
- Add
ToastProvider
andToast
to yourApp.tsx
:
...
import { ToastProvider, Toast } from '@vladimir-vovk/react-native-toast'
export default function App() {
return (
<ToastProvider config={{ timeout: 2000 }}>
...
<Toast />
</ToastProvider>
)
}
- 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.