1.1.2 • Published 6 years ago

@kevinwang0316/react-native-snackbar-component v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

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
textMessagestringThe main message textnone
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.(distance) => {}
bottomnumberThe starting bottom position of snackbar0
positionstringThe position of the snackbar: top, bottombottom

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.
  • This works great together with react-native-fab. See demo for example and instructions how to.