Created
December 4, 2017 15:18
-
-
Save princessjanf/d87a9ad9af609c1a32a70ae205763b87 to your computer and use it in GitHub Desktop.
View that shows condition for showing current location marker
This file contains hidden or 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
render() { | |
return ( | |
<MapView style={styles.map} initialRegion={{ | |
latitude:-6.270565, | |
longitude:106.759550, | |
latitudeDelta: 1, | |
longitudeDelta: 1 | |
}}> | |
{!!this.state.latitude && !!this.state.longitude && <MapView.Marker | |
coordinate={{"latitude":this.state.latitude,"longitude":this.state.longitude}} | |
title={"Your Location"} | |
/>} | |
</MapView> | |
); | |
} | |
const styles = StyleSheet.create({ | |
map: { | |
position: 'absolute', | |
top: 0, | |
left: 0, | |
right: 0, | |
bottom: 0, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment