Browse Source

added noticias code

Luis Ortiz 1 year ago
parent
commit
cd0cd9ef92
6 changed files with 11414 additions and 5 deletions
  1. 14
    0
      App.js
  2. 51
    1
      Noticias.js
  3. 4
    0
      fetchData.js
  4. 156
    0
      package-lock.json
  5. 14
    0
      package.json
  6. 11175
    4
      yarn.lock

+ 14
- 0
App.js View File

@@ -1,10 +1,16 @@
1 1
 import React, {useState, useEffect} from 'react';
2 2
 import { View, Image, Text, Button, ScrollView, Pressable, Linking,StyleSheet} from 'react-native';
3 3
 import {Picker, DataButton} from "./Datos"
4
+<<<<<<< HEAD
4 5
 import { styles } from './styles';
5 6
 
6 7
 
7 8
 
9
+=======
10
+import Noticias from './Noticias';
11
+import { styles } from './styles';
12
+
13
+>>>>>>> Prawject_UserSt1
8 14
 //actual application
9 15
 
10 16
 class App extends React.Component {
@@ -53,9 +59,17 @@ vars = {
53 59
 					<Text style={styles.intro}>Noticias</Text>
54 60
 					
55 61
 					<Image source={require('./Logo.jpeg')} />
62
+<<<<<<< HEAD
56 63
 					
57 64
 				</View>
58 65
 			</ScrollView>
66
+=======
67
+
68
+				</View>
69
+			</ScrollView>
70
+
71
+			<Noticias />
72
+>>>>>>> Prawject_UserSt1
59 73
 		</View>,
60 74
 		
61 75
 	dataOp:

+ 51
- 1
Noticias.js View File

@@ -1,4 +1,54 @@
1
+<<<<<<< HEAD
1 2
 import React, {useState, useEffect} from 'react';
2 3
 import { View, Image, Text, Button, ScrollView, Pressable, Linking} from 'react-native';
3 4
 import {Picker, DataButton} from "./Datos"
4
-import { styles } from './styles';
5
+import { styles } from './styles';
6
+=======
7
+import {useState, useEffect} from 'react';
8
+import {View, Text, FlatList} from 'react-native';
9
+
10
+//data display
11
+export default function Noticias() {
12
+    const [users,setUsers] = useState([]);
13
+
14
+    useEffect(()=>{
15
+      fetchData()
16
+    },[]);
17
+
18
+    //Busca la informacion en la base de datos
19
+    const fetchData = () => {
20
+      //fetch('https://ada.uprrp.edu/~luis.ortiz79/api/users/',{
21
+      fetch('http://localhost/apicenso/users/')
22
+        .then(response => response.json())
23
+        //.then(jsonResponse => setUsers(jsonResponse))
24
+        .then((response)=>{
25
+            console.log(response.data);
26
+            setUsers(response.data);
27
+        })
28
+        .catch(error => console.log(error))
29
+    }
30
+
31
+    //Es donde va a desplegar la informacion de la base de datos
32
+    const renderUser = ({item}) => {
33
+      return (
34
+        <View style={{margin:10,borderWidth:0.5,padding:10}}>
35
+          <Text style={{color:"black",fontSize:16,fontWeight:"bold"}}>
36
+            Noticia {item.id}
37
+          </Text>
38
+          <Text style={{color:"black"}}> {item.title}</Text>
39
+          <Text style={{color:"black"}}> {item.subject}</Text>
40
+        </View>
41
+      )
42
+    }
43
+
44
+    return (
45
+      <View style={{flex:1,backgroundColor:"white"}}>
46
+        <FlatList
47
+          data={users}
48
+          renderItem={renderUser}
49
+          keyExtractor={(item,index) => index.toString()}
50
+          />
51
+      </View>
52
+    )
53
+}
54
+>>>>>>> Prawject_UserSt1

+ 4
- 0
fetchData.js View File

@@ -1,4 +1,8 @@
1
+<<<<<<< HEAD
1 2
 import * from styles
3
+=======
4
+import * from styles;
5
+>>>>>>> Prawject_UserSt1
2 6
 import DropDownPicker from 'react-native-dropdown-picker';
3 7
 import React, {useState, useEffect} from 'react';
4 8
 

+ 156
- 0
package-lock.json View File

@@ -10,18 +10,32 @@
10 10
       "dependencies": {
11 11
         "@expo/webpack-config": "^0.17.2",
12 12
         "@react-native-picker/picker": "^2.4.8",
13
+<<<<<<< HEAD
14
+=======
15
+        "axios": "^1.2.1",
16
+>>>>>>> Prawject_UserSt1
13 17
         "danfojs": "^1.1.2",
14 18
         "expo": "^47.0.6",
15 19
         "expo-font": "~11.0.1",
16 20
         "expo-splash-screen": "~0.17.5",
17 21
         "expo-status-bar": "~1.4.2",
18 22
         "json2csv": "^5.0.7",
23
+<<<<<<< HEAD
19 24
         "react": "18.1.0",
20 25
         "react-dom": "18.1.0",
21 26
         "react-native": "0.70.5",
22 27
         "react-native-dropdown-picker": "^5.4.3",
23 28
         "react-native-element-dropdown": "^2.5.0",
24 29
         "react-native-web": "~0.18.9"
30
+=======
31
+        "react": "^18.1.0",
32
+        "react-dom": "^18.1.0",
33
+        "react-native": "0.70.5",
34
+        "react-native-dropdown-picker": "^5.4.3",
35
+        "react-native-element-dropdown": "^2.5.0",
36
+        "react-native-web": "~0.18.9",
37
+        "react-router-dom": "^6.5.0"
38
+>>>>>>> Prawject_UserSt1
25 39
       },
26 40
       "devDependencies": {
27 41
         "@babel/core": "^7.19.3"
@@ -3818,6 +3832,17 @@
3818 3832
       "integrity": "sha512-K0aGNn1TjalKj+65D7ycc1//H9roAQ51GJVk5ZJQFb2teECGmzd86bYDC0aYdbRf7gtovescq4Zt6FR0tgXiHQ==",
3819 3833
       "license": "MIT"
3820 3834
     },
3835
+<<<<<<< HEAD
3836
+=======
3837
+    "node_modules/@remix-run/router": {
3838
+      "version": "1.1.0",
3839
+      "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.1.0.tgz",
3840
+      "integrity": "sha512-rGl+jH/7x1KBCQScz9p54p0dtPLNeKGb3e0wD2H5/oZj41bwQUnXdzbj2TbUAFhvD7cp9EyEQA4dEgpUFa1O7Q==",
3841
+      "engines": {
3842
+        "node": ">=14"
3843
+      }
3844
+    },
3845
+>>>>>>> Prawject_UserSt1
3821 3846
     "node_modules/@segment/loosely-validate-event": {
3822 3847
       "version": "2.0.0",
3823 3848
       "resolved": "https://registry.npmjs.org/@segment/loosely-validate-event/-/loosely-validate-event-2.0.0.tgz",
@@ -4942,6 +4967,32 @@
4942 4967
         "node": ">= 4.5.0"
4943 4968
       }
4944 4969
     },
4970
+<<<<<<< HEAD
4971
+=======
4972
+    "node_modules/axios": {
4973
+      "version": "1.2.1",
4974
+      "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.1.tgz",
4975
+      "integrity": "sha512-I88cFiGu9ryt/tfVEi4kX2SITsvDddTajXTOFmt2uK1ZVA8LytjtdeyefdQWEf5PU8w+4SSJDoYnggflB5tW4A==",
4976
+      "dependencies": {
4977
+        "follow-redirects": "^1.15.0",
4978
+        "form-data": "^4.0.0",
4979
+        "proxy-from-env": "^1.1.0"
4980
+      }
4981
+    },
4982
+    "node_modules/axios/node_modules/form-data": {
4983
+      "version": "4.0.0",
4984
+      "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
4985
+      "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
4986
+      "dependencies": {
4987
+        "asynckit": "^0.4.0",
4988
+        "combined-stream": "^1.0.8",
4989
+        "mime-types": "^2.1.12"
4990
+      },
4991
+      "engines": {
4992
+        "node": ">= 6"
4993
+      }
4994
+    },
4995
+>>>>>>> Prawject_UserSt1
4945 4996
     "node_modules/babel-core": {
4946 4997
       "version": "7.0.0-bridge.0",
4947 4998
       "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-7.0.0-bridge.0.tgz",
@@ -14842,6 +14893,14 @@
14842 14893
         "node": ">= 0.10"
14843 14894
       }
14844 14895
     },
14896
+<<<<<<< HEAD
14897
+=======
14898
+    "node_modules/proxy-from-env": {
14899
+      "version": "1.1.0",
14900
+      "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
14901
+      "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
14902
+    },
14903
+>>>>>>> Prawject_UserSt1
14845 14904
     "node_modules/prr": {
14846 14905
       "version": "1.0.1",
14847 14906
       "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
@@ -15044,7 +15103,10 @@
15044 15103
       "version": "18.1.0",
15045 15104
       "resolved": "https://registry.npmjs.org/react/-/react-18.1.0.tgz",
15046 15105
       "integrity": "sha512-4oL8ivCz5ZEPyclFQXaNksK3adutVS8l2xzZU0cqEFrE9Sb7fC0EFK5uEk74wIreL1DERyjvsU915j1pcT2uEQ==",
15106
+<<<<<<< HEAD
15047 15107
       "license": "MIT",
15108
+=======
15109
+>>>>>>> Prawject_UserSt1
15048 15110
       "dependencies": {
15049 15111
         "loose-envify": "^1.1.0"
15050 15112
       },
@@ -15518,6 +15580,39 @@
15518 15580
         "node": ">=0.10.0"
15519 15581
       }
15520 15582
     },
15583
+<<<<<<< HEAD
15584
+=======
15585
+    "node_modules/react-router": {
15586
+      "version": "6.5.0",
15587
+      "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.5.0.tgz",
15588
+      "integrity": "sha512-fqqUSU0NC0tSX0sZbyuxzuAzvGqbjiZItBQnyicWlOUmzhAU8YuLgRbaCL2hf3sJdtRy4LP/WBrWtARkMvdGPQ==",
15589
+      "dependencies": {
15590
+        "@remix-run/router": "1.1.0"
15591
+      },
15592
+      "engines": {
15593
+        "node": ">=14"
15594
+      },
15595
+      "peerDependencies": {
15596
+        "react": ">=16.8"
15597
+      }
15598
+    },
15599
+    "node_modules/react-router-dom": {
15600
+      "version": "6.5.0",
15601
+      "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.5.0.tgz",
15602
+      "integrity": "sha512-/XzRc5fq80gW1ctiIGilyKFZC/j4kfe75uivMsTChFbkvrK4ZrF3P3cGIc1f/SSkQ4JiJozPrf+AwUHHWVehVg==",
15603
+      "dependencies": {
15604
+        "@remix-run/router": "1.1.0",
15605
+        "react-router": "6.5.0"
15606
+      },
15607
+      "engines": {
15608
+        "node": ">=14"
15609
+      },
15610
+      "peerDependencies": {
15611
+        "react": ">=16.8",
15612
+        "react-dom": ">=16.8"
15613
+      }
15614
+    },
15615
+>>>>>>> Prawject_UserSt1
15521 15616
     "node_modules/react-shallow-renderer": {
15522 15617
       "version": "16.15.0",
15523 15618
       "resolved": "https://registry.npmjs.org/react-shallow-renderer/-/react-shallow-renderer-16.15.0.tgz",
@@ -22993,6 +23088,14 @@
22993 23088
       "resolved": "https://registry.npmjs.org/@react-native/polyfills/-/polyfills-2.0.0.tgz",
22994 23089
       "integrity": "sha512-K0aGNn1TjalKj+65D7ycc1//H9roAQ51GJVk5ZJQFb2teECGmzd86bYDC0aYdbRf7gtovescq4Zt6FR0tgXiHQ=="
22995 23090
     },
23091
+<<<<<<< HEAD
23092
+=======
23093
+    "@remix-run/router": {
23094
+      "version": "1.1.0",
23095
+      "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.1.0.tgz",
23096
+      "integrity": "sha512-rGl+jH/7x1KBCQScz9p54p0dtPLNeKGb3e0wD2H5/oZj41bwQUnXdzbj2TbUAFhvD7cp9EyEQA4dEgpUFa1O7Q=="
23097
+    },
23098
+>>>>>>> Prawject_UserSt1
22996 23099
     "@segment/loosely-validate-event": {
22997 23100
       "version": "2.0.0",
22998 23101
       "resolved": "https://registry.npmjs.org/@segment/loosely-validate-event/-/loosely-validate-event-2.0.0.tgz",
@@ -23899,6 +24002,31 @@
23899 24002
       "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
23900 24003
       "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg=="
23901 24004
     },
24005
+<<<<<<< HEAD
24006
+=======
24007
+    "axios": {
24008
+      "version": "1.2.1",
24009
+      "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.1.tgz",
24010
+      "integrity": "sha512-I88cFiGu9ryt/tfVEi4kX2SITsvDddTajXTOFmt2uK1ZVA8LytjtdeyefdQWEf5PU8w+4SSJDoYnggflB5tW4A==",
24011
+      "requires": {
24012
+        "follow-redirects": "^1.15.0",
24013
+        "form-data": "^4.0.0",
24014
+        "proxy-from-env": "^1.1.0"
24015
+      },
24016
+      "dependencies": {
24017
+        "form-data": {
24018
+          "version": "4.0.0",
24019
+          "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
24020
+          "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
24021
+          "requires": {
24022
+            "asynckit": "^0.4.0",
24023
+            "combined-stream": "^1.0.8",
24024
+            "mime-types": "^2.1.12"
24025
+          }
24026
+        }
24027
+      }
24028
+    },
24029
+>>>>>>> Prawject_UserSt1
23902 24030
     "babel-core": {
23903 24031
       "version": "7.0.0-bridge.0",
23904 24032
       "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-7.0.0-bridge.0.tgz",
@@ -31375,6 +31503,14 @@
31375 31503
         "ipaddr.js": "1.9.1"
31376 31504
       }
31377 31505
     },
31506
+<<<<<<< HEAD
31507
+=======
31508
+    "proxy-from-env": {
31509
+      "version": "1.1.0",
31510
+      "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
31511
+      "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
31512
+    },
31513
+>>>>>>> Prawject_UserSt1
31378 31514
     "prr": {
31379 31515
       "version": "1.0.1",
31380 31516
       "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
@@ -31892,6 +32028,26 @@
31892 32028
       "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.4.3.tgz",
31893 32029
       "integrity": "sha512-Hwln1VNuGl/6bVwnd0Xdn1e84gT/8T9aYNL+HAKDArLCS7LWjwr7StE30IEYbIkx0Vi3vs+coQxe+SQDbGbbpA=="
31894 32030
     },
32031
+<<<<<<< HEAD
32032
+=======
32033
+    "react-router": {
32034
+      "version": "6.5.0",
32035
+      "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.5.0.tgz",
32036
+      "integrity": "sha512-fqqUSU0NC0tSX0sZbyuxzuAzvGqbjiZItBQnyicWlOUmzhAU8YuLgRbaCL2hf3sJdtRy4LP/WBrWtARkMvdGPQ==",
32037
+      "requires": {
32038
+        "@remix-run/router": "1.1.0"
32039
+      }
32040
+    },
32041
+    "react-router-dom": {
32042
+      "version": "6.5.0",
32043
+      "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.5.0.tgz",
32044
+      "integrity": "sha512-/XzRc5fq80gW1ctiIGilyKFZC/j4kfe75uivMsTChFbkvrK4ZrF3P3cGIc1f/SSkQ4JiJozPrf+AwUHHWVehVg==",
32045
+      "requires": {
32046
+        "@remix-run/router": "1.1.0",
32047
+        "react-router": "6.5.0"
32048
+      }
32049
+    },
32050
+>>>>>>> Prawject_UserSt1
31895 32051
     "react-shallow-renderer": {
31896 32052
       "version": "16.15.0",
31897 32053
       "resolved": "https://registry.npmjs.org/react-shallow-renderer/-/react-shallow-renderer-16.15.0.tgz",

+ 14
- 0
package.json View File

@@ -11,18 +11,32 @@
11 11
   "dependencies": {
12 12
     "@expo/webpack-config": "^0.17.2",
13 13
     "@react-native-picker/picker": "^2.4.8",
14
+<<<<<<< HEAD
15
+=======
16
+    "axios": "^1.2.1",
17
+>>>>>>> Prawject_UserSt1
14 18
     "danfojs": "^1.1.2",
15 19
     "expo": "^47.0.6",
16 20
     "expo-font": "~11.0.1",
17 21
     "expo-splash-screen": "~0.17.5",
18 22
     "expo-status-bar": "~1.4.2",
19 23
     "json2csv": "^5.0.7",
24
+<<<<<<< HEAD
20 25
     "react": "18.1.0",
21 26
     "react-dom": "18.1.0",
22 27
     "react-native": "0.70.5",
23 28
     "react-native-dropdown-picker": "^5.4.3",
24 29
     "react-native-element-dropdown": "^2.5.0",
25 30
     "react-native-web": "~0.18.9"
31
+=======
32
+    "react": "^18.1.0",
33
+    "react-dom": "^18.1.0",
34
+    "react-native": "0.70.5",
35
+    "react-native-dropdown-picker": "^5.4.3",
36
+    "react-native-element-dropdown": "^2.5.0",
37
+    "react-native-web": "~0.18.9",
38
+    "react-router-dom": "^6.5.0"
39
+>>>>>>> Prawject_UserSt1
26 40
   },
27 41
   "devDependencies": {
28 42
     "@babel/core": "^7.19.3"

+ 11175
- 4
yarn.lock
File diff suppressed because it is too large
View File