linter調整
This commit is contained in:
parent
560649004c
commit
2a3fd7774d
@ -1,16 +1,10 @@
|
|||||||
import React from 'react';
|
import React from "react";
|
||||||
import {Platform, StatusBar, View} from 'react-native';
|
import { Platform, StatusBar, View } from "react-native";
|
||||||
|
|
||||||
export default function StatusbarDetect() {
|
export default function StatusbarDetect() {
|
||||||
if(Platform.OS == "ios"){
|
if (Platform.OS == "ios") {
|
||||||
return (
|
return <StatusBar barStyle="dark-content" />;
|
||||||
<StatusBar barStyle="dark-content"/>
|
} else if (Platform.OS == "android") {
|
||||||
);
|
return <View />;
|
||||||
}
|
}
|
||||||
else if(Platform.OS == "android"){
|
}
|
||||||
return (
|
|
||||||
<View/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
99
TestArea.js
99
TestArea.js
@ -1,49 +1,74 @@
|
|||||||
import React, { Component, useEffect, useState } from 'react';
|
import React, { Component, useEffect, useState } from "react";
|
||||||
import {StatusBar,View,ScrollView,Linking,Text } from 'react-native';
|
import { StatusBar, View, ScrollView, Linking, Text } from "react-native";
|
||||||
import Constants from 'expo-constants';
|
import Constants from "expo-constants";
|
||||||
import { ListItem } from 'react-native-elements';
|
import { ListItem } from "react-native-elements";
|
||||||
import Icon from 'react-native-vector-icons/Entypo';
|
import Icon from "react-native-vector-icons/Entypo";
|
||||||
import StatusbarDetect from './StatusbarDetect';
|
import StatusbarDetect from "./StatusbarDetect";
|
||||||
var Status = StatusbarDetect();
|
var Status = StatusbarDetect();
|
||||||
let a=[];
|
let a = [];
|
||||||
export default function TestArea(props) {
|
export default function TestArea(props) {
|
||||||
const [data,setdata] = useState(null);
|
const [data, setdata] = useState(null);
|
||||||
useEffect(()=>{
|
useEffect(() => {
|
||||||
data==null ? test().then(res=>{
|
data == null
|
||||||
//console.log(res);
|
? test().then((res) => {
|
||||||
setdata(res);
|
//console.log(res);
|
||||||
}):null
|
setdata(res);
|
||||||
},[data])
|
})
|
||||||
|
: null;
|
||||||
|
}, [data]);
|
||||||
return (
|
return (
|
||||||
<View style={{height:"100%",paddingTop: Constants.statusBarHeight,}}>
|
<View style={{ height: "100%", paddingTop: Constants.statusBarHeight }}>
|
||||||
{Status}
|
{Status}
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<Text>TEST AREA!!</Text>
|
<Text>TEST AREA!!</Text>
|
||||||
{data}
|
{data}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function test(){
|
async function test() {
|
||||||
return fetch('https://train.jr-shikoku.co.jp/g?arg1=train&arg2=train', {
|
return fetch("https://train.jr-shikoku.co.jp/g?arg1=train&arg2=train", {
|
||||||
headers: {
|
headers: {
|
||||||
'authority': 'train.jr-shikoku.co.jp',
|
authority: "train.jr-shikoku.co.jp",
|
||||||
'cache-control': 'no-cache',
|
"cache-control": "no-cache",
|
||||||
'pragma': 'no-cache',
|
pragma: "no-cache",
|
||||||
'if-modified-since': 'Thu, 01 Jun 1970 00:00:00 GMT',
|
"if-modified-since": "Thu, 01 Jun 1970 00:00:00 GMT",
|
||||||
'accept': '*/*',
|
accept: "*/*",
|
||||||
'sec-fetch-site': 'same-origin',
|
"sec-fetch-site": "same-origin",
|
||||||
'sec-fetch-mode': 'cors',
|
"sec-fetch-mode": "cors",
|
||||||
'referer': 'https://train.jr-shikoku.co.jp/sp.html'
|
referer: "https://train.jr-shikoku.co.jp/sp.html",
|
||||||
}
|
},
|
||||||
}).then(res=>res.json()).then(D=>{
|
})
|
||||||
let d =[];
|
.then((res) => res.json())
|
||||||
D.forEach(element => {
|
.then((D) => {
|
||||||
console.log(element)
|
let d = [];
|
||||||
d.push(<ListItem title={"Direction:"+element.Direction+" Index:"+element.Index+" Line:"+element.Line+" Pos:"+element.Pos+" PosNum:"+element.PosNum+" TrainNum:"+element.TrainNum+" Type:"+element.Type+" Delay:"+element.delay}/>);
|
D.forEach((element) => {
|
||||||
|
console.log(element);
|
||||||
|
d.push(
|
||||||
|
<ListItem
|
||||||
|
title={
|
||||||
|
"Direction:" +
|
||||||
|
element.Direction +
|
||||||
|
" Index:" +
|
||||||
|
element.Index +
|
||||||
|
" Line:" +
|
||||||
|
element.Line +
|
||||||
|
" Pos:" +
|
||||||
|
element.Pos +
|
||||||
|
" PosNum:" +
|
||||||
|
element.PosNum +
|
||||||
|
" TrainNum:" +
|
||||||
|
element.TrainNum +
|
||||||
|
" Type:" +
|
||||||
|
element.Type +
|
||||||
|
" Delay:" +
|
||||||
|
element.delay
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
a = d;
|
||||||
|
return d;
|
||||||
});
|
});
|
||||||
a=d;
|
}
|
||||||
return d;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,27 @@
|
|||||||
import { ToastAndroid, } from 'react-native';
|
import { ToastAndroid } from "react-native";
|
||||||
import * as Updates from 'expo-updates';
|
import * as Updates from "expo-updates";
|
||||||
|
|
||||||
export function UpdateAsync(){
|
export function UpdateAsync() {
|
||||||
Updates.checkForUpdateAsync().then(update=>{
|
Updates.checkForUpdateAsync()
|
||||||
if (update.isAvailable) {
|
.then((update) => {
|
||||||
ToastAndroid.showWithGravityAndOffset('アプリのデータを更新しています。',ToastAndroid.LONG,ToastAndroid.BOTTOM,25,50,);
|
if (update.isAvailable) {
|
||||||
Updates.fetchUpdateAsync().then(()=>Updates.reloadAsync());
|
ToastAndroid.showWithGravityAndOffset(
|
||||||
}
|
"アプリのデータを更新しています。",
|
||||||
}).catch(e=>ToastAndroid.showWithGravityAndOffset(e.toString(),ToastAndroid.LONG,ToastAndroid.BOTTOM,25,50,))
|
ToastAndroid.LONG,
|
||||||
}
|
ToastAndroid.BOTTOM,
|
||||||
|
25,
|
||||||
|
50
|
||||||
|
);
|
||||||
|
Updates.fetchUpdateAsync().then(() => Updates.reloadAsync());
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) =>
|
||||||
|
ToastAndroid.showWithGravityAndOffset(
|
||||||
|
e.toString(),
|
||||||
|
ToastAndroid.LONG,
|
||||||
|
ToastAndroid.BOTTOM,
|
||||||
|
25,
|
||||||
|
50
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@ -1,398 +1,586 @@
|
|||||||
export const customTrainDataDetector = (TrainNumber) =>{
|
export const customTrainDataDetector = (TrainNumber) => {
|
||||||
switch(TrainNumber){
|
switch (TrainNumber) {
|
||||||
//しおかぜメイン
|
//しおかぜメイン
|
||||||
//8000 ノーマル
|
//8000 ノーマル
|
||||||
case "2M":
|
case "2M":
|
||||||
case "4M":
|
case "4M":
|
||||||
case "6M":
|
case "6M":
|
||||||
case "14M":
|
case "14M":
|
||||||
case "16M":
|
case "16M":
|
||||||
case "18M":
|
case "18M":
|
||||||
case "26M":
|
case "26M":
|
||||||
case "28M":
|
case "28M":
|
||||||
case "30M":
|
case "30M":
|
||||||
case "1M":
|
case "1M":
|
||||||
case "3M":
|
case "3M":
|
||||||
case "5M":
|
case "5M":
|
||||||
case "13M":
|
case "13M":
|
||||||
case "15M":
|
case "15M":
|
||||||
case "17M":
|
case "17M":
|
||||||
case "25M":
|
case "25M":
|
||||||
case "27M":
|
case "27M":
|
||||||
case "29M":
|
case "29M":
|
||||||
return {type:"LTDEXP",trainName:"しおかぜ",trainIcon:'http://www.trainfrontview.net/b/s8000nr.png',trainNumDistance:0,info:"いしづちと併結 / 8000系で運転"};
|
return {
|
||||||
//8000 アンパン
|
type: "LTDEXP",
|
||||||
case "10M":
|
trainName: "しおかぜ",
|
||||||
case "22M":
|
trainIcon: "http://www.trainfrontview.net/b/s8000nr.png",
|
||||||
case "9M":
|
trainNumDistance: 0,
|
||||||
case "21M":
|
info: "いしづちと併結 / 8000系で運転",
|
||||||
return {type:"LTDEXP",trainName:"しおかぜ",trainIcon:'http://www.trainfrontview.net/f/s8000ap.png',trainNumDistance:0,info:"いしづちと併結 / アンパンマン列車で運転"};
|
};
|
||||||
//8600
|
//8000 アンパン
|
||||||
case "8M":
|
case "10M":
|
||||||
case "12M":
|
case "22M":
|
||||||
case "20M":
|
case "9M":
|
||||||
case "24M":
|
case "21M":
|
||||||
case "7M":
|
return {
|
||||||
case "11M":
|
type: "LTDEXP",
|
||||||
case "19M":
|
trainName: "しおかぜ",
|
||||||
case "23M":
|
trainIcon: "http://www.trainfrontview.net/f/s8000ap.png",
|
||||||
return {type:"LTDEXP",trainName:"しおかぜ",trainIcon:'http://www.trainfrontview.net/b/s8600.png',trainNumDistance:0,info:"いしづちと併結 / 8600系で運転"};
|
trainNumDistance: 0,
|
||||||
|
info: "いしづちと併結 / アンパンマン列車で運転",
|
||||||
//いしづちメイン
|
};
|
||||||
//8000 ノーマル
|
//8600
|
||||||
|
case "8M":
|
||||||
case "1004M":
|
case "12M":
|
||||||
case "1006M":
|
case "20M":
|
||||||
case "1014M":
|
case "24M":
|
||||||
case "1016M":
|
case "7M":
|
||||||
case "1018M":
|
case "11M":
|
||||||
case "1026M":
|
case "19M":
|
||||||
case "1028M":
|
case "23M":
|
||||||
case "1030M":
|
return {
|
||||||
case "1001M":
|
type: "LTDEXP",
|
||||||
case "1003M":
|
trainName: "しおかぜ",
|
||||||
case "1005M":
|
trainIcon: "http://www.trainfrontview.net/b/s8600.png",
|
||||||
case "1013M":
|
trainNumDistance: 0,
|
||||||
case "1015M":
|
info: "いしづちと併結 / 8600系で運転",
|
||||||
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系で運転"};
|
|
||||||
|
|
||||||
|
//いしづちメイン
|
||||||
//あしずり 2700
|
//8000 ノーマル
|
||||||
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 "1004M":
|
||||||
case "4002D":
|
case "1006M":
|
||||||
case "4004D":
|
case "1014M":
|
||||||
case "4006D":
|
case "1016M":
|
||||||
case "4008D":
|
case "1018M":
|
||||||
case "4010D":
|
case "1026M":
|
||||||
case "4001D":
|
case "1028M":
|
||||||
case "4003D":
|
case "1030M":
|
||||||
case "4005D":
|
case "1001M":
|
||||||
case "4007D":
|
case "1003M":
|
||||||
case "4009D":
|
case "1005M":
|
||||||
case "4011D":
|
case "1013M":
|
||||||
return {type:"LTDEXP",trainName:"剣山",trainIcon:'http://www.trainfrontview.net/b/s185tu.png',trainNumDistance:4000,info:"キハ185系で運転"};
|
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 "5051D":
|
case "1010M":
|
||||||
case "5052D":
|
case "1022M":
|
||||||
return {type:"LTDEXP",trainName:"むろと",trainIcon:'http://www.trainfrontview.net/b/s185_mrt.png',trainNumDistance:5050,info:"キハ185系で運転"};
|
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 "8452D":
|
case "1020M":
|
||||||
case "8451D":
|
case "1024M":
|
||||||
return {type:"LTDEXP",trainName:"よしのがわトロッコ",trainIcon:'http://www.trainfrontview.net/f/s185to_ai.png',trainNumDistance:null,info:""};
|
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 "8176D":
|
case "1092M":
|
||||||
case "8179D":
|
return {
|
||||||
//岡山琴平アントロ
|
type: "LTDEXP",
|
||||||
case "8277D":
|
trainName: "モーニングEXP高松",
|
||||||
case "8278D":
|
trainIcon: "http://www.trainfrontview.net/b/s8000no.png",
|
||||||
return {type:"LTDEXP",trainName:"アンパンマントロッコ",trainIcon:'http://www.trainfrontview.net/f/s32to4.png',trainNumDistance:null,info:""};
|
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 "8901D":
|
case "38D":
|
||||||
case "8903D":
|
case "40D":
|
||||||
case "8902D":
|
case "42D":
|
||||||
case "8904D":
|
case "46D":
|
||||||
return {type:"LTDEXP",trainName:"伊予灘ものがたり",trainIcon:'http://www.trainfrontview.net/b/s185iyoy.png',trainNumDistance:null,info:""};
|
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 "8011D":
|
case "5022D":
|
||||||
case "8012D":
|
case "5013D":
|
||||||
return {type:"LTDEXP",trainName:"四国まんなか千年ものがたり",trainIcon:'http://www.trainfrontview.net/b/s185mm1.png',trainNumDistance:null,info:""};
|
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 "8053D":
|
case "3014D":
|
||||||
case "8054D":
|
case "3020D":
|
||||||
case "8062D":
|
case "3026D":
|
||||||
case "8063D":
|
case "3001D":
|
||||||
return {type:"LTDEXP",trainName:"時代の夜明けのものがたり",trainIcon:'http://www.trainfrontview.net/b/s185ym1.png',trainNumDistance:null,info:""};
|
case "3011D":
|
||||||
|
case "3017D":
|
||||||
|
case "3023D":
|
||||||
|
return {
|
||||||
|
type: "LTDEXP",
|
||||||
|
trainName: "うずしお",
|
||||||
|
trainIcon: "http://www.trainfrontview.net/b/s2600.png",
|
||||||
|
trainNumDistance: 3000,
|
||||||
|
info: "2600系で運転",
|
||||||
|
};
|
||||||
|
|
||||||
default:
|
//キハ185
|
||||||
return {type:"Normal",trainName:"",trainIcon:null,trainNumDistance:null,info:null};
|
case "3009D":
|
||||||
break;
|
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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@ -1,13 +1,24 @@
|
|||||||
import React, { Component, useRef, useState, useEffect } from 'react';
|
import React, { Component, useRef, useState, useEffect } from "react";
|
||||||
import {StatusBar,View,LayoutAnimation,ScrollView,Linking,Text,TouchableOpacity } from 'react-native';
|
import {
|
||||||
import { Switch } from 'react-native-elements';
|
StatusBar,
|
||||||
import {widthPercentageToDP as wp, heightPercentageToDP as hp} from 'react-native-responsive-screen';
|
View,
|
||||||
import { customTrainDataDetector } from '../custom-train-data';
|
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;
|
let diagramData = undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* 1-30M しおかぜ
|
* 1-30M しおかぜ
|
||||||
* 31-58D 南風
|
* 31-58D 南風
|
||||||
* 1001-1030M いしづち(併結)
|
* 1001-1030M いしづち(併結)
|
||||||
@ -35,222 +46,362 @@ let diagramData = undefined;
|
|||||||
* 9031M サンライズ瀬戸琴平(延長)(臨時?)
|
* 9031M サンライズ瀬戸琴平(延長)(臨時?)
|
||||||
* 9062D 四国まんなか千年ものがたり(臨時?)
|
* 9062D 四国まんなか千年ものがたり(臨時?)
|
||||||
*/
|
*/
|
||||||
export default function LED_vision(props){
|
export default function LED_vision(props) {
|
||||||
const HeaderConfig = {
|
const HeaderConfig = {
|
||||||
headers:{
|
headers: {
|
||||||
'referer': 'https://train.jr-shikoku.co.jp/sp.html'
|
referer: "https://train.jr-shikoku.co.jp/sp.html",
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
const [trainDiagram,setTrainDiagram] = useState(null);
|
const [trainDiagram, setTrainDiagram] = useState(null);
|
||||||
const [stationDiagram,setStationDiagram] = useState(null);
|
const [stationDiagram, setStationDiagram] = useState(null);
|
||||||
const [currentTrain, setCurrentTrain] = useState(null);
|
const [currentTrain, setCurrentTrain] = useState(null);
|
||||||
const [finalSwitch, setFinalSwitch] = useState(false);
|
const [finalSwitch, setFinalSwitch] = useState(false);
|
||||||
const [trainIDSwitch, setTrainIDSwitch] = useState(false);
|
const [trainIDSwitch, setTrainIDSwitch] = useState(false);
|
||||||
const [trainDescriptionSwitch, setTrainDescriptionSwitch] = useState(false);
|
const [trainDescriptionSwitch, setTrainDescriptionSwitch] = useState(false);
|
||||||
useEffect(()=>{
|
useEffect(() => {
|
||||||
fetch('https://train.jr-shikoku.co.jp/g?arg1=station&arg2=traintimeinfo&arg3=dia', HeaderConfig).then(response => response.text()).then(d=>{
|
fetch(
|
||||||
const val = d.replace("[\r\n","").split(',\r\n');
|
"https://train.jr-shikoku.co.jp/g?arg1=station&arg2=traintimeinfo&arg3=dia",
|
||||||
let returnData = {};
|
HeaderConfig
|
||||||
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(
|
|
||||||
<View style={{ width: wp("98%"),/* height: wp("98%")/10*9, */backgroundColor:"#432",borderWidth:1,margin:10,marginHorizontal:wp("1%")}} >
|
|
||||||
<View style={{alignContent:"center",alignItems:"center",width:"100%",marginVertical:10,flexDirection:"row"}}>
|
|
||||||
<View style={{flex:1}}>
|
|
||||||
|
|
||||||
</View>
|
|
||||||
<View style={{}}>
|
|
||||||
<Text style={{fontSize:25,color:"white",fontWeight:"bold"}}>次の列車</Text>
|
|
||||||
<Text style={{fontSize:15,color:"white"}}>Next Train</Text>
|
|
||||||
</View>
|
|
||||||
<View style={{flex:1}}>
|
|
||||||
|
|
||||||
</View>
|
|
||||||
|
|
||||||
</View>
|
|
||||||
{trainTimeAndNumber ? currentTrain && trainTimeAndNumber.filter(filtering).filter(timeFiltering).filter(finalFiltering).map((d,index)=>
|
|
||||||
[<View style={{alignContent:"center",alignItems:"center",width:"94%",marginVertical:5,marginHorizontal:"3%",backgroundColor:"#000",flexDirection:"row"}}>
|
|
||||||
<View style={{flex:9}}>
|
|
||||||
<Text style={{fontSize:(()=>{
|
|
||||||
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 "";
|
|
||||||
}
|
|
||||||
})()}</Text>
|
|
||||||
</View>
|
|
||||||
<View style={{flex:4,flexDirection:"row"}}>
|
|
||||||
<Text style={{fontSize: d.lastStation.length > 4 ? 15 : 20,color:"white",fontWeight:"bold"}}>{d.lastStation}</Text>
|
|
||||||
</View>
|
|
||||||
<View style={{flex:3}}>
|
|
||||||
<Text style={{fontSize:20,color:"white",fontWeight:"bold"}}>{d.time}</Text>
|
|
||||||
</View>
|
|
||||||
<View style={{flex:4}}>
|
|
||||||
<Text style={{fontSize:20,color:"white",fontWeight:"bold"}}>{(()=>{
|
|
||||||
let data= currentTrain.filter(data=>data.num==d.train)[0].delay;
|
|
||||||
if(isNaN(data)){
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
else if(data == 0){
|
|
||||||
return "定刻通り"
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
return data+"分遅れ"
|
|
||||||
}
|
|
||||||
})()}</Text>
|
|
||||||
</View>
|
|
||||||
</View>,Boolean(trainDescriptionSwitch) && Boolean(customTrainDataDetector(d.train).info) &&
|
|
||||||
<View style={{alignContent:"center",alignItems:"center",width:"94%",marginVertical:5,marginHorizontal:"3%",backgroundColor:"#000",flexDirection:"row"}}>
|
|
||||||
<View style={{flex:4}}>
|
|
||||||
<Text style={{fontSize:20,color:"green",fontWeight:"bold"}}> > {customTrainDataDetector(d.train).info}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
]
|
|
||||||
)
|
|
||||||
: null}
|
|
||||||
<View style={{flexDirection:"row",padding:10}}>
|
|
||||||
<Text style={{alignItems:"center",alignContent:"center",textAlign:"center",textAlignVertical:"center",color:"white"}}>種別名 / 列番</Text>
|
|
||||||
<Switch value={trainIDSwitch} onValueChange={(value)=>setTrainIDSwitch(!trainIDSwitch)}/>
|
|
||||||
<View style={{flex:1}} />
|
|
||||||
<Text style={{alignItems:"center",alignContent:"center",textAlign:"center",textAlignVertical:"center",color:"white"}}>列車情報</Text>
|
|
||||||
<Switch value={trainDescriptionSwitch} onValueChange={(value)=>setTrainDescriptionSwitch(!trainDescriptionSwitch)}/>
|
|
||||||
<View style={{flex:1}} />
|
|
||||||
<Text style={{alignItems:"center",alignContent:"center",textAlign:"center",textAlignVertical:"center",color:"white"}}>当駅止表示</Text>
|
|
||||||
<Switch value={finalSwitch} onValueChange={(value)=>setFinalSwitch(!finalSwitch)}/>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
)
|
)
|
||||||
|
.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 (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
width: wp("98%"),
|
||||||
|
/* height: wp("98%")/10*9, */ backgroundColor: "#432",
|
||||||
|
borderWidth: 1,
|
||||||
|
margin: 10,
|
||||||
|
marginHorizontal: wp("1%"),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
alignContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
width: "100%",
|
||||||
|
marginVertical: 10,
|
||||||
|
flexDirection: "row",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View style={{ flex: 1 }}></View>
|
||||||
|
<View style={{}}>
|
||||||
|
<Text style={{ fontSize: 25, color: "white", fontWeight: "bold" }}>
|
||||||
|
次の列車
|
||||||
|
</Text>
|
||||||
|
<Text style={{ fontSize: 15, color: "white" }}>Next Train</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1 }}></View>
|
||||||
|
</View>
|
||||||
|
{trainTimeAndNumber
|
||||||
|
? currentTrain &&
|
||||||
|
trainTimeAndNumber
|
||||||
|
.filter(filtering)
|
||||||
|
.filter(timeFiltering)
|
||||||
|
.filter(finalFiltering)
|
||||||
|
.map((d, index) => [
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
alignContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
width: "94%",
|
||||||
|
marginVertical: 5,
|
||||||
|
marginHorizontal: "3%",
|
||||||
|
backgroundColor: "#000",
|
||||||
|
flexDirection: "row",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View style={{ flex: 9 }}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: (() => {
|
||||||
|
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 "";
|
||||||
|
}
|
||||||
|
})()}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 4, flexDirection: "row" }}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: d.lastStation.length > 4 ? 15 : 20,
|
||||||
|
color: "white",
|
||||||
|
fontWeight: "bold",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{d.lastStation}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 3 }}>
|
||||||
|
<Text
|
||||||
|
style={{ fontSize: 20, color: "white", fontWeight: "bold" }}
|
||||||
|
>
|
||||||
|
{d.time}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 4 }}>
|
||||||
|
<Text
|
||||||
|
style={{ fontSize: 20, color: "white", fontWeight: "bold" }}
|
||||||
|
>
|
||||||
|
{(() => {
|
||||||
|
let data = currentTrain.filter(
|
||||||
|
(data) => data.num == d.train
|
||||||
|
)[0].delay;
|
||||||
|
if (isNaN(data)) {
|
||||||
|
return data;
|
||||||
|
} else if (data == 0) {
|
||||||
|
return "定刻通り";
|
||||||
|
} else {
|
||||||
|
return data + "分遅れ";
|
||||||
|
}
|
||||||
|
})()}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</View>,
|
||||||
|
Boolean(trainDescriptionSwitch) &&
|
||||||
|
Boolean(customTrainDataDetector(d.train).info) && (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
alignContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
width: "94%",
|
||||||
|
marginVertical: 5,
|
||||||
|
marginHorizontal: "3%",
|
||||||
|
backgroundColor: "#000",
|
||||||
|
flexDirection: "row",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View style={{ flex: 4 }}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 20,
|
||||||
|
color: "green",
|
||||||
|
fontWeight: "bold",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
> {customTrainDataDetector(d.train).info}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
),
|
||||||
|
])
|
||||||
|
: null}
|
||||||
|
<View style={{ flexDirection: "row", padding: 10 }}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
alignItems: "center",
|
||||||
|
alignContent: "center",
|
||||||
|
textAlign: "center",
|
||||||
|
textAlignVertical: "center",
|
||||||
|
color: "white",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
種別名 / 列番
|
||||||
|
</Text>
|
||||||
|
<Switch
|
||||||
|
value={trainIDSwitch}
|
||||||
|
onValueChange={(value) => setTrainIDSwitch(!trainIDSwitch)}
|
||||||
|
/>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
alignItems: "center",
|
||||||
|
alignContent: "center",
|
||||||
|
textAlign: "center",
|
||||||
|
textAlignVertical: "center",
|
||||||
|
color: "white",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
列車情報
|
||||||
|
</Text>
|
||||||
|
<Switch
|
||||||
|
value={trainDescriptionSwitch}
|
||||||
|
onValueChange={(value) =>
|
||||||
|
setTrainDescriptionSwitch(!trainDescriptionSwitch)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
alignItems: "center",
|
||||||
|
alignContent: "center",
|
||||||
|
textAlign: "center",
|
||||||
|
textAlignVertical: "center",
|
||||||
|
color: "white",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
当駅止表示
|
||||||
|
</Text>
|
||||||
|
<Switch
|
||||||
|
value={finalSwitch}
|
||||||
|
onValueChange={(value) => setFinalSwitch(!finalSwitch)}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,106 +1,311 @@
|
|||||||
import React, { Component, useRef, useState, useEffect } from 'react';
|
import React, { Component, useRef, useState, useEffect } from "react";
|
||||||
import {StatusBar,View,LayoutAnimation,ScrollView,Linking,Text,TouchableOpacity } from 'react-native';
|
import {
|
||||||
import {widthPercentageToDP as wp, heightPercentageToDP as hp} from 'react-native-responsive-screen';
|
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) {
|
||||||
export default function Sign(props){
|
const { currentStation, originalStationList, oP } = props;
|
||||||
const {currentStation, originalStationList, oP} = props;
|
const getPreNextStation = (now) => {
|
||||||
const getPreNextStation = (now) =>{
|
const lineList = [
|
||||||
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]]
|
"高徳線",
|
||||||
|
"徳島線",
|
||||||
|
"鳴門線",
|
||||||
|
];
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
}, 1000);
|
||||||
})
|
return () => clearInterval(stationCount);
|
||||||
return returnData;
|
}
|
||||||
}
|
}
|
||||||
const [nexPrePosition, setNexPrePosition] = useState(0);
|
}, [currentStation]);
|
||||||
useEffect(()=>{
|
return (
|
||||||
if(currentStation){
|
<TouchableOpacity
|
||||||
if(currentStation.length > 1){
|
style={{
|
||||||
let stationCount = setInterval(()=>{
|
width: wp("80%"),
|
||||||
LayoutAnimation.easeInEaseOut();
|
height: (wp("80%") / 20) * 9,
|
||||||
if(nexPrePosition+1 == currentStation.length){
|
borderColor: "#2E94BB",
|
||||||
setNexPrePosition(0)
|
borderWidth: 1,
|
||||||
}
|
margin: 10,
|
||||||
else{
|
marginHorizontal: wp("10%"),
|
||||||
setNexPrePosition(nexPrePosition+1);
|
}}
|
||||||
}
|
/* onPress={()=> !stationName.今.JrHpUrl || Linking.openURL(stationName.今.JrHpUrl)} */ onPress={
|
||||||
|
oP
|
||||||
},1000)
|
}
|
||||||
return ()=>clearInterval(stationCount);
|
>
|
||||||
}
|
<View
|
||||||
}
|
style={{
|
||||||
},[currentStation])
|
position: "absolute",
|
||||||
return(
|
bottom: "0%",
|
||||||
<TouchableOpacity style={{ width: wp("80%"), height: wp("80%")/20*9,borderColor:"#2E94BB",borderWidth:1,margin:10,marginHorizontal:wp("10%")}} /* onPress={()=> !stationName.今.JrHpUrl || Linking.openURL(stationName.今.JrHpUrl)} */onPress={oP}>
|
left: "0%",
|
||||||
<View style={{position:"absolute",bottom:"0%",left:"0%",width:"100%",height:'30%',backgroundColor:"#2E94BB"}} />
|
width: "100%",
|
||||||
<Text style={{position:"absolute",top:"2%",left:"2%",fontWeight:"bold",fontSize:parseInt("30%"),color:"#2E94BB"}}>JR</Text>
|
height: "30%",
|
||||||
{currentStation.map((d,index,array)=>
|
backgroundColor: "#2E94BB",
|
||||||
<View style={{position:"absolute",alignContent:"center",alignItems:"center",top:(()=>{
|
}}
|
||||||
if(array.length == 1) return 20;
|
/>
|
||||||
else if(index == 0) return 5;
|
<Text
|
||||||
else if(index == 1) return 35;
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
top: "2%",
|
||||||
|
left: "2%",
|
||||||
|
fontWeight: "bold",
|
||||||
|
fontSize: parseInt("30%"),
|
||||||
|
color: "#2E94BB",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
JR
|
||||||
|
</Text>
|
||||||
|
{currentStation.map((d, index, array) => (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
alignContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
top:
|
||||||
|
(() => {
|
||||||
|
if (array.length == 1) return 20;
|
||||||
|
else if (index == 0) return 5;
|
||||||
|
else if (index == 1) return 35;
|
||||||
else return 20;
|
else return 20;
|
||||||
})()+"%",right:'10%',width:wp("10%"),height:wp("10%"),borderColor:"#2E94BB",borderWidth:parseInt("2%"),borderRadius:parseInt("100%")}} >
|
})() + "%",
|
||||||
<View style={{flex:1}} />
|
right: "10%",
|
||||||
<Text style={{fontSize:parseInt("20%")}}>{d.StationNumber}</Text>
|
width: wp("10%"),
|
||||||
<View style={{flex:1}} />
|
height: wp("10%"),
|
||||||
|
borderColor: "#2E94BB",
|
||||||
|
borderWidth: parseInt("2%"),
|
||||||
|
borderRadius: parseInt("100%"),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text style={{ fontSize: parseInt("20%") }}>{d.StationNumber}</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
</View>
|
||||||
|
))}
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
top: "10%",
|
||||||
|
alignContent: "center",
|
||||||
|
flexDirection: "row",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<View style={{ alignItems: "center" }}>
|
||||||
|
{/* <Text style={{fontWeight:"bold",fontSize:parseInt("15%"),color:"#005170"}}>{stationName.今.LineName}</Text> */}
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontWeight: "bold",
|
||||||
|
fontSize: parseInt("40%"),
|
||||||
|
color: "#005170",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{currentStation[0].Station_JP}
|
||||||
|
</Text>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontWeight: "bold",
|
||||||
|
fontSize: parseInt("15%"),
|
||||||
|
color: "#005170",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{currentStation[0].Station_EN}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
bottom: "0%",
|
||||||
|
height: "30%",
|
||||||
|
width: "100%",
|
||||||
|
alignItems: "center",
|
||||||
|
flexDirection: "column",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{(() => {
|
||||||
|
return currentStation.map((currentStation) => {
|
||||||
|
let [preStation, nexStation] = getPreNextStation(currentStation);
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: "row",
|
||||||
|
alignContent: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: "row",
|
||||||
|
alignContent: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{preStation && [
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontWeight: "bold",
|
||||||
|
fontSize: parseInt("20%"),
|
||||||
|
color: "white",
|
||||||
|
paddingHorizontal: 10,
|
||||||
|
textAlignVertical: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
◀
|
||||||
|
</Text>,
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
alignContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
width: wp("8%"),
|
||||||
|
height: wp("8%"),
|
||||||
|
margin: wp("1%"),
|
||||||
|
borderColor: "white",
|
||||||
|
borderWidth: parseInt("2%"),
|
||||||
|
borderRadius: parseInt("100%"),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text
|
||||||
|
style={{ fontSize: parseInt("10%"), color: "white" }}
|
||||||
|
>
|
||||||
|
{preStation.StationNumber}
|
||||||
|
</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
</View>,
|
||||||
|
<View style={{ flex: 1, alignItems: "flex-start" }}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontWeight: "bold",
|
||||||
|
fontSize: parseInt("15%"),
|
||||||
|
color: "white",
|
||||||
|
flex: 1,
|
||||||
|
textAlignVertical: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{preStation.Station_JP}
|
||||||
|
</Text>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontWeight: "bold",
|
||||||
|
fontSize: parseInt("15%"),
|
||||||
|
color: "white",
|
||||||
|
flex: 1,
|
||||||
|
textAlignVertical: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{preStation.Station_EN}
|
||||||
|
</Text>
|
||||||
|
</View>,
|
||||||
|
]}
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: "row",
|
||||||
|
alignContent: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{nexStation && [
|
||||||
|
<View style={{ flex: 1, alignItems: "flex-end" }}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontWeight: "bold",
|
||||||
|
fontSize: parseInt("15%"),
|
||||||
|
color: "white",
|
||||||
|
flex: 1,
|
||||||
|
textAlignVertical: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{nexStation.Station_JP}
|
||||||
|
</Text>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontWeight: "bold",
|
||||||
|
fontSize: parseInt("15%"),
|
||||||
|
color: "white",
|
||||||
|
flex: 1,
|
||||||
|
textAlignVertical: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{nexStation.Station_EN}
|
||||||
|
</Text>
|
||||||
|
</View>,
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
alignContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
width: wp("8%"),
|
||||||
|
height: wp("8%"),
|
||||||
|
margin: wp("1%"),
|
||||||
|
borderColor: "white",
|
||||||
|
borderWidth: parseInt("2%"),
|
||||||
|
borderRadius: parseInt("100%"),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text
|
||||||
|
style={{ fontSize: parseInt("10%"), color: "white" }}
|
||||||
|
>
|
||||||
|
{nexStation.StationNumber}
|
||||||
|
</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
</View>,
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontWeight: "bold",
|
||||||
|
fontSize: parseInt("20%"),
|
||||||
|
color: "white",
|
||||||
|
paddingHorizontal: 10,
|
||||||
|
textAlignVertical: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
▶
|
||||||
|
</Text>,
|
||||||
|
]}
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
)}
|
);
|
||||||
<View style={{position:"absolute",top:"10%",alignContent:"center",flexDirection:"row"}}>
|
})[nexPrePosition];
|
||||||
<View style={{flex:1}}/>
|
})()}
|
||||||
<View style={{alignItems:"center"}}>
|
</View>
|
||||||
{/* <Text style={{fontWeight:"bold",fontSize:parseInt("15%"),color:"#005170"}}>{stationName.今.LineName}</Text> */}
|
</TouchableOpacity>
|
||||||
<Text style={{fontWeight:"bold",fontSize:parseInt("40%"),color:"#005170"}}>{currentStation[0].Station_JP}</Text>
|
);
|
||||||
<Text style={{fontWeight:"bold",fontSize:parseInt("15%"),color:"#005170"}}>{currentStation[0].Station_EN}</Text>
|
}
|
||||||
</View>
|
|
||||||
<View style={{flex:1}}/>
|
|
||||||
</View>
|
|
||||||
<View style={{position:"absolute",bottom:"0%",height:"30%",width:"100%",alignItems:"center",flexDirection:"column"}}>
|
|
||||||
|
|
||||||
{(()=>{return currentStation.map(currentStation =>{
|
|
||||||
let [preStation, nexStation] = getPreNextStation(currentStation)
|
|
||||||
return(
|
|
||||||
<View style={{flex:1,flexDirection:"row",alignContent:"center"}}>
|
|
||||||
<View style={{flex:1,flexDirection:"row",alignContent:"center"}}>
|
|
||||||
{preStation &&
|
|
||||||
[<Text style={{fontWeight:"bold",fontSize:parseInt("20%"),color:"white",paddingHorizontal:10,textAlignVertical:"center"}}>◀</Text>,
|
|
||||||
<View style={{alignContent:"center",alignItems:"center",width:wp("8%"),height:wp("8%"),margin:wp("1%"),borderColor:"white",borderWidth:parseInt("2%"),borderRadius:parseInt("100%")}} >
|
|
||||||
<View style={{flex:1}} />
|
|
||||||
<Text style={{fontSize:parseInt("10%"),color:"white"}}>{preStation.StationNumber}</Text>
|
|
||||||
<View style={{flex:1}} />
|
|
||||||
</View>,
|
|
||||||
<View style={{flex:1,alignItems:"flex-start"}}>
|
|
||||||
<Text style={{fontWeight:"bold",fontSize:parseInt("15%"),color:"white",flex:1,textAlignVertical:"center"}}>{preStation.Station_JP}</Text>
|
|
||||||
<Text style={{fontWeight:"bold",fontSize:parseInt("15%"),color:"white",flex:1,textAlignVertical:"center"}}>{preStation.Station_EN}</Text>
|
|
||||||
</View>]}
|
|
||||||
</View>
|
|
||||||
<View style={{flex:1,flexDirection:"row",alignContent:"center"}}>
|
|
||||||
|
|
||||||
{nexStation &&
|
|
||||||
[<View style={{flex:1,alignItems:"flex-end"}}>
|
|
||||||
<Text style={{fontWeight:"bold",fontSize:parseInt("15%"),color:"white",flex:1,textAlignVertical:"center"}}>{nexStation.Station_JP}</Text>
|
|
||||||
<Text style={{fontWeight:"bold",fontSize:parseInt("15%"),color:"white",flex:1,textAlignVertical:"center"}}>{nexStation.Station_EN}</Text>
|
|
||||||
</View>,
|
|
||||||
<View style={{alignContent:"center",alignItems:"center",width:wp("8%"),height:wp("8%"),margin:wp("1%"),borderColor:"white",borderWidth:parseInt("2%"),borderRadius:parseInt("100%")}} >
|
|
||||||
<View style={{flex:1}} />
|
|
||||||
<Text style={{fontSize:parseInt("10%"),color:"white"}}>{nexStation.StationNumber}</Text>
|
|
||||||
<View style={{flex:1}} />
|
|
||||||
</View>,
|
|
||||||
<Text style={{fontWeight:"bold",fontSize:parseInt("20%"),color:"white",paddingHorizontal:10,textAlignVertical:"center"}}>▶</Text>]}
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
})[nexPrePosition]
|
|
||||||
|
|
||||||
})()}
|
|
||||||
|
|
||||||
</View>
|
|
||||||
|
|
||||||
</TouchableOpacity>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
41
howto.js
41
howto.js
@ -1,13 +1,30 @@
|
|||||||
const WEBVIEW = "WEBVIEW";
|
const WEBVIEW = "WEBVIEW";
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from "react";
|
||||||
import { StatusBar,View, TouchableOpacity, Text} from 'react-native';
|
import { StatusBar, View, TouchableOpacity, Text } from "react-native";
|
||||||
import {WebView} from 'react-native-webview';
|
import { WebView } from "react-native-webview";
|
||||||
export default ({ navigation: { navigate } }) =>
|
export default ({ navigation: { navigate } }) => (
|
||||||
<View style={{height:"100%",backgroundColor:"#0099CC"}}>
|
<View style={{ height: "100%", backgroundColor: "#0099CC" }}>
|
||||||
<WebView useWebKit={true} source={{uri: 'https://train.jr-shikoku.co.jp/usage.htm'}}/>
|
<WebView
|
||||||
<TouchableOpacity style={{padding:10,flexDirection:"row",borderColor:"white",borderWidth:1,margin:10,borderRadius:5,alignItems:"center"}} onPress={()=>navigate('Apps')}>
|
useWebKit={true}
|
||||||
<View style={{flex:1}} />
|
source={{ uri: "https://train.jr-shikoku.co.jp/usage.htm" }}
|
||||||
<Text style={{fontSize:25,fontWeight:"bold",color:"white"}}>閉じる</Text>
|
/>
|
||||||
<View style={{flex:1}} />
|
<TouchableOpacity
|
||||||
</TouchableOpacity>
|
style={{
|
||||||
</View>
|
padding: 10,
|
||||||
|
flexDirection: "row",
|
||||||
|
borderColor: "white",
|
||||||
|
borderWidth: 1,
|
||||||
|
margin: 10,
|
||||||
|
borderRadius: 5,
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
|
onPress={() => navigate("Apps")}
|
||||||
|
>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text style={{ fontSize: 25, fontWeight: "bold", color: "white" }}>
|
||||||
|
閉じる
|
||||||
|
</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
</TouchableOpacity>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
36
ndView.js
36
ndView.js
@ -1,18 +1,25 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from "react";
|
||||||
import { StatusBar,View,Linking,Platform,Text} from 'react-native';
|
import { StatusBar, View, Linking, Platform, Text } from "react-native";
|
||||||
import {WebView} from 'react-native-webview';
|
import { WebView } from "react-native-webview";
|
||||||
import Constants from 'expo-constants';
|
import Constants from "expo-constants";
|
||||||
import { TouchableOpacity } from 'react-native-gesture-handler';
|
import { TouchableOpacity } from "react-native-gesture-handler";
|
||||||
export default function tndView () {
|
export default function tndView() {
|
||||||
return (
|
return (
|
||||||
<View style={{backgroundColor: '#309AC3', height:"100%",paddingTop: Platform.OS == "ios" ? Constants.statusBarHeight: 0,}}>
|
<View
|
||||||
<WebView
|
style={{
|
||||||
useWebKit={true}
|
backgroundColor: "#309AC3",
|
||||||
source={{uri: 'https://www.jr-shikoku.co.jp/info/'}}
|
height: "100%",
|
||||||
originWhitelist={['https://www.jr-shikoku.co.jp']}
|
paddingTop: Platform.OS == "ios" ? Constants.statusBarHeight : 0,
|
||||||
mixedContentMode={'compatibility'}
|
}}
|
||||||
javaScriptEnabled={true}
|
>
|
||||||
injectedJavaScript={jsa}/>
|
<WebView
|
||||||
|
useWebKit={true}
|
||||||
|
source={{ uri: "https://www.jr-shikoku.co.jp/info/" }}
|
||||||
|
originWhitelist={["https://www.jr-shikoku.co.jp"]}
|
||||||
|
mixedContentMode={"compatibility"}
|
||||||
|
javaScriptEnabled={true}
|
||||||
|
injectedJavaScript={jsa}
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -20,4 +27,3 @@ const jsa = `
|
|||||||
document.querySelector('.sitettl').style.display = 'none';
|
document.querySelector('.sitettl').style.display = 'none';
|
||||||
document.querySelector('.attention').style.display = 'none';
|
document.querySelector('.attention').style.display = 'none';
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user