|
@@ -0,0 +1,44 @@
|
|
1
|
+import * as React from 'react';
|
|
2
|
+import MapView, { Marker } from 'react-native-maps';
|
|
3
|
+import { StyleSheet, Text, View, Dimensions } from 'react-native';
|
|
4
|
+
|
|
5
|
+export default function Map() {
|
|
6
|
+ const [pin, setPin] = React.useState({
|
|
7
|
+ latitude: 18.4655,
|
|
8
|
+ longitude: -66.1057,
|
|
9
|
+ })
|
|
10
|
+
|
|
11
|
+ return (
|
|
12
|
+ <View style={styles.container}>
|
|
13
|
+ <MapView style={styles.map}
|
|
14
|
+ initialRegion={{
|
|
15
|
+ latitude: 18.4655,
|
|
16
|
+ longitude: -66.1057,
|
|
17
|
+ latitudeDelta: 0.0922,
|
|
18
|
+ longitudeDelta: 0.0421,
|
|
19
|
+ }}
|
|
20
|
+ onLongPress={(e) => {
|
|
21
|
+ setPin({
|
|
22
|
+ latitude: e.nativeEvent.coordinate.latitude,
|
|
23
|
+ longitude: e.nativeEvent.coordinate.longitude
|
|
24
|
+ })}}
|
|
25
|
+ provider="google"
|
|
26
|
+ >
|
|
27
|
+ <Marker coordinate={pin} />
|
|
28
|
+ </MapView>
|
|
29
|
+ </View>
|
|
30
|
+ );
|
|
31
|
+}
|
|
32
|
+
|
|
33
|
+const styles = StyleSheet.create({
|
|
34
|
+ container: {
|
|
35
|
+ flex: 1,
|
|
36
|
+ backgroundColor: '#fff',
|
|
37
|
+ alignItems: 'center',
|
|
38
|
+ justifyContent: 'center',
|
|
39
|
+ },
|
|
40
|
+ map: {
|
|
41
|
+ width: Dimensions.get('window').width,
|
|
42
|
+ height: Dimensions.get('window').height,
|
|
43
|
+ },
|
|
44
|
+});
|