Browse Source

Added map file; in register.js, interpreters are going to Interpretes collection.

ErnestoOrtiz2 2 years ago
parent
commit
8dcdb5b5b3
3 changed files with 47 additions and 1 deletions
  1. 2
    0
      App.js
  2. 1
    1
      screens/auth/RegisterScreen.js
  3. 44
    0
      screens/main/Map.js

+ 2
- 0
App.js View File

@@ -23,6 +23,7 @@ import RoomScreen from './screens/main/RoomScreen';
23 23
 import Calendario from './screens/main/Calendar';
24 24
 import Time from './screens/main/StateTime';
25 25
 import Search from './screens/main/Search';
26
+import Map from './screens/main/Map';
26 27
 
27 28
 
28 29
 if (firebase.apps.length === 0) {
@@ -95,6 +96,7 @@ export default class App extends Component {
95 96
             <Stack.Screen name="Calendar"  component={Calendario}/>
96 97
             <Stack.Screen name = "StateTime" component={Time}/>
97 98
             <Stack.Screen name = "Search" component={Search}/>
99
+            <Stack.Screen name = "Map" component={Map}/>
98 100
           </Stack.Navigator>
99 101
         </NavigationContainer>
100 102
       </Provider>

+ 1
- 1
screens/auth/RegisterScreen.js View File

@@ -23,7 +23,7 @@ export default class RegisterScreen extends Component {
23 23
         firebase.auth().createUserWithEmailAndPassword(email, password)
24 24
             .then((result) => {
25 25
                 if (interpreter) {
26
-                    firebase.firestore().collection("Interpreters")
26
+                    firebase.firestore().collection("Interprete")
27 27
                         .doc(firebase.auth().currentUser.uid)
28 28
                         .set({
29 29
                             username,

+ 44
- 0
screens/main/Map.js View File

@@ -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
+});