React Native stubs for react-toastify
npm install @jamsch/react-native-toastifyReact Native stubs for the library react-toastify. Please note that not all exports are handled.
- react-native-paper
- react-native-vector-icons (specifically MaterialIcons included in your app's bundle)
``sh`
npm install @jamsch/react-native-toastify
`js
import React from 'react';
import { Text, TouchableOpacity, View } from 'react-native';
import { PaperProvider } from 'react-native-paper';
import { toast, ToastContainer } from '@jamsch/react-native-toastify';
export default function App() {
return (
{/* Required for theming & Snackbar element /}
{/* This element will render the toast /}
{/* Somewhere else in your app /}
);
}
`
If you're already using react-toastify in a shared monorepo, you may want to install babel-plugin-module-resolver and alias react-toastify to this library on your React Native project.
`js`
// babel.config.js
module.exports = {
plugins: [
[
'module-resolver',
{
alias: {
'react-toastify': '@jamsch/react-native-toastify',
},
},
],
],
};
Alternatively, you can configure resolver.extraNodeModules in metro.config.js
`jsnode_modules/@jamsch/react-native-toastify
// metro.config.js
module.exports = {
// ....
resolver: {
extraNodeModules: new Proxy(
{},
{
get: (target, name) => {
if (name === 'react-toastify') {
return path.join(
process.cwd(),
node_modules/${name}
);
}
return path.join(process.cwd(), );``
},
}
),
},
};
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT