Skip to content

Instantly share code, notes, and snippets.

@ThakurBallary
Created July 8, 2018 14:36
Show Gist options
  • Save ThakurBallary/3cfc42f1fce8b118f1793f2687539b0d to your computer and use it in GitHub Desktop.
Save ThakurBallary/3cfc42f1fce8b118f1793f2687539b0d to your computer and use it in GitHub Desktop.
react-native-btr-demo
import React, { Component } from 'react';
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
import { BottomSheet } from 'react-native-btr';
class BottomSheetDemo extends Component {
static navigationOptions = {
title: 'BottomSheet'
}
constructor(props) {
super(props);
this.state = {
visible: false
}
}
toggle = () => this.setState({ visible: !this.state.visible });
render() {
return (
<View style={styles.container}>
<TouchableOpacity onPress={this.toggle}>
<View style={styles.button}>
<Text>Toggle BottomSheet</Text>
</View>
</TouchableOpacity>
<BottomSheet
visible={this.state.visible}
onBackButtonPress={this.toggle}
onBackdropPress={this.toggle}>
<View style={styles.card}>
<Text>Place your custom view inside BottomSheet</Text>
</View>
</BottomSheet>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
button: {
backgroundColor: '#fff',
borderWidth: 2,
borderRadius: 50,
padding: 16
},
card: {
backgroundColor: '#fff',
height: 250,
justifyContent: 'center',
alignItems: 'center'
}
});
export default BottomSheetDemo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment