import React, { useContext, useEffect, useState } from "react"; import { MaterialCommunityIcons } from '@expo/vector-icons'; import { UserContext } from "../context/UserContext"; import { API } from "../environment/api"; import { Box, Button, Center, FormControl, Heading, ScrollView, VStack,FlatList, HStack,Avatar,Spacer,Text } from "native-base"; export default function Invitados({navigation}) { const [isRequesting, setIsRequesting] = useState(false); const [invitados, setInvitados] = useState([]); const { user } = useContext(UserContext); const id = user._id; useEffect(() => { const onRequestInvitadosData = async () => { setIsRequesting(true); try { const jsonResponse = await fetch(`${API.BASE_URL}/guest/findGuestUser/`+`${id}`, { method: "GET", headers: { 'Content-Type': 'application/json' } }) const response = await jsonResponse.json(); //console.log(response); setInvitados(response.message); } catch (error) { } setIsRequesting(false) } onRequestInvitadosData() }) return ( Lista de invitados {item.name+" "+item.last_name} {item.dni} {item.phone} {item.number_plate} } keyExtractor={item => item.id} /> ); }