import React, { Component, useEffect, useState } from "react"; import { StatusBar, View, ScrollView, Linking, Text } from "react-native"; import Constants from "expo-constants"; import { ListItem } from "react-native-elements"; import Icon from "react-native-vector-icons/Entypo"; import StatusbarDetect from "./StatusbarDetect"; var Status = StatusbarDetect(); let a = []; export default function TestArea(props) { const [data, setdata] = useState(null); useEffect(() => { data == null ? test().then((res) => { //console.log(res); setdata(res); }) : null; }, [data]); return ( {Status} TEST AREA!! {data} ); } async function test() { return fetch("https://train.jr-shikoku.co.jp/g?arg1=train&arg2=train", { headers: { authority: "train.jr-shikoku.co.jp", "cache-control": "no-cache", pragma: "no-cache", "if-modified-since": "Thu, 01 Jun 1970 00:00:00 GMT", accept: "*/*", "sec-fetch-site": "same-origin", "sec-fetch-mode": "cors", referer: "https://train.jr-shikoku.co.jp/sp.html", }, }) .then((res) => res.json()) .then((D) => { let d = []; D.forEach((element) => { console.log(element); d.push( ); }); a = d; return d; }); }