Explorar el Código

Cambios para que se envien los usernames con la cita y para que funcione con Confirm

gilberto.cancel hace 3 años
padre
commit
a197747f59
Se han modificado 1 ficheros con 33 adiciones y 6 borrados
  1. 33
    6
      screens/main/Map.js

+ 33
- 6
screens/main/Map.js Ver fichero

@@ -2,6 +2,7 @@ import * as React from 'react';
2 2
 import { useState } from 'react';
3 3
 import MapView, { Marker } from 'react-native-maps';
4 4
 import { Button, StyleSheet, Text, View, Dimensions, Pressable } from 'react-native';
5
+import { Confirm } from './Confirm';
5 6
 
6 7
 
7 8
 export default function Map({route, navigation} ) {
@@ -19,6 +20,7 @@ export default function Map({route, navigation} ) {
19 20
     u_token =  route.params.U_Token,
20 21
     username = route.params.Username,
21 22
     I_username = route.params.I_Username,
23
+    Confirm_Flag = route.params.Confirm_Flag,
22 24
     View_Only = route.params.View_Only
23 25
     } = route.params
24 26
     
@@ -30,15 +32,39 @@ export default function Map({route, navigation} ) {
30 32
   if(View_Only == true){
31 33
 
32 34
     const Retrive_pin = route.params.Pin;
35
+    console.log("Retrieve lat", Retrive_pin)
33 36
 
34
-  console.log("Retrieve lat", Retrive_pin.Pin[0])
37
+    if(Confirm_Flag == true){
38
+      const [pin2, setPin2] = React.useState({
39
+        latitude: Retrive_pin[0].Pin[0],
40
+        longitude: Retrive_pin[0].Pin[1],
41
+      })
35 42
 
36
-  const [pin2, setPin2] = React.useState({
37
-    latitude: Retrive_pin.Pin[0],
38
-    longitude: Retrive_pin.Pin[1],
39
-  })
43
+      console.log("Pin2", pin2)
44
+  
45
+      return (
46
+        <View style={styles.container}>
47
+          <MapView style={styles.map}
48
+            initialRegion={{
49
+              latitude: pin2.latitude,
50
+              longitude: pin2.longitude,
51
+              latitudeDelta: 0.0922,
52
+              longitudeDelta: 0.0421,
53
+            }}
54
+            provider="google"
55
+          >
56
+            <Marker coordinate={pin2} />
57
+          </MapView>
58
+        </View>
59
+      );
60
+    }
40 61
 
41
-  console.log("Pin2", pin2)
62
+    else{
63
+      const [pin2, setPin2] = React.useState({
64
+      latitude: Retrive_pin.Pin[0],
65
+      longitude: Retrive_pin.Pin[1],
66
+      })
67
+    console.log("Pin2", pin2)
42 68
   
43 69
     return (
44 70
       <View style={styles.container}>
@@ -56,6 +82,7 @@ export default function Map({route, navigation} ) {
56 82
       </View>
57 83
     );
58 84
   }
85
+}
59 86
   else{
60 87
 
61 88
     const [pin1, setPin1] = React.useState({