Browse Source

fixed some details

Orlando04 2 years ago
parent
commit
09365cd198

+ 3
- 0
MocionesIUPI/routes/homeStack.js View File

28
 
28
 
29
     Mocion: {
29
     Mocion: {
30
         screen: MocionScreen,
30
         screen: MocionScreen,
31
+        navigationOptions: {
32
+            headerTitle: () => <Header />
33
+        }
31
     },
34
     },
32
 }
35
 }
33
 
36
 

+ 0
- 5
MocionesIUPI/screens/HomeScreen.js View File

4
 import { globalStyles } from "../styles/global";
4
 import { globalStyles } from "../styles/global";
5
 
5
 
6
 export default App = ({ navigation }) => {
6
 export default App = ({ navigation }) => {
7
-    const [isLoading, setLoading] = useState(true);
8
-    const [Description, setDescription] = useState([]); // this is looking for 'Description' and it's content
9
-    const [Mocion, setMocion] = useState([]); // this is looking for 'Mocion' and it's content
10
     const [PIN, setPIN] = useState([]); // this is looking for 'PIN' and it's content
7
     const [PIN, setPIN] = useState([]); // this is looking for 'PIN' and it's content
11
   
8
   
12
     // this connects us to the API and fetches the json file with the mociones
9
     // this connects us to the API and fetches the json file with the mociones
16
         const json = await response.json();
13
         const json = await response.json();
17
   
14
   
18
         // setting the content of each category 
15
         // setting the content of each category 
19
-        setMocion(json.Mocion); 
20
-        setDescription(json.Description);
21
         setPIN(json.PIN);
16
         setPIN(json.PIN);
22
   
17
   
23
       } catch (error) {
18
       } catch (error) {

+ 20
- 1
MocionesIUPI/screens/MocionScreen.js View File

7
   const [isLoading, setLoading] = useState(true);
7
   const [isLoading, setLoading] = useState(true);
8
   const [Description, setDescription] = useState([]); // this is looking for 'Description' and it's content
8
   const [Description, setDescription] = useState([]); // this is looking for 'Description' and it's content
9
   const [Mocion, setMocion] = useState([]); // this is looking for 'Mocion' and it's content
9
   const [Mocion, setMocion] = useState([]); // this is looking for 'Mocion' and it's content
10
-  const [PIN, setPIN] = useState([]); // this is looking for 'PIN' and it's content
10
+  
11
+      // this connects us to the API and fetches the json file with the mociones
12
+      const getMociones = async () => {
13
+        try {
14
+         const response = await fetch('http://10.190.1.140:5000/send?PIN=121071'); // connection to the website 
15
+         const json = await response.json();
16
+   
17
+         // setting the content of each category 
18
+         setMocion(json.Mocion); 
19
+         setDescription(json.Description);
20
+       } catch (error) {
21
+         console.error(error);
22
+       } finally {
23
+         setLoading(false); // once found the loading icon will be replaced with the content of the json
24
+       }
25
+     }
26
+
27
+     useEffect(() => {
28
+      getMociones();
29
+    }, []);
11
 
30
 
12
 
31
 
13
   // this is for displaying the mocion on the screen
32
   // this is for displaying the mocion on the screen

+ 1
- 1
MocionesIUPI/screens/PincodeScreen.js View File

9
     
9
     
10
     pressHandler = () => {
10
     pressHandler = () => {
11
     {/*Dentro del parentesis va el path al screen para redirigir*/}
11
     {/*Dentro del parentesis va el path al screen para redirigir*/}
12
-      this.props.navigation.navigate('test')
12
+      this.props.navigation.navigate('Mocion')
13
     }
13
     }
14
 
14
 
15
     state = {
15
     state = {