Created
February 23, 2018 22:59
-
-
Save iwilsonq/1a2e859084759e9cc5e859dfd7359b6f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from ‘react’ | |
import { View, Text } from ‘react-native’ | |
import { MapView } from ‘expo’ | |
const Marker = MapView.Marker | |
export default class Map extends Component { | |
renderMarkers() { | |
return this.props.places.map((place, i) => ( | |
<Marker key={i} title={place.name} coordinate={place.coords} /> | |
)) | |
} | |
render() { | |
const { region } = this.props | |
return ( | |
<MapView | |
style={styles.container} | |
region={region} | |
showsUserLocation | |
showsMyLocationButton | |
> | |
{this.renderMarkers()} | |
</MapView> | |
) | |
} | |
} | |
const styles = { | |
container: { | |
width: ‘100%’, | |
height: ‘80%’, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment