forked from cemaden-educacao/WPD-MobileApp
GabrielTrettel
4 years ago
2 changed files with 72 additions and 49 deletions
@ -0,0 +1,66 @@ |
|||||
|
import React from "react"; |
||||
|
import { |
||||
|
Modal, |
||||
|
View, |
||||
|
StyleSheet, |
||||
|
TouchableWithoutFeedback, |
||||
|
} from "react-native"; |
||||
|
import { screen_height, screen_width } from "../config/dimensions"; |
||||
|
|
||||
|
export default function SelfClosingModal(props) { |
||||
|
return ( |
||||
|
<View style={styles.centeredView}> |
||||
|
<Modal |
||||
|
animationType={props.animationType} |
||||
|
transparent={props.transparent} |
||||
|
visible={props.visible} |
||||
|
> |
||||
|
<TouchableWithoutFeedback |
||||
|
onPress={() => props.setVisible(!props.visible)} |
||||
|
> |
||||
|
<View style={styles.modalOverlay} /> |
||||
|
</TouchableWithoutFeedback> |
||||
|
|
||||
|
<View style={styles.centeredView}> |
||||
|
<View style={styles.modalView}>{props.children}</View> |
||||
|
</View> |
||||
|
</Modal> |
||||
|
</View> |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
const styles = StyleSheet.create({ |
||||
|
centeredView: { |
||||
|
flex: 1, |
||||
|
justifyContent: "flex-end", |
||||
|
alignItems: "center", |
||||
|
marginTop: 22, |
||||
|
}, |
||||
|
modalView: { |
||||
|
margin: 20, |
||||
|
width: screen_width, |
||||
|
height: screen_height * 0.4, |
||||
|
backgroundColor: "white", |
||||
|
borderTopLeftRadius: 10, |
||||
|
borderTopRightRadius: 10, |
||||
|
padding: 35, |
||||
|
marginBottom: 0, |
||||
|
alignItems: "center", |
||||
|
shadowColor: "#000", |
||||
|
shadowOffset: { |
||||
|
width: 0, |
||||
|
height: 2, |
||||
|
}, |
||||
|
shadowOpacity: 0.25, |
||||
|
shadowRadius: 4, |
||||
|
elevation: 5, |
||||
|
}, |
||||
|
modalOverlay: { |
||||
|
position: "absolute", |
||||
|
top: 0, |
||||
|
bottom: 0, |
||||
|
left: 0, |
||||
|
right: 0, |
||||
|
backgroundColor: "rgba(0,0,0,0)", |
||||
|
}, |
||||
|
}); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue