Files

86 lines
1.8 KiB
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({
getInitialState() {
return {
a: {
latitude: LATITUDE + SPACE,
longitude: LONGITUDE + SPACE,
},
b: {
latitude: LATITUDE - SPACE,
longitude: LONGITUDE - SPACE,
},
}
},
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={this.state.a}
onSelect={(e) => console.log('onSelect', e)}
onDrag={(e) => console.log('onDrag', e)}
onDragStart={(e) => console.log('onDragStart', e)}
onPress={(e) => console.log('onPress', e)}
draggable
>
<PriceMarker amount={99} />
</MapView.Marker>
</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;