-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathSnackBar.js
73 lines (65 loc) · 1.58 KB
/
SnackBar.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import React, { Component } from 'react';
import {
AppRegistry,
Text,
Button,
View,
ScrollView,
StyleSheet,
TouchableOpacity
} from 'react-native';
import { StackNavigator } from 'react-navigation';
import SnackBarCustom from 'react-native-custom-snackbar';
class SnackBar extends React.Component {
constructor()
{
super();
}
showSnackBar = () =>
{
this.refs.mySnackBar.show("Custom SnackBar Text...");
}
static navigationOptions = {
title: 'this is scrollview example',
};
render() {
var{params}=this.props.navigation.state;
return (
<View style = { styles.container }>
<TouchableOpacity activeOpacity = { 0.8 } onPress = { this.showSnackBar } style = { styles.button }>
<Text style = { styles.btnText }>Show Snack Bar</Text>
</TouchableOpacity>
<SnackBarCustom
ref = "mySnackBar"
closeText = "close"/>
</View>
);
}
}
SnackBar.navigationOptions = {
title: 'Snackbar Screen',
};
const styles = StyleSheet.create({
container:
{
flex: 1,
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: 15,
// paddingTop: (Platform.OS) === 'ios' ? 20 : 0
},
button:
{
backgroundColor: 'rgba(0,0,0,0.6)',
padding: 10,
alignSelf: 'stretch'
},
btnText:
{
alignSelf: 'stretch',
color: 'white',
fontSize: 18,
textAlign: 'center'
}
})
export default SnackBar;