Socket
Socket
Sign inDemoInstall

react-native-snackbar-component

Package Overview
Dependencies
1
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-snackbar-component

A snackbar component for Android and iOS


Version published
Weekly downloads
1.4K
increased by10.82%
Maintainers
1
Install size
445 kB
Created
Weekly downloads
 

Readme

Source

react-native-snackbar-component

A snackbar component for Android and iOS, customizable and simple.

Snackbar demo With fab

See Google Material Design for more info on Snackbars.

Installation

npm install --save react-native-snackbar-component

Basic Usage

import SnackBar from 'react-native-snackbar-component'

Code

<SnackBar visible={true} textMessage="Hello There!" actionHandler={()=>{console.log("snackbar button clicked!")}} actionText="let's go"/>

Options

PropTypeEffectDefault Value
visiblebooleanShow or hide the snackbarnone
textMessagestring / functionThe main message text, can also supply a function returning JSX to render custom message UInone
actionHandlerfunctionFunction to be called when button is pressed, if absent no action button is shownnone
actionTextmessageThe text of action button, will be uppercased automaticallynone
backgroundColorcolorThe background color of snackbar#484848
accentColorcolorThe color of action button textorange
messageColorcolorThe color of main message text#FFFFFF
distanceCallbackfunctionFunction to be caled whenever snackbar moves in and out or changes layout, the function will be supplied a number indicating distance taken up by snackbar on bottom or top, based on position.(distance) => {}
positionstringThe position of the snackbar: top, bottombottom
top / bottom / left / rightnumberUse these to position the snackbar0
autoHidingTimenumberHow many milliseconds the snackbar will be hidden0 (Do not hide automatically)
containerStyleobjectOverride or add style to the root container View{}
messageStyleobjectOverride or add style to the message Text{}
actionStyleobjectOverride or add style to the action button Text{}

Note

  • When visible prop is changed, the snackbar will be animated in/out of screen
  • The snackbar will not auto-dismiss by itself, for auto-dismiss use setTimeout() and change value passed to prop to false,
    OR you can set autoHidingTime to any particular value to hide the snackbar itself, although you will need to reset visible to false manually after the autoHidingTime period is over, since visible is controlled from outside.
  • This works great together with react-native-fab. See demo for example and instructions how to.

Keywords

FAQs

Last updated on 16 Aug 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc