Maps.js
1.42 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
53
54
import React, {useState, useEffect} from 'react';
import MapView, {Marker} from 'react-native-maps';
import {StyleSheet, Text, View, Dimensions} from 'react-native';
import screen from '../constants/layout';
import StartAndFinishLocationComponent from "../components/CurrentUserLocationComponent";
const Maps = () => {
const [initialRegion, setInitialRegion] = useState(
{
latitude: 37.56647,
longitude: 126.977963,
latitudeDelta: 0.3922,
longitudeDelta: 0.3421
});
return (
<View style={styles.container}>
<Text style={styles.textStyle}>Current User Location</Text>
<StartAndFinishLocationComponent/>
<MapView
style={styles.mapStyle}
initialRegion={initialRegion}
>
<Marker
coordinate={initialRegion}
title="this is a marker"
description="this is a marker example">
</Marker>
</MapView>
</View>
)
};
export default Maps;
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
},
mapStyle: {
width: screen.width,
height: screen.height / 2,
},
textStyle: {
fontWeight: 'bold',
fontSize: 20,
color: 'grey',
marginBottom: 20,
}
});