diff --git a/App.js b/App.js
index ee02b4e..94bbc8a 100644
--- a/App.js
+++ b/App.js
@@ -13,6 +13,7 @@ import menu from './menu';
import News from './components/news.js';
import TestArea from './TestArea.js';
import Setting from './components/settings.js';
+import trainMenu from './components/trainMenu.js';
const Stack = createStackNavigator();
const Tab = createBottomTabNavigator();
if (Platform.OS === 'android') {
@@ -44,6 +45,7 @@ function top(){
+
)
}
diff --git a/Apps.js b/Apps.js
index a566f6b..f9ab361 100644
--- a/Apps.js
+++ b/Apps.js
@@ -3,7 +3,6 @@ import {View, Platform,ToastAndroid, Text, TouchableOpacity} from 'react-native'
import {WebView} from 'react-native-webview';
import Constants from 'expo-constants';
import AsyncStorage from '@react-native-async-storage/async-storage';
-import MapView,{ Marker, Geojson, PROVIDER_GOOGLE } from 'react-native-maps';
/*
import StatusbarDetect from './StatusbarDetect';
var Status = StatusbarDetect(); */
@@ -14,9 +13,7 @@ export default function Apps (props) {
const { navigation: { navigate } } = props;
var urlcache="";
const webview = useRef();
- const mapRef = useRef();
const [iconSetting, setIconSetting] = useState(undefined)
- const [mapView, setMapView] = useState(false);
const [mapSwitch, setMapSwitch] = useState(undefined);
@@ -731,32 +728,7 @@ const injectJavascriptData = bootData+trainIconMaker+textInsert;
},[])
- const [yosanData,setYosanData] = useState(undefined);
- useEffect(()=>{
- const HeaderConfig = {
- headers:{
- 'referer':'https://train.jr-shikoku.co.jp/sp.html'
- }
- }/*
- fetch('https://train.jr-shikoku.co.jp/g?arg1=station&arg2=yosan', HeaderConfig)
- .then(response => response.json())
- .then(setYosanData); */
-
- 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())
- ]).then(values =>{
- let stationList = {};
- [stationList.yosan, stationList.uwajima, stationList.uwajima2, stationList.dosan, stationList.dosan2, stationList.koutoku, stationList.tokushima, stationList.naruto] = values;
- setYosanData(stationList);
- })
- },[]);
+
return (
@@ -791,44 +763,12 @@ const injectJavascriptData = bootData+trainIconMaker+textInsert;
}
onMessage={(event)=>{}}
injectedJavaScript={injectJavascriptData}/>
- setMapView(true)} style={{position:"absolute",bottom:0,right:0,width:50,height:50,backgroundColor:"white",borderColor:"blue",borderStyle:"solid",borderWidth:1,borderRadius:50,alignContent:"center",alignSelf:"center",alignItems:"center",margin:10,display:mapSwitch == "true" ? "flex": "none"}}>
+ navigate('trainMenu', {webview: webview})} style={{position:"absolute",bottom:0,right:0,width:50,height:50,backgroundColor:"white",borderColor:"blue",borderStyle:"solid",borderWidth:1,borderRadius:50,alignContent:"center",alignSelf:"center",alignItems:"center",margin:10,display:mapSwitch == "true" ? "flex": "none"}}>
線
-
- {/*MoveDisplayStation('yosan_37_伊予北条') */}
-
- {mapView && yosanData && Object.keys(yosanData).map(d=>
- yosanData[d].map((D,index)=>{
- if(!D.StationMap)return null;
- const latlng = D.StationMap.replace("https://www.google.co.jp/maps/place/","").split(",");
- if(latlng.length == 0)return null;
- return(
- {
- webview.current?.injectJavaScript("MoveDisplayStation('"+d+"_"+D.MyStation+"_"+D.Station_JP+"')");
- setMapView(false);
- }}>
-
- )
- })
- ) }
-
- setMapView(false)} style={{fontSize:30}}>閉じる
-
+
);
}
\ No newline at end of file
diff --git a/components/trainMenu.js b/components/trainMenu.js
new file mode 100644
index 0000000..bb02ee1
--- /dev/null
+++ b/components/trainMenu.js
@@ -0,0 +1,82 @@
+import React, { useState, useEffect, useRef } from 'react';
+import {View,Text,TouchableOpacity } from 'react-native';
+import {WebView} from 'react-native-webview';
+import StatusbarDetect from '../StatusbarDetect';
+import AsyncStorage from '@react-native-async-storage/async-storage';
+import MapView,{ Marker, Geojson, PROVIDER_GOOGLE } from 'react-native-maps';
+import { FontAwesome, Fontisto, Foundation, Ionicons, MaterialCommunityIcons } from '@expo/vector-icons';
+var Status = StatusbarDetect();
+export default function trainMenu({route:{params: {webview}}, navigation:{ navigate }}){
+ const [stationData,setStationData] = useState(undefined);
+ const mapRef = useRef();
+ useEffect(()=>{
+ const HeaderConfig = {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())
+ ]).then(values =>{
+ let stationList = {};
+ [stationList.yosan, stationList.uwajima, stationList.uwajima2, stationList.dosan, stationList.dosan2, stationList.koutoku, stationList.tokushima, stationList.naruto] = values;
+ setStationData(stationList);
+ })
+ },[]);
+ return(
+
+
+ {stationData && Object.keys(stationData).map(d=>
+ stationData[d].map((D,index)=>{
+ if(!D.StationMap)return null;
+ const latlng = D.StationMap.replace("https://www.google.co.jp/maps/place/","").split(",");
+ if(latlng.length == 0)return null;
+ return(
+ {
+ webview.current?.injectJavaScript("MoveDisplayStation('"+d+"_"+D.MyStation+"_"+D.Station_JP+"')");
+ navigate('Apps');
+ }}>
+
+ )
+ })
+ ) }
+
+
+ navigate('howto')}>使い方
+ Linking.openURL("https://www.jr-shikoku.co.jp/01_trainbus/jikoku/sp/#mainprice-box")}>お気に入り
+ Linking.openURL("https://www.jr-shikoku.co.jp/e5489/")}>予約
+
+ {AsyncStorage.setItem('status', "2022/04/14");navigate('Apps');}}>
+
+ 閉じる
+
+
+
+ )
+}
+const UsefulBox = (props) =>{
+ const { icon, backgroundColor, flex, onPressButton, children } = props;
+ return(
+
+
+ {children}
+
+ )
+}
\ No newline at end of file
diff --git a/howto.js b/howto.js
index 197ce42..2468685 100644
--- a/howto.js
+++ b/howto.js
@@ -1,16 +1,13 @@
const WEBVIEW = "WEBVIEW";
import React, { Component } from 'react';
-import { StatusBar,View} from 'react-native';
+import { StatusBar,View, TouchableOpacity, Text} from 'react-native';
import {WebView} from 'react-native-webview';
-export default class howto extends Component {
- render() {
- return (
-
-
-
-
-
-
- );
- }
-}
\ No newline at end of file
+export default ({ navigation: { navigate } }) =>
+
+
+ navigate('Apps')}>
+
+ 閉じる
+
+
+
\ No newline at end of file