-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarket-view.js
80 lines (74 loc) · 1.67 KB
/
market-view.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
'use strict';
var React = require('react-native');
var {
StyleSheet,
View,
MapView,
Text
} = React;
var styles = StyleSheet.create({
container: {
flex: 1,
margin: 10,
marginTop: 75,
// justifyContent: 'center',
// alignItems: 'center',
// backgroundColor: '#F5FCFF',
},
map: {
height: 150,
borderWidth: 1,
borderColor: '#000000',
marginBottom: 10
}
});
var MarketView = React.createClass({
getRegion: function(){
return {
latitude: this.props.latitude,
longitude: this.props.longitude,
latitudeDelta: 0.002,
longitudeDelta: 0.002
};
},
getAnnotations: function(){
var region = this.getRegion();
return [{
longitude: region.longitude,
latitude: region.latitude,
title: this.props.name,
}];
},
// "address": {
// "street": "St Marks Pl and Hyatt St",
// "zipcode": 10301,
// "city": "Staten Island",
// "state": "NY"
// },
// "links": {
// "web": "http://www.grownyc.org",
// "twitter": null
// },
render: function(){
var distanceView;
if (this.props.distanceMiles) {
distanceView= <Text>{this.props.distanceMiles} Miles from you</Text>
}
return (
<View style={styles.container}>
<MapView
style={styles.map}
region={this.getRegion()}
annotations={this.getAnnotations()}
scrollEnabled={true}
/>
<Text>{this.props.name}</Text>
<Text>{this.props.location_description}</Text>
<Text>{this.props.schedule_hours_description}</Text>
<Text>{this.props.schedule_season_description}</Text>
{distanceView}
</View>
);
}
});
module.exports = MarketView;