|
@@ -4,11 +4,12 @@ import {View, Text, FlatList} from 'react-native';
|
4
|
4
|
//data display
|
5
|
5
|
export default function Noticias() {
|
6
|
6
|
const [users,setUsers] = useState([]);
|
7
|
|
-
|
|
7
|
+
|
8
|
8
|
useEffect(()=>{
|
9
|
9
|
fetchData()
|
10
|
10
|
},[]);
|
11
|
|
-
|
|
11
|
+
|
|
12
|
+ //Busca la informacion en la base de datos
|
12
|
13
|
const fetchData = () => {
|
13
|
14
|
//fetch('https://ada.uprrp.edu/~luis.ortiz79/api/users/',{
|
14
|
15
|
fetch('http://localhost/apicenso/users/')
|
|
@@ -20,7 +21,8 @@ export default function Noticias() {
|
20
|
21
|
})
|
21
|
22
|
.catch(error => console.log(error))
|
22
|
23
|
}
|
23
|
|
-
|
|
24
|
+
|
|
25
|
+ //Es donde va a desplegar la informacion de la base de datos
|
24
|
26
|
const renderUser = ({item}) => {
|
25
|
27
|
return (
|
26
|
28
|
<View style={{margin:10,borderWidth:0.5,padding:10}}>
|
|
@@ -32,6 +34,7 @@ export default function Noticias() {
|
32
|
34
|
</View>
|
33
|
35
|
)
|
34
|
36
|
}
|
|
37
|
+
|
35
|
38
|
return (
|
36
|
39
|
<View style={{flex:1,backgroundColor:"white"}}>
|
37
|
40
|
<FlatList
|
|
@@ -41,4 +44,4 @@ export default function Noticias() {
|
41
|
44
|
/>
|
42
|
45
|
</View>
|
43
|
46
|
)
|
44
|
|
-}
|
|
47
|
+}
|