Browse Source

Update al mapa para enviar el Pin a la pantalla de StateTime para guardar la cita

gilberto.cancel 2 years ago
parent
commit
fce78d9e48
1 changed files with 29 additions and 3 deletions
  1. 29
    3
      screens/main/Map.js

+ 29
- 3
screens/main/Map.js View File

@@ -1,12 +1,27 @@
1 1
 import * as React from 'react';
2
+import { useState } from 'react';
2 3
 import MapView, { Marker } from 'react-native-maps';
3
-import { StyleSheet, Text, View, Dimensions, Pressable } from 'react-native';
4
+import { Button, StyleSheet, Text, View, Dimensions, Pressable } from 'react-native';
5
+
6
+
7
+export default function Map({route, navigation} ) {
8
+
9
+    
10
+    const {
11
+    Appointment = route.params.Appointment_Date ,
12
+    int_id = route.params.int_id,
13
+    mapflag = route.params.Flag 
14
+    } = route.params
15
+    
16
+
17
+    console.log('In map params')
18
+    console.log(route.params)
4 19
 
5
-export default function Map() {
6 20
   const [pin, setPin] = React.useState({
7 21
     latitude: 18.4655,
8 22
     longitude: -66.1057,
9 23
   })
24
+
10 25
   
11 26
   return (
12 27
     <View style={styles.container}>
@@ -26,10 +41,14 @@ export default function Map() {
26 41
       >
27 42
         <Marker coordinate={pin} />
28 43
       </MapView>
44
+        <View style = {{position: 'absolute', bottom: '5%'}}>
45
+            <Button title= 'Confirm Location' onPress = {() => navigation.navigate('StateTime' , {Pin : pin , Appointment : Appointment, int_id : int_id, mapflag : mapflag})}/>
46
+        </View>
29 47
     </View>
30 48
   );
31
-}
32 49
 
50
+    
51
+}
33 52
 const styles = StyleSheet.create({
34 53
   container: {
35 54
     flex: 1,
@@ -41,4 +60,11 @@ const styles = StyleSheet.create({
41 60
     width: Dimensions.get('window').width,
42 61
     height: Dimensions.get('window').height,
43 62
   },
63
+  container2: {
64
+    flex: 1,
65
+    alignItems: 'center',
66
+    justifyContent: 'center',
67
+    backgroundColor: '#307ecc',
68
+    padding: 16,
69
+  },
44 70
 });