A theme friendly, easy to use react-native toast component built using styled-components and styled-system.
The react-native-styled-toast is a fully customizable toast library for React Native. It supports multiple toasts, is compatible with both iOS and Android, and is written using React Hooks and TypeScript.
To install the react-native-styled-toast library, use the following command:
$ yarn add react-native-styled-toast
Wrap your app in the ThemeProvider component from styled-components to ensure that the toasts rely on theming.
Use the ToastProvider and wrap the rest of your app.
Access the Toast context by using the provided useToast hook to trigger a toast anywhere in your app. If you can’t use hooks, you can still use the ToastContext.Consumer to fire off a toast.
Configure your theme object to contain at least a spacing scale with some default colors. The theme object should look something like this:
{
spacing: [0, 4, 8, 16, 32],
colors: {
background: '#FFF',
text: '#000',
success: '#00FF00',
info: '#0000FF',
error: '#FF0000',
muted: '#888'
}
}
The react-native-styled-toast library provides a fully customizable toast solution for React Native apps. It supports multiple toasts, is compatible with both iOS and Android, and is written using React Hooks and TypeScript. The library relies on theming and styled-components to style the toasts, and can be easily integrated into any React Native app.