react-native-maps
Version:
React Native Mapview component for iOS + Android
82 lines (75 loc) • 1.84 kB
JavaScript
var React = require('react-native');
var {
StyleSheet,
PropTypes,
View,
Text,
Dimensions,
TouchableOpacity,
Image,
} = React;
var MapView = require('react-native-maps');
var PriceMarker = require('./PriceMarker');
var { width, height } = Dimensions.get('window');
const ASPECT_RATIO = width / height;
const LATITUDE = 37.78825;
const LONGITUDE = -122.4324;
const LATITUDE_DELTA = 0.0922;
const LONGITUDE_DELTA = LATITUDE_DELTA * ASPECT_RATIO;
const SPACE = 0.01;
var MarkerTypes = React.createClass({
render() {
return (
<View style={styles.container}>
<MapView
ref="map"
style={styles.map}
initialRegion={{
latitude: LATITUDE,
longitude: LONGITUDE,
latitudeDelta: LATITUDE_DELTA,
longitudeDelta: LONGITUDE_DELTA,
}}
>
<MapView.Marker
coordinate={{
latitude: LATITUDE + SPACE,
longitude: LONGITUDE + SPACE,
}}
centerOffset={{ x: -18, y: -60 }}
anchor={{ x: 0.69, y: 1 }}
image={require('./assets/flag-blue.png')}
/>
<MapView.Marker
coordinate={{
latitude: LATITUDE - SPACE,
longitude: LONGITUDE - SPACE,
}}
centerOffset={{ x: -42, y: -60 }}
anchor={{ x: 0.84, y: 1 }}
image={require('./assets/flag-pink.png')}
/>
</MapView>
</View>
);
},
});
var styles = StyleSheet.create({
container: {
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
justifyContent: 'flex-end',
alignItems: 'center',
},
map: {
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
},
});
module.exports = MarkerTypes;