-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMapView.tsx
78 lines (74 loc) · 1.6 KB
/
MapView.tsx
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
import React from 'react';
import MapView from 'react-native-maps';
import {StyleSheet, Text, View, Dimensions} from 'react-native';
function Map() {
const availableLocations = [
{
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
},
{
latitude: 34.04544,
longitude: -118.445848,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
},
{
latitude: 34.136254,
longitude: -118.026447,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
},
{
latitude: 40.682294,
longitude: -73.978018,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
},
{
latitude: 42.35052,
longitude: -71.058802,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
},
{
latitude: 47.610903,
longitude: -122.336229,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
},
{
latitude: 34.419007,
longitude: -119.709215,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
},
];
return (
<View style={styles.container}>
<MapView
style={styles.mapStyle}
initialRegion={
availableLocations[
Math.floor(Math.random() * availableLocations.length)
]
}
/>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
mapStyle: {
width: Dimensions.get('window').width,
height: Dimensions.get('window').height,
},
});
export default Map;