Browse Source
Adjusting initial code for modal view in MapMarker when user wants more
Adjusting initial code for modal view in MapMarker when user wants more
information.master
GabrielTrettel
4 years ago
2 changed files with 85 additions and 15 deletions
@ -0,0 +1,65 @@ |
|||||
|
import React, { Component } from "react"; |
||||
|
import { Modal, Text, TouchableOpacity, View, StyleSheet } from "react-native"; |
||||
|
import { screen_height, screen_width } from "../config/dimensions"; |
||||
|
|
||||
|
function MapModal({ isVisible, setIsVisible }) { |
||||
|
console.log(screen_width); |
||||
|
return ( |
||||
|
<View style={styles.centeredView}> |
||||
|
<Modal |
||||
|
animationType="slide" |
||||
|
transparent={true} |
||||
|
visible={isVisible} |
||||
|
onRequestClose={() => { |
||||
|
alert("Modal has been closed."); |
||||
|
}} |
||||
|
> |
||||
|
<View style={styles.centeredView}> |
||||
|
<View style={styles.modalView}> |
||||
|
<View> |
||||
|
<Text>Hello World!</Text> |
||||
|
|
||||
|
<TouchableOpacity |
||||
|
onPress={() => { |
||||
|
setIsVisible(!isVisible); |
||||
|
}} |
||||
|
> |
||||
|
<Text>Hide Modal</Text> |
||||
|
</TouchableOpacity> |
||||
|
</View> |
||||
|
</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, |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
export default MapModal; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue