Skip to content

Instantly share code, notes, and snippets.

@iwilsonq
Created February 23, 2018 22:59
Show Gist options
  • Save iwilsonq/1a2e859084759e9cc5e859dfd7359b6f to your computer and use it in GitHub Desktop.
Save iwilsonq/1a2e859084759e9cc5e859dfd7359b6f to your computer and use it in GitHub Desktop.
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