Created
November 9, 2017 16:49
-
-
Save ricardokdz/1f36f9db8dbf7a096de60b8b4fc7710f 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
class Home extends Component { | |
render(){ | |
const Buses = this.props.home.buses.map((b) => { | |
return ( | |
<MapView.Marker | |
title={b.title} | |
description={b.route} | |
key={b.id} | |
coordinate={{ | |
latitude: parseFloat(b.latitude), | |
longitude: parseFloat(b.longitude) | |
}}> | |
<Image | |
source={bus} | |
style={{width:45, height:45}} | |
/> | |
</MapView.Marker> | |
) | |
}) | |
const Markers = this.props.home.markers.map((m) => { | |
return ( | |
<MapView.Marker | |
title={m.name} | |
description={m.reference} | |
key={m.id} | |
coordinate={{ | |
latitude: parseFloat(m.latitude), | |
longitude: parseFloat(m.longitude) | |
}}/> | |
) | |
}) | |
return ( | |
<View style={styles.container}> | |
<MapView | |
ref={ref => { this.map = ref }} | |
style={styles.map} | |
showsUserLocation={true} | |
userLocationAnnotationTitle='Você está aqui' | |
initialRegion={{ | |
latitude: -23.001628, | |
longitude: -43.304472, | |
latitudeDelta: 0.9, | |
longitudeDelta: 0.9, | |
}}> | |
{Buses} | |
{Markers} | |
</MapView> | |
</View> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment