import React, { useEffect, useState } from "react"; import { ActivityIndicator, FlatList, View, Text, StyleSheet, TouchableOpacity, } from "react-native"; const Lista = () => { const [isLoading, setLoading] = useState(true); const [data, setData] = useState([]); const getComplaints = async () => { try { const response = await fetch("http://192.168.7.178:5001/complaints/all"); const json = await response.json(); setData(json.Complaints); } catch (error) { console.error(error); } finally { setLoading(false); } }; useEffect(() => { getComplaints(); }, []); return ( {isLoading ? ( ) : ( id} renderItem={({ item }) => ( ID:{item.id}, Tipo de denuncia: {item.complaint_type}, Hecha por:{" "} {item.name}, en el lugar: {item.place}, descripcion del problema:{" "} {item.complaint_description}, estatus:{"En espera"} )} /> )} ); }; export default Lista;