Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@jamsch/react-native-toastify

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jamsch/react-native-toastify

React Native stubs for react-toastify

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

@jamsch/react-native-toastify

React Native stubs for the library react-toastify. Please note that not all exports are handled.

Prerequisites

  • react-native-paper
  • react-native-vector-icons (specifically MaterialIcons included in your app's bundle)

Installation

npm install @jamsch/react-native-toastify

Usage

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 (
    <View>
      {/** Required for theming & Snackbar element */}
      <PaperProvider>
        {/** This element will render the toast */}
        <ToastContainer position="bottom-left" />

        {/** Somewhere else in your app */}
        <TouchableOpacity onPress={() => toast.success('Success!')}>
          <Text>Success toast</Text>
        </TouchableOpacity>
        <TouchableOpacity onPress={() => toast.info('Info!')}>
          <Text>Info toast</Text>
        </TouchableOpacity>
      </PaperProvider>
    </View>
  );
}

Usage in monorepos

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.

// 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

// metro.config.js
module.exports = {
  // ....
  resolver: {
    extraNodeModules: new Proxy(
      {},
      {
        get: (target, name) => {
          if (name === 'react-toastify') {
            return path.join(
              process.cwd(),
              `node_modules/@jamsch/react-native-toastify`
            );
          }
          return path.join(process.cwd(), `node_modules/${name}`);
        },
      }
    ),
  },
};

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Keywords

react-native

FAQs

Package last updated on 06 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts