-
Notifications
You must be signed in to change notification settings - Fork 1
/
Modal.js
33 lines (31 loc) · 913 Bytes
/
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
import React, { Component } from "react";
import { Platform, StyleSheet, Text, View, Modal, TouchableOpacity, Button } from "react-native";
export default ModalScreen = props => {
let { visible, onClose, children } = props;
return (
<Modal animated={false} visible={visible} transparent={true}>
<TouchableOpacity style={styles.modalContainer} activeOpacity={1} onPress={onClose}>
<TouchableOpacity style={styles.modelContent} activeOpacity={1}>
{children}
</TouchableOpacity>
</TouchableOpacity>
</Modal>
);
};
const styles = StyleSheet.create({
modalContainer: {
backgroundColor: "rgba(0,0,0,0.5)",
flex: 1,
justifyContent: "center"
},
modelContent: {
marginHorizontal: 20,
minHeight: 180,
backgroundColor: "white",
marginVertical: 0,
}
});
/**
while using this componetn pass visible, onClose from parent
Also write the code inside model as in view
*/