From 2a3fd7774dad894d58b6cb10fc0050af3eebf97f Mon Sep 17 00:00:00 2001 From: harukin-DeskMini Date: Wed, 28 Sep 2022 03:19:04 +0900 Subject: [PATCH] =?UTF-8?q?linter=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- StatusbarDetect.js | 22 +- TestArea.js | 99 +- UpdateAsync.js | 36 +- components/custom-train-data.js | 966 +++++++++------- components/発車時刻表/LED_vidion.js | 597 ++++++---- components/駅名表/Sign.js | 409 +++++-- howto.js | 41 +- menu.js | 1342 ++++++++++++++++------ ndView.js | 36 +- 9 files changed, 2384 insertions(+), 1164 deletions(-) diff --git a/StatusbarDetect.js b/StatusbarDetect.js index e954e55..930d558 100644 --- a/StatusbarDetect.js +++ b/StatusbarDetect.js @@ -1,16 +1,10 @@ -import React from 'react'; -import {Platform, StatusBar, View} from 'react-native'; +import React from "react"; +import { Platform, StatusBar, View } from "react-native"; export default function StatusbarDetect() { - if(Platform.OS == "ios"){ - return ( - - ); - } - else if(Platform.OS == "android"){ - return ( - - ); - } - -} \ No newline at end of file + if (Platform.OS == "ios") { + return ; + } else if (Platform.OS == "android") { + return ; + } +} diff --git a/TestArea.js b/TestArea.js index 00bb082..55b450a 100644 --- a/TestArea.js +++ b/TestArea.js @@ -1,49 +1,74 @@ -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'; +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=[]; +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]) + const [data, setdata] = useState(null); + useEffect(() => { + data == null + ? test().then((res) => { + //console.log(res); + setdata(res); + }) + : null; + }, [data]); return ( - + {Status} - TEST AREA!! - {data} + TEST AREA!! + {data} ); } -async function test(){ - return fetch('https://train.jr-shikoku.co.jp/g?arg1=train&arg2=train', { +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(); + 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; }); - a=d; - return d; - }); -} \ No newline at end of file +} diff --git a/UpdateAsync.js b/UpdateAsync.js index 3e76594..a8cf7f9 100644 --- a/UpdateAsync.js +++ b/UpdateAsync.js @@ -1,11 +1,27 @@ -import { ToastAndroid, } from 'react-native'; -import * as Updates from 'expo-updates'; +import { ToastAndroid } from "react-native"; +import * as Updates from "expo-updates"; -export function UpdateAsync(){ - Updates.checkForUpdateAsync().then(update=>{ - if (update.isAvailable) { - ToastAndroid.showWithGravityAndOffset('アプリのデータを更新しています。',ToastAndroid.LONG,ToastAndroid.BOTTOM,25,50,); - Updates.fetchUpdateAsync().then(()=>Updates.reloadAsync()); - } - }).catch(e=>ToastAndroid.showWithGravityAndOffset(e.toString(),ToastAndroid.LONG,ToastAndroid.BOTTOM,25,50,)) -} \ No newline at end of file +export function UpdateAsync() { + Updates.checkForUpdateAsync() + .then((update) => { + if (update.isAvailable) { + ToastAndroid.showWithGravityAndOffset( + "アプリのデータを更新しています。", + ToastAndroid.LONG, + ToastAndroid.BOTTOM, + 25, + 50 + ); + Updates.fetchUpdateAsync().then(() => Updates.reloadAsync()); + } + }) + .catch((e) => + ToastAndroid.showWithGravityAndOffset( + e.toString(), + ToastAndroid.LONG, + ToastAndroid.BOTTOM, + 25, + 50 + ) + ); +} diff --git a/components/custom-train-data.js b/components/custom-train-data.js index 290ce01..2290532 100644 --- a/components/custom-train-data.js +++ b/components/custom-train-data.js @@ -1,398 +1,586 @@ -export const customTrainDataDetector = (TrainNumber) =>{ - switch(TrainNumber){ - //しおかぜメイン - //8000 ノーマル - case "2M": - case "4M": - case "6M": - case "14M": - case "16M": - case "18M": - case "26M": - case "28M": - case "30M": - case "1M": - case "3M": - case "5M": - case "13M": - case "15M": - case "17M": - case "25M": - case "27M": - case "29M": - return {type:"LTDEXP",trainName:"しおかぜ",trainIcon:'http://www.trainfrontview.net/b/s8000nr.png',trainNumDistance:0,info:"いしづちと併結 / 8000系で運転"}; - //8000 アンパン - case "10M": - case "22M": - case "9M": - case "21M": - return {type:"LTDEXP",trainName:"しおかぜ",trainIcon:'http://www.trainfrontview.net/f/s8000ap.png',trainNumDistance:0,info:"いしづちと併結 / アンパンマン列車で運転"}; - //8600 - case "8M": - case "12M": - case "20M": - case "24M": - case "7M": - case "11M": - case "19M": - case "23M": - return {type:"LTDEXP",trainName:"しおかぜ",trainIcon:'http://www.trainfrontview.net/b/s8600.png',trainNumDistance:0,info:"いしづちと併結 / 8600系で運転"}; - - //いしづちメイン - //8000 ノーマル - - case "1004M": - case "1006M": - case "1014M": - case "1016M": - case "1018M": - case "1026M": - case "1028M": - case "1030M": - case "1001M": - case "1003M": - case "1005M": - case "1013M": - case "1015M": - case "1017M": - case "1025M": - case "1027M": - case "1029M": - return {type:"LTDEXP",trainName:"いしづち",trainIcon:'http://www.trainfrontview.net/b/s8000no.png',trainNumDistance:1000,info:"しおかぜと併結 / 8000系で運転"}; - - //8000 アンパン - case "1010M": - case "1022M": - case "1009M": - case "1021M": - return {type:"LTDEXP",trainName:"いしづち",trainIcon:'http://www.trainfrontview.net/f/s8000ap.png',trainNumDistance:1000,info:"しおかぜと併結 / アンパンマン列車で運転"}; - - //8600 - case "1008M": - case "1012M": - case "1020M": - case "1024M": - case "1007M": - case "1011M": - case "1019M": - case "1023M": - return {type:"LTDEXP",trainName:"いしづち",trainIcon:'http://www.trainfrontview.net/b/s8600_isz.png',trainNumDistance:1000,info:"しおかぜと併結 / 8600系で運転"}; - - //MEXP - //8000 - case "1092M": - return {type:"LTDEXP",trainName:"モーニングEXP高松",trainIcon:'http://www.trainfrontview.net/b/s8000no.png',trainNumDistance:null,info:"8000系で運転"}; - //8600 - case "1091M": - return {type:"LTDEXP",trainName:"モーニングEXP松山",trainIcon:'http://www.trainfrontview.net/b/s8600_isz.png',trainNumDistance:null,info:"8600系で運転"}; - //三桁いしづち - //8000 アンパン - case "1041M": - case "1044M": - return {type:"LTDEXP",trainName:"いしづち",trainIcon:'http://www.trainfrontview.net/f/s8000ap.png',trainNumDistance:940,info:"アンパンマン列車で運転"}; - //8600 - case "1043M": - case "1042M": - case "1046M": - return {type:"LTDEXP",trainName:"いしづち",trainIcon:'http://www.trainfrontview.net/b/s8600_isz.png',trainNumDistance:940,info:"8600系で運転"}; - - //南風 2700ノーマル - case "34D": - case "38D": - case "40D": - case "42D": - case "46D": - case "50D": - case "52D": - case "54D": - case "58D": - case "31D": - case "35D": - case "39D": - case "41D": - case "43D": - case "47D": - case "51D": - case "53D": - case "55D": - return {type:"LTDEXP",trainName:"南風",trainIcon:'http://www.trainfrontview.net/b/s2700.png',trainNumDistance:30,info:"2700系で運転"}; - //2700アンパン - case "32D": - case "36D": - case "44D": - case "48D": - case "56D": - case "33D": - case "37D": - case "45D": - case "49D": - case "57D": - return {type:"LTDEXP",trainName:"南風",trainIcon:'http://www.trainfrontview.net/f/s2700apr.png',trainNumDistance:30,info:"アンパンマン列車で運転"}; - break; - - - - //うずしお - //2700 - case "5006D": - case "5022D": - case "5013D": - case "5029D": - return {type:"LTDEXP",trainName:"うずしお",trainIcon:'http://www.trainfrontview.net/b/s2700_uzu.png',trainNumDistance:5000,info:"南風と宇多津で併結 / 高松-宇多津間進行方向逆転 / 2700系で運転"}; - case "3002D": - case "3004D": - case "3010D": - case "3012D": - case "3016D": - case "3018D": - case "3024D": - case "3028D": - case "3030D": - case "3003D": - case "3005D": - case "3007D": - case "3015D": - case "3019D": - case "3021D": - case "3025D": - case "3027D": - case "3031D": - case "3033D": - return {type:"LTDEXP",trainName:"うずしお",trainIcon:'http://www.trainfrontview.net/b/s2700_uzu.png',trainNumDistance:3000,info:"2700系で運転"}; - - //2600 - case "3008D": - case "3014D": - case "3020D": - case "3026D": - case "3001D": - case "3011D": - case "3017D": - case "3023D": - return {type:"LTDEXP",trainName:"うずしお",trainIcon:'http://www.trainfrontview.net/b/s2600.png',trainNumDistance:3000,info:"2600系で運転"}; - - //キハ185 - case "3009D": - case "3032D": - return {type:"LTDEXP",trainName:"うずしお",trainIcon:'http://www.trainfrontview.net/b/s185tu_uzu.png',trainNumDistance:3000,info:"キハ185系で運転"}; - - //マリンライナー - case "3104M": - case "3106M": - case "3108M": - case "3110M": - case "3112M": - case "3114M": - case "3116M": - case "3118M": - case "3120M": - case "3122M": - case "3124M": - case "3126M": - case "3128M": - case "3130M": - case "3132M": - case "3134M": - case "3136M": - case "3138M": - case "3140M": - case "3142M": - case "3144M": - case "3146M": - case "3148M": - case "3150M": - case "3152M": - case "3154M": - case "3156M": - case "3158M": - case "3160M": - case "3162M": - case "3164M": - case "3166M": - case "3168M": - case "3170M": - case "3105M": - case "3107M": - case "3109M": - case "3111M": - case "3113M": - case "3115M": - case "3117M": - case "3119M": - case "3121M": - case "3123M": - case "3125M": - case "3127M": - case "3129M": - case "3131M": - case "3133M": - case "3135M": - case "3137M": - case "3139M": - case "3141M": - case "3143M": - case "3145M": - case "3147M": - case "3149M": - case "3151M": - case "3153M": - case "3155M": - case "3157M": - case "3159M": - case "3161M": - case "3163M": - case "3165M": - case "3167M": - case "3169M": - case "3175M": - return {type:"Rapid",trainName:"マリンライナー",trainIcon:'http://www.trainfrontview.net/b/s5001.png',trainNumDistance:3100,info:""}; - case "3102M": - case "3101M": - case "3103M": - case "3171M": - case "3173M": - return {type:"Rapid",trainName:"マリンライナー",trainIcon:'http://www.trainfrontview.net/b/s5001k.png',trainNumDistance:3100,info:""}; - - //サンライズ瀬戸 - case "5032M": - case "5031M": - return {type:"NightLTDEXP",trainName:"サンライズ瀬戸",trainIcon:'http://www.trainfrontview.net/b/w285.png',trainNumDistance:null,info:""}; - case "8041M": //琴平延長高松迄 - case "8031M": //琴平延長高松以降 - return {type:"NightLTDEXP",trainName:"サンライズ瀬戸",trainIcon:'http://www.trainfrontview.net/b/w285.png',trainNumDistance:null,info:"琴平延長運転日"}; - - //宇和海 - //2000 ノーマル - case "1052D": - case "1056D": - case "1058D": - case "1064D": - case "1070D": - case "1074D": - case "1076D": - case "1078D": - case "1080D": - case "1082D": - case "1051D": - case "1059D": - case "1065D": - case "1069D": - case "1071D": - case "1073D": - case "1075D": - case "1077D": - case "1079D": - case "1053D": - return {type:"LTDEXP",trainName:"宇和海",trainIcon:'http://www.trainfrontview.net/b/s2000_uwa.png',trainNumDistance:1050,info:"2000系で運転"}; - //2000 アンパン込み - case "1054D": - case "1060D": - case "1062D": - case "1066D": - case "1068D": - case "1072D": - case "1055D": - case "1057D": - case "1061D": - case "1063D": - case "1067D": - case "1081D": - return {type:"LTDEXP",trainName:"宇和海",trainIcon:'http://www.trainfrontview.net/f/s2002a.png',trainNumDistance:1050,info:"アンパン列車で運転"}; - //しまんと - case "2002D": - case "2004D": - case "2006D": - case "2008D": - case "2001D": - case "2003D": - case "2005D": - case "2007D": - return {type:"LTDEXP",trainName:"しまんと",trainIcon:'http://www.trainfrontview.net/b/s2700_smn.png',trainNumDistance:2000,info:"2700系で運転"}; - - //あしずり 2000 - case "2074D": - case "2076D": - case "2080D": - case "2084D": - case "2086D": - case "2071D": - case "2075D": - case "2077D": - case "2081D": - case "2083D": - return {type:"LTDEXP",trainName:"あしずり",trainIcon:'http://www.trainfrontview.net/b/s2000_asi.png',trainNumDistance:2070,info:"2000系で運転"}; +export const customTrainDataDetector = (TrainNumber) => { + switch (TrainNumber) { + //しおかぜメイン + //8000 ノーマル + case "2M": + case "4M": + case "6M": + case "14M": + case "16M": + case "18M": + case "26M": + case "28M": + case "30M": + case "1M": + case "3M": + case "5M": + case "13M": + case "15M": + case "17M": + case "25M": + case "27M": + case "29M": + return { + type: "LTDEXP", + trainName: "しおかぜ", + trainIcon: "http://www.trainfrontview.net/b/s8000nr.png", + trainNumDistance: 0, + info: "いしづちと併結 / 8000系で運転", + }; + //8000 アンパン + case "10M": + case "22M": + case "9M": + case "21M": + return { + type: "LTDEXP", + trainName: "しおかぜ", + trainIcon: "http://www.trainfrontview.net/f/s8000ap.png", + trainNumDistance: 0, + info: "いしづちと併結 / アンパンマン列車で運転", + }; + //8600 + case "8M": + case "12M": + case "20M": + case "24M": + case "7M": + case "11M": + case "19M": + case "23M": + return { + type: "LTDEXP", + trainName: "しおかぜ", + trainIcon: "http://www.trainfrontview.net/b/s8600.png", + trainNumDistance: 0, + info: "いしづちと併結 / 8600系で運転", + }; - - //あしずり 2700 - case "2078D": - case "2082D": - case "2088D": - case "2073D": - case "2079D": - case "2085D": - case "2072D": - return {type:"LTDEXP",trainName:"あしずり",trainIcon:'http://www.trainfrontview.net/b/s2700_asi.png',trainNumDistance:2070,info:"2700系で運転"}; + //いしづちメイン + //8000 ノーマル - //剣山 - case "4002D": - case "4004D": - case "4006D": - case "4008D": - case "4010D": - case "4001D": - case "4003D": - case "4005D": - case "4007D": - case "4009D": - case "4011D": - return {type:"LTDEXP",trainName:"剣山",trainIcon:'http://www.trainfrontview.net/b/s185tu.png',trainNumDistance:4000,info:"キハ185系で運転"}; + case "1004M": + case "1006M": + case "1014M": + case "1016M": + case "1018M": + case "1026M": + case "1028M": + case "1030M": + case "1001M": + case "1003M": + case "1005M": + case "1013M": + case "1015M": + case "1017M": + case "1025M": + case "1027M": + case "1029M": + return { + type: "LTDEXP", + trainName: "いしづち", + trainIcon: "http://www.trainfrontview.net/b/s8000no.png", + trainNumDistance: 1000, + info: "しおかぜと併結 / 8000系で運転", + }; - //むろと - case "5051D": - case "5052D": - return {type:"LTDEXP",trainName:"むろと",trainIcon:'http://www.trainfrontview.net/b/s185_mrt.png',trainNumDistance:5050,info:"キハ185系で運転"}; + //8000 アンパン + case "1010M": + case "1022M": + case "1009M": + case "1021M": + return { + type: "LTDEXP", + trainName: "いしづち", + trainIcon: "http://www.trainfrontview.net/f/s8000ap.png", + trainNumDistance: 1000, + info: "しおかぜと併結 / アンパンマン列車で運転", + }; - - - //よしのがわトロッコ - case "8452D": - case "8451D": - return {type:"LTDEXP",trainName:"よしのがわトロッコ",trainIcon:'http://www.trainfrontview.net/f/s185to_ai.png',trainNumDistance:null,info:""}; + //8600 + case "1008M": + case "1012M": + case "1020M": + case "1024M": + case "1007M": + case "1011M": + case "1019M": + case "1023M": + return { + type: "LTDEXP", + trainName: "いしづち", + trainIcon: "http://www.trainfrontview.net/b/s8600_isz.png", + trainNumDistance: 1000, + info: "しおかぜと併結 / 8600系で運転", + }; - - //岡山高松アントロ - case "8176D": - case "8179D": - //岡山琴平アントロ - case "8277D": - case "8278D": - return {type:"LTDEXP",trainName:"アンパンマントロッコ",trainIcon:'http://www.trainfrontview.net/f/s32to4.png',trainNumDistance:null,info:""}; + //MEXP + //8000 + case "1092M": + return { + type: "LTDEXP", + trainName: "モーニングEXP高松", + trainIcon: "http://www.trainfrontview.net/b/s8000no.png", + trainNumDistance: null, + info: "8000系で運転", + }; + //8600 + case "1091M": + return { + type: "LTDEXP", + trainName: "モーニングEXP松山", + trainIcon: "http://www.trainfrontview.net/b/s8600_isz.png", + trainNumDistance: null, + info: "8600系で運転", + }; + //三桁いしづち + //8000 アンパン + case "1041M": + case "1044M": + return { + type: "LTDEXP", + trainName: "いしづち", + trainIcon: "http://www.trainfrontview.net/f/s8000ap.png", + trainNumDistance: 940, + info: "アンパンマン列車で運転", + }; + //8600 + case "1043M": + case "1042M": + case "1046M": + return { + type: "LTDEXP", + trainName: "いしづち", + trainIcon: "http://www.trainfrontview.net/b/s8600_isz.png", + trainNumDistance: 940, + info: "8600系で運転", + }; - - //伊予灘ものがたり - case "8901D": - case "8903D": - case "8902D": - case "8904D": - return {type:"LTDEXP",trainName:"伊予灘ものがたり",trainIcon:'http://www.trainfrontview.net/b/s185iyoy.png',trainNumDistance:null,info:""}; + //南風 2700ノーマル + case "34D": + case "38D": + case "40D": + case "42D": + case "46D": + case "50D": + case "52D": + case "54D": + case "58D": + case "31D": + case "35D": + case "39D": + case "41D": + case "43D": + case "47D": + case "51D": + case "53D": + case "55D": + return { + type: "LTDEXP", + trainName: "南風", + trainIcon: "http://www.trainfrontview.net/b/s2700.png", + trainNumDistance: 30, + info: "2700系で運転", + }; + //2700アンパン + case "32D": + case "36D": + case "44D": + case "48D": + case "56D": + case "33D": + case "37D": + case "45D": + case "49D": + case "57D": + return { + type: "LTDEXP", + trainName: "南風", + trainIcon: "http://www.trainfrontview.net/f/s2700apr.png", + trainNumDistance: 30, + info: "アンパンマン列車で運転", + }; + break; - - - //千年ものがたり - case "8011D": - case "8012D": - return {type:"LTDEXP",trainName:"四国まんなか千年ものがたり",trainIcon:'http://www.trainfrontview.net/b/s185mm1.png',trainNumDistance:null,info:""}; + //うずしお + //2700 + case "5006D": + case "5022D": + case "5013D": + case "5029D": + return { + type: "LTDEXP", + trainName: "うずしお", + trainIcon: "http://www.trainfrontview.net/b/s2700_uzu.png", + trainNumDistance: 5000, + info: "南風と宇多津で併結 / 高松-宇多津間進行方向逆転 / 2700系で運転", + }; + case "3002D": + case "3004D": + case "3010D": + case "3012D": + case "3016D": + case "3018D": + case "3024D": + case "3028D": + case "3030D": + case "3003D": + case "3005D": + case "3007D": + case "3015D": + case "3019D": + case "3021D": + case "3025D": + case "3027D": + case "3031D": + case "3033D": + return { + type: "LTDEXP", + trainName: "うずしお", + trainIcon: "http://www.trainfrontview.net/b/s2700_uzu.png", + trainNumDistance: 3000, + info: "2700系で運転", + }; - - //夜明けものがたり - case "8053D": - case "8054D": - case "8062D": - case "8063D": - return {type:"LTDEXP",trainName:"時代の夜明けのものがたり",trainIcon:'http://www.trainfrontview.net/b/s185ym1.png',trainNumDistance:null,info:""}; + //2600 + case "3008D": + case "3014D": + case "3020D": + case "3026D": + case "3001D": + case "3011D": + case "3017D": + case "3023D": + return { + type: "LTDEXP", + trainName: "うずしお", + trainIcon: "http://www.trainfrontview.net/b/s2600.png", + trainNumDistance: 3000, + info: "2600系で運転", + }; - default: - return {type:"Normal",trainName:"",trainIcon:null,trainNumDistance:null,info:null}; - break; - } -} \ No newline at end of file + //キハ185 + case "3009D": + case "3032D": + return { + type: "LTDEXP", + trainName: "うずしお", + trainIcon: "http://www.trainfrontview.net/b/s185tu_uzu.png", + trainNumDistance: 3000, + info: "キハ185系で運転", + }; + + //マリンライナー + case "3104M": + case "3106M": + case "3108M": + case "3110M": + case "3112M": + case "3114M": + case "3116M": + case "3118M": + case "3120M": + case "3122M": + case "3124M": + case "3126M": + case "3128M": + case "3130M": + case "3132M": + case "3134M": + case "3136M": + case "3138M": + case "3140M": + case "3142M": + case "3144M": + case "3146M": + case "3148M": + case "3150M": + case "3152M": + case "3154M": + case "3156M": + case "3158M": + case "3160M": + case "3162M": + case "3164M": + case "3166M": + case "3168M": + case "3170M": + case "3105M": + case "3107M": + case "3109M": + case "3111M": + case "3113M": + case "3115M": + case "3117M": + case "3119M": + case "3121M": + case "3123M": + case "3125M": + case "3127M": + case "3129M": + case "3131M": + case "3133M": + case "3135M": + case "3137M": + case "3139M": + case "3141M": + case "3143M": + case "3145M": + case "3147M": + case "3149M": + case "3151M": + case "3153M": + case "3155M": + case "3157M": + case "3159M": + case "3161M": + case "3163M": + case "3165M": + case "3167M": + case "3169M": + case "3175M": + return { + type: "Rapid", + trainName: "マリンライナー", + trainIcon: "http://www.trainfrontview.net/b/s5001.png", + trainNumDistance: 3100, + info: "", + }; + case "3102M": + case "3101M": + case "3103M": + case "3171M": + case "3173M": + return { + type: "Rapid", + trainName: "マリンライナー", + trainIcon: "http://www.trainfrontview.net/b/s5001k.png", + trainNumDistance: 3100, + info: "", + }; + + //サンライズ瀬戸 + case "5032M": + case "5031M": + return { + type: "NightLTDEXP", + trainName: "サンライズ瀬戸", + trainIcon: "http://www.trainfrontview.net/b/w285.png", + trainNumDistance: null, + info: "", + }; + case "8041M": //琴平延長高松迄 + case "8031M": //琴平延長高松以降 + return { + type: "NightLTDEXP", + trainName: "サンライズ瀬戸", + trainIcon: "http://www.trainfrontview.net/b/w285.png", + trainNumDistance: null, + info: "琴平延長運転日", + }; + + //宇和海 + //2000 ノーマル + case "1052D": + case "1056D": + case "1058D": + case "1064D": + case "1070D": + case "1074D": + case "1076D": + case "1078D": + case "1080D": + case "1082D": + case "1051D": + case "1059D": + case "1065D": + case "1069D": + case "1071D": + case "1073D": + case "1075D": + case "1077D": + case "1079D": + case "1053D": + return { + type: "LTDEXP", + trainName: "宇和海", + trainIcon: "http://www.trainfrontview.net/b/s2000_uwa.png", + trainNumDistance: 1050, + info: "2000系で運転", + }; + //2000 アンパン込み + case "1054D": + case "1060D": + case "1062D": + case "1066D": + case "1068D": + case "1072D": + case "1055D": + case "1057D": + case "1061D": + case "1063D": + case "1067D": + case "1081D": + return { + type: "LTDEXP", + trainName: "宇和海", + trainIcon: "http://www.trainfrontview.net/f/s2002a.png", + trainNumDistance: 1050, + info: "アンパン列車で運転", + }; + //しまんと + case "2002D": + case "2004D": + case "2006D": + case "2008D": + case "2001D": + case "2003D": + case "2005D": + case "2007D": + return { + type: "LTDEXP", + trainName: "しまんと", + trainIcon: "http://www.trainfrontview.net/b/s2700_smn.png", + trainNumDistance: 2000, + info: "2700系で運転", + }; + + //あしずり 2000 + case "2074D": + case "2076D": + case "2080D": + case "2084D": + case "2086D": + case "2071D": + case "2075D": + case "2077D": + case "2081D": + case "2083D": + return { + type: "LTDEXP", + trainName: "あしずり", + trainIcon: "http://www.trainfrontview.net/b/s2000_asi.png", + trainNumDistance: 2070, + info: "2000系で運転", + }; + + //あしずり 2700 + case "2078D": + case "2082D": + case "2088D": + case "2073D": + case "2079D": + case "2085D": + case "2072D": + return { + type: "LTDEXP", + trainName: "あしずり", + trainIcon: "http://www.trainfrontview.net/b/s2700_asi.png", + trainNumDistance: 2070, + info: "2700系で運転", + }; + + //剣山 + case "4002D": + case "4004D": + case "4006D": + case "4008D": + case "4010D": + case "4001D": + case "4003D": + case "4005D": + case "4007D": + case "4009D": + case "4011D": + return { + type: "LTDEXP", + trainName: "剣山", + trainIcon: "http://www.trainfrontview.net/b/s185tu.png", + trainNumDistance: 4000, + info: "キハ185系で運転", + }; + + //むろと + case "5051D": + case "5052D": + return { + type: "LTDEXP", + trainName: "むろと", + trainIcon: "http://www.trainfrontview.net/b/s185_mrt.png", + trainNumDistance: 5050, + info: "キハ185系で運転", + }; + + //よしのがわトロッコ + case "8452D": + case "8451D": + return { + type: "LTDEXP", + trainName: "よしのがわトロッコ", + trainIcon: "http://www.trainfrontview.net/f/s185to_ai.png", + trainNumDistance: null, + info: "", + }; + + //岡山高松アントロ + case "8176D": + case "8179D": + //岡山琴平アントロ + case "8277D": + case "8278D": + return { + type: "LTDEXP", + trainName: "アンパンマントロッコ", + trainIcon: "http://www.trainfrontview.net/f/s32to4.png", + trainNumDistance: null, + info: "", + }; + + //伊予灘ものがたり + case "8901D": + case "8903D": + case "8902D": + case "8904D": + return { + type: "LTDEXP", + trainName: "伊予灘ものがたり", + trainIcon: "http://www.trainfrontview.net/b/s185iyoy.png", + trainNumDistance: null, + info: "", + }; + + //千年ものがたり + case "8011D": + case "8012D": + return { + type: "LTDEXP", + trainName: "四国まんなか千年ものがたり", + trainIcon: "http://www.trainfrontview.net/b/s185mm1.png", + trainNumDistance: null, + info: "", + }; + + //夜明けものがたり + case "8053D": + case "8054D": + case "8062D": + case "8063D": + return { + type: "LTDEXP", + trainName: "時代の夜明けのものがたり", + trainIcon: "http://www.trainfrontview.net/b/s185ym1.png", + trainNumDistance: null, + info: "", + }; + + default: + return { + type: "Normal", + trainName: "", + trainIcon: null, + trainNumDistance: null, + info: null, + }; + break; + } +}; diff --git a/components/発車時刻表/LED_vidion.js b/components/発車時刻表/LED_vidion.js index 8bf9fc8..5c0c632 100644 --- a/components/発車時刻表/LED_vidion.js +++ b/components/発車時刻表/LED_vidion.js @@ -1,13 +1,24 @@ -import React, { Component, useRef, useState, useEffect } from 'react'; -import {StatusBar,View,LayoutAnimation,ScrollView,Linking,Text,TouchableOpacity } from 'react-native'; -import { Switch } from 'react-native-elements'; -import {widthPercentageToDP as wp, heightPercentageToDP as hp} from 'react-native-responsive-screen'; -import { customTrainDataDetector } from '../custom-train-data'; +import React, { Component, useRef, useState, useEffect } from "react"; +import { + StatusBar, + View, + LayoutAnimation, + ScrollView, + Linking, + Text, + TouchableOpacity, +} from "react-native"; +import { Switch } from "react-native-elements"; +import { + widthPercentageToDP as wp, + heightPercentageToDP as hp, +} from "react-native-responsive-screen"; +import { customTrainDataDetector } from "../custom-train-data"; let diagramData = undefined; /** - * + * * 1-30M しおかぜ * 31-58D 南風 * 1001-1030M いしづち(併結) @@ -35,222 +46,362 @@ let diagramData = undefined; * 9031M サンライズ瀬戸琴平(延長)(臨時?) * 9062D 四国まんなか千年ものがたり(臨時?) */ -export default function LED_vision(props){ - const HeaderConfig = { - headers:{ - 'referer': 'https://train.jr-shikoku.co.jp/sp.html' - } - } - const [trainDiagram,setTrainDiagram] = useState(null); - const [stationDiagram,setStationDiagram] = useState(null); - const [currentTrain, setCurrentTrain] = useState(null); - const [finalSwitch, setFinalSwitch] = useState(false); - const [trainIDSwitch, setTrainIDSwitch] = useState(false); - const [trainDescriptionSwitch, setTrainDescriptionSwitch] = useState(false); - useEffect(()=>{ - fetch('https://train.jr-shikoku.co.jp/g?arg1=station&arg2=traintimeinfo&arg3=dia', HeaderConfig).then(response => response.text()).then(d=>{ - const val = d.replace("[\r\n","").split(',\r\n'); - let returnData = {}; - val.forEach(element =>{ - try{ - let data = JSON.parse(element); - Object.keys(data).forEach( key => returnData[key] = data[key] ); - }catch(e){ - } - }) - return(returnData); - }).then((trainDiagram)=>{ - let returnData = {}; - if(trainDiagram){ - Object.keys(trainDiagram).forEach( key => { - - if(trainDiagram[key].match(props.station.Station_JP) ){ - returnData[key] = trainDiagram[key]; - } - }); - } - setTrainDiagram(trainDiagram); - setStationDiagram(returnData); - - }) - },[]); - const getTime = ()=>{ - const returnData = []; - const date = new Date(); - Object.keys(stationDiagram).forEach((d)=>{ - let a = (() =>{ - let returnData = {}; - stationDiagram[d].split("#").forEach((data)=>{ - if(data.match("着")){ - returnData.lastStation = data.split(",着,")[0]; - } - if(data.match(props.station.Station_JP)){ - if(data.match(",発,")){ - returnData.time = data.split(",発,")[1]; - } - else{ - returnData.time = data.split(",着,")[1]; - returnData.lastStation = "当駅止" - } - - } - }) - return returnData; - })(); - returnData.push({train:d,time:a.time,lastStation:a.lastStation}); - }) - - return (returnData.sort((a,b)=> { - if(parseInt(a.time.split(":")[0]) < parseInt(b.time.split(":")[0])){ - return -1; - } - else if(parseInt(a.time.split(":")[0]) > parseInt(b.time.split(":")[0])){ - return 1; - } - else if(parseInt(a.time.split(":")[1]) < parseInt(b.time.split(":")[1])){ - return -1; - } - else if(parseInt(a.time.split(":")[1]) > parseInt(b.time.split(":")[1])){ - return 1; - } - })) - - }; - const trainTimeAndNumber = stationDiagram != null ? getTime() : null; - useEffect(()=>{ - const getCurrentTrain = () =>fetch("https://train.jr-shikoku.co.jp/g?arg1=train&arg2=train", HeaderConfig).then(response => response.json()).then(d=>d.map(x=>({num:x.TrainNum,delay:x.delay}))).then(d=>setCurrentTrain(d)); - getCurrentTrain(); - const currentTrainInterval = setInterval(()=>getCurrentTrain(),15000) - return ()=>clearInterval(currentTrainInterval); - - },[]) - - const filtering = d => currentTrain.map(m=>m.num).includes(d.train) - console.log(new Date()) - const timeFiltering = d => { - const date = new Date(); - const newDate = new Date(); - let data = d.time.split(":"); - let delay = isNaN(currentTrain.filter(data =>data.num == d.train)[0].delay) ? 0 : currentTrain.filter(data =>data.num == d.train)[0].delay; - - date.setHours(parseInt(data[0])); - date.setMinutes(parseInt(data[1])+parseInt(delay)); - console.log(date); - console.log(newDate) - if(!(newDate > date)){ - return true; - } - - return false; - - } - const finalFiltering = d =>{ - if(finalSwitch){ - return true; - } - else{ - if(d.lastStation == "当駅止"){ - return false; - } - return true; - } - } - return( - - - - - - - 次の列車 - Next Train - - - - - - - {trainTimeAndNumber ? currentTrain && trainTimeAndNumber.filter(filtering).filter(timeFiltering).filter(finalFiltering).map((d,index)=> - [ - - { - if(customTrainDataDetector(d.train).trainName.length > 6){ - return 15; - } - else{ - return 20 - } - })(),color:(()=>{ - switch(customTrainDataDetector(d.train).type){ - case "Rapid": - return "aqua"; - case "LTDEXP": - return "red"; - case "NightLTDEXP": - return "red"; - case "Normal": - return "white"; - - } - })(),fontWeight:"bold"}}>{trainIDSwitch ? d.train : (()=>{ - switch(customTrainDataDetector(d.train).type){ - case "Rapid": - return "快速"; - case "LTDEXP": - return "特急"; - case "NightLTDEXP": - return "寝台特急"; - case "Normal": - return "普通列車"; - } - })()+" "+customTrainDataDetector(d.train).trainName+(()=>{ - if(customTrainDataDetector(d.train).trainNumDistance != null){ - return parseInt(d.train.replace("M","").replace("D","")) - customTrainDataDetector(d.train).trainNumDistance + "号"; - } - else{ - return ""; - } - })()} - - - 4 ? 15 : 20,color:"white",fontWeight:"bold"}}>{d.lastStation} - - - {d.time} - - - {(()=>{ - let data= currentTrain.filter(data=>data.num==d.train)[0].delay; - if(isNaN(data)){ - return data; - } - else if(data == 0){ - return "定刻通り" - } - else{ - return data+"分遅れ" - } - })()} - - ,Boolean(trainDescriptionSwitch) && Boolean(customTrainDataDetector(d.train).info) && - - - > {customTrainDataDetector(d.train).info} - - - ] - ) - : null} - - 種別名 / 列番 - setTrainIDSwitch(!trainIDSwitch)}/> - - 列車情報 - setTrainDescriptionSwitch(!trainDescriptionSwitch)}/> - - 当駅止表示 - setFinalSwitch(!finalSwitch)}/> - - +export default function LED_vision(props) { + const HeaderConfig = { + headers: { + referer: "https://train.jr-shikoku.co.jp/sp.html", + }, + }; + const [trainDiagram, setTrainDiagram] = useState(null); + const [stationDiagram, setStationDiagram] = useState(null); + const [currentTrain, setCurrentTrain] = useState(null); + const [finalSwitch, setFinalSwitch] = useState(false); + const [trainIDSwitch, setTrainIDSwitch] = useState(false); + const [trainDescriptionSwitch, setTrainDescriptionSwitch] = useState(false); + useEffect(() => { + fetch( + "https://train.jr-shikoku.co.jp/g?arg1=station&arg2=traintimeinfo&arg3=dia", + HeaderConfig ) + .then((response) => response.text()) + .then((d) => { + const val = d.replace("[\r\n", "").split(",\r\n"); + let returnData = {}; + val.forEach((element) => { + try { + let data = JSON.parse(element); + Object.keys(data).forEach((key) => (returnData[key] = data[key])); + } catch (e) {} + }); + return returnData; + }) + .then((trainDiagram) => { + let returnData = {}; + if (trainDiagram) { + Object.keys(trainDiagram).forEach((key) => { + if (trainDiagram[key].match(props.station.Station_JP)) { + returnData[key] = trainDiagram[key]; + } + }); + } + setTrainDiagram(trainDiagram); + setStationDiagram(returnData); + }); + }, []); + const getTime = () => { + const returnData = []; + const date = new Date(); + Object.keys(stationDiagram).forEach((d) => { + let a = (() => { + let returnData = {}; + stationDiagram[d].split("#").forEach((data) => { + if (data.match("着")) { + returnData.lastStation = data.split(",着,")[0]; + } + if (data.match(props.station.Station_JP)) { + if (data.match(",発,")) { + returnData.time = data.split(",発,")[1]; + } else { + returnData.time = data.split(",着,")[1]; + returnData.lastStation = "当駅止"; + } + } + }); + return returnData; + })(); + returnData.push({ train: d, time: a.time, lastStation: a.lastStation }); + }); + + return returnData.sort((a, b) => { + if (parseInt(a.time.split(":")[0]) < parseInt(b.time.split(":")[0])) { + return -1; + } else if ( + parseInt(a.time.split(":")[0]) > parseInt(b.time.split(":")[0]) + ) { + return 1; + } else if ( + parseInt(a.time.split(":")[1]) < parseInt(b.time.split(":")[1]) + ) { + return -1; + } else if ( + parseInt(a.time.split(":")[1]) > parseInt(b.time.split(":")[1]) + ) { + return 1; + } + }); + }; + const trainTimeAndNumber = stationDiagram != null ? getTime() : null; + useEffect(() => { + const getCurrentTrain = () => + fetch( + "https://train.jr-shikoku.co.jp/g?arg1=train&arg2=train", + HeaderConfig + ) + .then((response) => response.json()) + .then((d) => d.map((x) => ({ num: x.TrainNum, delay: x.delay }))) + .then((d) => setCurrentTrain(d)); + getCurrentTrain(); + const currentTrainInterval = setInterval(() => getCurrentTrain(), 15000); + return () => clearInterval(currentTrainInterval); + }, []); + + const filtering = (d) => currentTrain.map((m) => m.num).includes(d.train); + console.log(new Date()); + const timeFiltering = (d) => { + const date = new Date(); + const newDate = new Date(); + let data = d.time.split(":"); + let delay = isNaN( + currentTrain.filter((data) => data.num == d.train)[0].delay + ) + ? 0 + : currentTrain.filter((data) => data.num == d.train)[0].delay; + + date.setHours(parseInt(data[0])); + date.setMinutes(parseInt(data[1]) + parseInt(delay)); + console.log(date); + console.log(newDate); + if (!(newDate > date)) { + return true; + } + + return false; + }; + const finalFiltering = (d) => { + if (finalSwitch) { + return true; + } else { + if (d.lastStation == "当駅止") { + return false; + } + return true; + } + }; + return ( + + + + + + 次の列車 + + Next Train + + + + {trainTimeAndNumber + ? currentTrain && + trainTimeAndNumber + .filter(filtering) + .filter(timeFiltering) + .filter(finalFiltering) + .map((d, index) => [ + + + { + if ( + customTrainDataDetector(d.train).trainName.length > 6 + ) { + return 15; + } else { + return 20; + } + })(), + color: (() => { + switch (customTrainDataDetector(d.train).type) { + case "Rapid": + return "aqua"; + case "LTDEXP": + return "red"; + case "NightLTDEXP": + return "red"; + case "Normal": + return "white"; + } + })(), + fontWeight: "bold", + }} + > + {trainIDSwitch + ? d.train + : (() => { + switch (customTrainDataDetector(d.train).type) { + case "Rapid": + return "快速"; + case "LTDEXP": + return "特急"; + case "NightLTDEXP": + return "寝台特急"; + case "Normal": + return "普通列車"; + } + })() + + " " + + customTrainDataDetector(d.train).trainName + + (() => { + if ( + customTrainDataDetector(d.train).trainNumDistance != + null + ) { + return ( + parseInt( + d.train.replace("M", "").replace("D", "") + ) - + customTrainDataDetector(d.train) + .trainNumDistance + + "号" + ); + } else { + return ""; + } + })()} + + + + 4 ? 15 : 20, + color: "white", + fontWeight: "bold", + }} + > + {d.lastStation} + + + + + {d.time} + + + + + {(() => { + let data = currentTrain.filter( + (data) => data.num == d.train + )[0].delay; + if (isNaN(data)) { + return data; + } else if (data == 0) { + return "定刻通り"; + } else { + return data + "分遅れ"; + } + })()} + + + , + Boolean(trainDescriptionSwitch) && + Boolean(customTrainDataDetector(d.train).info) && ( + + + + {" "} + > {customTrainDataDetector(d.train).info} + + + + ), + ]) + : null} + + + 種別名 / 列番 + + setTrainIDSwitch(!trainIDSwitch)} + /> + + + 列車情報 + + + setTrainDescriptionSwitch(!trainDescriptionSwitch) + } + /> + + + 当駅止表示 + + setFinalSwitch(!finalSwitch)} + /> + + + ); } diff --git a/components/駅名表/Sign.js b/components/駅名表/Sign.js index ce77ce5..cbefea4 100644 --- a/components/駅名表/Sign.js +++ b/components/駅名表/Sign.js @@ -1,106 +1,311 @@ -import React, { Component, useRef, useState, useEffect } from 'react'; -import {StatusBar,View,LayoutAnimation,ScrollView,Linking,Text,TouchableOpacity } from 'react-native'; -import {widthPercentageToDP as wp, heightPercentageToDP as hp} from 'react-native-responsive-screen'; +import React, { Component, useRef, useState, useEffect } from "react"; +import { + StatusBar, + View, + LayoutAnimation, + ScrollView, + Linking, + Text, + TouchableOpacity, +} from "react-native"; +import { + widthPercentageToDP as wp, + heightPercentageToDP as hp, +} from "react-native-responsive-screen"; - -export default function Sign(props){ - const {currentStation, originalStationList, oP} = props; - const getPreNextStation = (now) =>{ - const lineList = ["予讃線", "松宇線", "伊予灘線", "土讃線", "窪川線", "高徳線", "徳島線", "鳴門線"]; - let returnData; - lineList.forEach(d=>{ - let cache = originalStationList[d].findIndex( data => data.StationNumber == now.StationNumber); - if(cache != -1){ - returnData = [originalStationList[d][cache-1],originalStationList[d][cache+1]] +export default function Sign(props) { + const { currentStation, originalStationList, oP } = props; + const getPreNextStation = (now) => { + const lineList = [ + "予讃線", + "松宇線", + "伊予灘線", + "土讃線", + "窪川線", + "高徳線", + "徳島線", + "鳴門線", + ]; + let returnData; + lineList.forEach((d) => { + let cache = originalStationList[d].findIndex( + (data) => data.StationNumber == now.StationNumber + ); + if (cache != -1) { + returnData = [ + originalStationList[d][cache - 1], + originalStationList[d][cache + 1], + ]; + } + }); + return returnData; + }; + const [nexPrePosition, setNexPrePosition] = useState(0); + useEffect(() => { + if (currentStation) { + if (currentStation.length > 1) { + let stationCount = setInterval(() => { + LayoutAnimation.easeInEaseOut(); + if (nexPrePosition + 1 == currentStation.length) { + setNexPrePosition(0); + } else { + setNexPrePosition(nexPrePosition + 1); } - - }) - return returnData; - } - const [nexPrePosition, setNexPrePosition] = useState(0); - useEffect(()=>{ - if(currentStation){ - if(currentStation.length > 1){ - let stationCount = setInterval(()=>{ - LayoutAnimation.easeInEaseOut(); - if(nexPrePosition+1 == currentStation.length){ - setNexPrePosition(0) - } - else{ - setNexPrePosition(nexPrePosition+1); - } - - },1000) - return ()=>clearInterval(stationCount); - } - } - },[currentStation]) - return( - !stationName.今.JrHpUrl || Linking.openURL(stationName.今.JrHpUrl)} */onPress={oP}> - - JR - {currentStation.map((d,index,array)=> - { - if(array.length == 1) return 20; - else if(index == 0) return 5; - else if(index == 1) return 35; + }, 1000); + return () => clearInterval(stationCount); + } + } + }, [currentStation]); + return ( + !stationName.今.JrHpUrl || Linking.openURL(stationName.今.JrHpUrl)} */ onPress={ + oP + } + > + + + JR + + {currentStation.map((d, index, array) => ( + { + if (array.length == 1) return 20; + else if (index == 0) return 5; + else if (index == 1) return 35; else return 20; - })()+"%",right:'10%',width:wp("10%"),height:wp("10%"),borderColor:"#2E94BB",borderWidth:parseInt("2%"),borderRadius:parseInt("100%")}} > - - {d.StationNumber} - + })() + "%", + right: "10%", + width: wp("10%"), + height: wp("10%"), + borderColor: "#2E94BB", + borderWidth: parseInt("2%"), + borderRadius: parseInt("100%"), + }} + > + + {d.StationNumber} + + + ))} + + + + {/* {stationName.今.LineName} */} + + {currentStation[0].Station_JP} + + + {currentStation[0].Station_EN} + + + + + + {(() => { + return currentStation.map((currentStation) => { + let [preStation, nexStation] = getPreNextStation(currentStation); + return ( + + + {preStation && [ + + ◀ + , + + + + {preStation.StationNumber} + + + , + + + {preStation.Station_JP} + + + {preStation.Station_EN} + + , + ]} + + + {nexStation && [ + + + {nexStation.Station_JP} + + + {nexStation.Station_EN} + + , + + + + {nexStation.StationNumber} + + + , + + ▶ + , + ]} + - )} - - - - {/* {stationName.今.LineName} */} - {currentStation[0].Station_JP} - {currentStation[0].Station_EN} - - - - - - {(()=>{return currentStation.map(currentStation =>{ - let [preStation, nexStation] = getPreNextStation(currentStation) - return( - - - {preStation && - [, - - - {preStation.StationNumber} - - , - - {preStation.Station_JP} - {preStation.Station_EN} - ]} - - - - {nexStation && - [ - {nexStation.Station_JP} - {nexStation.Station_EN} - , - - - {nexStation.StationNumber} - - , - ]} - - - ) - })[nexPrePosition] - - })()} - - - - - ) -} \ No newline at end of file + ); + })[nexPrePosition]; + })()} + + + ); +} diff --git a/howto.js b/howto.js index 2468685..fb9c3d3 100644 --- a/howto.js +++ b/howto.js @@ -1,13 +1,30 @@ const WEBVIEW = "WEBVIEW"; -import React, { Component } from 'react'; -import { StatusBar,View, TouchableOpacity, Text} from 'react-native'; -import {WebView} from 'react-native-webview'; -export default ({ navigation: { navigate } }) => - - - navigate('Apps')}> - - 閉じる - - - \ No newline at end of file +import React, { Component } from "react"; +import { StatusBar, View, TouchableOpacity, Text } from "react-native"; +import { WebView } from "react-native-webview"; +export default ({ navigation: { navigate } }) => ( + + + navigate("Apps")} + > + + + 閉じる + + + + +); diff --git a/menu.js b/menu.js index bc1f9ba..2c20435 100644 --- a/menu.js +++ b/menu.js @@ -1,440 +1,1058 @@ -import React, { Component, useRef, useState, useEffect } from 'react'; -import {StatusBar,Platform,View,LayoutAnimation,ScrollView,Linking,Text,TouchableOpacity } from 'react-native'; -import Image from 'react-native-remote-svg'; -import Constants from 'expo-constants'; -import { List, ListItem } from 'native-base'; -import Icon from 'react-native-vector-icons/Entypo'; -import * as Location from 'expo-location'; -import StatusbarDetect from './StatusbarDetect'; +import React, { Component, useRef, useState, useEffect } from "react"; +import { + StatusBar, + Platform, + View, + LayoutAnimation, + ScrollView, + Linking, + Text, + TouchableOpacity, +} from "react-native"; +import Image from "react-native-remote-svg"; +import Constants from "expo-constants"; +import { List, ListItem } from "native-base"; +import Icon from "react-native-vector-icons/Entypo"; +import * as Location from "expo-location"; +import StatusbarDetect from "./StatusbarDetect"; var Status = StatusbarDetect(); -import { useNavigation } from '@react-navigation/native'; -import AutoHeightImage from 'react-native-auto-height-image'; -import {widthPercentageToDP as wp, heightPercentageToDP as hp} from 'react-native-responsive-screen'; -import { FontAwesome, Fontisto, Foundation, Ionicons, MaterialCommunityIcons } from '@expo/vector-icons'; -import * as WebBrowser from 'expo-web-browser'; +import { useNavigation } from "@react-navigation/native"; +import AutoHeightImage from "react-native-auto-height-image"; +import { + widthPercentageToDP as wp, + heightPercentageToDP as hp, +} from "react-native-responsive-screen"; +import { + FontAwesome, + Fontisto, + Foundation, + Ionicons, + MaterialCommunityIcons, +} from "@expo/vector-icons"; +import * as WebBrowser from "expo-web-browser"; import ActionSheet from "react-native-actions-sheet"; -import LottieView from 'lottie-react-native'; -import SvgUri from 'react-native-svg-uri'; +import LottieView from "lottie-react-native"; +import SvgUri from "react-native-svg-uri"; +import 予讃線 from "./assets/四国旅客鉄道予讃線.json"; +import 土讃線 from "./assets/四国旅客鉄道土讃線.json"; +import 高徳線 from "./assets/四国旅客鉄道高徳線.json"; +import 内子線 from "./assets/四国旅客鉄道内子線.json"; +import 徳島線 from "./assets/四国旅客鉄道徳島線.json"; +import 鳴門線 from "./assets/四国旅客鉄道鳴門線.json"; +import LED_vision from "./components/発車時刻表/LED_vidion"; +import Sign from "./components/駅名表/Sign"; -import 予讃線 from './assets/四国旅客鉄道予讃線.json'; -import 土讃線 from './assets/四国旅客鉄道土讃線.json'; -import 高徳線 from './assets/四国旅客鉄道高徳線.json'; -import 内子線 from './assets/四国旅客鉄道内子線.json'; -import 徳島線 from './assets/四国旅客鉄道徳島線.json'; -import 鳴門線 from './assets/四国旅客鉄道鳴門線.json' -import LED_vision from './components/発車時刻表/LED_vidion'; -import Sign from './components/駅名表/Sign'; - - - -const UsefulBox = (props) =>{ +const UsefulBox = (props) => { const { icon, backgroundColor, flex, onPressButton, children } = props; - return( - - - {children} + return ( + + + + {children} + - ) -} -const TicketBox = (props) =>{ + ); +}; +const TicketBox = (props) => { const { icon, backgroundColor, flex, onPressButton, children } = props; - return( - - {children} + return ( + + + {children} + {icon} - ) -} + ); +}; -const TextBox = (props) =>{ +const TextBox = (props) => { const { backgroundColor, flex, onPressButton, children } = props; - return( - - - {children} - + return ( + + + {children} + - ) -} + ); +}; export default function Menu(props) { - const { navigation: { navigate } } = props; + const { + navigation: { navigate }, + } = props; const JRSTraInfoEXAcSR = useRef(null); const StationBoardAcSR = useRef(null); const navigation = useNavigation(); - - //位置情報 const [location, setLocation] = useState(null); const [errorMsg, setErrorMsg] = useState(null); useEffect(() => { - Location.requestForegroundPermissionsAsync().then(data=>{ - if (data.status !== 'granted') { - setErrorMsg('Permission to access location was denied'); - return ()=>{}; + Location.requestForegroundPermissionsAsync().then((data) => { + if (data.status !== "granted") { + setErrorMsg("Permission to access location was denied"); + return () => {}; } - Location.getCurrentPositionAsync({}).then(location=>setLocation(location)) - }) + Location.getCurrentPositionAsync({}).then((location) => + setLocation(location) + ); + }); setInterval(() => { - Location.getCurrentPositionAsync({}).then(location=>setLocation(location)) + Location.getCurrentPositionAsync({}).then((location) => + setLocation(location) + ); }, 10000); - },[]) + }, []); - const [originalStationList , setOriginalStationList] = useState(); - useEffect(()=>{ //駅リストイニシャライズ + const [originalStationList, setOriginalStationList] = useState(); + useEffect(() => { + //駅リストイニシャライズ const HeaderConfig = { - headers:{ - 'referer':'https://train.jr-shikoku.co.jp/sp.html' - } - } + headers: { + referer: "https://train.jr-shikoku.co.jp/sp.html", + }, + }; Promise.all([ - fetch('https://train.jr-shikoku.co.jp/g?arg1=station&arg2=yosan', HeaderConfig).then(response => response.json()), - fetch('https://train.jr-shikoku.co.jp/g?arg1=station&arg2=uwajima',HeaderConfig).then(response => response.json()), - fetch('https://train.jr-shikoku.co.jp/g?arg1=station&arg2=uwajima2',HeaderConfig).then(response => response.json()), - fetch('https://train.jr-shikoku.co.jp/g?arg1=station&arg2=dosan',HeaderConfig).then(response => response.json()), - fetch('https://train.jr-shikoku.co.jp/g?arg1=station&arg2=dosan2',HeaderConfig).then(response => response.json()), - fetch('https://train.jr-shikoku.co.jp/g?arg1=station&arg2=koutoku',HeaderConfig).then(response => response.json()), - fetch('https://train.jr-shikoku.co.jp/g?arg1=station&arg2=tokushima',HeaderConfig).then(response => response.json()), - fetch('https://train.jr-shikoku.co.jp/g?arg1=station&arg2=naruto',HeaderConfig).then(response => response.json()), - fetch('https://train.jr-shikoku.co.jp/g?arg1=station&arg2=between',HeaderConfig).then(response => response.json()), - fetch('https://train.jr-shikoku.co.jp/g?arg1=line&arg2=train_lang',HeaderConfig).then(response => response.json()) - ]).then(values =>{ + fetch( + "https://train.jr-shikoku.co.jp/g?arg1=station&arg2=yosan", + HeaderConfig + ).then((response) => response.json()), + fetch( + "https://train.jr-shikoku.co.jp/g?arg1=station&arg2=uwajima", + HeaderConfig + ).then((response) => response.json()), + fetch( + "https://train.jr-shikoku.co.jp/g?arg1=station&arg2=uwajima2", + HeaderConfig + ).then((response) => response.json()), + fetch( + "https://train.jr-shikoku.co.jp/g?arg1=station&arg2=dosan", + HeaderConfig + ).then((response) => response.json()), + fetch( + "https://train.jr-shikoku.co.jp/g?arg1=station&arg2=dosan2", + HeaderConfig + ).then((response) => response.json()), + fetch( + "https://train.jr-shikoku.co.jp/g?arg1=station&arg2=koutoku", + HeaderConfig + ).then((response) => response.json()), + fetch( + "https://train.jr-shikoku.co.jp/g?arg1=station&arg2=tokushima", + HeaderConfig + ).then((response) => response.json()), + fetch( + "https://train.jr-shikoku.co.jp/g?arg1=station&arg2=naruto", + HeaderConfig + ).then((response) => response.json()), + fetch( + "https://train.jr-shikoku.co.jp/g?arg1=station&arg2=between", + HeaderConfig + ).then((response) => response.json()), + fetch( + "https://train.jr-shikoku.co.jp/g?arg1=line&arg2=train_lang", + HeaderConfig + ).then((response) => response.json()), + ]).then((values) => { let stationList = {}; - [stationList.予讃線, stationList.松宇線, stationList.伊予灘線, stationList.土讃線, stationList.窪川線, stationList.高徳線, stationList.徳島線, stationList.鳴門線, stationList.駅間リスト,stationList.日英対応表] = values; - + [ + stationList.予讃線, + stationList.松宇線, + stationList.伊予灘線, + stationList.土讃線, + stationList.窪川線, + stationList.高徳線, + stationList.徳島線, + stationList.鳴門線, + stationList.駅間リスト, + stationList.日英対応表, + ] = values; + const concatBetweenStations = (eachRouteData) => { let additional = []; - eachRouteData.forEach((routeData,routeIndex) => { - try{ - const currentStationID = parseInt(routeData.StationNumber.replace(/[A-Z]/g,"")) - const nextStationID = parseInt(eachRouteData[routeIndex+1].StationNumber.replace(/[A-Z]/g,"")) - if((nextStationID-currentStationID) != 1){ - stationList.駅間リスト.forEach(betweenList=>{ - if(betweenList.BetweenStation == (routeData.Station_JP+"~"+eachRouteData[routeIndex+1].Station_JP)){ + eachRouteData.forEach((routeData, routeIndex) => { + try { + const currentStationID = parseInt( + routeData.StationNumber.replace(/[A-Z]/g, "") + ); + const nextStationID = parseInt( + eachRouteData[routeIndex + 1].StationNumber.replace(/[A-Z]/g, "") + ); + if (nextStationID - currentStationID != 1) { + stationList.駅間リスト.forEach((betweenList) => { + if ( + betweenList.BetweenStation == + routeData.Station_JP + + "~" + + eachRouteData[routeIndex + 1].Station_JP + ) { additional = additional.concat(betweenList.Datas); } - }) - } - }catch(e){} + }); + } + } catch (e) {} }); - return(eachRouteData.concat(additional).sort((a,b)=> (a.StationNumber > b.StationNumber) ? 1 : -1 )) - } - const addStationPosition = (setDataBase, geoJson, EnJpList) =>{ - return setDataBase.map((data)=>{ + return eachRouteData + .concat(additional) + .sort((a, b) => (a.StationNumber > b.StationNumber ? 1 : -1)); + }; + const addStationPosition = (setDataBase, geoJson, EnJpList) => { + return setDataBase.map((data) => { let stationName; - if(data.hasOwnProperty("Station_JP")) stationName = data.Station_JP; - else if(data.hasOwnProperty("StationName")){ + if (data.hasOwnProperty("Station_JP")) stationName = data.Station_JP; + else if (data.hasOwnProperty("StationName")) { stationName = data.StationName; data.Station_JP = data.StationName; - data.Station_EN = EnJpList.find(d=>d.Station_JP == data.Station_JP).Station_EN + data.Station_EN = EnJpList.find( + (d) => d.Station_JP == data.Station_JP + ).Station_EN; } - geoJson.features.filter(d=>d.geometry.type == "Point").forEach(element =>{ - if(element.properties.name == stationName){ - data.lat = element.geometry.coordinates[1]; - data.lng = element.geometry.coordinates[0]; - } - }); + geoJson.features + .filter((d) => d.geometry.type == "Point") + .forEach((element) => { + if (element.properties.name == stationName) { + data.lat = element.geometry.coordinates[1]; + data.lng = element.geometry.coordinates[0]; + } + }); return data; - }) - } - stationList.予讃線 = addStationPosition(concatBetweenStations(stationList.予讃線), 予讃線, stationList.日英対応表); - stationList.松宇線 = addStationPosition(concatBetweenStations(stationList.松宇線), 予讃線, stationList.日英対応表); - stationList.伊予灘線 = addStationPosition(concatBetweenStations(stationList.伊予灘線), 予讃線, stationList.日英対応表); - stationList.土讃線 = addStationPosition(concatBetweenStations(stationList.土讃線), 土讃線, stationList.日英対応表); - stationList.窪川線 = addStationPosition(concatBetweenStations(stationList.窪川線), 土讃線, stationList.日英対応表); - stationList.高徳線 = addStationPosition(concatBetweenStations(stationList.高徳線), 高徳線, stationList.日英対応表); - stationList.徳島線 = addStationPosition(concatBetweenStations(stationList.徳島線), 徳島線, stationList.日英対応表); - stationList.鳴門線 = addStationPosition(concatBetweenStations(stationList.鳴門線), 鳴門線, stationList.日英対応表); + }); + }; + stationList.予讃線 = addStationPosition( + concatBetweenStations(stationList.予讃線), + 予讃線, + stationList.日英対応表 + ); + stationList.松宇線 = addStationPosition( + concatBetweenStations(stationList.松宇線), + 予讃線, + stationList.日英対応表 + ); + stationList.伊予灘線 = addStationPosition( + concatBetweenStations(stationList.伊予灘線), + 予讃線, + stationList.日英対応表 + ); + stationList.土讃線 = addStationPosition( + concatBetweenStations(stationList.土讃線), + 土讃線, + stationList.日英対応表 + ); + stationList.窪川線 = addStationPosition( + concatBetweenStations(stationList.窪川線), + 土讃線, + stationList.日英対応表 + ); + stationList.高徳線 = addStationPosition( + concatBetweenStations(stationList.高徳線), + 高徳線, + stationList.日英対応表 + ); + stationList.徳島線 = addStationPosition( + concatBetweenStations(stationList.徳島線), + 徳島線, + stationList.日英対応表 + ); + stationList.鳴門線 = addStationPosition( + concatBetweenStations(stationList.鳴門線), + 鳴門線, + stationList.日英対応表 + ); setOriginalStationList(stationList); }); - },[]) + }, []); - - - const [stationName,setStationName] = useState(undefined); + const [stationName, setStationName] = useState(undefined); const [currentStation, setCurrentStation] = useState(undefined); - useEffect(()=>{ - if(!location) return ()=>{}; - if(!originalStationList) return ()=>{}; + useEffect(() => { + if (!location) return () => {}; + if (!originalStationList) return () => {}; const findStationEachLine = (selectLine) => { const searchArea = 0.0015; - const _calcDistance = (from, to) =>{ + const _calcDistance = (from, to) => { let lat = Math.abs(from.lat - to.lat); let lng = Math.abs(from.lng - to.lng); - return Math.sqrt((lat*lat)+(lng*lng)) - } - let NearStation = selectLine.filter(d=>_calcDistance(d,{lat:location.coords.latitude,lng:location.coords.longitude}) < searchArea); + return Math.sqrt(lat * lat + lng * lng); + }; + let NearStation = selectLine.filter( + (d) => + _calcDistance(d, { + lat: location.coords.latitude, + lng: location.coords.longitude, + }) < searchArea + ); return NearStation; - } + }; - const lineList = ["予讃線", "松宇線", "伊予灘線", "土讃線", "窪川線", "高徳線", "徳島線", "鳴門線"]; - console.log(lineList.map(d=>findStationEachLine(originalStationList[d])).filter(d=>d.length > 0).reduce((pre,current) => {pre.push(...current);return pre},[])); - let returnDataBase = lineList.map(d=>findStationEachLine(originalStationList[d])).filter(d=>d.length > 0).reduce((pre,current) => {pre.push(...current);return pre},[]); - LayoutAnimation.spring() - if(returnDataBase.length){ + const lineList = [ + "予讃線", + "松宇線", + "伊予灘線", + "土讃線", + "窪川線", + "高徳線", + "徳島線", + "鳴門線", + ]; + console.log( + lineList + .map((d) => findStationEachLine(originalStationList[d])) + .filter((d) => d.length > 0) + .reduce((pre, current) => { + pre.push(...current); + return pre; + }, []) + ); + let returnDataBase = lineList + .map((d) => findStationEachLine(originalStationList[d])) + .filter((d) => d.length > 0) + .reduce((pre, current) => { + pre.push(...current); + return pre; + }, []); + LayoutAnimation.spring(); + if (returnDataBase.length) { let currentStation = currentStation == undefined ? [] : currentStation; - if(currentStation.toString() != returnDataBase.toString()){ + if (currentStation.toString() != returnDataBase.toString()) { setCurrentStation(returnDataBase); } - } - else{ + } else { setCurrentStation(undefined); - StationBoardAcSR.current?.hide() + StationBoardAcSR.current?.hide(); } - - },[location,originalStationList]) - - useEffect(()=>{ - console.log("test") - console.log(currentStation) - },[currentStation]) - - + }, [location, originalStationList]); + useEffect(() => { + console.log("test"); + console.log(currentStation); + }, [currentStation]); const LottieRef = useRef(null); const LottieRef2 = useRef(null); - const [count,setCount] =useState(0); - const [delayData,setDelayData] = useState(undefined); - const [getTime,setGetTime] = useState(new Date()); - const [loadingDelayData,setLoadingDelayData] = useState(true); + const [count, setCount] = useState(0); + const [delayData, setDelayData] = useState(undefined); + const [getTime, setGetTime] = useState(new Date()); + const [loadingDelayData, setLoadingDelayData] = useState(true); - useEffect(()=>{ - fetch("https://script.google.com/macros/s/AKfycbyKxch7z7l8e07LXulRHqxjVoIiB13kcgvoToLE-rqlxLmLSKdlmqz0FI1F2EuA7Zfg/exec") - .then(response => response.text()) - .then(data => {if(data != ""){setDelayData(data.split("^"))}else setDelayData(null)}) - .then(data => LayoutAnimation.easeInEaseOut()) - .then(()=>setGetTime(new Date())) - .finally(()=>setLoadingDelayData(false)); - },[loadingDelayData]) + useEffect(() => { + fetch( + "https://script.google.com/macros/s/AKfycbyKxch7z7l8e07LXulRHqxjVoIiB13kcgvoToLE-rqlxLmLSKdlmqz0FI1F2EuA7Zfg/exec" + ) + .then((response) => response.text()) + .then((data) => { + if (data != "") { + setDelayData(data.split("^")); + } else setDelayData(null); + }) + .then((data) => LayoutAnimation.easeInEaseOut()) + .then(() => setGetTime(new Date())) + .finally(() => setLoadingDelayData(false)); + }, [loadingDelayData]); - useEffect(()=>{ - try{ + useEffect(() => { + try { LottieRef?.current.play(); LottieRef2?.current.play(); - }catch(e){} - - }) - return ( - - {Status} - - Linking.openURL("https://www.jr-shikoku.co.jp")}> - - - - - - Linking.openURL("https://www.jr-shikoku.co.jp/01_trainbus/sp/")}>駅・鉄道情報 - Linking.openURL("https://www.jr-shikoku.co.jp/01_trainbus/jikoku/sp/#mainprice-box")}>運賃表 - Linking.openURL("https://www.jr-shikoku.co.jp/e5489/")}>予約 - - Linking.openURL("https://www.jr-shikoku.co.jp/02_information/suspension/sp/")}> - 新型コロナウイルスに関するお知らせ - 列車の運行計画・混雑状況・感染症対策への取り組み - - {currentStation && StationBoardAcSR.current?.setModalVisible()} />} - {currentStation && } - {JRSTraInfoEXAcSR.current?.setModalVisible()}}> - - - - 列車遅延速報EX - - {getTime ? getTime.toLocaleTimeString('ja-JP').split(":")[0]+":"+getTime.toLocaleTimeString('ja-JP').split(":")[1]: NaN} - {LayoutAnimation.easeInEaseOut(),setLoadingDelayData(true)}}/> - - - {loadingDelayData ? - - - - : delayData ? delayData.map((d)=>{ + } catch (e) {} + }); + return ( + + {Status} + + Linking.openURL("https://www.jr-shikoku.co.jp")} + > + + + + + + + Linking.openURL("https://www.jr-shikoku.co.jp/01_trainbus/sp/") + } + > + 駅・鉄道情報 + + + Linking.openURL( + "https://www.jr-shikoku.co.jp/01_trainbus/jikoku/sp/#mainprice-box" + ) + } + > + 運賃表 + + + Linking.openURL("https://www.jr-shikoku.co.jp/e5489/") + } + > + 予約 + + + + Linking.openURL( + "https://www.jr-shikoku.co.jp/02_information/suspension/sp/" + ) + } + > + + 新型コロナウイルスに関するお知らせ + + + 列車の運行計画・混雑状況・感染症対策への取り組み + + + {currentStation && ( + StationBoardAcSR.current?.setModalVisible()} + /> + )} + {currentStation && } + { + JRSTraInfoEXAcSR.current?.setModalVisible(); + }} + > + + + + + 列車遅延速報EX + + + + {getTime + ? getTime.toLocaleTimeString("ja-JP").split(":")[0] + + ":" + + getTime.toLocaleTimeString("ja-JP").split(":")[1] + : NaN} + + { + LayoutAnimation.easeInEaseOut(), setLoadingDelayData(true); + }} + /> + + + {loadingDelayData ? ( + + + + ) : delayData ? ( + delayData.map((d) => { let data = d.split(" "); return ( - - {data[0].replace("\n","")} - {data[1]} - {data[3]} + + + {data[0].replace("\n", "")} + + {data[1]} + {data[3]} ); - }) : 現在、5分以上の遅れはありません。} - - - - - 詳細を見る - + }) + ) : ( + 現在、5分以上の遅れはありません。 + )} + + + + + 詳細を見る + + - - - + + - - } flex={1} onPressButton={()=>Linking.openURL("https://www.jr-eki.com/ticket/brand")}>トクトク切符 - } flex={1} onPressButton={()=>Linking.openURL("https://www.jr-shikoku.co.jp/01_trainbus/event_train/sp/")}>観光列車 - } flex={1} onPressButton={()=>Linking.openURL("https://www.jr-eki.com/tour/brand")}>旅行ツアー + + } + flex={1} + onPressButton={() => + Linking.openURL("https://www.jr-eki.com/ticket/brand") + } + > + トクトク切符 + + } + flex={1} + onPressButton={() => + Linking.openURL( + "https://www.jr-shikoku.co.jp/01_trainbus/event_train/sp/" + ) + } + > + 観光列車 + + } + flex={1} + onPressButton={() => + Linking.openURL("https://www.jr-eki.com/tour/brand") + } + > + 旅行ツアー + + + + Linking.openURL( + "https://www.jr-shikoku.co.jp/sp/index.html#menu-box" + ) + } + > + + 臨時列車などのお知らせ + + + 区間縮小・計画運休・イベント・季節臨時列車など + + + + Linking.openURL("https://www.jr-shikoku.co.jp/03_news/press/") + } + > + + ニュースリリース + + + 公式プレス記事はこちら + + + + Linking.openURL("https://www.jr-shikoku.co.jp/teiki/") + } + > + + 定期運賃計算 + + + 通常/学生/快て〜き等はこちら + + + + Linking.openURL("https://www.jr-shikoku.co.jp/04_company/group/sp/") + } + > + + JR四国のお店・サービス + + + JR四国グループの施設をご案内 + + + + Linking.openURL("https://www.jr-odekake.net/smt/")} + > + + 時刻・運賃計算 + + + (マイ・ダイヤ) + + + + マイ・ダイヤはJR西日本提供のサービスです。 + + + Linking.openURL("tel:0570-00-4592")} + > + + JR四国案内センター + + + 0570-00-4592 + (8:00~20:00 年中無休) + (通話料がかかります) + + + + + + + 公式Twitter一族 + - Linking.openURL("https://www.jr-shikoku.co.jp/sp/index.html#menu-box")}> - 臨時列車などのお知らせ - 区間縮小・計画運休・イベント・季節臨時列車など - - Linking.openURL("https://www.jr-shikoku.co.jp/03_news/press/")}> - ニュースリリース - 公式プレス記事はこちら - - Linking.openURL("https://www.jr-shikoku.co.jp/teiki/")}> - 定期運賃計算 - 通常/学生/快て〜き等はこちら - - Linking.openURL("https://www.jr-shikoku.co.jp/04_company/group/sp/")}> - JR四国のお店・サービス - JR四国グループの施設をご案内 - - - Linking.openURL("https://www.jr-odekake.net/smt/")}> - 時刻・運賃計算 - (マイ・ダイヤ) - - マイ・ダイヤはJR西日本提供のサービスです。 - - Linking.openURL("tel:0570-00-4592")}> - JR四国案内センター - - 0570-00-4592 - (8:00~20:00 年中無休) - (通話料がかかります) - + + + Linking.openURL("https://twitter.com/JRshikoku_tokyo") + } + > + JR四国 東京営業情報【公式】 + + + + + Linking.openURL("https://twitter.com/JRshikoku_osaka") + } + > + JR四国 大阪営業部【公式】 + + + + Linking.openURL("https://twitter.com/shikoku_DC")} + > + JR四国営業部 四国DC情報【公式】 + + + + + Linking.openURL("https://twitter.com/jr_shikoku_info") + } + > + JR四国運行情報Twitter + + + + + Linking.openURL("https://twitter.com/Smile_Eki_Chan") + } + > + JR四国いそうろう妖精 すまいるえきちゃん♡【公式】 + + + + + Linking.openURL("https://twitter.com/JR_Shikoku_DPT") + } + > + JR四国デザインPT♡ + + + + Linking.openURL("https://twitter.com/PT2nd_Yuki")} + > + JR四国デザインPT弐号◇ + + + - - - - 公式Twitter一族 - - - Linking.openURL("https://twitter.com/JRshikoku_tokyo")}> - JR四国 東京営業情報【公式】 - - - - Linking.openURL("https://twitter.com/JRshikoku_osaka")}> - JR四国 大阪営業部【公式】 - - - - Linking.openURL("https://twitter.com/shikoku_DC")}> - JR四国営業部 四国DC情報【公式】 - - - - Linking.openURL("https://twitter.com/jr_shikoku_info")}> - JR四国運行情報Twitter - - - - Linking.openURL("https://twitter.com/Smile_Eki_Chan")}> - JR四国いそうろう妖精 すまいるえきちゃん♡【公式】 - - - - Linking.openURL("https://twitter.com/JR_Shikoku_DPT")}> - JR四国デザインPT♡ - - - - Linking.openURL("https://twitter.com/PT2nd_Yuki")}> - JR四国デザインPT弐号◇ - - - - - - このアプリについて - このアプリはXprocess(HARUKIN)が製作しているJR四国の完全非公式アシストアプリケーションです。このアプリに関することでのJR四国公式へ問合せすることはお控えください。以下のTwitterよりお願いします。 - 2022/4/14 4.1公開!列車アイコン表示が開始しました。 - 2021/6/23 4.0公開!ホーム画面を大改造しました。 - Linking.openURL("https://twitter.com/Xprocess_main")}> - XprocessのTwitter - 制作運営のTwitterです。 - - navigate('setting')}> - アプリの設定 - アプリの設定画面を表示します。 - - - - {}}> - - - - - - 列車遅延速報EX - - {/* {doFetch()}}> + + + このアプリについて + + + このアプリはXprocess(HARUKIN)が製作しているJR四国の完全非公式アシストアプリケーションです。このアプリに関することでのJR四国公式へ問合せすることはお控えください。以下のTwitterよりお願いします。 + + 2022/4/14 4.1公開!列車アイコン表示が開始しました。 + 2021/6/23 4.0公開!ホーム画面を大改造しました。 + + Linking.openURL("https://twitter.com/Xprocess_main") + } + > + + XprocessのTwitter + + + 制作運営のTwitterです。 + + + navigate("setting")} + > + + アプリの設定 + + + アプリの設定画面を表示します。 + + + + + {}} + > + + + + + + + 列車遅延速報EX + + + {/* {doFetch()}}> 最新の情報へ更新 */} - {getTime ? getTime.toLocaleTimeString('ja-JP').split(":")[0]+":"+getTime.toLocaleTimeString('ja-JP').split(":")[1]: NaN} - {LayoutAnimation.easeInEaseOut(),setLoadingDelayData(true)}}/> + + {getTime + ? getTime.toLocaleTimeString("ja-JP").split(":")[0] + + ":" + + getTime.toLocaleTimeString("ja-JP").split(":")[1] + : NaN}{" "} + + { + LayoutAnimation.easeInEaseOut(), setLoadingDelayData(true); + }} + /> + + + + {loadingDelayData ? ( + + - + ) : delayData ? ( + delayData.map((d) => { + let data = d.split(" "); + return ( + + + {data[0].replace("\n", "")} + + {data[1]} + {data[3]} + + ); + }) + ) : ( + 現在、5分以上の遅れはありません。 + )} + - - {loadingDelayData ? - - - - : delayData ? delayData.map((d)=>{ - let data = d.split(" "); - return ( - - {data[0].replace("\n","")} - {data[1]} - {data[3]} - - ); - }) : 現在、5分以上の遅れはありません。} - - - - 列車遅延情報EXについて - 列車遅延情報をJR四国公式列車運行情報より5分毎に取得します。Twitterにて投稿している内容と同一のものとなります。 - - Linking.openURL("https://twitter.com/JRSTrainfoEX")}> - - - TwitterBOTはこちら! - - + + + 列車遅延情報EXについて + + + 列車遅延情報をJR四国公式列車運行情報より5分毎に取得します。Twitterにて投稿している内容と同一のものとなります。 + + + + Linking.openURL("https://twitter.com/JRSTrainfoEX") + } + > + + + + TwitterBOTはこちら! + + + + → + - - - - - - {}}> - - - - - {currentStation && - Linking.openURL(currentStation[0].StationTimeTable)} />} - {currentStation && - - {!currentStation[0].JrHpUrl ||} flex={1} onPressButton={()=> Linking.openURL(currentStation[0].JrHpUrl)}>web} - {!currentStation[0].StationTimeTable || } flex={1} onPressButton={()=> Linking.openURL(currentStation[0].StationTimeTable)}>時刻表} - {!currentStation[0].StationMap || } flex={1} onPressButton={()=> Linking.openURL(currentStation[0].StationMap)}>GoogleMap} - - } - - - - - - - ); + + + + {}} + > + + + + + + {currentStation && ( + Linking.openURL(currentStation[0].StationTimeTable)} + /> + )} + {currentStation && ( + + {!currentStation[0].JrHpUrl || ( + } + flex={1} + onPressButton={() => + Linking.openURL(currentStation[0].JrHpUrl) + } + > + web + + )} + {!currentStation[0].StationTimeTable || ( + } + flex={1} + onPressButton={() => + Linking.openURL(currentStation[0].StationTimeTable) + } + > + 時刻表 + + )} + {!currentStation[0].StationMap || ( + } + flex={1} + onPressButton={() => + Linking.openURL(currentStation[0].StationMap) + } + > + GoogleMap + + )} + + )} + + + + + ); } diff --git a/ndView.js b/ndView.js index a585ac2..4e19c7e 100644 --- a/ndView.js +++ b/ndView.js @@ -1,18 +1,25 @@ -import React, { Component } from 'react'; -import { StatusBar,View,Linking,Platform,Text} from 'react-native'; -import {WebView} from 'react-native-webview'; -import Constants from 'expo-constants'; -import { TouchableOpacity } from 'react-native-gesture-handler'; -export default function tndView () { +import React, { Component } from "react"; +import { StatusBar, View, Linking, Platform, Text } from "react-native"; +import { WebView } from "react-native-webview"; +import Constants from "expo-constants"; +import { TouchableOpacity } from "react-native-gesture-handler"; +export default function tndView() { return ( - - + + ); } @@ -20,4 +27,3 @@ const jsa = ` document.querySelector('.sitettl').style.display = 'none'; document.querySelector('.attention').style.display = 'none'; `; -