-
Notifications
You must be signed in to change notification settings - Fork 0
/
Modal.js
102 lines (98 loc) · 2.89 KB
/
Modal.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import React, { Component } from 'react';
import { StyleSheet, Text, View, TouchableOpacity, Image, Modal, Alert } from 'react-native';
export default class CustomModal extends Component {
constructor(props) {
super(props);
}
render() {
return (
<Modal
animationType="fade"
transparent={true}
visible={this.props.visible}
onRequestClose={() => {
Alert.alert("Modal has been closed.");
}}
style={styles.backgroundModal}
>
<View style={styles.centeredView}>
<View style={styles.modalView}>
<TouchableOpacity
style={styles.close}
onPress={() => {
this.props.close();
}}
>
<Image
source={require('./assets/modal_close.png')}
/>
</TouchableOpacity>
<Text style={styles.modalTitle}>{this.props.title}</Text>
<Text style={styles.modalText}>{this.props.text}</Text>
<TouchableOpacity
style={styles.modalClose}
onPress={() => {
this.props.close();
}}
>
<Text style={styles.modalCloseText}>{this.props.closeText}</Text>
</TouchableOpacity>
</View>
</View>
</Modal>
)
}
}
const styles = StyleSheet.create({
centeredView: {
backgroundColor: 'rgba(51, 65, 75, 0.3)',
flex: 1,
justifyContent: "center",
alignItems: "center",
marginTop: 22,
padding: 30
},
modalView: {
backgroundColor: '#FFFFFF',
borderRadius: 15,
padding: 30,
shadowColor: "#000",
shadowOffset: {
width: 0,
height: 2
},
shadowOpacity: 0.25,
shadowRadius: 3.84,
elevation: 5,
width: '100%'
},
modalTitle: {
color: '#222222',
fontSize: 22,
marginBottom: 15,
fontWeight: '300'
},
modalText: {
color: '#666666',
fontSize: 14,
marginBottom: 15,
fontWeight: '300'
},
modalClose: {
backgroundColor: '#F1F1F1',
borderColor: '#FF4343',
borderWidth: 1,
padding: 15,
width: '100%',
borderRadius: 10
},
modalCloseText: {
color: '#FF4343',
fontSize: 16,
textAlign: 'center',
fontWeight: 'bold'
},
close: {
alignItems: 'flex-end'
}
})