Browse Source

Merge branch 'MocionesIUPI' into PincodeB

Ricardo-gonzalez32 2 years ago
parent
commit
9cebb52c2a

+ 2
- 11
MocionesIUPI/App.js View File

4
 // importing other files
4
 // importing other files
5
 import Navigator from './routes/homeStack';
5
 import Navigator from './routes/homeStack';
6
 
6
 
7
-
8
 export default function App() {
7
 export default function App() {
9
   return (
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
File diff suppressed because it is too large
View File


+ 10
- 4
MocionesIUPI/package.json View File

9
     "web": "expo start --web"
9
     "web": "expo start --web"
10
   },
10
   },
11
   "dependencies": {
11
   "dependencies": {
12
+    "@apollo/client": "^3.7.2",
12
     "@expo/webpack-config": "^0.17.2",
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
     "deprecated-react-native-prop-types": "^2.2.0",
14
     "deprecated-react-native-prop-types": "^2.2.0",
17
     "expo": "~47.0.6",
15
     "expo": "~47.0.6",
18
     "expo-status-bar": "~1.4.2",
16
     "expo-status-bar": "~1.4.2",
17
+    "graphql": "^15.8.0",
18
+    "native-base": "^3.4.25",
19
     "react": "18.1.0",
19
     "react": "18.1.0",
20
     "react-dom": "18.1.0",
20
     "react-dom": "18.1.0",
21
+    "react-dom": "18.1.0",
21
     "react-native": "0.70.5",
22
     "react-native": "0.70.5",
22
     "react-native-paper": "^3.12.0",
23
     "react-native-paper": "^3.12.0",
23
     "react-native-safe-area-context": "4.4.1",
24
     "react-native-safe-area-context": "4.4.1",
27
     "react-native-web": "~0.18.9",
28
     "react-native-web": "~0.18.9",
28
     "react-navigation-material-bottom-tabs": "^2.3.5",
29
     "react-navigation-material-bottom-tabs": "^2.3.5",
29
     "react-navigation-stack": "^2.10.4",
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
   "devDependencies": {
38
   "devDependencies": {
33
     "@babel/core": "^7.12.9"
39
     "@babel/core": "^7.12.9"

+ 6
- 1
MocionesIUPI/routes/homeStack.js View File

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

+ 41
- 0
MocionesIUPI/screens/MocionScreen.js View File

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