Files
birdbam/MapsInterface.js
2020-06-23 12:31:32 -05:00

62 lines
1.5 KiB
JavaScript

import React from 'react';
import { Alert, StyleSheet, AsyncStorage, Image, Text, View } from 'react-native';
import MapView from 'react-native-maps';
import Marker from 'react-native-maps';
export default class MapsInterface extends React.Component {
constructor(props) {
super(props);
this.state = {
region: this.props.navigation.getParam('region')
}
}
// getInitialState() {
// return {
// test:""
// };
// }
onRegionChange(region) {
this.setState({ region });
}
componentDidMount() {
console.log(this.props.navigation.getParam('region'));
}
render() {
return (
<MapView
style={styles.container}
initialRegion={this.props.navigation.getParam('region')}
region={this.state.region}
onRegionChange={this.onRegionChange}
>
{this.props.navigation.getParam('mapData').map(marker => (
<Marker
key={marker.id}
coordinate={marker.location}
title={marker.id}
/>
))}
</MapView>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1
},
stretch: {
width: 75,
height: 75,
resizeMode: 'stretch'
}
});