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
 import * as React from 'react';
1
 import * as React from 'react';
2
+import { useState } from 'react';
2
 import MapView, { Marker } from 'react-native-maps';
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
   const [pin, setPin] = React.useState({
20
   const [pin, setPin] = React.useState({
7
     latitude: 18.4655,
21
     latitude: 18.4655,
8
     longitude: -66.1057,
22
     longitude: -66.1057,
9
   })
23
   })
24
+
10
   
25
   
11
   return (
26
   return (
12
     <View style={styles.container}>
27
     <View style={styles.container}>
26
       >
41
       >
27
         <Marker coordinate={pin} />
42
         <Marker coordinate={pin} />
28
       </MapView>
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
     </View>
47
     </View>
30
   );
48
   );
31
-}
32
 
49
 
50
+    
51
+}
33
 const styles = StyleSheet.create({
52
 const styles = StyleSheet.create({
34
   container: {
53
   container: {
35
     flex: 1,
54
     flex: 1,
41
     width: Dimensions.get('window').width,
60
     width: Dimensions.get('window').width,
42
     height: Dimensions.get('window').height,
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
 });