-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapsScreen.js
More file actions
52 lines (49 loc) · 1.41 KB
/
MapsScreen.js
File metadata and controls
52 lines (49 loc) · 1.41 KB
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
import React, { Component } from 'react';
import { View, Linking } from 'react-native';
import MapView, { Marker, Callout } from 'react-native-maps';
import CafeCount from './CafeCount';
import InfoButton from './InfoButton';
// https://developers.google.com/maps/documentation/urls/guide
const URL = "https://www.google.com/maps/dir/?api=1&destination=";
export default class MapsScreen extends Component {
constructor(props) {
super(props);
// mock the data
this.state = {
nCafes : 120
}
}
render() {
const { navigation } = this.props;
// TODO FIXME. If 'NO-LATLNG' then there will be an error.
let latLng = navigation.getParam('latLng', 'NO-LATLNG');
// latLng param is passed from Navigation and used to
// set initialRegion on MapView below.
let description = 'Zen Cafe';
return (<View style={
[{ flex: 1, justifyContent: 'center' },
{
flexDirection: 'row',
justifyContent: 'space-around',
padding: 10
}]
}>
<MapView style={[{ flex: 1 }]}
initialRegion={{
latitude: latLng.latitude,
longitude: latLng.longitude,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421
}}>
<Marker key={name} coordinate={latLng}
title={name} description={description}>
<Callout alphaHitTest tooltip
>
</Callout>
</Marker>
</MapView>
<CafeCount nCafes={this.state.nCafes} />
<InfoButton onPress={this.props.openHelpModal} />
</View>);
}
}