Skip to content

Instantly share code, notes, and snippets.

@ThakurBallary
Created July 8, 2018 18:02
Show Gist options
  • Save ThakurBallary/8f1a71f05162715533e42b52dd1a3b4c to your computer and use it in GitHub Desktop.
Save ThakurBallary/8f1a71f05162715533e42b52dd1a3b4c to your computer and use it in GitHub Desktop.
react-native-btr-demo
import React, { Component } from 'react';
import { View, StyleSheet } from 'react-native';
import { SnackBar } from 'react-native-btr';
class SnackBarDemo extends Component {
static navigationOptions = {
title: 'SnackBar'
}
state = {
visible: false
}
onPress = () => this.setState({visible: !this.state.visible});
render() {
return (
<View style={styles.container}>
<SnackBar text='Will close only onPress of action' duration={0} actionText='NEXT' onPress={this.onPress} />
{ this.state.visible && <SnackBar text='Will close in 5 seconds' onPress={()=>alert('5 seconds SnackBar')} /> }
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
justifyContent: 'center',
},
});
export default SnackBarDemo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment