-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathModal.js
69 lines (64 loc) · 1.62 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
import React, {Component} from 'react';
import {
SafeAreaView,
StyleSheet,
Text,
TouchableOpacity,
View,
Modal as NativeModal,
} from 'react-native';
import CustomIcon from 'assets/icons/CustomIcon.js';
import colors from 'assets/colors';
import PropTypes from 'prop-types';
class Modal extends Component {
render() {
const {visible, title, actionButton} = this.props;
return (
<NativeModal
presentationStyle="pageSheet"
visible={visible}
animationType="slide">
<SafeAreaView style={styles.status_bar} />
<View style={styles.header}>
<View style={styles.title_wrapper}>
<TouchableOpacity onPress={this.props.handleModalClose}>
<CustomIcon name={'close24'} color={colors.gray_icon} size={24} />
</TouchableOpacity>
<Text style={styles.title}>{title}</Text>
</View>
{actionButton && this.props.actionButton}
</View>
{this.props.children}
</NativeModal>
);
}
}
Modal.propTypes = {
visible: PropTypes.bool.isRequired,
};
const styles = StyleSheet.create({
status_bar: {
backgroundColor: 'white',
},
header: {
flexDirection: 'row',
backgroundColor: 'white',
paddingVertical: 15,
paddingHorizontal: 10,
borderBottomWidth: 1,
borderBottomColor: colors.card_border,
alignItems: 'center',
justifyContent: 'space-between',
},
title_wrapper: {
flexDirection: 'row',
alignItems: 'center',
},
title: {
paddingLeft: 20,
fontSize: 24,
color: colors.section_title,
fontWeight: '500',
},
});
export default Modal;