Skip to content

Material-design "Snackbar" component for both Android and iOS.

License

Notifications You must be signed in to change notification settings

hazelw/react-native-snackbar

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-snackbar

npm downloads npm version Latest GitHub tag

Material-design "Snackbar" component for both Android and iOS.

See Google Design for more info on Snackbars.

Installation

To use this extension, you have to do the following steps:

  1. In your react-native project, run

    • using npm:

      npm install react-native-snackbar
    • using yarn:

      yarn add react-native-snackbar
  2. Link the library using react-native link react-native-snackbar (learn more about linking.

  3. Import it in your JS where you want to show a snackbar:

    import Snackbar from 'react-native-snackbar';

Usage

To show a simple snackbar:

Snackbar.show({
    title: 'Hello world',

    // Optional duration. Can be one of LENGTH_LONG | LENGTH_SHORT | LENGTH_INDEFINITE.
    duration: Snackbar.LENGTH_LONG,
});

Or, to include an action button:

Snackbar.show({
    title: 'Hello world',
    action: {
        title: 'UNDO',
        color: 'green',
        onPress: () => { /* Do something. */ },
    },
});

TODO: Add screenshots 😎

About

Material-design "Snackbar" component for both Android and iOS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 57.8%
  • Java 23.0%
  • JavaScript 11.7%
  • Python 7.5%