Parcourir la source

Merge branch 'MocionesIUPI' into PincodeB

Ricardo-gonzalez32 il y a 2 ans
Parent
révision
9cebb52c2a

+ 2
- 11
MocionesIUPI/App.js Voir le fichier

@@ -4,18 +4,9 @@ import { StyleSheet, Text, View } from 'react-native';
4 4
 // importing other files
5 5
 import Navigator from './routes/homeStack';
6 6
 
7
-
8 7
 export default function App() {
9 8
   return (
10
-      <Navigator />
11
-  );
9
+    <Navigator />
10
+);
12 11
 }
13 12
 
14
-const styles  = StyleSheet.create({
15
-  container: {
16
-    flex: 1,
17
-    backgroundColor: '#fff',
18
-    alignItems: 'center',
19
-    justifyContent: 'center',
20
-  },
21
-});

+ 1296
- 154
MocionesIUPI/package-lock.json
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 10
- 4
MocionesIUPI/package.json Voir le fichier

@@ -9,15 +9,16 @@
9 9
     "web": "expo start --web"
10 10
   },
11 11
   "dependencies": {
12
+    "@apollo/client": "^3.7.2",
12 13
     "@expo/webpack-config": "^0.17.2",
13
-    "@react-native-community/hooks": "^2.8.1",
14
-    "@react-navigation/material-bottom-tabs": "^6.2.8",
15
-    "@react-navigation/native-stack": "^6.9.4",
16 14
     "deprecated-react-native-prop-types": "^2.2.0",
17 15
     "expo": "~47.0.6",
18 16
     "expo-status-bar": "~1.4.2",
17
+    "graphql": "^15.8.0",
18
+    "native-base": "^3.4.25",
19 19
     "react": "18.1.0",
20 20
     "react-dom": "18.1.0",
21
+    "react-dom": "18.1.0",
21 22
     "react-native": "0.70.5",
22 23
     "react-native-paper": "^3.12.0",
23 24
     "react-native-safe-area-context": "4.4.1",
@@ -27,7 +28,12 @@
27 28
     "react-native-web": "~0.18.9",
28 29
     "react-navigation-material-bottom-tabs": "^2.3.5",
29 30
     "react-navigation-stack": "^2.10.4",
30
-    "yarn": "^1.22.19"
31
+    "yarn": "^1.22.19",
32
+    "react-native-web": "~0.18.9",
33
+    "styled-components": "^5.3.6",
34
+    "styled-system": "^5.1.5",
35
+    "react-native-svg": "13.4.0",
36
+    "react-native-safe-area-context": "4.4.1"
31 37
   },
32 38
   "devDependencies": {
33 39
     "@babel/core": "^7.12.9"

+ 6
- 1
MocionesIUPI/routes/homeStack.js Voir le fichier

@@ -6,7 +6,7 @@ import HomeScreen from '../screens/HomeScreen';
6 6
 import PincodeScreen from '../screens/PincodeScreen';
7 7
 import testscreen from '../screens/testscreen';
8 8
 
9
-// import MocionPage from '../screens/MocionPage';
9
+import MocionScreen from '../screens/MocionScreen';
10 10
 
11 11
 {/*Aqui deberan estar todas las pantallas de la aplicacion
12 12
    no olvide hacer 'import MyPage from './MyPage' */}
@@ -16,6 +16,11 @@ const screens = {
16 16
         screen: PincodeScreen,
17 17
         backgroundColor: '#e81b39', // no se como hacer que despliegue color
18 18
     },
19
+
20
+    Mocion: {
21
+        screen: MocionScreen,
22
+
23
+    },
19 24
     test: {
20 25
         screen: testscreen,
21 26
     }

+ 41
- 0
MocionesIUPI/screens/MocionScreen.js Voir le fichier

@@ -0,0 +1,41 @@
1
+import React, { useEffect, useState } from 'react';
2
+import { ActivityIndicator, FlatList, Text, View } from 'react-native';
3
+
4
+export default App = () => {
5
+  const [isLoading, setLoading] = useState(true);
6
+  const [Description, setDescription] = useState([]); // this is looking for 'Description' and it's content
7
+  const [Mocion, setMocion] = useState([]); // this is looking for 'Mocion' and it's content
8
+  const [PIN, setPIN] = useState([]); // this is looking for 'PIN' and it's content
9
+
10
+  // this connects us to the API and fetches the json file with the mociones
11
+  const getMociones = async () => {
12
+     try {
13
+      const response = await fetch('http://10.190.1.140:5000/send?PIN=121071'); // connection to the website 
14
+      const json = await response.json();
15
+
16
+      // setting the content of each category 
17
+      setMocion(json.Mocion); 
18
+      setDescription(json.Description);
19
+      setPIN(json.PIN);
20
+
21
+    } catch (error) {
22
+      console.error(error);
23
+    } finally {
24
+      setLoading(false); // once found the loading icon will be replaced with the content of the json
25
+    }
26
+  }
27
+
28
+  useEffect(() => {
29
+    getMociones();
30
+  }, []);
31
+
32
+  // here we want to display each mocion in a flatlist 
33
+  // it's supposed to be like buttons. Once clicked it would let you vote inside
34
+  return (
35
+    <View style={{ flex: 1, padding: 24 }}>
36
+      <Text>{Mocion}</Text>
37
+      <Text>{Description}</Text>
38
+      <Text>{PIN}</Text>
39
+    </View>
40
+  );
41
+};