|
@@ -0,0 +1,65 @@
|
|
1
|
+const React = require('react');
|
|
2
|
+const { View, Text, StyleSheet, TouchableOpacity } = require('react-native');
|
|
3
|
+const Colors = require('../commons/Colors');
|
|
4
|
+const Navigation = require('../services/Navigation');
|
|
5
|
+
|
|
6
|
+const Toast = function ({componentId}) {
|
|
7
|
+ return (
|
|
8
|
+ <View style={styles.root}>
|
|
9
|
+ <View style={styles.toast}>
|
|
10
|
+ <Text style={styles.text}>This a very important message!</Text>
|
|
11
|
+ <TouchableOpacity style={styles.button} onPress={() => Navigation.dismissOverlay(componentId)}>
|
|
12
|
+ <Text style={styles.buttonText}>OK</Text>
|
|
13
|
+ </TouchableOpacity>
|
|
14
|
+ </View>
|
|
15
|
+ </View>
|
|
16
|
+ )
|
|
17
|
+}
|
|
18
|
+
|
|
19
|
+const styles = StyleSheet.create({
|
|
20
|
+ root: {
|
|
21
|
+ flex: 1,
|
|
22
|
+ flexDirection: 'column-reverse',
|
|
23
|
+ backgroundColor: 0x3e434aa1
|
|
24
|
+ // backgroundColor: 'red'
|
|
25
|
+ },
|
|
26
|
+ toast: {
|
|
27
|
+ elevation: 2,
|
|
28
|
+ flexDirection: 'row',
|
|
29
|
+ height: 40,
|
|
30
|
+ margin: 16,
|
|
31
|
+ borderRadius: 20,
|
|
32
|
+ backgroundColor: Colors.accent,
|
|
33
|
+ alignItems: 'center',
|
|
34
|
+ justifyContent: 'space-between'
|
|
35
|
+ },
|
|
36
|
+ text: {
|
|
37
|
+ color: 'white',
|
|
38
|
+ fontSize: 16,
|
|
39
|
+ marginLeft: 16
|
|
40
|
+ },
|
|
41
|
+ button: {
|
|
42
|
+ marginRight: 16
|
|
43
|
+ },
|
|
44
|
+ buttonText: {
|
|
45
|
+ color: 'white',
|
|
46
|
+ fontSize: 16,
|
|
47
|
+ fontWeight: 'bold'
|
|
48
|
+ }
|
|
49
|
+});
|
|
50
|
+
|
|
51
|
+Toast.options = {
|
|
52
|
+ statusBar: {
|
|
53
|
+ drawBehind: true,
|
|
54
|
+ backgroundColor: 0x3e434aa1,
|
|
55
|
+ style: 'light'
|
|
56
|
+ },
|
|
57
|
+ layout: {
|
|
58
|
+ componentBackgroundColor: 'transparent'
|
|
59
|
+ },
|
|
60
|
+ overlay: {
|
|
61
|
+ interceptTouchOutside: false
|
|
62
|
+ }
|
|
63
|
+}
|
|
64
|
+
|
|
65
|
+module.exports = Toast;
|