Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Why does consulting a json file take so long on the real device and on the emulator is immediate?

$
0
0

I execute a query to a json file through the fetch function and in the emulator the result is immediate, it takes a century on the real device (motorola one vision) to give results.

What can it be? I isolated the code in a project from scratch to see and the problem really is in the type of query.

Could it be some gradlew configuration when generating the APK?

Thank you in advance!

import React, { useState } from 'react';import {    View,    Text,    ActivityIndicator} from 'react-native';export default () => {          const [status, setStatus] = useState(false);    fetch('https://senhor.app/trilhas/restaurantes.json').then(data => setStatus(true));    return (<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}><Text>Funcional</Text>            {                status                ?   <Text>Carregou</Text>                : <ActivityIndicator size="large" color="#00ff00" />            }</View>    );}

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>