Implementation of the material design snacker component. See Google Design
To use this extension, you have to do the following steps:
-
In your react-native project, run
npm install react-native-snackbar
-
Link your library using
rpm link
(learn more about rnpm) or following react-native doc guide. -
Import it in you JS, where you want to show a snacker
import Snackbar from 'react-native-snackbar'
To show a simple snackbar simply call:
Snackbar.show({
title: 'Hello world',
duration: Snackbar.LENGTH_INDEFINITE, // optional
// Can be .LENGTH_INDEFINITE | .LENGTH_LONG | LENGTH_SHORT
})
..Preview..
To add an action:
Snackbar.show({
title: 'Hello world',
action: {
title: 'UNDO',
color: 'green',
onPress: () => {
// do something here
},
},
})
..Preview..