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

rn-snackbar-component

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rn-snackbar-component

A snackbar component for Android and iOS

  • 0.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

React Native SnackBar (rn-snackbar-component)

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

See Google Material Design for more info on Snackbars.

Installation

npm install --save rn-snackbar-component

Basic Usage

import SnackBar from 'rn-snackbar-component'

Code

Simple

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

Advanced

<SnackBar
  visible={true}
  message={(
      <View style={{ flex: 1, flexDirection: 'column'}}>
        <Text>{title}</Text>
        <TouchableOpacity activeOpacity={0.5} onPress={doSomething}>
          <Text>{subtitle}</Text>
        </TouchableOpacity>
      </View>
  )}
  actionHandler={() => {
    console.log("snackbar button clicked!")
  }}
  action={(
    <Icon name="close" size={20} />
  )}
  autoHidingTime={0}
/>

Options

PropTypeEffectDefault Value
visiblebooleanShow or hide the snackbarnone
messagestring / elementThe main message text / your custom componentnone
actionHandlerfunctionFunction to be called when button is pressed, if absent no action button is shownnone
actionstring / elementThe text of action button, will be uppercased automatically / your custom componentnone
containerStyleViewStyleThe styling of snackbar containernone
actionTextStyleTextStyleaction button text style{ color: 'orange'}
actionContainerStyleViewStyleyour custom component for action's stylenone
messageStyleTextStyleThe style of message text{ color: '#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.(distance) => {}
bottomnumberThe starting bottom position of snackbar0
topnumberThe starting top position of snackbar0
positionstringThe position of the snackbar: top, bottombottom
autoHidingTimenumberHow many milliseconds the snackbar will be hidden0 (Do not hide automatically)
nativebooleanUsing native drivertrue

Note

  • When visible prop is changed, the snackbar will be animated in/out of screen
  • When position is top/bottom, you can specify those properties, e.g. position="top" top={10} (or) position="bottom" bottom={10}

Keywords

FAQs

Package last updated on 01 Nov 2023

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