Browse Source

Arreglo de entrega de fecha

gilberto.cancel 2 years ago
parent
commit
f98a6da359
1 changed files with 131 additions and 129 deletions
  1. 131
    129
      screens/main/Map.js

+ 131
- 129
screens/main/Map.js View File

@@ -1,143 +1,145 @@
1
-import * as React from 'react';
2
-import { useState } from 'react';
3
-import MapView, { Marker } from 'react-native-maps';
4
-import { Button, StyleSheet, Text, View, Dimensions, Pressable } from 'react-native';
5
-import { Confirm } from './Confirm';
1
+    import * as React from 'react';
2
+    import { useState } from 'react';
3
+    import MapView, { Marker } from 'react-native-maps';
4
+    import { Button, StyleSheet, Text, View, Dimensions, Pressable } from 'react-native';
5
+    import { Confirm } from './Confirm';
6 6
 
7 7
 
8
-export default function Map({route, navigation} ) {
9
-    
10
-  console.log('In map params')
11
-  console.log(route.params)
12
-  
8
+    export default function Map({route, navigation} ) {
9
+        
10
+      console.log('In map params')
11
+      console.log(route.params)
12
+      
13 13
 
14
-    
15
-    const {
16
-    Appointment = route.params.Appointment_Date ,
17
-    int_id = route.params.int_id,
18
-    mapflag = route.params.Flag, 
19
-    i_token = route.params.I_Token,
20
-    u_token =  route.params.U_Token,
21
-    username = route.params.Username,
22
-    I_username = route.params.I_Username,
23
-    Confirm_Flag = route.params.Confirm_Flag,
24
-    View_Only = route.params.View_Only
25
-    } = route.params
26
-    
14
+        
15
+        const {
16
+        Day = route.params.Day ,
17
+        Month = route.params.Month,
18
+        int_id = route.params.int_id,
19
+        mapflag = route.params.Flag, 
20
+        i_token = route.params.I_Token,
21
+        u_token =  route.params.U_Token,
22
+        username = route.params.Username,
23
+        I_username = route.params.I_Username,
24
+        Confirm_Flag = route.params.Confirm_Flag,
25
+        View_Only = route.params.View_Only
26
+        } = route.params
27
+        
27 28
 
28
-    
29
+        
29 30
 
30
-  
31
+      
31 32
 
32
-  if(View_Only == true){
33
+      if(View_Only == true){
33 34
 
34
-    const Retrive_pin = route.params.Pin;
35
-    console.log("Retrieve lat", Retrive_pin)
35
+        const Retrive_pin = route.params.Pin;
36
+        console.log("Retrieve lat", Retrive_pin)
36 37
 
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
-      })
38
+        if(Confirm_Flag == true){
39
+          const [pin2, setPin2] = React.useState({
40
+            latitude: Retrive_pin[0].Pin[0],
41
+            longitude: Retrive_pin[0].Pin[1],
42
+          })
42 43
 
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
-    }
44
+          console.log("Pin2", pin2)
45
+      
46
+          return (
47
+            <View style={styles.container}>
48
+              <MapView style={styles.map}
49
+                initialRegion={{
50
+                  latitude: pin2.latitude,
51
+                  longitude: pin2.longitude,
52
+                  latitudeDelta: 0.0922,
53
+                  longitudeDelta: 0.0421,
54
+                }}
55
+                provider="google"
56
+              >
57
+                <Marker coordinate={pin2} />
58
+              </MapView>
59
+            </View>
60
+          );
61
+        }
61 62
 
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)
68
-  
69
-    return (
70
-      <View style={styles.container}>
71
-        <MapView style={styles.map}
72
-          initialRegion={{
73
-            latitude: pin2.latitude,
74
-            longitude: pin2.longitude,
75
-            latitudeDelta: 0.0922,
76
-            longitudeDelta: 0.0421,
77
-          }}
78
-          provider="google"
79
-        >
80
-          <Marker coordinate={pin2} />
81
-        </MapView>
82
-      </View>
83
-    );
84
-  }
85
-}
86
-  else{
63
+        else{
64
+          const [pin2, setPin2] = React.useState({
65
+          latitude: Retrive_pin.Pin[0],
66
+          longitude: Retrive_pin.Pin[1],
67
+          })
68
+        console.log("Pin2", pin2)
69
+      
70
+        return (
71
+          <View style={styles.container}>
72
+            <MapView style={styles.map}
73
+              initialRegion={{
74
+                latitude: pin2.latitude,
75
+                longitude: pin2.longitude,
76
+                latitudeDelta: 0.0922,
77
+                longitudeDelta: 0.0421,
78
+              }}
79
+              provider="google"
80
+            >
81
+              <Marker coordinate={pin2} />
82
+            </MapView>
83
+          </View>
84
+        );
85
+      }
86
+    }
87
+      else{
87 88
 
88
-    const [pin1, setPin1] = React.useState({
89
-      latitude: 18.4655,
90
-      longitude: -66.1057,
91
-    })
89
+        const [pin1, setPin1] = React.useState({
90
+          latitude: 18.4655,
91
+          longitude: -66.1057,
92
+        })
92 93
 
93
-    return (
94
-      <View style={styles.container}>
95
-        <MapView style={styles.map}
96
-          initialRegion={{
97
-            latitude: 18.4655,
98
-            longitude: -66.1057,
99
-            latitudeDelta: 0.0922,
100
-            longitudeDelta: 0.0421,
101
-          }}
102
-          onPress={(e) => {
103
-            setPin1({
104
-              latitude: e.nativeEvent.coordinate.latitude,
105
-              longitude: e.nativeEvent.coordinate.longitude
106
-            })
107
-          }}
108
-          
109
-          provider="google"
110
-        >
111
-          <Marker coordinate={pin1} />
112
-        </MapView>
113
-          <View style = {{position: 'absolute', bottom: '5%'}}>
114
-              <Button title= 'Confirm Location' color = "#000000" onPress = {() => navigation.navigate('StateTime' , {Pin : pin1 , Appointment : Appointment, int_id : int_id, 
115
-                mapflag : mapflag, I_Token: i_token, U_Token: u_token
116
-                ,Username: username, I_Username: I_username})}/>
94
+        return (
95
+          <View style={styles.container}>
96
+            <MapView style={styles.map}
97
+              initialRegion={{
98
+                latitude: 18.4655,
99
+                longitude: -66.1057,
100
+                latitudeDelta: 0.0922,
101
+                longitudeDelta: 0.0421,
102
+              }}
103
+              onPress={(e) => {
104
+                setPin1({
105
+                  latitude: e.nativeEvent.coordinate.latitude,
106
+                  longitude: e.nativeEvent.coordinate.longitude
107
+                })
108
+              }}
109
+              
110
+              provider="google"
111
+            >
112
+              <Marker coordinate={pin1} />
113
+            </MapView>
114
+              <View style = {{position: 'absolute', bottom: '5%'}}>
115
+                  <Button title= 'Confirm Location' color = "#000000" onPress = {() => navigation.navigate('StateTime' , {Pin : pin1 , 
116
+                    Day : Day, Month: Month, int_id : int_id, 
117
+                    mapflag : mapflag, I_Token: i_token, U_Token: u_token
118
+                    ,Username: username, I_Username: I_username})}/>
119
+              </View>
117 120
           </View>
118
-      </View>
119
-      
120
-    );
121
-  }
121
+          
122
+        );
123
+      }
122 124
 
123
-    
124
-}
125
-const styles = StyleSheet.create({
126
-  container: {
127
-    flex: 1,
128
-    backgroundColor: '#fff',
129
-    alignItems: 'center',
130
-    justifyContent: 'center',
131
-  },
132
-  map: {
133
-    width: Dimensions.get('window').width,
134
-    height: Dimensions.get('window').height,
135
-  },
136
-  container2: {
137
-    flex: 1,
138
-    alignItems: 'center',
139
-    justifyContent: 'center',
140
-    backgroundColor: '#307ecc',
141
-    padding: 16,
142
-  },
143
-});
125
+        
126
+    }
127
+    const styles = StyleSheet.create({
128
+      container: {
129
+        flex: 1,
130
+        backgroundColor: '#fff',
131
+        alignItems: 'center',
132
+        justifyContent: 'center',
133
+      },
134
+      map: {
135
+        width: Dimensions.get('window').width,
136
+        height: Dimensions.get('window').height,
137
+      },
138
+      container2: {
139
+        flex: 1,
140
+        alignItems: 'center',
141
+        justifyContent: 'center',
142
+        backgroundColor: '#307ecc',
143
+        padding: 16,
144
+      },
145
+    });