Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

104
Views
La aplicación Expo React-Native no muestra datos de ApiCall

Estoy probando react-native por primera vez e hice una simple llamada de API a una API web principal de asp.net:

 import React, {Component} from 'react'; import axios from 'axios'; import {View, Text} from 'react-native'; import { FlatList } from 'react-native-gesture-handler'; class ApiCalls extends Component{ constructor(props){ super(props); this.state = { data: [ ] }; } async getData(){ const response = await fetch('http://localhost:33255/api/Cities'); const json = await response.json(); this.setState({data: json}) } catch(error){ console.log(error); } componentDidMount(){ this.getData(); } render(){ const {data} = this.state; console.log(data); return( <View> <FlatList data={data} keyExtractor={({ id }, index) => id} renderItem={({ item }) =>( <Text>{item.citiesId}, {item.cityName}, {item.zipCode}</Text> )} > </FlatList> </View> ) } } export default ApiCalls;

Así que puedo obtener los datos en el navegador web de la exposición: ingrese la descripción de la imagen aquí

Pero mi aplicación expo en mi teléfono no muestra los datos y recibo el siguiente mensaje de error: "Possible unhandled Promise Rejection (id 0):" "The operation couldn't be completed. Socket is not connected"

¿Alguna sugerencia sobre cómo puedo mostrar los datos en la aplicación de la exposición?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!