Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-paper-snackbar-stack

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-paper-snackbar-stack

test

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
55
increased by34.15%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-paper-snackbar-stack

This library is a React native library which allows you to use react-native-paper snackbar component with great functionality.

Installation

npm:

npm install react-native-paper-snackbar-stack

yarn:

yarn add react-native-paper-snackbar-stack

Usage

Wrap your root component in SnackbarProvider from react-native-paper-snackbar-stack. While it uses react-native-paper, it also requires Provider from react-native-paper to wrap itself.

import { SnackbarProvider } from 'react-native-paper-snackbar-stack';
import * as React from 'react';
import { Provider } from 'react-native-paper';

export default function App() {
  return (
    <Provider>
      <SnackbarProvider maxSnack={2}>{/** Body component*/}</SnackbarProvider>
    </Provider>
  );
}

Now, useSnackbar can be used in the body of the SnackbarProvider.

import { useSnackbar } from 'react-native-paper-snackbar-stack';
import { Button } from 'react-native-paper';

export default function SnackbarTest() {
  const { enqueueSnackbar, closeSnackbar } = useSnackbar();
  const [snackbarId, setSnackbarId] = useState('');

  const handleOpenSnackbar = () => {
    const id = enqueueSnackbar({
      message: 'This is an example snackbar',
      variant: 'info',
    });

    setSnackbarId(id);
  };

  const handleCloseSnackbar = () => {
    closeSnackbar(snackbarId);
  };

  return (
    <View>
      <Button onPress={handleOpenSnackbar}>Show</Button>
      <Button onPress={handleCloseSnackbar}>Close</Button>
    </View>
  );
}

Example App

To use example app in expo go, scan the qr code in the mobile device.

react-native-paper

Contributing

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

License

MIT


Made with create-react-native-library

Keywords

FAQs

Package last updated on 06 Nov 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc