Compare commits
163 Commits
feature/ne
...
patch/4.5.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84d36b88cc | ||
|
|
711f0bbe9f | ||
|
|
dbae477bea | ||
|
|
0de3d73ced | ||
|
|
49098308db | ||
|
|
bfec537f56 | ||
|
|
bf78287563 | ||
|
|
d511b80437 | ||
|
|
e90ffd8926 | ||
|
|
4446019ab2 | ||
|
|
92b9a4a044 | ||
|
|
f504497bdf | ||
|
|
dfdd9a7f37 | ||
|
|
b0b15f726c | ||
|
|
e8906495c2 | ||
|
|
d3c9bca4d3 | ||
|
|
eb806e3f8a | ||
|
|
dfe3c831bc | ||
|
|
946f669eb0 | ||
|
|
b1ecbb1cfe | ||
|
|
480bcbfcd3 | ||
|
|
420a805f3c | ||
|
|
7e092671a2 | ||
|
|
1b16e09633 | ||
|
|
52b15288b9 | ||
|
|
b2ee75205b | ||
|
|
5115656050 | ||
|
|
f5491200eb | ||
|
|
26111e7ce8 | ||
|
|
b2624d319b | ||
|
|
0618ff0180 | ||
|
|
b4c306bce3 | ||
|
|
cdea9a1e05 | ||
|
|
0ff05f911c | ||
|
|
84efa42e57 | ||
|
|
610f9c21ce | ||
|
|
9fee43d6ff | ||
|
|
ce9dccc158 | ||
|
|
7f67fc6cc8 | ||
|
|
ed76462436 | ||
|
|
a643ab5c56 | ||
|
|
ea1c505453 | ||
|
|
35907df3c4 | ||
|
|
180bc95a80 | ||
|
|
6f7f02e4fa | ||
|
|
df7608acaf | ||
|
|
34413f522f | ||
|
|
07adaf2ef5 | ||
|
|
34f907ef9b | ||
|
|
f815b31720 | ||
|
|
06b1933d1c | ||
|
|
1aac1e40df | ||
|
|
4ef5a13dc3 | ||
|
|
0f56a7ceea | ||
|
|
1622cd2ab8 | ||
|
|
a3e8e3cbbe | ||
|
|
a83bb27f60 | ||
|
|
320a94565d | ||
|
|
fd7fd7f623 | ||
|
|
cfbd126fe3 | ||
|
|
bfd6decfcc | ||
|
|
81f394d6ca | ||
|
|
357490314a | ||
|
|
bb115afe35 | ||
|
|
c00073bb32 | ||
|
|
47d84777e2 | ||
|
|
65dd6dd0fd | ||
|
|
054dab518f | ||
|
|
3d09b93df5 | ||
|
|
ffe18b8398 | ||
|
|
9381e0ee15 | ||
|
|
9eca679019 | ||
|
|
dc4f1d7454 | ||
|
|
98b22db4db | ||
|
|
59df072e45 | ||
|
|
816d96d37b | ||
|
|
e9fd753a8f | ||
|
|
d627617ca0 | ||
|
|
f6a88f09e4 | ||
|
|
12934f0963 | ||
|
|
3f8a753abb | ||
|
|
28c58ce83f | ||
|
|
d45b6aee0e | ||
|
|
abe8334b26 | ||
|
|
64538e33f3 | ||
|
|
942b90e6d2 | ||
|
|
9d75186691 | ||
|
|
9959fbe5c9 | ||
|
|
0230f5409a | ||
|
|
1c67d1d486 | ||
|
|
97d05571e5 | ||
|
|
655f174321 | ||
|
|
3137d50e24 | ||
|
|
74864da293 | ||
|
|
4e90ecf132 | ||
|
|
a7347a1816 | ||
|
|
815734eb07 | ||
|
|
369ae557c7 | ||
|
|
4c47a1684c | ||
|
|
c2ca832b80 | ||
|
|
5867ad3aa8 | ||
|
|
ece076ad48 | ||
|
|
58340bb608 | ||
|
|
32fb402126 | ||
|
|
44b6a113ff | ||
|
|
e93fe7095e | ||
|
|
bb89149876 | ||
|
|
12f23bef16 | ||
|
|
f580e319cf | ||
|
|
7dc72ef433 | ||
|
|
746c996cba | ||
|
|
556b04e3b0 | ||
|
|
67f9b8b698 | ||
|
|
3ff585a577 | ||
|
|
f5e4947c3b | ||
|
|
fae18a6a47 | ||
|
|
40fb55c8cf | ||
|
|
1fd2be5ddf | ||
|
|
e35ab09002 | ||
|
|
f993577e34 | ||
|
|
7f8a77d9fa | ||
|
|
50973db9ce | ||
|
|
2fbd54eb7f | ||
|
|
7595dd845a | ||
|
|
d475b5c8a4 | ||
|
|
3a45288eee | ||
|
|
c996b31dad | ||
|
|
2040d829fe | ||
|
|
9eaa32a0f2 | ||
|
|
a17626042a | ||
|
|
1dc1b9a636 | ||
|
|
a56dfc7618 | ||
|
|
178fda07af | ||
|
|
bf016b1c8b | ||
|
|
1a1227dfeb | ||
|
|
29963ab876 | ||
|
|
a5523d61c3 | ||
|
|
337179b4c4 | ||
|
|
052c121179 | ||
|
|
7321f6d514 | ||
|
|
ff48198c87 | ||
|
|
690df1d2bc | ||
|
|
0251b9fc2f | ||
|
|
67eed85c22 | ||
|
|
cb94b545dc | ||
|
|
1ef8870153 | ||
|
|
18e046dc33 | ||
|
|
f64ccfa271 | ||
|
|
5406d98195 | ||
|
|
a923ac8b20 | ||
|
|
03d6f02de5 | ||
|
|
1ecb9ec046 | ||
|
|
796464c03a | ||
|
|
3723b01401 | ||
|
|
59c60d7791 | ||
|
|
10ea09cb00 | ||
|
|
7810b770cc | ||
|
|
00e0dbab9d | ||
|
|
923a28e1a5 | ||
|
|
151edd5fff | ||
|
|
f7965be3ef | ||
|
|
32f6fa3b60 | ||
|
|
5474b3eab2 |
293
App.js
293
App.js
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useRef } from "react";
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
import { NavigationContainer } from "@react-navigation/native";
|
import { NavigationContainer } from "@react-navigation/native";
|
||||||
import {
|
import {
|
||||||
createStackNavigator,
|
createStackNavigator,
|
||||||
@@ -8,14 +8,25 @@ import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
|
|||||||
import { AntDesign, Ionicons } from "@expo/vector-icons";
|
import { AntDesign, Ionicons } from "@expo/vector-icons";
|
||||||
import { Platform, UIManager } from "react-native";
|
import { Platform, UIManager } from "react-native";
|
||||||
import { UpdateAsync } from "./UpdateAsync.js";
|
import { UpdateAsync } from "./UpdateAsync.js";
|
||||||
|
import { getStationList2 } from "./lib/getStationList2";
|
||||||
|
import { AS } from "./storageControl";
|
||||||
import Apps from "./Apps";
|
import Apps from "./Apps";
|
||||||
import tndView from "./ndView";
|
import TNDView from "./ndView";
|
||||||
import trainbase from "./trainbaseview";
|
import TrainBase from "./trainbaseview";
|
||||||
import howto from "./howto";
|
import HowTo from "./howto";
|
||||||
import menu from "./menu";
|
import Menu from "./menu";
|
||||||
import News from "./components/news.js";
|
import News from "./components/news.js";
|
||||||
import Setting from "./components/settings.js";
|
import Setting from "./components/settings.js";
|
||||||
import trainMenu from "./components/trainMenu.js";
|
import TrainMenu from "./components/trainMenu.js";
|
||||||
|
import FavoriteList from "./components/FavoriteList.js";
|
||||||
|
import { LogBox } from "react-native";
|
||||||
|
import useInterval from "./lib/useInterval";
|
||||||
|
import { HeaderConfig } from "./lib/HeaderConfig";
|
||||||
|
|
||||||
|
LogBox.ignoreLogs([
|
||||||
|
"ViewPropTypes will be removed",
|
||||||
|
"ColorPropType will be removed",
|
||||||
|
]);
|
||||||
const Stack = createStackNavigator();
|
const Stack = createStackNavigator();
|
||||||
const Tab = createBottomTabNavigator();
|
const Tab = createBottomTabNavigator();
|
||||||
if (Platform.OS === "android") {
|
if (Platform.OS === "android") {
|
||||||
@@ -24,96 +35,312 @@ if (Platform.OS === "android") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const navigationRef = useRef();
|
useEffect(() => {
|
||||||
useEffect(UpdateAsync, []);
|
UpdateAsync();
|
||||||
|
}, []);
|
||||||
|
const [favoriteStation, setFavoriteStation] = useState([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
AS.getItem("favoriteStation")
|
||||||
|
.then((d) => {
|
||||||
|
const returnData = JSON.parse(d);
|
||||||
|
setFavoriteStation(returnData);
|
||||||
|
})
|
||||||
|
.catch((d) => console.log(d));
|
||||||
|
}, []);
|
||||||
|
const [busAndTrainData, setBusAndTrainData] = useState([]);
|
||||||
|
useEffect(() => {
|
||||||
|
AS.getItem("busAndTrain")
|
||||||
|
.then((d) => {
|
||||||
|
const returnData = JSON.parse(d);
|
||||||
|
setBusAndTrainData(returnData);
|
||||||
|
})
|
||||||
|
.catch((d) => {
|
||||||
|
fetch(
|
||||||
|
"https://script.google.com/macros/s/AKfycbw0UW6ZeCDgUYFRP0zxpc_Oqfy-91dBdbWv-cM8n3narKp14IyCd2wy5HW7taXcW7E/exec"
|
||||||
|
)
|
||||||
|
.then((d) => d.json())
|
||||||
|
.then((d) => {
|
||||||
|
setBusAndTrainData(d);
|
||||||
|
AS.setItem("busAndTrain", JSON.stringify(d));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const [currentTrain, setCurrentTrain] = useState([]); //現在在線中の全列車 { num: 列車番号, delay: 遅延時分(状態), Pos: 位置情報 }
|
||||||
|
const [currentTrainLoading, setCurrentTrainLoading] = useState("loading"); // success, error, loading
|
||||||
|
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, Pos: x.Pos }))
|
||||||
|
)
|
||||||
|
.then((d) => {
|
||||||
|
setCurrentTrain(d);
|
||||||
|
setCurrentTrainLoading("success");
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.log("えらー");
|
||||||
|
setCurrentTrainLoading("error");
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(getCurrentTrain, []); //初回だけ現在の全在線列車取得
|
||||||
|
|
||||||
|
useInterval(getCurrentTrain, 15000); //15秒毎に全在線列車取得
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NavigationContainer name="Root" ref={navigationRef} style={{ flex: 1 }}>
|
<NavigationContainer name="Root" style={{ flex: 1 }}>
|
||||||
<Tab.Navigator>
|
<Tab.Navigator detachInactiveScreens={false}>
|
||||||
<Stack.Screen
|
<Tab.Screen
|
||||||
name="login"
|
name="login"
|
||||||
component={top}
|
|
||||||
options={{
|
options={{
|
||||||
tabBarLabel: "位置情報",
|
tabBarLabel: "位置情報",
|
||||||
headerTransparent: true,
|
headerTransparent: true,
|
||||||
gestureEnabled: true,
|
gestureEnabled: true,
|
||||||
tabBarIcon: () => <AntDesign name="barchart" size={32} />,
|
tabBarIcon: initIcon("barchart", "AntDesign"),
|
||||||
}}
|
}}
|
||||||
|
>
|
||||||
|
{(props) => (
|
||||||
|
<Top
|
||||||
|
{...props}
|
||||||
|
favoriteStation={favoriteStation}
|
||||||
|
setFavoriteStation={setFavoriteStation}
|
||||||
|
busAndTrainData={busAndTrainData}
|
||||||
|
currentTrainState={{ currentTrain, setCurrentTrain }}
|
||||||
|
currentTrainLoadingState={{
|
||||||
|
currentTrainLoading,
|
||||||
|
setCurrentTrainLoading,
|
||||||
|
}}
|
||||||
|
getCurrentTrain={getCurrentTrain}
|
||||||
/>
|
/>
|
||||||
<Stack.Screen
|
)}
|
||||||
|
</Tab.Screen>
|
||||||
|
<Tab.Screen
|
||||||
name="menuPage"
|
name="menuPage"
|
||||||
component={menuPage}
|
|
||||||
options={{
|
options={{
|
||||||
tabBarLabel: "リンク",
|
tabBarLabel: "リンク",
|
||||||
headerTransparent: true,
|
headerTransparent: true,
|
||||||
gestureEnabled: true,
|
gestureEnabled: true,
|
||||||
tabBarIcon: () => <Ionicons name="ios-radio" size={32} />,
|
tabBarIcon: initIcon("ios-radio", "Ionicons"),
|
||||||
}}
|
}}
|
||||||
|
>
|
||||||
|
{(props) => (
|
||||||
|
<MenuPage
|
||||||
|
{...props}
|
||||||
|
favoriteStation={favoriteStation}
|
||||||
|
setFavoriteStation={setFavoriteStation}
|
||||||
|
busAndTrainData={busAndTrainData}
|
||||||
|
currentTrainState={{ currentTrain, setCurrentTrain }}
|
||||||
|
currentTrainLoadingState={{
|
||||||
|
currentTrainLoading,
|
||||||
|
setCurrentTrainLoading,
|
||||||
|
}}
|
||||||
|
getCurrentTrain={getCurrentTrain}
|
||||||
/>
|
/>
|
||||||
<Stack.Screen
|
)}
|
||||||
|
</Tab.Screen>
|
||||||
|
<Tab.Screen
|
||||||
name="home"
|
name="home"
|
||||||
component={tndView}
|
|
||||||
options={{
|
options={{
|
||||||
tabBarLabel: "運行情報",
|
tabBarLabel: "運行情報",
|
||||||
headerTransparent: true,
|
headerTransparent: true,
|
||||||
gestureEnabled: true,
|
gestureEnabled: true,
|
||||||
tabBarIcon: () => <Ionicons name="md-train" size={32} />,
|
tabBarIcon: initIcon("md-train", "Ionicons"),
|
||||||
}}
|
}}
|
||||||
/>
|
>
|
||||||
|
{(props) => <TNDView {...props} />}
|
||||||
|
</Tab.Screen>
|
||||||
</Tab.Navigator>
|
</Tab.Navigator>
|
||||||
</NavigationContainer>
|
</NavigationContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
function top() {
|
|
||||||
|
const initIcon = (name, type) => {
|
||||||
|
switch (type) {
|
||||||
|
case "Ionicons":
|
||||||
|
return ({ focused, color, size }) => (
|
||||||
|
<Ionicons name={name} size={32} color={focused ? "#0099CC" : "black"} />
|
||||||
|
);
|
||||||
|
case "AntDesign":
|
||||||
|
return ({ focused, color, size }) => (
|
||||||
|
<AntDesign
|
||||||
|
name={name}
|
||||||
|
size={32}
|
||||||
|
color={focused ? "#0099CC" : "black"}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const Top = ({
|
||||||
|
navigation,
|
||||||
|
favoriteStation,
|
||||||
|
setFavoriteStation,
|
||||||
|
busAndTrainData,
|
||||||
|
currentTrainState,
|
||||||
|
currentTrainLoadingState,
|
||||||
|
getCurrentTrain,
|
||||||
|
}) => {
|
||||||
|
const webview = useRef();
|
||||||
|
|
||||||
|
//地図用
|
||||||
|
const [mapsStationData, setMapsStationData] = useState(undefined);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getStationList2().then(setMapsStationData);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const unsubscribe = navigation.addListener("tabLongPress", (e) => {
|
||||||
|
navigation.navigate("favoriteList");
|
||||||
|
});
|
||||||
|
|
||||||
|
return unsubscribe;
|
||||||
|
}, [navigation]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack.Navigator>
|
<Stack.Navigator>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
name="Apps"
|
name="Apps"
|
||||||
component={Apps}
|
|
||||||
options={{
|
options={{
|
||||||
headerShown: false,
|
headerShown: false,
|
||||||
gestureEnabled: true,
|
gestureEnabled: true,
|
||||||
headerTransparent: true,
|
headerTransparent: true,
|
||||||
}}
|
}}
|
||||||
|
>
|
||||||
|
{(props) => (
|
||||||
|
<Apps
|
||||||
|
{...props}
|
||||||
|
webview={webview}
|
||||||
|
favoriteStation={favoriteStation}
|
||||||
|
setFavoriteStation={setFavoriteStation}
|
||||||
|
busAndTrainData={busAndTrainData}
|
||||||
|
stationData={mapsStationData}
|
||||||
|
currentTrainState={currentTrainState}
|
||||||
|
currentTrainLoadingState={currentTrainLoadingState}
|
||||||
|
getCurrentTrain={getCurrentTrain}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
|
</Stack.Screen>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
name="trainbase"
|
name="trainbase"
|
||||||
component={trainbase}
|
|
||||||
options={{
|
options={{
|
||||||
title: "トレインビジョン",
|
title: "トレインビジョン",
|
||||||
gestureEnabled: true,
|
gestureEnabled: true,
|
||||||
...TransitionPresets.SlideFromRightIOS,
|
...TransitionPresets.SlideFromRightIOS,
|
||||||
}}
|
}}
|
||||||
/>
|
>
|
||||||
|
{(props) => <TrainBase {...props} />}
|
||||||
|
</Stack.Screen>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
name="howto"
|
name="howto"
|
||||||
component={howto}
|
|
||||||
options={{
|
options={{
|
||||||
title: "使い方",
|
|
||||||
...optionData,
|
...optionData,
|
||||||
}}
|
}}
|
||||||
|
>
|
||||||
|
{(props) => <HowTo {...props} />}
|
||||||
|
</Stack.Screen>
|
||||||
|
<Stack.Screen name="news" options={optionData}>
|
||||||
|
{(props) => <News {...props} />}
|
||||||
|
</Stack.Screen>
|
||||||
|
<Stack.Screen name="trainMenu" options={optionData}>
|
||||||
|
{(props) => (
|
||||||
|
<TrainMenu
|
||||||
|
{...props}
|
||||||
|
webview={webview}
|
||||||
|
stationData={mapsStationData}
|
||||||
/>
|
/>
|
||||||
<Stack.Screen name="news" component={News} options={optionData} />
|
)}
|
||||||
|
</Stack.Screen>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
name="trainMenu"
|
name="favoriteList"
|
||||||
component={trainMenu}
|
options={{ ...optionData, gestureEnabled: false }}
|
||||||
options={optionData}
|
>
|
||||||
|
{(props) => (
|
||||||
|
<FavoriteList
|
||||||
|
{...props}
|
||||||
|
webview={webview}
|
||||||
|
stationData={mapsStationData}
|
||||||
|
favoriteStation={favoriteStation}
|
||||||
|
setFavoriteStation={setFavoriteStation}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
|
</Stack.Screen>
|
||||||
</Stack.Navigator>
|
</Stack.Navigator>
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
function MenuPage({
|
||||||
|
navigation,
|
||||||
|
favoriteStation,
|
||||||
|
setFavoriteStation,
|
||||||
|
busAndTrainData,
|
||||||
|
currentTrainState,
|
||||||
|
currentTrainLoadingState,
|
||||||
|
getCurrentTrain,
|
||||||
|
}) {
|
||||||
|
useEffect(() => {
|
||||||
|
const unsubscribe = navigation.addListener("tabPress", (e) => {
|
||||||
|
AS.getItem("favoriteStation")
|
||||||
|
.then((d) => {
|
||||||
|
const returnData = JSON.parse(d);
|
||||||
|
if (favoriteStation.toString() != d) {
|
||||||
|
setFavoriteStation(returnData);
|
||||||
}
|
}
|
||||||
function menuPage() {
|
})
|
||||||
|
.catch((d) => console.log(d));
|
||||||
|
});
|
||||||
|
|
||||||
|
return unsubscribe;
|
||||||
|
}, [navigation]);
|
||||||
return (
|
return (
|
||||||
<Stack.Navigator>
|
<Stack.Navigator>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
name="menu"
|
name="menu"
|
||||||
component={menu}
|
|
||||||
options={{
|
options={{
|
||||||
headerShown: false,
|
headerShown: false,
|
||||||
gestureEnabled: true,
|
gestureEnabled: true,
|
||||||
headerTransparent: true,
|
headerTransparent: true,
|
||||||
}}
|
}}
|
||||||
|
>
|
||||||
|
{(props) => (
|
||||||
|
<Menu
|
||||||
|
{...props}
|
||||||
|
favoriteStation={favoriteStation}
|
||||||
|
setFavoriteStation={setFavoriteStation}
|
||||||
|
busAndTrainData={busAndTrainData}
|
||||||
|
currentTrainState={currentTrainState}
|
||||||
|
currentTrainLoadingState={currentTrainLoadingState}
|
||||||
|
getCurrentTrain={getCurrentTrain}
|
||||||
/>
|
/>
|
||||||
<Stack.Screen name="setting" component={Setting} options={optionData} />
|
)}
|
||||||
|
</Stack.Screen>
|
||||||
|
<Stack.Screen name="setting" options={optionData}>
|
||||||
|
{(props) => <Setting {...props} />}
|
||||||
|
</Stack.Screen>
|
||||||
|
<Stack.Screen
|
||||||
|
name="trainbase"
|
||||||
|
options={{
|
||||||
|
...TransitionPresets.ModalPresentationIOS,
|
||||||
|
cardOverlayEnabled: true,
|
||||||
|
headerShown: false,
|
||||||
|
gestureEnabled: true,
|
||||||
|
headerTransparent: true,
|
||||||
|
gestureResponseDistance: { vertical: 300 },
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{(props) => <TrainBase {...props} />}
|
||||||
|
</Stack.Screen>
|
||||||
|
<Stack.Screen
|
||||||
|
name="howto"
|
||||||
|
options={{
|
||||||
|
...optionData,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{(props) => <HowTo {...props} />}
|
||||||
|
</Stack.Screen>
|
||||||
</Stack.Navigator>
|
</Stack.Navigator>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
399
Apps.js
399
Apps.js
@@ -8,138 +8,195 @@ import {
|
|||||||
} from "react-native";
|
} 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 AsyncStorage from "@react-native-async-storage/async-storage";
|
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
|
import { AS } from "./storageControl";
|
||||||
import { news } from "./config/newsUpdate";
|
import { news } from "./config/newsUpdate";
|
||||||
import { getStationList } from "./lib/getStationList";
|
import { getStationList, lineList } from "./lib/getStationList";
|
||||||
import { StationDeteilView } from "./components/ActionSheetComponents/StationDeteilView";
|
import { StationDeteilView } from "./components/ActionSheetComponents/StationDeteilView";
|
||||||
import { injectJavascriptData } from "./lib/webViewInjectjavascript";
|
import { injectJavascriptData } from "./lib/webViewInjectjavascript";
|
||||||
import { getStationList2 } from "./lib/getStationList2";
|
import { getStationList2 } from "./lib/getStationList2";
|
||||||
|
import { EachTrainInfo } from "./components/ActionSheetComponents/EachTrainInfo";
|
||||||
|
import { checkDuplicateTrainData } from "./lib/checkDuplicateTrainData";
|
||||||
/*
|
/*
|
||||||
import StatusbarDetect from './StatusbarDetect';
|
import StatusbarDetect from './StatusbarDetect';
|
||||||
var Status = StatusbarDetect(); */
|
var Status = StatusbarDetect(); */
|
||||||
|
|
||||||
export default function Apps(props) {
|
export default function Apps({
|
||||||
const {
|
navigation,
|
||||||
navigation: { navigate },
|
webview,
|
||||||
} = props;
|
favoriteStation,
|
||||||
|
setFavoriteStation,
|
||||||
|
busAndTrainData,
|
||||||
|
stationData,
|
||||||
|
currentTrainState,
|
||||||
|
currentTrainLoadingState,
|
||||||
|
getCurrentTrain,
|
||||||
|
}) {
|
||||||
|
const { currentTrain, setCurrentTrain } = currentTrainState;
|
||||||
|
const { currentTrainLoading, setCurrentTrainLoading } =
|
||||||
|
currentTrainLoadingState;
|
||||||
|
const { navigate } = navigation;
|
||||||
var urlcache = "";
|
var urlcache = "";
|
||||||
const webview = useRef();
|
|
||||||
//画面表示関連
|
//画面表示関連
|
||||||
const [iconSetting, setIconSetting] = useState(undefined);
|
const [iconSetting, setIconSetting] = useState(undefined);
|
||||||
const [mapSwitch, setMapSwitch] = useState(undefined);
|
const [mapSwitch, setMapSwitch] = useState(undefined);
|
||||||
const [stationMenu, setStationMenu] = useState(undefined);
|
const [stationMenu, setStationMenu] = useState(undefined);
|
||||||
|
|
||||||
//地図用
|
//列車情報表示関連
|
||||||
const [mapsStationData, setMapsStationData] = useState(undefined);
|
const EachTrainInfoAsSR = useRef(null);
|
||||||
useEffect(() => {
|
const [trainInfo, setTrainInfo] = useState({
|
||||||
getStationList2().then((data) => {
|
trainNum: undefined,
|
||||||
console.log(data);
|
limited: undefined,
|
||||||
setMapsStationData(data);
|
trainData: undefined,
|
||||||
});
|
});
|
||||||
}, []);
|
|
||||||
|
|
||||||
//駅情報画面用
|
//駅情報画面用
|
||||||
const StationBoardAcSR = useRef(null);
|
const StationBoardAcSR = useRef(null);
|
||||||
const [stationBoardData, setStationBoardData] = useState(undefined);
|
const [stationBoardData, setStationBoardData] = useState(undefined);
|
||||||
const [originalStationList, setOriginalStationList] = useState();
|
const [originalStationList, setOriginalStationList] = useState();
|
||||||
const [selectedStation, setSelectedStation] = useState(undefined);
|
const [selectedStation, setSelectedStation] = useState(undefined);
|
||||||
useEffect(() => getStationList().then(setOriginalStationList), []);
|
const [trainMenu, setTrainMenu] = useState("true");
|
||||||
|
let once = false;
|
||||||
|
useEffect(() => {
|
||||||
|
getStationList().then(setOriginalStationList);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {}, [stationData, favoriteStation]);
|
||||||
//地図表示テキスト
|
//地図表示テキスト
|
||||||
const injectJavascript = injectJavascriptData(
|
const injectJavascript = injectJavascriptData(
|
||||||
mapSwitch,
|
mapSwitch,
|
||||||
iconSetting,
|
iconSetting,
|
||||||
stationMenu
|
stationMenu,
|
||||||
|
trainMenu
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
//ニュース表示
|
//ニュース表示
|
||||||
AsyncStorage.getItem("status")
|
AS.getItem("status")
|
||||||
.then((d) => {
|
.then((d) => {
|
||||||
if (d != news) navigate("news");
|
if (d != news) navigate("news");
|
||||||
})
|
})
|
||||||
.catch((e) => navigate("news"));
|
.catch((e) => navigate("news"));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
//列車アイコンスイッチ
|
//列車アイコンスイッチ
|
||||||
AsyncStorage.getItem("iconSwitch")
|
AS.getItem("iconSwitch")
|
||||||
.then((d) => {
|
.then((d) => {
|
||||||
if (d) {
|
if (d) {
|
||||||
setIconSetting(d);
|
setIconSetting(d);
|
||||||
} else {
|
} else {
|
||||||
AsyncStorage.setItem("iconSwitch", "true").then(() =>
|
AS.setItem("iconSwitch", "true").then(Updates.reloadAsync);
|
||||||
Updates.reloadAsync()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((d) =>
|
.catch((d) => AS.setItem("iconSwitch", "true").then(Updates.reloadAsync));
|
||||||
AsyncStorage.setItem("iconSwitch", "true").then(() =>
|
}, []);
|
||||||
Updates.reloadAsync()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
//地図スイッチ
|
//地図スイッチ
|
||||||
AsyncStorage.getItem("mapSwitch")
|
AS.getItem("mapSwitch")
|
||||||
.then((d) => {
|
.then((d) => {
|
||||||
if (d) {
|
if (d) {
|
||||||
setMapSwitch(d);
|
setMapSwitch(d);
|
||||||
} else {
|
} else {
|
||||||
AsyncStorage.setItem("mapSwitch", "false").then(() =>
|
AS.setItem("mapSwitch", "false").then(Updates.reloadAsync);
|
||||||
Updates.reloadAsync()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((d) =>
|
.catch((d) => AS.setItem("mapSwitch", "false").then(Updates.reloadAsync));
|
||||||
AsyncStorage.setItem("mapSwitch", "false").then(() =>
|
}, []);
|
||||||
Updates.reloadAsync()
|
|
||||||
)
|
useEffect(() => {
|
||||||
);
|
|
||||||
//駅メニュースイッチ
|
//駅メニュースイッチ
|
||||||
AsyncStorage.getItem("stationSwitch")
|
AS.getItem("stationSwitch")
|
||||||
.then((d) => {
|
.then((d) => {
|
||||||
if (d) {
|
if (d) {
|
||||||
setStationMenu(d);
|
setStationMenu(d);
|
||||||
} else {
|
} else {
|
||||||
AsyncStorage.setItem("stationSwitch", "true").then(() =>
|
AS.setItem("stationSwitch", "true").then(Updates.reloadAsync);
|
||||||
Updates.reloadAsync()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((d) =>
|
.catch((d) =>
|
||||||
AsyncStorage.setItem("stationSwitch", "true").then(() =>
|
AS.setItem("stationSwitch", "true").then(Updates.reloadAsync)
|
||||||
Updates.reloadAsync()
|
);
|
||||||
)
|
}, []);
|
||||||
|
useEffect(() => {
|
||||||
|
//列車メニュースイッチ
|
||||||
|
AS.getItem("trainSwitch")
|
||||||
|
.then((d) => {
|
||||||
|
if (d) {
|
||||||
|
setTrainMenu(d);
|
||||||
|
} else {
|
||||||
|
AS.setItem("trainSwitch", "true").then(Updates.reloadAsync);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((d) =>
|
||||||
|
AS.setItem("trainSwitch", "true").then(Updates.reloadAsync)
|
||||||
);
|
);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
const onMessage = (event) => {
|
||||||
<View
|
if (event.nativeEvent.data.includes("train.html")) {
|
||||||
style={{
|
navigate("trainbase", { info: event.nativeEvent.data, from: "Train" });
|
||||||
height: "100%",
|
return;
|
||||||
paddingTop: Platform.OS == "ios" ? Constants.statusBarHeight : 0,
|
}
|
||||||
}}
|
if (!originalStationList) {
|
||||||
>
|
alert("駅名標データを取得中...");
|
||||||
{/* {Status} */}
|
return;
|
||||||
<WebView
|
}
|
||||||
useWebKit={true}
|
const dataSet = JSON.parse(event.nativeEvent.data);
|
||||||
ref={webview}
|
switch (dataSet.type) {
|
||||||
source={{ uri: "https://train.jr-shikoku.co.jp/sp.html" }}
|
case "PopUpMenu": {
|
||||||
originWhitelist={[
|
const selectedStationPDFAddress = dataSet.pdf;
|
||||||
"https://train.jr-shikoku.co.jp",
|
const findStationEachLine = (selectLine) => {
|
||||||
"https://train.jr-shikoku.co.jp/sp.html",
|
let NearStation = selectLine.filter(
|
||||||
]}
|
(d) => d.StationTimeTable == selectedStationPDFAddress
|
||||||
mixedContentMode={"compatibility"}
|
);
|
||||||
javaScriptEnabled={true}
|
return NearStation;
|
||||||
allowsBackForwardNavigationGestures={true}
|
};
|
||||||
setSupportMultipleWindows={true}
|
let returnDataBase = lineList
|
||||||
onNavigationStateChange={(event) => {
|
.map((d) => findStationEachLine(originalStationList[d]))
|
||||||
|
.filter((d) => d.length > 0)
|
||||||
|
.reduce((pre, current) => {
|
||||||
|
pre.push(...current);
|
||||||
|
return pre;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
if (returnDataBase.length) {
|
||||||
|
setStationBoardData(returnDataBase);
|
||||||
|
StationBoardAcSR.current?.show();
|
||||||
|
} else {
|
||||||
|
setStationBoardData(undefined);
|
||||||
|
StationBoardAcSR.current?.hide();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case "ShowTrainTimeInfo": {
|
||||||
|
const { trainNum, limited } = dataSet;
|
||||||
|
//alert(trainNum, limited);
|
||||||
|
setTrainInfo({
|
||||||
|
trainNum,
|
||||||
|
limited,
|
||||||
|
trainData: checkDuplicateTrainData(
|
||||||
|
currentTrain.filter((a) => a.num == trainNum)
|
||||||
|
),
|
||||||
|
}); //遅延情報は未実装
|
||||||
|
EachTrainInfoAsSR.current?.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const onNavigationStateChange = (event) => {
|
||||||
if (event.url != urlcache) {
|
if (event.url != urlcache) {
|
||||||
//URL二重判定回避
|
//URL二重判定回避
|
||||||
urlcache = event.url;
|
urlcache = event.url;
|
||||||
|
|
||||||
if (
|
if (event.url.includes("https://train.jr-shikoku.co.jp/usage.htm")) {
|
||||||
event.url.includes("https://train.jr-shikoku.co.jp/usage.htm")
|
if (Platform.OS === "android") navigate("howto", { info: event.url });
|
||||||
) {
|
|
||||||
if (Platform.OS === "android") navigate("howto");
|
|
||||||
webview?.current.goBack();
|
webview?.current.goBack();
|
||||||
//Actions.howto();
|
//Actions.howto();
|
||||||
} else if (
|
} else if (
|
||||||
@@ -151,36 +208,32 @@ export default function Apps(props) {
|
|||||||
webview?.current.goBack();
|
webview?.current.goBack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}}
|
};
|
||||||
onMessage={(event) => {
|
function sleep(waitSec, callbackFunc) {
|
||||||
if (!originalStationList) {
|
// 経過時間(秒)
|
||||||
alert("駅名標データを取得中...");
|
var spanedSec = 0;
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (event.nativeEvent.data.includes("PopUpMenu")) {
|
|
||||||
const selectedStationPDFAddress = event.nativeEvent.data
|
|
||||||
.split(",")[3]
|
|
||||||
.replace("'", "")
|
|
||||||
.replace("'", "");
|
|
||||||
|
|
||||||
|
// 1秒間隔で無名関数を実行
|
||||||
|
var id = setInterval(function () {
|
||||||
|
spanedSec++;
|
||||||
|
|
||||||
|
// 経過時間 >= 待機時間の場合、待機終了。
|
||||||
|
if (spanedSec >= waitSec) {
|
||||||
|
// タイマー停止
|
||||||
|
clearInterval(id);
|
||||||
|
|
||||||
|
// 完了時、コールバック関数を実行
|
||||||
|
if (callbackFunc) callbackFunc();
|
||||||
|
}
|
||||||
|
}, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const openStationACFromEachTrainInfo = (stationName) => {
|
||||||
|
EachTrainInfoAsSR.current?.hide();
|
||||||
const findStationEachLine = (selectLine) => {
|
const findStationEachLine = (selectLine) => {
|
||||||
let NearStation = selectLine.filter(
|
let NearStation = selectLine.filter((d) => d.Station_JP == stationName);
|
||||||
(d) => d.StationTimeTable == selectedStationPDFAddress
|
|
||||||
);
|
|
||||||
return NearStation;
|
return NearStation;
|
||||||
};
|
};
|
||||||
|
|
||||||
const lineList = [
|
|
||||||
"予讃線",
|
|
||||||
"松宇線",
|
|
||||||
"伊予灘線",
|
|
||||||
"土讃線",
|
|
||||||
"窪川線",
|
|
||||||
"高徳線",
|
|
||||||
"徳島線",
|
|
||||||
"鳴門線",
|
|
||||||
"瀬戸大橋線",
|
|
||||||
];
|
|
||||||
let returnDataBase = lineList
|
let returnDataBase = lineList
|
||||||
.map((d) => findStationEachLine(originalStationList[d]))
|
.map((d) => findStationEachLine(originalStationList[d]))
|
||||||
.filter((d) => d.length > 0)
|
.filter((d) => d.length > 0)
|
||||||
@@ -189,29 +242,99 @@ export default function Apps(props) {
|
|||||||
return pre;
|
return pre;
|
||||||
}, []);
|
}, []);
|
||||||
if (returnDataBase.length) {
|
if (returnDataBase.length) {
|
||||||
let currentStation =
|
|
||||||
currentStation == undefined ? [] : currentStation;
|
|
||||||
setStationBoardData(returnDataBase);
|
setStationBoardData(returnDataBase);
|
||||||
StationBoardAcSR.current?.setModalVisible();
|
sleep(25, function () {
|
||||||
|
StationBoardAcSR.current?.show();
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
setStationBoardData(undefined);
|
setStationBoardData(undefined);
|
||||||
StationBoardAcSR.current?.hide();
|
StationBoardAcSR.current?.hide();
|
||||||
}
|
}
|
||||||
|
};
|
||||||
return;
|
return (
|
||||||
}
|
<View
|
||||||
navigate("trainbase", { info: event.nativeEvent.data });
|
style={{
|
||||||
|
height: "100%",
|
||||||
|
paddingTop: Platform.OS == "ios" ? Constants.statusBarHeight : 0,
|
||||||
}}
|
}}
|
||||||
|
>
|
||||||
|
{/* {Status} */}
|
||||||
|
<WebView
|
||||||
|
useWebKit
|
||||||
|
ref={webview}
|
||||||
|
source={{ uri: "https://train.jr-shikoku.co.jp/sp.html" }}
|
||||||
|
originWhitelist={[
|
||||||
|
"https://train.jr-shikoku.co.jp",
|
||||||
|
"https://train.jr-shikoku.co.jp/sp.html",
|
||||||
|
]}
|
||||||
|
mixedContentMode={"compatibility"}
|
||||||
|
javaScriptEnabled
|
||||||
|
allowsBackForwardNavigationGestures
|
||||||
|
setSupportMultipleWindows
|
||||||
|
onNavigationStateChange={onNavigationStateChange}
|
||||||
|
onMessage={onMessage}
|
||||||
injectedJavaScript={injectJavascript}
|
injectedJavaScript={injectJavascript}
|
||||||
onTouchMove={() => StationBoardAcSR.current?.hide()}
|
onTouchMove={() => StationBoardAcSR.current?.hide()}
|
||||||
/>
|
onLoadEnd={() => {
|
||||||
<TouchableOpacity
|
if (once) return () => {};
|
||||||
onPress={() =>
|
if (!stationData) return () => {};
|
||||||
navigate("trainMenu", { webview, stationData: mapsStationData })
|
if (favoriteStation.length > 0) {
|
||||||
|
const getStationLine = (now) => {
|
||||||
|
const returnData = Object.keys(stationData).filter((d) => {
|
||||||
|
const cache = stationData[d].findIndex(
|
||||||
|
(data) => data.Station_JP == now.Station_JP
|
||||||
|
);
|
||||||
|
return cache != -1;
|
||||||
|
});
|
||||||
|
return returnData[0];
|
||||||
|
};
|
||||||
|
const lineName = getStationLine(favoriteStation[0][0]);
|
||||||
|
webview.current?.injectJavaScript(
|
||||||
|
`MoveDisplayStation('${lineName}_${favoriteStation[0][0].MyStation}_${favoriteStation[0][0].Station_JP}')`
|
||||||
|
);
|
||||||
|
once = true;
|
||||||
}
|
}
|
||||||
style={{
|
}}
|
||||||
|
/>
|
||||||
|
<MapsButton
|
||||||
|
onPress={() => navigate("trainMenu", { webview })}
|
||||||
|
top={Platform.OS == "ios" ? Constants.statusBarHeight : 0}
|
||||||
|
mapSwitch={mapSwitch == "true" ? "flex" : "none"}
|
||||||
|
/>
|
||||||
|
<ReloadButton
|
||||||
|
onPress={() => webview.current.reload()}
|
||||||
|
top={Platform.OS == "ios" ? Constants.statusBarHeight : 0}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<StationDeteilView
|
||||||
|
StationBoardAcSR={StationBoardAcSR}
|
||||||
|
currentStation={stationBoardData}
|
||||||
|
originalStationList={originalStationList}
|
||||||
|
favoriteStation={favoriteStation}
|
||||||
|
setFavoriteStation={setFavoriteStation}
|
||||||
|
busAndTrainData={busAndTrainData}
|
||||||
|
navigate={navigate}
|
||||||
|
onExit={() => {
|
||||||
|
StationBoardAcSR.current?.setModalVisible();
|
||||||
|
navigate("Apps");
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<EachTrainInfo
|
||||||
|
setRef={EachTrainInfoAsSR}
|
||||||
|
data={trainInfo}
|
||||||
|
navigate={navigate}
|
||||||
|
originalStationList={originalStationList}
|
||||||
|
openStationACFromEachTrainInfo={openStationACFromEachTrainInfo}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const MapsButton = ({ onPress, top, mapSwitch }) => {
|
||||||
|
const styles = {
|
||||||
|
touch: {
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
top: Platform.OS == "ios" ? Constants.statusBarHeight : 0,
|
top,
|
||||||
left: 10,
|
left: 10,
|
||||||
width: 50,
|
width: 50,
|
||||||
height: 50,
|
height: 50,
|
||||||
@@ -223,30 +346,58 @@ export default function Apps(props) {
|
|||||||
alignContent: "center",
|
alignContent: "center",
|
||||||
alignSelf: "center",
|
alignSelf: "center",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
display: mapSwitch == "true" ? "flex" : "none",
|
display: mapSwitch,
|
||||||
}}
|
},
|
||||||
>
|
text: {
|
||||||
<View style={{ flex: 1 }} />
|
|
||||||
<Text
|
|
||||||
style={{
|
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
width: "auto",
|
width: "auto",
|
||||||
height: "auto",
|
height: "auto",
|
||||||
textAlignVertical: "center",
|
textAlignVertical: "center",
|
||||||
fontWeight: "bold",
|
fontWeight: "bold",
|
||||||
color: "white",
|
color: "white",
|
||||||
}}
|
},
|
||||||
>
|
};
|
||||||
三
|
return (
|
||||||
</Text>
|
<TouchableOpacity onPress={onPress} style={styles.touch}>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text style={styles.text}>三</Text>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|
||||||
<StationDeteilView
|
|
||||||
StationBoardAcSR={StationBoardAcSR}
|
|
||||||
currentStation={stationBoardData}
|
|
||||||
originalStationList={originalStationList}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
const ReloadButton = ({ onPress, top, mapSwitch }) => {
|
||||||
|
const styles = {
|
||||||
|
touch: {
|
||||||
|
position: "absolute",
|
||||||
|
top,
|
||||||
|
right: 10,
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
backgroundColor: "#0099CC",
|
||||||
|
borderColor: "white",
|
||||||
|
borderStyle: "solid",
|
||||||
|
borderWidth: 1,
|
||||||
|
borderRadius: 50,
|
||||||
|
alignContent: "center",
|
||||||
|
alignSelf: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
display: mapSwitch,
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
textAlign: "center",
|
||||||
|
width: "auto",
|
||||||
|
height: "auto",
|
||||||
|
textAlignVertical: "center",
|
||||||
|
fontWeight: "bold",
|
||||||
|
color: "white",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<TouchableOpacity onPress={onPress} style={styles.touch}>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Ionicons name="reload" color="white" size={30} />
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
</TouchableOpacity>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { ToastAndroid } from "react-native";
|
import { ToastAndroid } from "react-native";
|
||||||
import * as Updates from "expo-updates";
|
import * as Updates from "expo-updates";
|
||||||
|
|
||||||
export const UpdateAsync = () =>
|
export const UpdateAsync = () => {
|
||||||
Updates.checkForUpdateAsync()
|
Updates.checkForUpdateAsync()
|
||||||
.then((update) => {
|
.then((update) => {
|
||||||
if (!update.isAvailable) return;
|
if (!update.isAvailable) return;
|
||||||
@@ -34,3 +34,4 @@ export const UpdateAsync = () =>
|
|||||||
.finally(() => {
|
.finally(() => {
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|||||||
24
app.json
24
app.json
@@ -3,8 +3,11 @@
|
|||||||
"name": "JR四国運行状況",
|
"name": "JR四国運行状況",
|
||||||
"slug": "jrshikoku",
|
"slug": "jrshikoku",
|
||||||
"privacy": "public",
|
"privacy": "public",
|
||||||
"platforms": ["ios", "android"],
|
"platforms": [
|
||||||
"version": "4.4",
|
"ios",
|
||||||
|
"android"
|
||||||
|
],
|
||||||
|
"version": "4.5",
|
||||||
"orientation": "portrait",
|
"orientation": "portrait",
|
||||||
"icon": "./assets/icon.png",
|
"icon": "./assets/icon.png",
|
||||||
"splash": {
|
"splash": {
|
||||||
@@ -15,9 +18,11 @@
|
|||||||
"updates": {
|
"updates": {
|
||||||
"fallbackToCacheTimeout": 0
|
"fallbackToCacheTimeout": 0
|
||||||
},
|
},
|
||||||
"assetBundlePatterns": ["**/*"],
|
"assetBundlePatterns": [
|
||||||
|
"**/*"
|
||||||
|
],
|
||||||
"ios": {
|
"ios": {
|
||||||
"buildNumber": "22",
|
"buildNumber": "28",
|
||||||
"supportsTablet": true,
|
"supportsTablet": true,
|
||||||
"bundleIdentifier": "jrshikokuinfo.xprocess.hrkn",
|
"bundleIdentifier": "jrshikokuinfo.xprocess.hrkn",
|
||||||
"config": {
|
"config": {
|
||||||
@@ -26,14 +31,21 @@
|
|||||||
},
|
},
|
||||||
"android": {
|
"android": {
|
||||||
"package": "jrshikokuinfo.xprocess.hrkn",
|
"package": "jrshikokuinfo.xprocess.hrkn",
|
||||||
"versionCode": 16,
|
"versionCode": 18,
|
||||||
"permissions": ["ACCESS_FINE_LOCATION"],
|
"permissions": [
|
||||||
|
"ACCESS_FINE_LOCATION"
|
||||||
|
],
|
||||||
"googleServicesFile": "./google-services.json",
|
"googleServicesFile": "./google-services.json",
|
||||||
"config": {
|
"config": {
|
||||||
"googleMaps": {
|
"googleMaps": {
|
||||||
"apiKey": "AIzaSyAmFb-Yj033bXZWlSzNrfq_0jc1PgRrWcE"
|
"apiKey": "AIzaSyAmFb-Yj033bXZWlSzNrfq_0jc1PgRrWcE"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"eas": {
|
||||||
|
"projectId": "398abf60-57a7-11e9-970c-8f04356d08bf"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
assets/939-star.json
Normal file
1
assets/939-star.json
Normal file
File diff suppressed because one or more lines are too long
BIN
assets/A.png
Normal file
BIN
assets/A.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 439 KiB |
BIN
assets/B.png
Normal file
BIN
assets/B.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 405 KiB |
11
assets/originData/lineColorList.js
Normal file
11
assets/originData/lineColorList.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
export default {
|
||||||
|
Y: "#F5AC13",
|
||||||
|
U: "#F5AC13",
|
||||||
|
S: "#9AA7D7",
|
||||||
|
D: "#DC4586",
|
||||||
|
K: "#DC4586",
|
||||||
|
B: "#366481",
|
||||||
|
N: "#881F61",
|
||||||
|
T: "#87CA3B",
|
||||||
|
M: "#0071be",
|
||||||
|
};
|
||||||
1042
assets/originData/trainList.js
Normal file
1042
assets/originData/trainList.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@ export default [
|
|||||||
{"Station_JP" : "八幡浜", "Station_EN" : "Yawatahama", "MyStation" : "11", "StationNumber" : "U18", "DispNum" : "3", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/yawatahama.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.458146,132.436002", "JrHpUrl" : "http://www.jr-shikoku.co.jp/01_trainbus/kakueki/yawatahama/"},
|
{"Station_JP" : "八幡浜", "Station_EN" : "Yawatahama", "MyStation" : "11", "StationNumber" : "U18", "DispNum" : "3", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/yawatahama.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.458146,132.436002", "JrHpUrl" : "http://www.jr-shikoku.co.jp/01_trainbus/kakueki/yawatahama/"},
|
||||||
{"Station_JP" : "双岩", "Station_EN" : "Futaiwa", "MyStation" : "12", "StationNumber" : "U19", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/futaiwa.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.424669,132.457934", "JrHpUrl" : ""},
|
{"Station_JP" : "双岩", "Station_EN" : "Futaiwa", "MyStation" : "12", "StationNumber" : "U19", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/futaiwa.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.424669,132.457934", "JrHpUrl" : ""},
|
||||||
{"Station_JP" : "伊予石城", "Station_EN" : "Iyo-Iwaki", "MyStation" : "13", "StationNumber" : "U20", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/iyo-iwaki.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.391413,132.473259", "JrHpUrl" : ""},
|
{"Station_JP" : "伊予石城", "Station_EN" : "Iyo-Iwaki", "MyStation" : "13", "StationNumber" : "U20", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/iyo-iwaki.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.391413,132.473259", "JrHpUrl" : ""},
|
||||||
{"Station_JP" : "卯之町", "Station_EN" : "Unomachi", "MyStation" : "14", "StationNumber" : "U22", "DispNum" : "3", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/unomachi.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.363175,132.509959", "JrHpUrl" : "http://www.jr-shikoku.co.jp/01_trainbus/kakueki/unomachi/"},
|
{"Station_JP" : "卯之町", "Station_EN" : "Unomachi", "MyStation" : "14", "StationNumber" : "U22", "DispNum" : "3", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/unomachi.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.363175,132.509959", "JrHpUrl" : ""},
|
||||||
{"Station_JP" : "下宇和", "Station_EN" : "Shimo-Uwa", "MyStation" : "15", "StationNumber" : "U23", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/shimo-uwa.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.349786,132.531172", "JrHpUrl" : ""},
|
{"Station_JP" : "下宇和", "Station_EN" : "Shimo-Uwa", "MyStation" : "15", "StationNumber" : "U23", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/shimo-uwa.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.349786,132.531172", "JrHpUrl" : ""},
|
||||||
{"Station_JP" : "立間", "Station_EN" : "Tachima", "MyStation" : "16", "StationNumber" : "U24", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/tachima.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.296721,132.539509", "JrHpUrl" : ""},
|
{"Station_JP" : "立間", "Station_EN" : "Tachima", "MyStation" : "16", "StationNumber" : "U24", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/tachima.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.296721,132.539509", "JrHpUrl" : ""},
|
||||||
{"Station_JP" : "伊予吉田", "Station_EN" : "Iyo-Yoshida", "MyStation" : "17", "StationNumber" : "U25", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/iyo-yoshida.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.273287,132.544098", "JrHpUrl" : ""},
|
{"Station_JP" : "伊予吉田", "Station_EN" : "Iyo-Yoshida", "MyStation" : "17", "StationNumber" : "U25", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/iyo-yoshida.pdf", "StationMap":"https://www.google.co.jp/maps/place/33.273287,132.544098", "JrHpUrl" : ""},
|
||||||
|
|||||||
BIN
assets/雑.png
Normal file
BIN
assets/雑.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
714
components/ActionSheetComponents/EachTrainInfo.js
Normal file
714
components/ActionSheetComponents/EachTrainInfo.js
Normal file
@@ -0,0 +1,714 @@
|
|||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import {
|
||||||
|
View,
|
||||||
|
LayoutAnimation,
|
||||||
|
ScrollView,
|
||||||
|
Linking,
|
||||||
|
Text,
|
||||||
|
TouchableOpacity,
|
||||||
|
TouchableWithoutFeedback,
|
||||||
|
TouchableHighlight,
|
||||||
|
Platform,
|
||||||
|
} from "react-native";
|
||||||
|
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
|
import ActionSheet from "react-native-actions-sheet";
|
||||||
|
import { AS } from "../../storageControl";
|
||||||
|
import LottieView from "lottie-react-native";
|
||||||
|
import trainList from "../../assets/originData/trainList";
|
||||||
|
import { lineList } from "../../lib/getStationList";
|
||||||
|
import {
|
||||||
|
heightPercentageToDP,
|
||||||
|
widthPercentageToDP,
|
||||||
|
} from "react-native-responsive-screen";
|
||||||
|
import lineColorList from "../../assets/originData/lineColorList";
|
||||||
|
|
||||||
|
export const EachTrainInfo = ({
|
||||||
|
setRef,
|
||||||
|
data,
|
||||||
|
navigate,
|
||||||
|
originalStationList,
|
||||||
|
openStationACFromEachTrainInfo,
|
||||||
|
from,
|
||||||
|
}) => {
|
||||||
|
const [trainData, setTrainData] = useState([]);
|
||||||
|
const [isTop, setIsTop] = useState(true);
|
||||||
|
const [currentPosition, setCurrentPosition] = useState([]);
|
||||||
|
|
||||||
|
const [trainPositionSwitch, setTrainPositionSwitch] = useState("false");
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
//列車現在地アイコン表示スイッチ
|
||||||
|
AS.getItem("trainPositionSwitch")
|
||||||
|
.then((d) => {
|
||||||
|
if (d) {
|
||||||
|
setTrainPositionSwitch(d);
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((d) => AS.setItem("trainPositionSwitch", "false"));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const getStationData = (stationName) => {
|
||||||
|
const Stations = stationList.map((a) =>
|
||||||
|
a.filter((d) => d.StationName == stationName)
|
||||||
|
);
|
||||||
|
const Station =
|
||||||
|
Stations &&
|
||||||
|
Stations.reduce((newArray, e) => {
|
||||||
|
return newArray.concat(e);
|
||||||
|
}, []);
|
||||||
|
if (!Station[0]) return [];
|
||||||
|
return Station.map((d) => d.StationNumber)[0];
|
||||||
|
};
|
||||||
|
useEffect(() => {
|
||||||
|
//data.trainData.Pos = "鴨川~端岡"; //test
|
||||||
|
if (!data.trainData?.Pos) return;
|
||||||
|
if (data.trainData?.Pos.match("~")) {
|
||||||
|
const pos = data.trainData?.Pos.replace("(下り)", "")
|
||||||
|
.replace("(上り)", "")
|
||||||
|
.split("~");
|
||||||
|
setCurrentPosition([getStationData(pos[0]), getStationData(pos[1])]);
|
||||||
|
} else {
|
||||||
|
setCurrentPosition([getStationData(data.trainData?.Pos)]);
|
||||||
|
}
|
||||||
|
}, [data.trainData]);
|
||||||
|
|
||||||
|
const stationList =
|
||||||
|
originalStationList &&
|
||||||
|
lineList.map((d) =>
|
||||||
|
originalStationList[d].map((a) => ({
|
||||||
|
StationNumber: a.StationNumber,
|
||||||
|
StationName: a.Station_JP,
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
const stopStationIDList = trainData.map((i, index) => {
|
||||||
|
const [station, se, time] = i.split(",");
|
||||||
|
const Stations = stationList.map((a) =>
|
||||||
|
a.filter((d) => d.StationName == station)
|
||||||
|
);
|
||||||
|
const StationNumbers =
|
||||||
|
Stations &&
|
||||||
|
Stations.reduce((newArray, e) => {
|
||||||
|
return newArray.concat(e);
|
||||||
|
}, [])
|
||||||
|
.filter((d) => d.StationNumber)
|
||||||
|
.map((d) => d.StationNumber);
|
||||||
|
return StationNumbers[0];
|
||||||
|
});
|
||||||
|
function findReversalPoints(array) {
|
||||||
|
// arrayは現在位置の駅ID(駅在宅の場合は1つの配列、駅間の場合は2つの配列)
|
||||||
|
// stopStationIDListは停車駅の駅IDの配列
|
||||||
|
if (!stopStationIDList.length) return [];
|
||||||
|
const arrayNumber = array.map((d) => ({
|
||||||
|
line: d
|
||||||
|
.split("")
|
||||||
|
.filter((s) => "A" < s && s < "Z")
|
||||||
|
.join(""),
|
||||||
|
ID: d
|
||||||
|
.split("")
|
||||||
|
.filter((s) => "0" <= s && s <= "9")
|
||||||
|
.join(""),
|
||||||
|
}));
|
||||||
|
const stopStationIDListNumber = stopStationIDList.map((d) => {
|
||||||
|
if (!d) return { line: [], ID: [] };
|
||||||
|
return {
|
||||||
|
line: d
|
||||||
|
.split("")
|
||||||
|
.filter((s) => "A" < s && s < "Z")
|
||||||
|
.join(""),
|
||||||
|
ID: d
|
||||||
|
.split("")
|
||||||
|
.filter((s) => "0" <= s && s <= "9")
|
||||||
|
.join(""),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
// 完全一致
|
||||||
|
if (array.length == 1) {
|
||||||
|
const index = stopStationIDList.indexOf(array[0]);
|
||||||
|
if (index != -1) return [index];
|
||||||
|
// 通過駅の場合
|
||||||
|
for (let i = 0; i < stopStationIDListNumber.length - 1; i++) {
|
||||||
|
if (stopStationIDListNumber[i].ID < arrayNumber[0].ID) {
|
||||||
|
if (stopStationIDListNumber[i + 1].ID > arrayNumber[0].ID) {
|
||||||
|
return [i + 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (stopStationIDListNumber[i].ID > arrayNumber[0].ID) {
|
||||||
|
if (stopStationIDListNumber[i + 1].ID < arrayNumber[0].ID) {
|
||||||
|
return [i + 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 駅間の場合
|
||||||
|
if (array.length == 2) {
|
||||||
|
const index1 = stopStationIDList.indexOf(array[0]);
|
||||||
|
const index2 = stopStationIDList.indexOf(array[1]);
|
||||||
|
if (index1 != -1 && index2 != -1) {
|
||||||
|
// 駅間で通過駅も無い場合
|
||||||
|
if (index1 < index2) {
|
||||||
|
if (index1 + 1 == index2) {
|
||||||
|
return [index2];
|
||||||
|
} else {
|
||||||
|
const returnArray = [];
|
||||||
|
for (let i = index1 + 1; i <= index2; i++) {
|
||||||
|
returnArray.push(i);
|
||||||
|
}
|
||||||
|
return returnArray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (index1 > index2) {
|
||||||
|
if (index2 + 1 == index1) return [index1];
|
||||||
|
else {
|
||||||
|
const returnArray = [];
|
||||||
|
for (let i = index2 + 1; i <= index1; i++) {
|
||||||
|
returnArray.push(i);
|
||||||
|
}
|
||||||
|
return returnArray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const getNearStationID = (stationID) => {
|
||||||
|
for (let i = 0; i <= stopStationIDListNumber.length; i++) {
|
||||||
|
if (stopStationIDListNumber[i].ID < stationID) {
|
||||||
|
if (stopStationIDListNumber[i + 1].ID > stationID) {
|
||||||
|
return i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (stopStationIDListNumber[i].ID > stationID) {
|
||||||
|
if (stopStationIDListNumber[i + 1].ID < stationID) {
|
||||||
|
return i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let newIndex1 = index1;
|
||||||
|
let newIndex2 = index2;
|
||||||
|
if (index1 == -1) {
|
||||||
|
newIndex1 = getNearStationID(arrayNumber[0].ID);
|
||||||
|
}
|
||||||
|
if (index2 == -1) {
|
||||||
|
newIndex2 = getNearStationID(arrayNumber[1].ID);
|
||||||
|
}
|
||||||
|
if (newIndex1 && newIndex2) {
|
||||||
|
return [newIndex1, newIndex2];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通過駅の場合
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 使用例
|
||||||
|
const points =
|
||||||
|
trainPositionSwitch == "true" ? findReversalPoints(currentPosition) : [];
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setIsTop(true);
|
||||||
|
if (!data.trainNum) return;
|
||||||
|
const TD = trainList[data.trainNum];
|
||||||
|
if (!TD) {
|
||||||
|
setTrainData([]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setTrainData(TD.split("#").filter((d) => d != ""));
|
||||||
|
}, [data]);
|
||||||
|
const getType = (string) => {
|
||||||
|
switch (string) {
|
||||||
|
case "express":
|
||||||
|
return "特急";
|
||||||
|
case "rapid":
|
||||||
|
return "快速";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const migrateTrainName = (string) => {
|
||||||
|
return string
|
||||||
|
.replace("マリン", "マリンライナー")
|
||||||
|
.replace("ライナーライナー", "ライナー");
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ActionSheet
|
||||||
|
ref={setRef}
|
||||||
|
gestureEnabled={isTop}
|
||||||
|
CustomHeaderComponent={<></>}
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
backgroundColor: "#0099CC",
|
||||||
|
borderRadius: 5,
|
||||||
|
borderColor: "dark",
|
||||||
|
borderWidth: 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View style={{ height: 26, width: "100%" }}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
height: 6,
|
||||||
|
width: 45,
|
||||||
|
borderRadius: 100,
|
||||||
|
backgroundColor: "#f0f0f0",
|
||||||
|
marginVertical: 10,
|
||||||
|
alignSelf: "center",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={{ padding: 10, flexDirection: "row", alignItems: "center" }}
|
||||||
|
>
|
||||||
|
<Text style={{ fontSize: 20, fontWeight: "bold", color: "white" }}>
|
||||||
|
{data.limited
|
||||||
|
? getType(data.limited.split(":")[0]) +
|
||||||
|
migrateTrainName(
|
||||||
|
data.limited.split(":")[1] ||
|
||||||
|
(trainData.length > 0
|
||||||
|
? trainData[trainData.length - 1].split(",")[0] + "行き"
|
||||||
|
: " ")
|
||||||
|
)
|
||||||
|
: ""}
|
||||||
|
</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text style={{ fontSize: 20, fontWeight: "bold", color: "white" }}>
|
||||||
|
{data.trainNum}
|
||||||
|
</Text>
|
||||||
|
{data.limited != undefined &&
|
||||||
|
getType(data.limited.split(":")[0]) &&
|
||||||
|
!data.limited.split(":")[1].match("サンポート") && (
|
||||||
|
<Ionicons
|
||||||
|
name="subway"
|
||||||
|
color="white"
|
||||||
|
size={30}
|
||||||
|
style={{ margin: 5 }}
|
||||||
|
onPress={() => {
|
||||||
|
LayoutAnimation.easeInEaseOut(); //setLoadingDelayData(true);
|
||||||
|
navigate("trainbase", {
|
||||||
|
info: "train.html?tn=" + data.trainNum,
|
||||||
|
from,
|
||||||
|
});
|
||||||
|
setRef.current?.hide();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
<ScrollView
|
||||||
|
style={{
|
||||||
|
flexDirection: "row",
|
||||||
|
//width: widthPercentageToDP("200%"),
|
||||||
|
minHeight: 200,
|
||||||
|
height: heightPercentageToDP("20%"),
|
||||||
|
}}
|
||||||
|
horizontal
|
||||||
|
pagingEnabled
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flexDirection: "row",
|
||||||
|
minHeight: 200,
|
||||||
|
height: heightPercentageToDP("20%"),
|
||||||
|
width: widthPercentageToDP("100%"),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: "white",
|
||||||
|
borderRadius: 10,
|
||||||
|
padding: 10,
|
||||||
|
margin: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={{ fontSize: 15, color: "#0099CC" }}>
|
||||||
|
現在地 {currentPosition.toString()}
|
||||||
|
</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
{data.trainData?.Pos && data.trainData?.Pos.match("~") ? (
|
||||||
|
<>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 28,
|
||||||
|
color: "#0099CC",
|
||||||
|
textAlign: "right",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
data.trainData?.Pos.replace("(下り)", "")
|
||||||
|
.replace("(上り)", "")
|
||||||
|
.split("~")[0]
|
||||||
|
}
|
||||||
|
</Text>
|
||||||
|
<Text style={{ color: "#0099CC", textAlign: "right" }}>
|
||||||
|
~
|
||||||
|
</Text>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 28,
|
||||||
|
color: "#0099CC",
|
||||||
|
textAlign: "right",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
data.trainData?.Pos.replace("(下り)", "")
|
||||||
|
.replace("(上り)", "")
|
||||||
|
.split("~")[1]
|
||||||
|
}
|
||||||
|
</Text>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<Text
|
||||||
|
style={{ fontSize: 28, color: "#0099CC", textAlign: "right" }}
|
||||||
|
>
|
||||||
|
{data.trainData?.Pos}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1, flexDirection: "column" }}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: "white",
|
||||||
|
borderRadius: 10,
|
||||||
|
padding: 10,
|
||||||
|
margin: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={{ fontSize: 15, color: "#0099CC" }}>
|
||||||
|
{isNaN(data.trainData?.delay) ? "状態" : "遅延時分"}
|
||||||
|
</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 32,
|
||||||
|
color: "#0099CC",
|
||||||
|
textAlign: "right",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{data.trainData?.delay}
|
||||||
|
{isNaN(data.trainData?.delay) ? "" : "分"}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: "white",
|
||||||
|
borderRadius: 10,
|
||||||
|
padding: 10,
|
||||||
|
margin: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={{ fontSize: 15, color: "#0099CC" }}>列番</Text>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 32,
|
||||||
|
color: "#0099CC",
|
||||||
|
textAlign: "right",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{data.trainData?.num}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
{/* <View
|
||||||
|
style={{
|
||||||
|
flexDirection: "column",
|
||||||
|
height: heightPercentageToDP("20%"),
|
||||||
|
flex: 1,
|
||||||
|
width: widthPercentageToDP("100%"),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View style={{ flex: 1, flexDirection: "row" }}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: "white",
|
||||||
|
borderRadius: 10,
|
||||||
|
padding: 10,
|
||||||
|
margin: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={{ fontSize: 15, color: "#0099CC" }}>行先</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 20,
|
||||||
|
color: "#0099CC",
|
||||||
|
textAlign: "right",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
岡山
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flex: 3,
|
||||||
|
backgroundColor: "white",
|
||||||
|
borderRadius: 10,
|
||||||
|
padding: 10,
|
||||||
|
margin: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={{ fontSize: 15, color: "#0099CC" }}>車両案内</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 20,
|
||||||
|
color: "#0099CC",
|
||||||
|
textAlign: "right",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
宇多津でうずしお号と連結
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1, flexDirection: "row" }}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: "white",
|
||||||
|
borderRadius: 10,
|
||||||
|
padding: 10,
|
||||||
|
margin: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={{ fontSize: 15, color: "#0099CC" }}>
|
||||||
|
編成(使用車両:2700系)
|
||||||
|
</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 20,
|
||||||
|
color: "#0099CC",
|
||||||
|
textAlign: "left",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{"[<自][自>][アン自|指>][アン指|G>]"}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View> */}
|
||||||
|
</ScrollView>
|
||||||
|
<ScrollView
|
||||||
|
style={{ maxHeight: heightPercentageToDP("55%") }}
|
||||||
|
nestedScrollEnabled
|
||||||
|
onScroll={(e) => {
|
||||||
|
if (!Platform.OS !== "android") return;
|
||||||
|
setIsTop(e.nativeEvent.contentOffset.y < 0);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
padding: 10,
|
||||||
|
backgroundColor: "white",
|
||||||
|
borderBottomLeftRadius: 5,
|
||||||
|
borderBottomRightRadius: 5,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View style={{ alignItems: "center" }}>
|
||||||
|
{/* <LottieView
|
||||||
|
autoPlay
|
||||||
|
loop
|
||||||
|
style={{ width: 150, height: 150, backgroundColor: "#fff" }}
|
||||||
|
source={require("../../assets/51690-loading-diamonds.json")}
|
||||||
|
/>
|
||||||
|
<Text>ほげほげふがふが</Text> */}
|
||||||
|
<View style={{ flexDirection: "row" }}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
padding: 8,
|
||||||
|
flexDirection: "row",
|
||||||
|
borderBottomWidth: 1,
|
||||||
|
borderBottomColor: "#f0f0f0",
|
||||||
|
flex: 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={{ fontSize: 20 }}>停車駅</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<View style={{ flexDirection: "row" }}>
|
||||||
|
{!isNaN(data.trainData?.delay) &&
|
||||||
|
data.trainData?.delay != 0 && (
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 15,
|
||||||
|
color: "black",
|
||||||
|
position: "absolute",
|
||||||
|
right: 110,
|
||||||
|
textAlign: "right",
|
||||||
|
textDecorationLine: "line-through",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
(定刻)
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 20,
|
||||||
|
color: isNaN(data.trainData?.delay)
|
||||||
|
? "black"
|
||||||
|
: data.trainData?.delay == 0
|
||||||
|
? "black"
|
||||||
|
: "red",
|
||||||
|
width: 60,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
見込
|
||||||
|
</Text>
|
||||||
|
<Text style={{ fontSize: 20, width: 50 }}></Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
{trainData.map((i, index) => {
|
||||||
|
const [station, se, time] = i.split(",");
|
||||||
|
const Stations = stationList.map((a) =>
|
||||||
|
a.filter((d) => d.StationName == station)
|
||||||
|
);
|
||||||
|
const StationNumbers =
|
||||||
|
Stations &&
|
||||||
|
Stations.reduce((newArray, e) => {
|
||||||
|
return newArray.concat(e);
|
||||||
|
}, [])
|
||||||
|
.filter((d) => d.StationNumber)
|
||||||
|
.map((d) => d.StationNumber);
|
||||||
|
|
||||||
|
const colorIDs =
|
||||||
|
StationNumbers != null
|
||||||
|
? StationNumbers.map((d) => {
|
||||||
|
return d.split("").filter((s) => "A" < s && s < "Z");
|
||||||
|
}).reduce((newArray, e) => {
|
||||||
|
return newArray.concat(e);
|
||||||
|
}, [])
|
||||||
|
: [];
|
||||||
|
const EachIDs =
|
||||||
|
StationNumbers != null
|
||||||
|
? StationNumbers.map((d) => {
|
||||||
|
return d
|
||||||
|
.split("")
|
||||||
|
.filter((s) => "0" <= s && s <= "9")
|
||||||
|
.join("");
|
||||||
|
})
|
||||||
|
: [];
|
||||||
|
const date = new Date();
|
||||||
|
if (time) {
|
||||||
|
date.setHours(time.split(":")[0], time.split(":")[1]);
|
||||||
|
}
|
||||||
|
if (!isNaN(data.trainData?.delay)) {
|
||||||
|
date.setMinutes(date.getMinutes() + data.trainData?.delay);
|
||||||
|
}
|
||||||
|
const timeString = date.toTimeString().split(" ")[0].split(":");
|
||||||
|
return (
|
||||||
|
<TouchableWithoutFeedback
|
||||||
|
onPress={() => openStationACFromEachTrainInfo(station)}
|
||||||
|
key={station}
|
||||||
|
>
|
||||||
|
<View style={{ flexDirection: "row" }}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
width: 35,
|
||||||
|
position: "relative",
|
||||||
|
marginHorizontal: 15,
|
||||||
|
flexDirection: "row",
|
||||||
|
height: "101%",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{colorIDs.map((color, index) => (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
backgroundColor: lineColorList[color],
|
||||||
|
flex: 1,
|
||||||
|
}}
|
||||||
|
key={color}
|
||||||
|
>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
color: "white",
|
||||||
|
textAlign: "center",
|
||||||
|
fontSize: 10,
|
||||||
|
fontWeight: "bold",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{colorIDs[index]}
|
||||||
|
</Text>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
color: "white",
|
||||||
|
textAlign: "center",
|
||||||
|
fontSize: 10,
|
||||||
|
fontWeight: "bold",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{EachIDs[index]}
|
||||||
|
</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
</View>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
padding: 8,
|
||||||
|
flexDirection: "row",
|
||||||
|
borderBottomWidth: 1,
|
||||||
|
borderBottomColor: "#f0f0f0",
|
||||||
|
flex: 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={{ fontSize: 20 }}>{station}</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
{points.findIndex((d) => d == index) >= 0 ? (
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 20,
|
||||||
|
marginRight: 70,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
🚊
|
||||||
|
</Text>
|
||||||
|
) : null}
|
||||||
|
{!isNaN(data.trainData?.delay) &&
|
||||||
|
data.trainData?.delay != 0 && (
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 15,
|
||||||
|
color: "black",
|
||||||
|
width: 60,
|
||||||
|
position: "absolute",
|
||||||
|
right: 120,
|
||||||
|
textAlign: "right",
|
||||||
|
textDecorationLine: "line-through",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{time}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 20,
|
||||||
|
color: isNaN(data.trainData?.delay)
|
||||||
|
? "black"
|
||||||
|
: data.trainData?.delay == 0
|
||||||
|
? "black"
|
||||||
|
: "red",
|
||||||
|
width: 60,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{timeString[0]}:{timeString[1]}
|
||||||
|
</Text>
|
||||||
|
<Text style={{ fontSize: 18, width: 50 }}>
|
||||||
|
{se?.replace("発", "出発").replace("着", "到着")}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</TouchableWithoutFeedback>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</ScrollView>
|
||||||
|
</View>
|
||||||
|
</ActionSheet>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
import React, { Component, useRef, useState, useEffect } from "react";
|
import React from "react";
|
||||||
import {
|
import {
|
||||||
StatusBar,
|
|
||||||
Platform,
|
|
||||||
View,
|
View,
|
||||||
LayoutAnimation,
|
LayoutAnimation,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
@@ -9,30 +7,9 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import Image from "react-native-remote-svg";
|
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
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 ActionSheet from "react-native-actions-sheet";
|
import ActionSheet from "react-native-actions-sheet";
|
||||||
import LottieView from "lottie-react-native";
|
import LottieView from "lottie-react-native";
|
||||||
import SvgUri from "react-native-svg-uri";
|
|
||||||
export const JRSTraInfo = (props) => {
|
export const JRSTraInfo = (props) => {
|
||||||
const {
|
const {
|
||||||
JRSTraInfoEXAcSR,
|
JRSTraInfoEXAcSR,
|
||||||
@@ -45,7 +22,7 @@ export const JRSTraInfo = (props) => {
|
|||||||
<ActionSheet
|
<ActionSheet
|
||||||
ref={JRSTraInfoEXAcSR}
|
ref={JRSTraInfoEXAcSR}
|
||||||
gestureEnabled
|
gestureEnabled
|
||||||
CustomHeaderComponent={() => { }}
|
CustomHeaderComponent={<></>}
|
||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
@@ -116,7 +93,7 @@ export const JRSTraInfo = (props) => {
|
|||||||
delayData.map((d) => {
|
delayData.map((d) => {
|
||||||
let data = d.split(" ");
|
let data = d.split(" ");
|
||||||
return (
|
return (
|
||||||
<View style={{ flexDirection: "row" }}>
|
<View style={{ flexDirection: "row" }} key={data[1]}>
|
||||||
<Text style={{ flex: 15, fontSize: 20 }}>
|
<Text style={{ flex: 15, fontSize: 20 }}>
|
||||||
{data[0].replace("\n", "")}
|
{data[0].replace("\n", "")}
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
@@ -1,21 +1,59 @@
|
|||||||
import React from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { View, ScrollView, Linking } from "react-native";
|
import {
|
||||||
import StatusbarDetect from "../../StatusbarDetect";
|
StatusBar,
|
||||||
var Status = StatusbarDetect();
|
View,
|
||||||
|
LayoutAnimation,
|
||||||
|
ScrollView,
|
||||||
|
Linking,
|
||||||
|
Text,
|
||||||
|
TouchableOpacity,
|
||||||
|
} from "react-native";
|
||||||
|
import AutoHeightImage from "react-native-auto-height-image";
|
||||||
import { FontAwesome, Foundation, Ionicons } from "@expo/vector-icons";
|
import { FontAwesome, Foundation, Ionicons } from "@expo/vector-icons";
|
||||||
import ActionSheet from "react-native-actions-sheet";
|
import ActionSheet from "react-native-actions-sheet";
|
||||||
import Sign from "../../components/駅名表/Sign";
|
import Sign from "../../components/駅名表/Sign";
|
||||||
|
import { useInterval } from "../../lib/useInterval";
|
||||||
|
|
||||||
import { TicketBox } from "../atom/TicketBox";
|
import { TicketBox } from "../atom/TicketBox";
|
||||||
|
import {
|
||||||
|
widthPercentageToDP as wp,
|
||||||
|
heightPercentageToDP as hp,
|
||||||
|
} from "react-native-responsive-screen";
|
||||||
|
import lineColorList from "../../assets/originData/lineColorList";
|
||||||
|
import { getPDFViewURL } from "../../lib/getPdfViewURL";
|
||||||
|
|
||||||
export const StationDeteilView = (props) => {
|
export const StationDeteilView = (props) => {
|
||||||
const { StationBoardAcSR, currentStation, originalStationList } = props;
|
const {
|
||||||
|
StationBoardAcSR,
|
||||||
|
currentStation,
|
||||||
|
originalStationList,
|
||||||
|
favoriteStation,
|
||||||
|
setFavoriteStation,
|
||||||
|
busAndTrainData,
|
||||||
|
navigate,
|
||||||
|
onExit,
|
||||||
|
} = props;
|
||||||
|
const [trainBus, setTrainBus] = useState();
|
||||||
|
useEffect(() => {
|
||||||
|
if (!currentStation) return () => {};
|
||||||
|
const data = busAndTrainData.filter((d) => {
|
||||||
|
return d.name === currentStation[0].Station_JP;
|
||||||
|
});
|
||||||
|
if (data.length == 0) {
|
||||||
|
setTrainBus();
|
||||||
|
}
|
||||||
|
setTrainBus(data[0]);
|
||||||
|
}, [currentStation]);
|
||||||
|
const info =
|
||||||
|
currentStation &&
|
||||||
|
(currentStation[0].StationTimeTable.match(".pdf")
|
||||||
|
? getPDFViewURL(currentStation[0].StationTimeTable)
|
||||||
|
: currentStation[0].StationTimeTable);
|
||||||
return (
|
return (
|
||||||
<ActionSheet
|
<ActionSheet
|
||||||
ref={StationBoardAcSR}
|
ref={StationBoardAcSR}
|
||||||
gestureEnabled
|
gestureEnabled
|
||||||
CustomHeaderComponent={() => {}}
|
CustomHeaderComponent={<></>}
|
||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
key={currentStation}
|
key={currentStation}
|
||||||
@@ -40,10 +78,57 @@ export const StationDeteilView = (props) => {
|
|||||||
</View>
|
</View>
|
||||||
<View>
|
<View>
|
||||||
{currentStation && (
|
{currentStation && (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
margin: 10,
|
||||||
|
marginHorizontal: wp("10%"),
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Sign
|
<Sign
|
||||||
currentStation={currentStation}
|
currentStation={currentStation}
|
||||||
originalStationList={originalStationList}
|
originalStationList={originalStationList}
|
||||||
oP={() => Linking.openURL(currentStation[0].StationTimeTable)}
|
favoriteStation={favoriteStation}
|
||||||
|
setFavoriteStation={setFavoriteStation}
|
||||||
|
oP={() => {
|
||||||
|
navigate("howto", {
|
||||||
|
info,
|
||||||
|
onExit,
|
||||||
|
});
|
||||||
|
StationBoardAcSR.current?.hide();
|
||||||
|
}}
|
||||||
|
oLP={() => Linking.openURL(currentStation[0].StationTimeTable)}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
{currentStation &&
|
||||||
|
currentStation.map((d) => (
|
||||||
|
<NexPreStationLine
|
||||||
|
currentStation={d}
|
||||||
|
originalStationList={originalStationList}
|
||||||
|
favoriteStation={favoriteStation}
|
||||||
|
setFavoriteStation={setFavoriteStation}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
{currentStation &&
|
||||||
|
currentStation[0].JrHpUrl &&
|
||||||
|
currentStation[0].StationNumber != "M12" && (
|
||||||
|
<駅構内図 //高松/阿波池田&後免&須崎kounai.png児島例外/
|
||||||
|
oP={() => {
|
||||||
|
navigate("howto", {
|
||||||
|
info:
|
||||||
|
currentStation[0].JrHpUrl.replace("/index.html", "/") +
|
||||||
|
"/kounai_map.html",
|
||||||
|
onExit,
|
||||||
|
});
|
||||||
|
StationBoardAcSR.current?.hide();
|
||||||
|
}}
|
||||||
|
oLP={() => {
|
||||||
|
Linking.openURL(
|
||||||
|
currentStation[0].JrHpUrl.replace("/index.html", "/") +
|
||||||
|
"/kounai_map.html"
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
uri={currentStation[0].JrHpUrl.replace("/index.html", "/")}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{currentStation && (
|
{currentStation && (
|
||||||
@@ -53,7 +138,14 @@ export const StationDeteilView = (props) => {
|
|||||||
backgroundColor={"#AD7FA8"}
|
backgroundColor={"#AD7FA8"}
|
||||||
icon={<Foundation name="web" color="white" size={50} />}
|
icon={<Foundation name="web" color="white" size={50} />}
|
||||||
flex={1}
|
flex={1}
|
||||||
onPressButton={() =>
|
onPressButton={() => {
|
||||||
|
navigate("howto", {
|
||||||
|
info: currentStation[0].JrHpUrl,
|
||||||
|
onExit,
|
||||||
|
});
|
||||||
|
StationBoardAcSR.current?.hide();
|
||||||
|
}}
|
||||||
|
onLongPressButton={() =>
|
||||||
Linking.openURL(currentStation[0].JrHpUrl)
|
Linking.openURL(currentStation[0].JrHpUrl)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@@ -65,7 +157,14 @@ export const StationDeteilView = (props) => {
|
|||||||
backgroundColor={"#8F5902"}
|
backgroundColor={"#8F5902"}
|
||||||
icon={<FontAwesome name="table" color="white" size={50} />}
|
icon={<FontAwesome name="table" color="white" size={50} />}
|
||||||
flex={1}
|
flex={1}
|
||||||
onPressButton={() =>
|
onPressButton={() => {
|
||||||
|
navigate("howto", {
|
||||||
|
info,
|
||||||
|
onExit,
|
||||||
|
});
|
||||||
|
StationBoardAcSR.current?.hide();
|
||||||
|
}}
|
||||||
|
onLongPressButton={() =>
|
||||||
Linking.openURL(currentStation[0].StationTimeTable)
|
Linking.openURL(currentStation[0].StationTimeTable)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@@ -81,7 +180,24 @@ export const StationDeteilView = (props) => {
|
|||||||
Linking.openURL(currentStation[0].StationMap)
|
Linking.openURL(currentStation[0].StationMap)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
GoogleMap
|
Map
|
||||||
|
</TicketBox>
|
||||||
|
)}
|
||||||
|
{!trainBus || (
|
||||||
|
<TicketBox
|
||||||
|
backgroundColor={"#CE5C00"}
|
||||||
|
icon={<Ionicons name="bus" color="white" size={50} />}
|
||||||
|
flex={1}
|
||||||
|
onPressButton={() => {
|
||||||
|
navigate("howto", {
|
||||||
|
info: trainBus.address,
|
||||||
|
onExit,
|
||||||
|
});
|
||||||
|
StationBoardAcSR.current?.hide();
|
||||||
|
}}
|
||||||
|
onLongPressButton={() => Linking.openURL(trainBus.address)}
|
||||||
|
>
|
||||||
|
並行バス
|
||||||
</TicketBox>
|
</TicketBox>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
@@ -91,3 +207,286 @@ export const StationDeteilView = (props) => {
|
|||||||
</ActionSheet>
|
</ActionSheet>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const StationName = (props) => {
|
||||||
|
const { stringData, ss } = props;
|
||||||
|
return (
|
||||||
|
<View style={ss}>
|
||||||
|
<Text style={styleSheet.下枠駅名}>{stringData.Station_JP}</Text>
|
||||||
|
<Text style={styleSheet.下枠駅名}>{stringData.Station_EN}</Text>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const NexPreStationLine = ({
|
||||||
|
currentStation,
|
||||||
|
originalStationList,
|
||||||
|
oP,
|
||||||
|
favoriteStation,
|
||||||
|
setFavoriteStation,
|
||||||
|
}) => {
|
||||||
|
const [preStation, setPreStation] = useState();
|
||||||
|
const [nexStation, setNexStation] = useState();
|
||||||
|
const [lineName, setLineName] = useState();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getPreNextStation(currentStation);
|
||||||
|
}, [currentStation]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!currentStation) return () => {};
|
||||||
|
getPreNextStation(currentStation);
|
||||||
|
}, []);
|
||||||
|
const getPreNextStation = (now) => {
|
||||||
|
const lineList = [
|
||||||
|
"予讃線(高松-松山間)[Y]",
|
||||||
|
"予讃線(松山-宇和島間)[U]",
|
||||||
|
"予讃線/愛ある伊予灘線(向井原-伊予大洲間)[S]",
|
||||||
|
"土讃線(多度津-高知間)[D]",
|
||||||
|
"土讃線(高知-窪川間)[K]",
|
||||||
|
"高徳線(高松-徳島間)[T]",
|
||||||
|
"徳島線(徳島-阿波池田)[B]",
|
||||||
|
"鳴門線(池谷-鳴門間)[N]",
|
||||||
|
"瀬戸大橋線(宇多津-児島間)[M]",
|
||||||
|
];
|
||||||
|
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],
|
||||||
|
d,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setPreStation(returnData[0]);
|
||||||
|
setNexStation(returnData[1]);
|
||||||
|
setLineName(returnData[2]);
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
height: 50,
|
||||||
|
backgroundColor: lineName
|
||||||
|
? lineColorList[lineName.split("[")[1].replace("]", "")]
|
||||||
|
: "red",
|
||||||
|
flexDirection: "row",
|
||||||
|
alignContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View style={styleSheet.下枠フレーム}>
|
||||||
|
{preStation ? (
|
||||||
|
<>
|
||||||
|
<Text style={styleSheet.下枠左右マーク}>◀</Text>
|
||||||
|
{preStation.StationNumber ? (
|
||||||
|
<View style={styleSheet.下枠駅ナンバー}>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: parseInt("10%"),
|
||||||
|
color: "white",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{preStation.StationNumber}
|
||||||
|
</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
</View>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
|
<StationName
|
||||||
|
stringData={preStation}
|
||||||
|
ss={{ flex: 1, alignItems: "flex-start" }}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: parseInt("10%"),
|
||||||
|
color: "white",
|
||||||
|
textAlign: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{lineName &&
|
||||||
|
lineName
|
||||||
|
.split("(")
|
||||||
|
.map((d, index) => (index == 1 ? "(" + d : d))
|
||||||
|
.join("\n")}
|
||||||
|
</Text>
|
||||||
|
<View style={styleSheet.下枠フレーム}>
|
||||||
|
{nexStation ? (
|
||||||
|
<>
|
||||||
|
<StationName
|
||||||
|
stringData={nexStation}
|
||||||
|
ss={{ flex: 1, alignItems: "flex-end" }}
|
||||||
|
/>
|
||||||
|
{nexStation.StationNumber ? (
|
||||||
|
<View style={styleSheet.下枠駅ナンバー}>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text style={{ fontSize: parseInt("15%"), color: "white" }}>
|
||||||
|
{nexStation.StationNumber}
|
||||||
|
</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
</View>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
|
<Text style={styleSheet.下枠左右マーク}>▶</Text>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const 駅構内図 = (props) => {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<TouchableOpacity
|
||||||
|
style={{
|
||||||
|
height: 50,
|
||||||
|
backgroundColor: "#888A85",
|
||||||
|
flexDirection: "column",
|
||||||
|
alignContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
margin: 2,
|
||||||
|
}}
|
||||||
|
onPress={props.oP}
|
||||||
|
onLongPress={props.oLP}
|
||||||
|
//onPress={() => setOpen(!open)}
|
||||||
|
>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
color: "white",
|
||||||
|
textAlign: "center",
|
||||||
|
textAlignVertical: "center",
|
||||||
|
flex: 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{open ? "駅構内図を非表示" : "駅構内図を表示"}
|
||||||
|
</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
</TouchableOpacity>
|
||||||
|
<View>
|
||||||
|
{open && (
|
||||||
|
<>
|
||||||
|
<AutoHeightImage
|
||||||
|
source={{ uri: props.uri + "images/kounai.gif" }}
|
||||||
|
resizeMode="contain"
|
||||||
|
width={wp("100%")}
|
||||||
|
/>
|
||||||
|
<AutoHeightImage
|
||||||
|
source={{ uri: props.uri + "images/kounai.png" }}
|
||||||
|
resizeMode="contain"
|
||||||
|
width={wp("100%")}
|
||||||
|
/>
|
||||||
|
<AutoHeightImage
|
||||||
|
source={{ uri: props.uri + "images/kounai_1f.gif" }}
|
||||||
|
resizeMode="contain"
|
||||||
|
width={wp("100%")}
|
||||||
|
/>
|
||||||
|
<AutoHeightImage
|
||||||
|
source={{ uri: props.uri + "images/kounai_2f.png" }}
|
||||||
|
resizeMode="contain"
|
||||||
|
width={wp("100%")}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const styleSheet = {
|
||||||
|
外枠: {
|
||||||
|
width: wp("80%"),
|
||||||
|
height: (wp("80%") / 20) * 9,
|
||||||
|
borderColor: "#2E94BB",
|
||||||
|
borderWidth: 1,
|
||||||
|
backgroundColor: "white",
|
||||||
|
},
|
||||||
|
下帯: {
|
||||||
|
position: "absolute",
|
||||||
|
bottom: "0%",
|
||||||
|
left: "0%",
|
||||||
|
width: "100%",
|
||||||
|
height: "30%",
|
||||||
|
backgroundColor: "#2E94BB",
|
||||||
|
},
|
||||||
|
JRStyle: {
|
||||||
|
position: "absolute",
|
||||||
|
top: "2%",
|
||||||
|
left: "2%",
|
||||||
|
fontWeight: "bold",
|
||||||
|
fontSize: parseInt("30%"),
|
||||||
|
color: "#2E94BB",
|
||||||
|
},
|
||||||
|
stationNameAreaOverWrap: {
|
||||||
|
position: "absolute",
|
||||||
|
top: "10%",
|
||||||
|
alignContent: "center",
|
||||||
|
flexDirection: "row",
|
||||||
|
},
|
||||||
|
Station_JP: {
|
||||||
|
fontWeight: "bold",
|
||||||
|
fontSize: parseInt("40%"),
|
||||||
|
color: "#005170",
|
||||||
|
},
|
||||||
|
Station_EN: {
|
||||||
|
fontWeight: "bold",
|
||||||
|
fontSize: parseInt("15%"),
|
||||||
|
color: "#005170",
|
||||||
|
},
|
||||||
|
下帯内容: {
|
||||||
|
position: "absolute",
|
||||||
|
bottom: "0%",
|
||||||
|
height: "30%",
|
||||||
|
width: "100%",
|
||||||
|
alignItems: "center",
|
||||||
|
flexDirection: "column",
|
||||||
|
},
|
||||||
|
下枠フレーム: {
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: "row",
|
||||||
|
alignContent: "center",
|
||||||
|
height: wp("10%"),
|
||||||
|
},
|
||||||
|
下枠左右マーク: {
|
||||||
|
fontWeight: "bold",
|
||||||
|
fontSize: parseInt("20%"),
|
||||||
|
color: "white",
|
||||||
|
paddingHorizontal: 10,
|
||||||
|
textAlignVertical: "center",
|
||||||
|
},
|
||||||
|
下枠駅ナンバー: {
|
||||||
|
alignContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
width: wp("8%"),
|
||||||
|
height: wp("8%"),
|
||||||
|
margin: wp("1%"),
|
||||||
|
borderColor: "white",
|
||||||
|
borderWidth: parseInt("2%"),
|
||||||
|
borderRadius: parseInt("100%"),
|
||||||
|
},
|
||||||
|
下枠駅名: {
|
||||||
|
fontWeight: "bold",
|
||||||
|
fontSize: parseInt("15%"),
|
||||||
|
color: "white",
|
||||||
|
flex: 1,
|
||||||
|
paddingHorizontal: 0,
|
||||||
|
marginVertical: 0,
|
||||||
|
textAlignVertical: "center",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|||||||
111
components/FavoriteList.js
Normal file
111
components/FavoriteList.js
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
import React, { Component, useRef, useState, useEffect } from "react";
|
||||||
|
import { View, Text, TouchableOpacity, ScrollView } from "react-native";
|
||||||
|
import { WebView } from "react-native-webview";
|
||||||
|
import { ListItem } from "native-base";
|
||||||
|
import Icon from "react-native-vector-icons/Entypo";
|
||||||
|
import StatusbarDetect from "../StatusbarDetect";
|
||||||
|
import { AS } from "../storageControl";
|
||||||
|
import { news } from "../config/newsUpdate";
|
||||||
|
import { getStationList, lineList } from "../lib/getStationList";
|
||||||
|
var Status = StatusbarDetect();
|
||||||
|
export default function FavoriteList({
|
||||||
|
navigation,
|
||||||
|
webview,
|
||||||
|
stationData,
|
||||||
|
favoriteStation,
|
||||||
|
setFavoriteStation,
|
||||||
|
}) {
|
||||||
|
const { navigate } = navigation;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={{ height: "100%", backgroundColor: "#0099CC" }}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
textAlign: "center",
|
||||||
|
fontSize: 25,
|
||||||
|
color: "white",
|
||||||
|
fontWeight: "bold",
|
||||||
|
paddingVertical: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
位置情報クイック移動メニュー
|
||||||
|
</Text>
|
||||||
|
<ScrollView style={{ height: "100%", backgroundColor: "white" }}>
|
||||||
|
{favoriteStation
|
||||||
|
.filter((d) => d[0].StationMap)
|
||||||
|
.map((currentStation) => {
|
||||||
|
return (
|
||||||
|
<ListItem
|
||||||
|
onPress={() => {
|
||||||
|
const getStationLine = (now) => {
|
||||||
|
const returnData = Object.keys(stationData).filter((d) => {
|
||||||
|
const cache = stationData[d].findIndex(
|
||||||
|
(data) => data.Station_JP == now.Station_JP
|
||||||
|
);
|
||||||
|
return cache != -1;
|
||||||
|
});
|
||||||
|
return returnData[0];
|
||||||
|
};
|
||||||
|
const lineName = getStationLine(currentStation[0]);
|
||||||
|
|
||||||
|
webview.current?.injectJavaScript(
|
||||||
|
`MoveDisplayStation('${lineName}_${currentStation[0].MyStation}_${currentStation[0].Station_JP}')`
|
||||||
|
);
|
||||||
|
navigate("Apps");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={{ fontSize: 20, flex: 2 }}>
|
||||||
|
{currentStation
|
||||||
|
.map((d) => d.StationNumber)
|
||||||
|
.filter((d) => d !== null)
|
||||||
|
.join("/")}
|
||||||
|
</Text>
|
||||||
|
<Text style={{ fontSize: 20, flex: 3 }}>
|
||||||
|
{currentStation[0].Station_JP}
|
||||||
|
</Text>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flex: 2,
|
||||||
|
flexDirection: "row",
|
||||||
|
alignContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text style={{ fontSize: 20 }}>移動する</Text>
|
||||||
|
<Icon name="chevron-right" size={20} />
|
||||||
|
</View>
|
||||||
|
</ListItem>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</ScrollView>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
backgroundColor: "white",
|
||||||
|
borderWidth: 1,
|
||||||
|
borderStyle: "solid",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
お気に入り登録した駅のうち、位置情報システムで移動可能な駅が表示されています。タップすることで位置情報システムの当該の駅に移動します。
|
||||||
|
</Text>
|
||||||
|
<TouchableOpacity
|
||||||
|
style={{
|
||||||
|
padding: 10,
|
||||||
|
flexDirection: "row",
|
||||||
|
borderColor: "white",
|
||||||
|
borderWidth: 1,
|
||||||
|
margin: 10,
|
||||||
|
borderRadius: 5,
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
|
onPress={() => navigation.goBack()}
|
||||||
|
>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text style={{ fontSize: 25, fontWeight: "bold", color: "white" }}>
|
||||||
|
閉じる
|
||||||
|
</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
</TouchableOpacity>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,7 +1,14 @@
|
|||||||
import { TouchableOpacity, Text } from "react-native";
|
import { TouchableOpacity, Text } from "react-native";
|
||||||
|
|
||||||
export const TicketBox = (props) => {
|
export const TicketBox = (props) => {
|
||||||
const { icon, backgroundColor, flex, onPressButton, children } = props;
|
const {
|
||||||
|
icon,
|
||||||
|
backgroundColor,
|
||||||
|
flex,
|
||||||
|
onPressButton,
|
||||||
|
children,
|
||||||
|
onLongPressButton,
|
||||||
|
} = props;
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={{
|
style={{
|
||||||
@@ -14,6 +21,7 @@ export const TicketBox = (props) => {
|
|||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
}}
|
}}
|
||||||
onPress={onPressButton}
|
onPress={onPressButton}
|
||||||
|
onLongPress={onLongPressButton}
|
||||||
>
|
>
|
||||||
<Text style={{ color: "white", fontWeight: "bold", fontSize: 18 }}>
|
<Text style={{ color: "white", fontWeight: "bold", fontSize: 18 }}>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ export const customTrainDataDetector = (TrainNumber) => {
|
|||||||
switch (TrainNumber) {
|
switch (TrainNumber) {
|
||||||
//しおかぜメイン
|
//しおかぜメイン
|
||||||
//8000 ノーマル
|
//8000 ノーマル
|
||||||
case "2M":
|
|
||||||
case "4M":
|
case "4M":
|
||||||
case "6M":
|
case "6M":
|
||||||
case "14M":
|
case "14M":
|
||||||
@@ -27,10 +26,18 @@ export const customTrainDataDetector = (TrainNumber) => {
|
|||||||
trainNumDistance: 0,
|
trainNumDistance: 0,
|
||||||
info: "いしづちと併結 / 8000系で運転",
|
info: "いしづちと併結 / 8000系で運転",
|
||||||
};
|
};
|
||||||
|
case "2M":
|
||||||
|
return {
|
||||||
|
type: "LTDEXP",
|
||||||
|
trainName: "しおかぜ",
|
||||||
|
trainIcon: "http://www.trainfrontview.net/b/s8000nr.png",
|
||||||
|
trainNumDistance: 0,
|
||||||
|
info: "8000系で運転",
|
||||||
|
};
|
||||||
//8000 アンパン
|
//8000 アンパン
|
||||||
case "10M":
|
|
||||||
case "22M":
|
case "22M":
|
||||||
case "9M":
|
case "9M":
|
||||||
|
case "10M":
|
||||||
case "21M":
|
case "21M":
|
||||||
return {
|
return {
|
||||||
type: "LTDEXP",
|
type: "LTDEXP",
|
||||||
@@ -158,22 +165,36 @@ export const customTrainDataDetector = (TrainNumber) => {
|
|||||||
|
|
||||||
//南風 2700ノーマル
|
//南風 2700ノーマル
|
||||||
case "34D":
|
case "34D":
|
||||||
|
case "58D":
|
||||||
|
case "31D":
|
||||||
|
case "51D":
|
||||||
|
return {
|
||||||
|
type: "LTDEXP",
|
||||||
|
trainName: "南風",
|
||||||
|
trainIcon: "http://www.trainfrontview.net/b/s2700.png",
|
||||||
|
trainNumDistance: 30,
|
||||||
|
info: "しまんとと併結 / 2700系で運転",
|
||||||
|
};
|
||||||
|
case "52D":
|
||||||
|
case "53D":
|
||||||
|
return {
|
||||||
|
type: "LTDEXP",
|
||||||
|
trainName: "南風",
|
||||||
|
trainIcon: "http://www.trainfrontview.net/b/s2700.png",
|
||||||
|
trainNumDistance: 30,
|
||||||
|
info: "うずしおと併結 / 2700系で運転",
|
||||||
|
};
|
||||||
case "38D":
|
case "38D":
|
||||||
case "40D":
|
case "40D":
|
||||||
case "42D":
|
case "42D":
|
||||||
case "46D":
|
case "46D":
|
||||||
case "50D":
|
case "50D":
|
||||||
case "52D":
|
|
||||||
case "54D":
|
case "54D":
|
||||||
case "58D":
|
|
||||||
case "31D":
|
|
||||||
case "35D":
|
case "35D":
|
||||||
case "39D":
|
case "39D":
|
||||||
case "41D":
|
case "41D":
|
||||||
case "43D":
|
case "43D":
|
||||||
case "47D":
|
case "47D":
|
||||||
case "51D":
|
|
||||||
case "53D":
|
|
||||||
case "55D":
|
case "55D":
|
||||||
return {
|
return {
|
||||||
type: "LTDEXP",
|
type: "LTDEXP",
|
||||||
@@ -182,14 +203,22 @@ export const customTrainDataDetector = (TrainNumber) => {
|
|||||||
trainNumDistance: 30,
|
trainNumDistance: 30,
|
||||||
info: "2700系で運転",
|
info: "2700系で運転",
|
||||||
};
|
};
|
||||||
|
|
||||||
//2700アンパン
|
//2700アンパン
|
||||||
case "32D":
|
|
||||||
case "36D":
|
case "36D":
|
||||||
|
case "37D":
|
||||||
|
return {
|
||||||
|
type: "LTDEXP",
|
||||||
|
trainName: "南風",
|
||||||
|
trainIcon: "http://www.trainfrontview.net/f/s2700apr.png",
|
||||||
|
trainNumDistance: 30,
|
||||||
|
info: "うずしおと連結 / アンパンマン列車で運転",
|
||||||
|
};
|
||||||
|
case "32D":
|
||||||
case "44D":
|
case "44D":
|
||||||
case "48D":
|
case "48D":
|
||||||
case "56D":
|
case "56D":
|
||||||
case "33D":
|
case "33D":
|
||||||
case "37D":
|
|
||||||
case "45D":
|
case "45D":
|
||||||
case "49D":
|
case "49D":
|
||||||
case "57D":
|
case "57D":
|
||||||
@@ -200,7 +229,6 @@ export const customTrainDataDetector = (TrainNumber) => {
|
|||||||
trainNumDistance: 30,
|
trainNumDistance: 30,
|
||||||
info: "アンパンマン列車で運転",
|
info: "アンパンマン列車で運転",
|
||||||
};
|
};
|
||||||
break;
|
|
||||||
|
|
||||||
//うずしお
|
//うずしお
|
||||||
//2700
|
//2700
|
||||||
@@ -213,7 +241,7 @@ export const customTrainDataDetector = (TrainNumber) => {
|
|||||||
trainName: "うずしお",
|
trainName: "うずしお",
|
||||||
trainIcon: "http://www.trainfrontview.net/b/s2700_uzu.png",
|
trainIcon: "http://www.trainfrontview.net/b/s2700_uzu.png",
|
||||||
trainNumDistance: 5000,
|
trainNumDistance: 5000,
|
||||||
info: "南風と宇多津で併結 / 高松-宇多津間進行方向逆転 / 2700系で運転",
|
info: "南風と併結 / 高松-宇多津間進行方向逆転 / 2700系で運転",
|
||||||
};
|
};
|
||||||
case "3002D":
|
case "3002D":
|
||||||
case "3004D":
|
case "3004D":
|
||||||
@@ -384,7 +412,9 @@ export const customTrainDataDetector = (TrainNumber) => {
|
|||||||
case "1052D":
|
case "1052D":
|
||||||
case "1056D":
|
case "1056D":
|
||||||
case "1058D":
|
case "1058D":
|
||||||
|
case "1062D":
|
||||||
case "1064D":
|
case "1064D":
|
||||||
|
case "1068D":
|
||||||
case "1070D":
|
case "1070D":
|
||||||
case "1074D":
|
case "1074D":
|
||||||
case "1076D":
|
case "1076D":
|
||||||
@@ -392,7 +422,10 @@ export const customTrainDataDetector = (TrainNumber) => {
|
|||||||
case "1080D":
|
case "1080D":
|
||||||
case "1082D":
|
case "1082D":
|
||||||
case "1051D":
|
case "1051D":
|
||||||
|
case "1053D":
|
||||||
|
case "1057D":
|
||||||
case "1059D":
|
case "1059D":
|
||||||
|
case "1063D":
|
||||||
case "1065D":
|
case "1065D":
|
||||||
case "1069D":
|
case "1069D":
|
||||||
case "1071D":
|
case "1071D":
|
||||||
@@ -400,7 +433,6 @@ export const customTrainDataDetector = (TrainNumber) => {
|
|||||||
case "1075D":
|
case "1075D":
|
||||||
case "1077D":
|
case "1077D":
|
||||||
case "1079D":
|
case "1079D":
|
||||||
case "1053D":
|
|
||||||
return {
|
return {
|
||||||
type: "LTDEXP",
|
type: "LTDEXP",
|
||||||
trainName: "宇和海",
|
trainName: "宇和海",
|
||||||
@@ -411,14 +443,10 @@ export const customTrainDataDetector = (TrainNumber) => {
|
|||||||
//2000 アンパン込み
|
//2000 アンパン込み
|
||||||
case "1054D":
|
case "1054D":
|
||||||
case "1060D":
|
case "1060D":
|
||||||
case "1062D":
|
|
||||||
case "1066D":
|
case "1066D":
|
||||||
case "1068D":
|
|
||||||
case "1072D":
|
case "1072D":
|
||||||
case "1055D":
|
case "1055D":
|
||||||
case "1057D":
|
|
||||||
case "1061D":
|
case "1061D":
|
||||||
case "1063D":
|
|
||||||
case "1067D":
|
case "1067D":
|
||||||
case "1081D":
|
case "1081D":
|
||||||
return {
|
return {
|
||||||
@@ -430,13 +458,9 @@ export const customTrainDataDetector = (TrainNumber) => {
|
|||||||
};
|
};
|
||||||
//しまんと
|
//しまんと
|
||||||
case "2002D":
|
case "2002D":
|
||||||
case "2004D":
|
|
||||||
case "2006D":
|
|
||||||
case "2008D":
|
case "2008D":
|
||||||
case "2001D":
|
case "2001D":
|
||||||
case "2003D":
|
|
||||||
case "2005D":
|
case "2005D":
|
||||||
case "2007D":
|
|
||||||
return {
|
return {
|
||||||
type: "LTDEXP",
|
type: "LTDEXP",
|
||||||
trainName: "しまんと",
|
trainName: "しまんと",
|
||||||
@@ -444,6 +468,17 @@ export const customTrainDataDetector = (TrainNumber) => {
|
|||||||
trainNumDistance: 2000,
|
trainNumDistance: 2000,
|
||||||
info: "2700系で運転",
|
info: "2700系で運転",
|
||||||
};
|
};
|
||||||
|
case "2004D":
|
||||||
|
case "2006D":
|
||||||
|
case "2003D":
|
||||||
|
case "2007D":
|
||||||
|
return {
|
||||||
|
type: "LTDEXP",
|
||||||
|
trainName: "しまんと",
|
||||||
|
trainIcon: "http://www.trainfrontview.net/b/s2700_smn.png",
|
||||||
|
trainNumDistance: 2000,
|
||||||
|
info: "南風と併結 / 2700系で運転",
|
||||||
|
};
|
||||||
|
|
||||||
//あしずり 2000
|
//あしずり 2000
|
||||||
case "2074D":
|
case "2074D":
|
||||||
@@ -537,10 +572,10 @@ export const customTrainDataDetector = (TrainNumber) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//伊予灘ものがたり
|
//伊予灘ものがたり
|
||||||
case "8901D":
|
case "8091D":
|
||||||
case "8903D":
|
case "8093D":
|
||||||
case "8902D":
|
case "8092D":
|
||||||
case "8904D":
|
case "8094D":
|
||||||
return {
|
return {
|
||||||
type: "LTDEXP",
|
type: "LTDEXP",
|
||||||
trainName: "伊予灘ものがたり",
|
trainName: "伊予灘ものがたり",
|
||||||
@@ -584,3 +619,37 @@ export const customTrainDataDetector = (TrainNumber) => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
export const getJRF = (num) => {
|
||||||
|
switch (num) {
|
||||||
|
case "71":
|
||||||
|
return "東京(タ)→高松(タ)\\n";
|
||||||
|
case "73":
|
||||||
|
case "75":
|
||||||
|
return "大阪(タ)→高松(タ)\\n";
|
||||||
|
case "3079":
|
||||||
|
return "高松(タ)→伊予三島\\n";
|
||||||
|
case "3071":
|
||||||
|
case "3077":
|
||||||
|
return "高松(タ)→新居浜\\n";
|
||||||
|
case "3073":
|
||||||
|
return "高松(タ)→松山貨物\\n";
|
||||||
|
case "70":
|
||||||
|
return "高松(タ)→東京(タ)\\n";
|
||||||
|
case "74":
|
||||||
|
case "76":
|
||||||
|
return "高松(タ)→大阪(タ)\\n";
|
||||||
|
case "3078":
|
||||||
|
return "伊予三島→高松(タ)\\n";
|
||||||
|
case "3070":
|
||||||
|
return "新居浜→高松(タ)\\n";
|
||||||
|
case "3076":
|
||||||
|
return "新居浜→高松(タ)\\n";
|
||||||
|
case "3072":
|
||||||
|
return "松山貨物→高松(タ)\\n";
|
||||||
|
case "9070":
|
||||||
|
return "臨時貨物\\n";
|
||||||
|
default:
|
||||||
|
JRF = true;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React from "react";
|
|||||||
import { View, Text, TouchableOpacity } from "react-native";
|
import { View, Text, TouchableOpacity } from "react-native";
|
||||||
import { WebView } from "react-native-webview";
|
import { WebView } from "react-native-webview";
|
||||||
import StatusbarDetect from "../StatusbarDetect";
|
import StatusbarDetect from "../StatusbarDetect";
|
||||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
import { AS } from "../storageControl";
|
||||||
import { news } from "../config/newsUpdate";
|
import { news } from "../config/newsUpdate";
|
||||||
var Status = StatusbarDetect();
|
var Status = StatusbarDetect();
|
||||||
export default function News(props) {
|
export default function News(props) {
|
||||||
@@ -30,7 +30,7 @@ export default function News(props) {
|
|||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
}}
|
}}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
AsyncStorage.setItem("status", news);
|
AS.setItem("status", news);
|
||||||
navigate("Apps");
|
navigate("Apps");
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react";
|
|||||||
import { View, Text, TouchableOpacity } from "react-native";
|
import { View, Text, TouchableOpacity } from "react-native";
|
||||||
import * as Updates from "expo-updates";
|
import * as Updates from "expo-updates";
|
||||||
import StatusbarDetect from "../StatusbarDetect";
|
import StatusbarDetect from "../StatusbarDetect";
|
||||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
import { AS } from "../storageControl";
|
||||||
var Status = StatusbarDetect();
|
var Status = StatusbarDetect();
|
||||||
import { Switch } from "react-native-elements";
|
import { Switch } from "react-native-elements";
|
||||||
|
|
||||||
@@ -13,10 +13,14 @@ export default function Setting(props) {
|
|||||||
const [iconSetting, setIconSetting] = useState(undefined);
|
const [iconSetting, setIconSetting] = useState(undefined);
|
||||||
const [mapSwitch, setMapSwitch] = useState(undefined);
|
const [mapSwitch, setMapSwitch] = useState(undefined);
|
||||||
const [stationMenu, setStationMenu] = useState(undefined);
|
const [stationMenu, setStationMenu] = useState(undefined);
|
||||||
|
const [trainMenu, setTrainMenu] = useState(undefined);
|
||||||
|
const [trainPosition, setTrainPosition] = useState(undefined);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
AsyncStorage.getItem("iconSwitch").then(setIconSetting);
|
AS.getItem("iconSwitch").then(setIconSetting);
|
||||||
AsyncStorage.getItem("mapSwitch").then(setMapSwitch);
|
AS.getItem("mapSwitch").then(setMapSwitch);
|
||||||
AsyncStorage.getItem("stationSwitch").then(setStationMenu);
|
AS.getItem("stationSwitch").then(setStationMenu);
|
||||||
|
AS.getItem("trainSwitch").then(setTrainMenu);
|
||||||
|
AS.getItem("trainPositionSwitch").then(setTrainPosition);
|
||||||
}, []);
|
}, []);
|
||||||
return (
|
return (
|
||||||
<View style={{ height: "100%", backgroundColor: "#0099CC" }}>
|
<View style={{ height: "100%", backgroundColor: "#0099CC" }}>
|
||||||
@@ -83,7 +87,7 @@ export default function Setting(props) {
|
|||||||
textAlignVertical: "center",
|
textAlignVertical: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
駅メニューを表示(beta)
|
駅メニューを表示
|
||||||
</Text>
|
</Text>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
<Switch
|
<Switch
|
||||||
@@ -102,7 +106,45 @@ export default function Setting(props) {
|
|||||||
textAlignVertical: "center",
|
textAlignVertical: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
内部バージョン: 4.4.2.3
|
列車メニュー
|
||||||
|
</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Switch
|
||||||
|
value={trainMenu == "true" ? true : false}
|
||||||
|
color={trainMenu == "true" ? "red" : null}
|
||||||
|
onValueChange={(value) => setTrainMenu(value.toString())}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
<View style={{ flexDirection: "row", padding: 10 }}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 25,
|
||||||
|
alignItems: "center",
|
||||||
|
alignContent: "center",
|
||||||
|
textAlign: "center",
|
||||||
|
textAlignVertical: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
→列車現在位置表示(alpha)
|
||||||
|
</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Switch
|
||||||
|
value={trainPosition == "true" ? true : false}
|
||||||
|
color={trainPosition == "true" ? "red" : null}
|
||||||
|
onValueChange={(value) => setTrainPosition(value.toString())}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
<View style={{ flexDirection: "row", padding: 10 }}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 25,
|
||||||
|
alignItems: "center",
|
||||||
|
alignContent: "center",
|
||||||
|
textAlign: "center",
|
||||||
|
textAlignVertical: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
内部バージョン: 4.5 beta-2
|
||||||
</Text>
|
</Text>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
</View>
|
</View>
|
||||||
@@ -134,9 +176,11 @@ export default function Setting(props) {
|
|||||||
}}
|
}}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
Promise.all([
|
Promise.all([
|
||||||
AsyncStorage.setItem("iconSwitch", iconSetting.toString()),
|
AS.setItem("iconSwitch", iconSetting.toString()),
|
||||||
AsyncStorage.setItem("mapSwitch", mapSwitch.toString()),
|
AS.setItem("mapSwitch", mapSwitch.toString()),
|
||||||
AsyncStorage.setItem("stationSwitch", stationMenu.toString()),
|
AS.setItem("stationSwitch", stationMenu.toString()),
|
||||||
|
AS.setItem("trainSwitch", trainMenu.toString()),
|
||||||
|
AS.setItem("trainPositionSwitch", trainPosition.toString()),
|
||||||
]).then(() => {
|
]).then(() => {
|
||||||
Updates.reloadAsync();
|
Updates.reloadAsync();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,22 +1,11 @@
|
|||||||
import React, { useState, useEffect, useRef } from "react";
|
import React, { useRef } from "react";
|
||||||
import { View, Text, TouchableOpacity, Linking } from "react-native";
|
import { View, Text, TouchableOpacity, Linking } from "react-native";
|
||||||
import { WebView } from "react-native-webview";
|
import MapView, { Marker } from "react-native-maps";
|
||||||
import StatusbarDetect from "../StatusbarDetect";
|
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
export default function TrainMenu({
|
||||||
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, stationData },
|
|
||||||
},
|
|
||||||
navigation: { navigate },
|
navigation: { navigate },
|
||||||
|
webview,
|
||||||
|
stationData,
|
||||||
}) {
|
}) {
|
||||||
const mapRef = useRef();
|
const mapRef = useRef();
|
||||||
return (
|
return (
|
||||||
@@ -54,7 +43,6 @@ export default function trainMenu({
|
|||||||
longitude: parseFloat(latlng[1]),
|
longitude: parseFloat(latlng[1]),
|
||||||
}}
|
}}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
console.log(stationData);
|
|
||||||
webview.current?.injectJavaScript(
|
webview.current?.injectJavaScript(
|
||||||
`MoveDisplayStation('${d}_${D.MyStation}_${D.Station_JP}')`
|
`MoveDisplayStation('${d}_${D.MyStation}_${D.Station_JP}')`
|
||||||
);
|
);
|
||||||
@@ -70,7 +58,11 @@ export default function trainMenu({
|
|||||||
backgroundColor={"#F89038"}
|
backgroundColor={"#F89038"}
|
||||||
icon="train-car"
|
icon="train-car"
|
||||||
flex={1}
|
flex={1}
|
||||||
onPressButton={() => navigate("howto")}
|
onPressButton={() =>
|
||||||
|
navigate("howto", {
|
||||||
|
info: "https://train.jr-shikoku.co.jp/usage.htm",
|
||||||
|
})
|
||||||
|
}
|
||||||
>
|
>
|
||||||
使い方
|
使い方
|
||||||
</UsefulBox>
|
</UsefulBox>
|
||||||
@@ -78,12 +70,7 @@ export default function trainMenu({
|
|||||||
backgroundColor={"#EA4752"}
|
backgroundColor={"#EA4752"}
|
||||||
icon="star"
|
icon="star"
|
||||||
flex={1}
|
flex={1}
|
||||||
onPressButton={() =>
|
onPressButton={() => navigate("favoriteList")}
|
||||||
/* Linking.openURL(
|
|
||||||
"https://www.jr-shikoku.co.jp/01_trainbus/jikoku/sp/#mainprice-box"
|
|
||||||
) */
|
|
||||||
alert("お気に入り駅登録機能は現在開発中です!レイアウト募集中!")
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
お気に入り
|
お気に入り
|
||||||
</UsefulBox>
|
</UsefulBox>
|
||||||
@@ -110,10 +97,7 @@ export default function trainMenu({
|
|||||||
borderRadius: 5,
|
borderRadius: 5,
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
}}
|
}}
|
||||||
onPress={() => {
|
onPress={() => navigate("Apps")}
|
||||||
AsyncStorage.setItem("status", "2022/04/14");
|
|
||||||
navigate("Apps");
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
<Text style={{ fontSize: 25, fontWeight: "bold", color: "white" }}>
|
<Text style={{ fontSize: 25, fontWeight: "bold", color: "white" }}>
|
||||||
|
|||||||
@@ -1,20 +1,16 @@
|
|||||||
import React, { Component, useRef, useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import {
|
import { View, Text, TouchableOpacity } from "react-native";
|
||||||
StatusBar,
|
|
||||||
View,
|
|
||||||
LayoutAnimation,
|
|
||||||
ScrollView,
|
|
||||||
Linking,
|
|
||||||
Text,
|
|
||||||
TouchableOpacity,
|
|
||||||
} from "react-native";
|
|
||||||
import { Switch } from "react-native-elements";
|
import { Switch } from "react-native-elements";
|
||||||
import {
|
import { widthPercentageToDP as wp } from "react-native-responsive-screen";
|
||||||
widthPercentageToDP as wp,
|
import LottieView from "lottie-react-native";
|
||||||
heightPercentageToDP as hp,
|
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
} from "react-native-responsive-screen";
|
|
||||||
import { customTrainDataDetector } from "../custom-train-data";
|
import { customTrainDataDetector } from "../custom-train-data";
|
||||||
import { useInterval } from "../../lib/useInterval";
|
import { useInterval } from "../../lib/useInterval";
|
||||||
|
import { objectIsEmpty } from "../../lib/objectIsEmpty";
|
||||||
|
import { getTrainType } from "../../lib/getTrainType";
|
||||||
|
import { HeaderConfig } from "../../lib/HeaderConfig";
|
||||||
|
import { getTrainDelayStatus } from "../../lib/getTrainDelayStatus";
|
||||||
|
import { checkDuplicateTrainData } from "../../lib/checkDuplicateTrainData";
|
||||||
|
|
||||||
let diagramData = undefined;
|
let diagramData = undefined;
|
||||||
|
|
||||||
@@ -48,71 +44,80 @@ let diagramData = undefined;
|
|||||||
* 9062D 四国まんなか千年ものがたり(臨時?)
|
* 9062D 四国まんなか千年ものがたり(臨時?)
|
||||||
*/
|
*/
|
||||||
export default function LED_vision(props) {
|
export default function LED_vision(props) {
|
||||||
const HeaderConfig = {
|
const {
|
||||||
headers: {
|
station,
|
||||||
referer: "https://train.jr-shikoku.co.jp/sp.html",
|
setTrainInfo,
|
||||||
},
|
EachTrainInfoAsSR,
|
||||||
};
|
trainDiagram,
|
||||||
const [trainDiagram, setTrainDiagram] = useState(null);
|
currentTrainState,
|
||||||
const [stationDiagram, setStationDiagram] = useState(null);
|
currentTrainLoadingState,
|
||||||
const [currentTrain, setCurrentTrain] = useState(null);
|
getCurrentTrain,
|
||||||
|
} = props;
|
||||||
|
const { currentTrain, setCurrentTrain } = currentTrainState;
|
||||||
|
const { currentTrainLoading, setCurrentTrainLoading } =
|
||||||
|
currentTrainLoadingState;
|
||||||
|
const [stationDiagram, setStationDiagram] = useState({}); //当該駅の全時刻表
|
||||||
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) => {
|
|
||||||
const val = d.replace("[\r\n", "").split(",\r\n");
|
|
||||||
let trainDiagram = {};
|
|
||||||
val.forEach((element) => {
|
|
||||||
try {
|
|
||||||
let data = JSON.parse(element);
|
|
||||||
Object.keys(data).forEach((key) => (trainDiagram[key] = data[key]));
|
|
||||||
} catch (e) {}
|
|
||||||
});
|
|
||||||
setTrainDiagram(trainDiagram);
|
|
||||||
return trainDiagram;
|
|
||||||
})
|
|
||||||
.then((trainDiagram) => {
|
|
||||||
let returnData = {};
|
|
||||||
if (!trainDiagram) {
|
if (!trainDiagram) {
|
||||||
setStationDiagram(returnData);
|
setStationDiagram({});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let returnData = {};
|
||||||
Object.keys(trainDiagram).forEach((key) => {
|
Object.keys(trainDiagram).forEach((key) => {
|
||||||
if (trainDiagram[key].match(props.station.Station_JP)) {
|
if (trainDiagram[key].match(station.Station_JP + ",")) {
|
||||||
returnData[key] = trainDiagram[key];
|
returnData[key] = trainDiagram[key];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setStationDiagram(returnData);
|
setStationDiagram(returnData);
|
||||||
});
|
}, [trainDiagram, station]);
|
||||||
}, []);
|
|
||||||
|
|
||||||
const getTime = () => {
|
const [trainTimeAndNumber, setTrainTimeAndNumber] = useState(null);
|
||||||
const returnData = [];
|
|
||||||
Object.keys(stationDiagram).forEach((d) => {
|
useEffect(() => {
|
||||||
let a = {};
|
//現在の駅に停車する列車から時刻を切り出してLEDベースにフォーマット
|
||||||
stationDiagram[d].split("#").forEach((data) => {
|
if (objectIsEmpty(stationDiagram)) return () => {};
|
||||||
|
const getTimeData = getTime(stationDiagram, station);
|
||||||
|
setTrainTimeAndNumber(getTimeData);
|
||||||
|
}, [stationDiagram]);
|
||||||
|
|
||||||
|
const [selectedTrain, setSelectedTrain] = useState([]);
|
||||||
|
useEffect(() => {
|
||||||
|
if (!trainTimeAndNumber) return () => {};
|
||||||
|
if (!currentTrain) return () => {};
|
||||||
|
const data = trainTimeAndNumber
|
||||||
|
.filter((d) => currentTrain.map((m) => m.num).includes(d.train))
|
||||||
|
.filter(timeFiltering)
|
||||||
|
.filter((d) => !!finalSwitch || d.lastStation != "当駅止");
|
||||||
|
setSelectedTrain(data);
|
||||||
|
}, [trainTimeAndNumber, currentTrain, finalSwitch]);
|
||||||
|
|
||||||
|
const getTime = (stationDiagram, station) => {
|
||||||
|
const returnData = Object.keys(stationDiagram).map((trainNum) => {
|
||||||
|
let trainData = {};
|
||||||
|
stationDiagram[trainNum].split("#").forEach((data) => {
|
||||||
if (data.match("着")) {
|
if (data.match("着")) {
|
||||||
a.lastStation = data.split(",着,")[0];
|
trainData.lastStation = data.split(",着,")[0];
|
||||||
}
|
}
|
||||||
if (data.match(props.station.Station_JP)) {
|
if (data.split(",")[0] === station.Station_JP) {
|
||||||
if (data.match(",発,")) {
|
if (data.match(",発,")) {
|
||||||
a.time = data.split(",発,")[1];
|
trainData.time = data.split(",発,")[1];
|
||||||
} else {
|
} else {
|
||||||
a.time = data.split(",着,")[1];
|
trainData.time = data.split(",着,")[1];
|
||||||
a.lastStation = "当駅止";
|
trainData.lastStation = "当駅止";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
returnData.push({ train: d, time: a.time, lastStation: a.lastStation });
|
return {
|
||||||
|
train: trainNum,
|
||||||
|
time: trainData.time,
|
||||||
|
lastStation: trainData.lastStation,
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
return returnData.sort((a, b) => {
|
return returnData.sort((a, b) => {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case parseInt(a.time.split(":")[0]) < parseInt(b.time.split(":")[0]):
|
case parseInt(a.time.split(":")[0]) < parseInt(b.time.split(":")[0]):
|
||||||
@@ -126,19 +131,6 @@ export default function LED_vision(props) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const trainTimeAndNumber = stationDiagram != null ? getTime() : null;
|
|
||||||
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(setCurrentTrain);
|
|
||||||
|
|
||||||
useEffect(getCurrentTrain, []);
|
|
||||||
|
|
||||||
useInterval(getCurrentTrain, 15000);
|
|
||||||
|
|
||||||
const timeFiltering = (d) => {
|
const timeFiltering = (d) => {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
@@ -156,6 +148,7 @@ export default function LED_vision(props) {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
@@ -166,6 +159,39 @@ export default function LED_vision(props) {
|
|||||||
marginHorizontal: wp("1%"),
|
marginHorizontal: wp("1%"),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<Header
|
||||||
|
currentTrainLoading={currentTrainLoading}
|
||||||
|
setCurrentTrainLoading={setCurrentTrainLoading}
|
||||||
|
getCurrentTrain={getCurrentTrain}
|
||||||
|
/>
|
||||||
|
{selectedTrain.map((d, index) => (
|
||||||
|
<EachData
|
||||||
|
d={d}
|
||||||
|
trainIDSwitch={trainIDSwitch}
|
||||||
|
trainDescriptionSwitch={trainDescriptionSwitch}
|
||||||
|
station={station}
|
||||||
|
currentTrain={currentTrain}
|
||||||
|
customTrainDataDetector={customTrainDataDetector}
|
||||||
|
setTrainInfo={setTrainInfo}
|
||||||
|
EachTrainInfoAsSR={EachTrainInfoAsSR}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
<Footer
|
||||||
|
trainIDSwitch={trainIDSwitch}
|
||||||
|
setTrainIDSwitch={setTrainIDSwitch}
|
||||||
|
trainDescriptionSwitch={trainDescriptionSwitch}
|
||||||
|
setTrainDescriptionSwitch={setTrainDescriptionSwitch}
|
||||||
|
finalSwitch={finalSwitch}
|
||||||
|
setFinalSwitch={setFinalSwitch}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const Header = ({
|
||||||
|
currentTrainLoading,
|
||||||
|
setCurrentTrainLoading,
|
||||||
|
getCurrentTrain,
|
||||||
|
}) => (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
alignContent: "center",
|
alignContent: "center",
|
||||||
@@ -182,190 +208,234 @@ export default function LED_vision(props) {
|
|||||||
</Text>
|
</Text>
|
||||||
<Text style={{ fontSize: 15, color: "white" }}>Next Train</Text>
|
<Text style={{ fontSize: 15, color: "white" }}>Next Train</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flex: 1 }}></View>
|
<View style={{ flex: 1, flexDirection: "row-reverse" }}>
|
||||||
</View>
|
{currentTrainLoading == "loading" ? (
|
||||||
{trainTimeAndNumber
|
<LottieView
|
||||||
? currentTrain &&
|
autoPlay
|
||||||
trainTimeAndNumber
|
loop
|
||||||
.filter((d) => currentTrain.map((m) => m.num).includes(d.train))
|
style={{ width: 40, height: 40, marginRight: 30 }}
|
||||||
.filter(timeFiltering)
|
source={require("../../assets/51690-loading-diamonds.json")}
|
||||||
.filter((d) => !!finalSwitch || d.lastStation != "当駅止")
|
/>
|
||||||
.map((d, index) => {
|
) : currentTrainLoading == "error" ? (
|
||||||
const train = customTrainDataDetector(d.train);
|
<Ionicons
|
||||||
return [
|
name="reload"
|
||||||
<View
|
color="white"
|
||||||
style={{
|
size={30}
|
||||||
alignContent: "center",
|
style={{ marginRight: 30 }}
|
||||||
alignItems: "center",
|
onPress={() => {
|
||||||
width: "94%",
|
setCurrentTrainLoading("loading");
|
||||||
marginVertical: 5,
|
getCurrentTrain();
|
||||||
marginHorizontal: "3%",
|
|
||||||
backgroundColor: "#000",
|
|
||||||
flexDirection: "row",
|
|
||||||
}}
|
}}
|
||||||
>
|
/>
|
||||||
<View style={{ flex: 9 }}>
|
) : null}
|
||||||
<Text
|
|
||||||
style={{
|
|
||||||
fontSize: train.trainName.length > 6 ? 15 : 20,
|
|
||||||
color: (() => {
|
|
||||||
switch (train.type) {
|
|
||||||
case "Rapid":
|
|
||||||
return "aqua";
|
|
||||||
case "LTDEXP":
|
|
||||||
return "red";
|
|
||||||
case "NightLTDEXP":
|
|
||||||
return "red";
|
|
||||||
case "Normal":
|
|
||||||
return "white";
|
|
||||||
}
|
|
||||||
})(),
|
|
||||||
fontWeight: "bold",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{trainIDSwitch
|
|
||||||
? d.train
|
|
||||||
: (() => {
|
|
||||||
switch (train.type) {
|
|
||||||
case "Rapid":
|
|
||||||
return "快速";
|
|
||||||
case "LTDEXP":
|
|
||||||
return "特急";
|
|
||||||
case "NightLTDEXP":
|
|
||||||
return "寝台特急";
|
|
||||||
case "Normal":
|
|
||||||
return "普通列車";
|
|
||||||
}
|
|
||||||
})() +
|
|
||||||
" " +
|
|
||||||
train.trainName +
|
|
||||||
(train.trainNumDistance == undefined
|
|
||||||
? ""
|
|
||||||
: parseInt(
|
|
||||||
d.train.replace("M", "").replace("D", "")
|
|
||||||
) -
|
|
||||||
train.trainNumDistance +
|
|
||||||
"号")}
|
|
||||||
</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",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{(() => {
|
|
||||||
const delay = currentTrain.filter(
|
|
||||||
(a) => a.num == d.train
|
|
||||||
)[0].delay;
|
|
||||||
switch (true) {
|
|
||||||
case isNaN(delay):
|
|
||||||
return delay;
|
|
||||||
case delay == 0:
|
|
||||||
return "定刻通り";
|
|
||||||
default:
|
|
||||||
return delay + "分遅れ";
|
|
||||||
}
|
|
||||||
})()}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
</View>,
|
|
||||||
trainDescriptionSwitch && !!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",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{" "}
|
|
||||||
> {train.info}
|
|
||||||
</Text>
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
),
|
);
|
||||||
];
|
|
||||||
})
|
const Footer = (props) => {
|
||||||
: null}
|
const {
|
||||||
<View style={{ flexDirection: "row", padding: 10 }}>
|
trainIDSwitch,
|
||||||
<Text
|
setTrainIDSwitch,
|
||||||
style={{
|
trainDescriptionSwitch,
|
||||||
|
setTrainDescriptionSwitch,
|
||||||
|
finalSwitch,
|
||||||
|
setFinalSwitch,
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
const textStyle = {
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
alignContent: "center",
|
alignContent: "center",
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
textAlignVertical: "center",
|
textAlignVertical: "center",
|
||||||
color: "white",
|
color: "white",
|
||||||
}}
|
};
|
||||||
>
|
|
||||||
種別名 / 列番
|
return (
|
||||||
</Text>
|
<View style={{ flexDirection: "row", padding: 10, alignItems: "center" }}>
|
||||||
|
<Text style={textStyle}>種別名 / 列番</Text>
|
||||||
<Switch value={trainIDSwitch} onValueChange={setTrainIDSwitch} />
|
<Switch value={trainIDSwitch} onValueChange={setTrainIDSwitch} />
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
<Text
|
<Text style={textStyle}>列車情報</Text>
|
||||||
style={{
|
|
||||||
alignItems: "center",
|
|
||||||
alignContent: "center",
|
|
||||||
textAlign: "center",
|
|
||||||
textAlignVertical: "center",
|
|
||||||
color: "white",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
列車情報
|
|
||||||
</Text>
|
|
||||||
<Switch
|
<Switch
|
||||||
value={trainDescriptionSwitch}
|
value={trainDescriptionSwitch}
|
||||||
onValueChange={setTrainDescriptionSwitch}
|
onValueChange={setTrainDescriptionSwitch}
|
||||||
/>
|
/>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text style={textStyle}>当駅止表示</Text>
|
||||||
|
<Switch value={finalSwitch} onValueChange={setFinalSwitch} />
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const EachData = ({
|
||||||
|
d,
|
||||||
|
trainIDSwitch,
|
||||||
|
trainDescriptionSwitch,
|
||||||
|
station,
|
||||||
|
currentTrain,
|
||||||
|
customTrainDataDetector,
|
||||||
|
setTrainInfo,
|
||||||
|
EachTrainInfoAsSR,
|
||||||
|
}) => {
|
||||||
|
const openTrainInfo = (d) => {
|
||||||
|
let TrainNumber = "";
|
||||||
|
if (train.trainNumDistance != undefined) {
|
||||||
|
const timeInfo =
|
||||||
|
parseInt(d.train.replace("M", "").replace("D", "")) -
|
||||||
|
train.trainNumDistance;
|
||||||
|
TrainNumber = timeInfo + "号";
|
||||||
|
}
|
||||||
|
setTrainInfo({
|
||||||
|
trainNum: d.train,
|
||||||
|
limited: `${getTrainType(train.type).data}:${
|
||||||
|
train.trainName
|
||||||
|
}${TrainNumber}`,
|
||||||
|
trainData: checkDuplicateTrainData(
|
||||||
|
currentTrain.filter((a) => a.num == d.train)
|
||||||
|
),
|
||||||
|
});
|
||||||
|
EachTrainInfoAsSR.current?.show();
|
||||||
|
};
|
||||||
|
const [train, setTrain] = useState(customTrainDataDetector(d.train));
|
||||||
|
useEffect(() => {
|
||||||
|
setTrain(customTrainDataDetector(d.train));
|
||||||
|
}, [currentTrain, d.train, trainDescriptionSwitch]);
|
||||||
|
// 土讃線複数存在対策
|
||||||
|
const trainDelayStatus = getTrainDelayStatus(
|
||||||
|
checkDuplicateTrainData(currentTrain.filter((a) => a.num == d.train)),
|
||||||
|
station.Station_JP
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<TouchableOpacity
|
||||||
|
style={{
|
||||||
|
alignContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
width: "94%",
|
||||||
|
marginVertical: 5,
|
||||||
|
marginHorizontal: "3%",
|
||||||
|
backgroundColor: "#000",
|
||||||
|
flexDirection: "row",
|
||||||
|
}}
|
||||||
|
onPress={() => openTrainInfo(d)}
|
||||||
|
>
|
||||||
|
<TrainName
|
||||||
|
trainName={train.trainName}
|
||||||
|
trainNumDistance={train.trainNumDistance}
|
||||||
|
trainIDSwitch={trainIDSwitch}
|
||||||
|
trainID={d.train}
|
||||||
|
type={train.type}
|
||||||
|
/>
|
||||||
|
<LastStation lastStation={d.lastStation} />
|
||||||
|
<DependTime time={d.time} />
|
||||||
|
<StatusAndDelay trainDelayStatus={trainDelayStatus} />
|
||||||
|
</TouchableOpacity>
|
||||||
|
{trainDescriptionSwitch && !!train.info && (
|
||||||
|
<Description info={train.info} />
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const TrainName = ({
|
||||||
|
trainName,
|
||||||
|
trainNumDistance,
|
||||||
|
trainIDSwitch,
|
||||||
|
trainID,
|
||||||
|
type,
|
||||||
|
}) => {
|
||||||
|
const { name, color } = getTrainType(type);
|
||||||
|
let TrainNumber =
|
||||||
|
trainNumDistance != undefined
|
||||||
|
? `${
|
||||||
|
parseInt(trainID.replace("M", "").replace("D", "")) - trainNumDistance
|
||||||
|
}号`
|
||||||
|
: "";
|
||||||
|
return (
|
||||||
|
<View style={{ flex: 9 }}>
|
||||||
<Text
|
<Text
|
||||||
style={{
|
style={{
|
||||||
alignItems: "center",
|
fontSize: trainName.length > 6 ? parseInt("13%") : parseInt("18%"),
|
||||||
alignContent: "center",
|
color: color,
|
||||||
textAlign: "center",
|
fontWeight: "bold",
|
||||||
textAlignVertical: "center",
|
|
||||||
color: "white",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
当駅止表示
|
{trainIDSwitch ? trainID : `${name} ${trainName}${TrainNumber}`}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const LastStation = ({ lastStation }) => {
|
||||||
|
return (
|
||||||
|
<View style={{ flex: 4, flexDirection: "row" }}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: lastStation.length > 4 ? parseInt("13%") : parseInt("18%"),
|
||||||
|
color: "white",
|
||||||
|
fontWeight: "bold",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{lastStation}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const DependTime = ({ time }) => (
|
||||||
|
<View style={{ flex: 3 }}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: parseInt("18%"),
|
||||||
|
color: "white",
|
||||||
|
fontWeight: "bold",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{time}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
|
||||||
|
const StatusAndDelay = ({ trainDelayStatus }) => {
|
||||||
|
return (
|
||||||
|
<View style={{ flex: 4 }}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: parseInt("18%"),
|
||||||
|
color: "white",
|
||||||
|
fontWeight: "bold",
|
||||||
|
paddingLeft: 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{trainDelayStatus}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const Description = ({ info }) => (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
alignContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
width: "94%",
|
||||||
|
marginVertical: 5,
|
||||||
|
marginHorizontal: "3%",
|
||||||
|
backgroundColor: "#000",
|
||||||
|
flexDirection: "row",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View style={{ flex: 4 }}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: parseInt("18%"),
|
||||||
|
color: "green",
|
||||||
|
fontWeight: "bold",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
> {info}
|
||||||
</Text>
|
</Text>
|
||||||
<Switch value={finalSwitch} onValueChange={setFinalSwitch} />
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|||||||
@@ -12,21 +12,68 @@ import {
|
|||||||
widthPercentageToDP as wp,
|
widthPercentageToDP as wp,
|
||||||
heightPercentageToDP as hp,
|
heightPercentageToDP as hp,
|
||||||
} from "react-native-responsive-screen";
|
} from "react-native-responsive-screen";
|
||||||
|
import LottieView from "lottie-react-native";
|
||||||
import { useInterval } from "../../lib/useInterval";
|
import { useInterval } from "../../lib/useInterval";
|
||||||
|
import { AS } from "../../storageControl";
|
||||||
|
|
||||||
export default function Sign(props) {
|
export default function Sign(props) {
|
||||||
const { currentStation, originalStationList, oP } = props;
|
const {
|
||||||
|
currentStation,
|
||||||
|
originalStationList,
|
||||||
|
oP,
|
||||||
|
oLP,
|
||||||
|
favoriteStation,
|
||||||
|
setFavoriteStation,
|
||||||
|
} = props;
|
||||||
|
const [nexPrePosition, setNexPrePosition] = useState(0);
|
||||||
|
|
||||||
|
const [preStation, setPreStation] = useState();
|
||||||
|
const [nexStation, setNexStation] = useState();
|
||||||
|
const [testButtonStatus, setTestButtonStatus] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const isFavorite = favoriteStation.filter((d) => {
|
||||||
|
const compare = JSON.stringify(d);
|
||||||
|
const current = JSON.stringify(currentStation);
|
||||||
|
if (compare === current) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setTestButtonStatus(isFavorite.length != 0);
|
||||||
|
}, [favoriteStation, currentStation]);
|
||||||
|
|
||||||
|
useInterval(() => {
|
||||||
|
if (currentStation.length == 1) {
|
||||||
|
setNexPrePosition(0);
|
||||||
|
return () => {};
|
||||||
|
}
|
||||||
|
setNexPrePosition(
|
||||||
|
nexPrePosition + 1 == currentStation.length ? 0 : nexPrePosition + 1
|
||||||
|
);
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setNexPrePosition(0);
|
||||||
|
getPreNextStation(currentStation[0]);
|
||||||
|
}, [currentStation]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!currentStation[nexPrePosition]) return () => {};
|
||||||
|
getPreNextStation(currentStation[nexPrePosition]);
|
||||||
|
}, [nexPrePosition]);
|
||||||
const getPreNextStation = (now) => {
|
const getPreNextStation = (now) => {
|
||||||
const lineList = [
|
const lineList = [
|
||||||
"予讃線",
|
"予讃線(高松-松山間)[Y]",
|
||||||
"松宇線",
|
"予讃線(松山-宇和島間)[U]",
|
||||||
"伊予灘線",
|
"予讃線/愛ある伊予灘線(向井原-伊予大洲間)[S]",
|
||||||
"土讃線",
|
"土讃線(多度津-高知間)[D]",
|
||||||
"窪川線",
|
"土讃線(高知-窪川間)[K]",
|
||||||
"高徳線",
|
"高徳線(高松-徳島間)[T]",
|
||||||
"徳島線",
|
"徳島線(徳島-阿波池田)[B]",
|
||||||
"鳴門線",
|
"鳴門線(池谷-鳴門間)[N]",
|
||||||
"瀬戸大橋線",
|
"瀬戸大橋線(宇多津-児島間)[M]",
|
||||||
];
|
];
|
||||||
let returnData;
|
let returnData;
|
||||||
lineList.forEach((d) => {
|
lineList.forEach((d) => {
|
||||||
@@ -40,34 +87,95 @@ export default function Sign(props) {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return returnData;
|
setPreStation(returnData[0]);
|
||||||
|
setNexStation(returnData[1]);
|
||||||
};
|
};
|
||||||
const [nexPrePosition, setNexPrePosition] = useState(0);
|
const lottieRef = useRef();
|
||||||
useInterval(() => {
|
|
||||||
if (currentStation.length == 1) return;
|
|
||||||
LayoutAnimation.easeInEaseOut();
|
|
||||||
setNexPrePosition(
|
|
||||||
nexPrePosition + 1 == currentStation.length ? 0 : nexPrePosition + 1
|
|
||||||
);
|
|
||||||
}, 2000);
|
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity style={styleSheet.外枠} onPress={oP}>
|
<TouchableOpacity style={styleSheet.外枠} onPress={oP} onLongPress={oLP}>
|
||||||
<StationNumberMaker currentStation={currentStation} />
|
<StationNumberMaker currentStation={currentStation} />
|
||||||
<StationNameArea currentStation={currentStation} />
|
<StationNameArea currentStation={currentStation} />
|
||||||
|
<TouchableOpacity
|
||||||
|
style={{ position: "absolute", right: -15, top: -20 }}
|
||||||
|
onPress={() => {
|
||||||
|
if (testButtonStatus) {
|
||||||
|
const otherData = favoriteStation.filter((d) => {
|
||||||
|
const compare = JSON.stringify(d);
|
||||||
|
const current = JSON.stringify(currentStation);
|
||||||
|
if (compare !== current) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AS.setItem("favoriteStation", JSON.stringify(otherData));
|
||||||
|
setFavoriteStation(otherData);
|
||||||
|
} else {
|
||||||
|
let ret = favoriteStation;
|
||||||
|
ret.push(currentStation);
|
||||||
|
AS.setItem("favoriteStation", JSON.stringify(ret));
|
||||||
|
setFavoriteStation(ret);
|
||||||
|
}
|
||||||
|
setTestButtonStatus(!testButtonStatus);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<LottieDelayView
|
||||||
|
progress={testButtonStatus ? 1 : 0}
|
||||||
|
speed={1.4}
|
||||||
|
style={{ width: 80, height: 80 }}
|
||||||
|
source={require("../../assets/939-star.json")}
|
||||||
|
lottieRef={lottieRef}
|
||||||
|
loop={false}
|
||||||
|
/>
|
||||||
|
</TouchableOpacity>
|
||||||
|
|
||||||
<Text style={styleSheet.JRStyle}>JR</Text>
|
<Text style={styleSheet.JRStyle}>JR</Text>
|
||||||
<View style={styleSheet.下帯} />
|
<View style={styleSheet.下帯} />
|
||||||
<View style={styleSheet.下帯内容}>
|
<View style={styleSheet.下帯内容}>
|
||||||
{(() => {
|
<NexPreStationLine preStation={preStation} nexStation={nexStation} />
|
||||||
let [preStation, nexStation] = getPreNextStation(
|
</View>
|
||||||
currentStation[nexPrePosition]
|
</TouchableOpacity>
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const LottieDelayView = ({
|
||||||
|
progress,
|
||||||
|
speed,
|
||||||
|
style,
|
||||||
|
source,
|
||||||
|
lottieRef,
|
||||||
|
loop,
|
||||||
|
}) => {
|
||||||
|
const [progressState, setProgressState] = useState(undefined);
|
||||||
|
useEffect(() => {
|
||||||
|
if (progress == 0) {
|
||||||
|
lottieRef.current.play(progressState !== undefined ? 35 : 7, 7);
|
||||||
|
} else {
|
||||||
|
lottieRef.current.play(progressState !== undefined ? 7 : 35, 35);
|
||||||
|
}
|
||||||
|
}, [progress]);
|
||||||
|
return (
|
||||||
|
<LottieView
|
||||||
|
progress={progressState}
|
||||||
|
speed={speed}
|
||||||
|
style={style}
|
||||||
|
source={source}
|
||||||
|
ref={lottieRef}
|
||||||
|
loop={loop}
|
||||||
|
onAnimationFinish={(isCanceled) => {
|
||||||
|
setProgressState(progress);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const NexPreStationLine = ({ nexStation, preStation }) => {
|
||||||
return (
|
return (
|
||||||
<View style={styleSheet.下枠フレーム}>
|
<View style={styleSheet.下枠フレーム}>
|
||||||
<View style={styleSheet.下枠フレーム}>
|
<View style={styleSheet.下枠フレーム}>
|
||||||
{preStation && (
|
{preStation ? (
|
||||||
<>
|
<>
|
||||||
<Text style={styleSheet.下枠左右マーク}>◀</Text>
|
<Text style={styleSheet.下枠左右マーク}>◀</Text>
|
||||||
{preStation.StationNumber && (
|
{preStation.StationNumber ? (
|
||||||
<View style={styleSheet.下枠駅ナンバー}>
|
<View style={styleSheet.下枠駅ナンバー}>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
<Text
|
<Text
|
||||||
@@ -80,61 +188,62 @@ export default function Sign(props) {
|
|||||||
</Text>
|
</Text>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
</View>
|
</View>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
)}
|
)}
|
||||||
<StationName
|
<StationName
|
||||||
stringData={preStation}
|
stringData={preStation}
|
||||||
ss={{ flex: 1, alignItems: "flex-start" }}
|
ss={{ flex: 1, alignItems: "flex-start" }}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
<View style={styleSheet.下枠フレーム}>
|
<View style={styleSheet.下枠フレーム}>
|
||||||
{nexStation && (
|
{nexStation ? (
|
||||||
<>
|
<>
|
||||||
<StationName
|
<StationName
|
||||||
stringData={nexStation}
|
stringData={nexStation}
|
||||||
ss={{ flex: 1, alignItems: "flex-end" }}
|
ss={{ flex: 1, alignItems: "flex-end" }}
|
||||||
/>
|
/>
|
||||||
{nexStation.StationNumber && (
|
{nexStation.StationNumber ? (
|
||||||
<View style={styleSheet.下枠駅ナンバー}>
|
<View style={styleSheet.下枠駅ナンバー}>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
<Text
|
<Text style={{ fontSize: parseInt("10%"), color: "white" }}>
|
||||||
style={{ fontSize: parseInt("10%"), color: "white" }}
|
|
||||||
>
|
|
||||||
{nexStation.StationNumber}
|
{nexStation.StationNumber}
|
||||||
</Text>
|
</Text>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
</View>
|
</View>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
)}
|
)}
|
||||||
<Text style={styleSheet.下枠左右マーク}>▶</Text>
|
<Text style={styleSheet.下枠左右マーク}>▶</Text>
|
||||||
</>
|
</>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
})()}
|
};
|
||||||
</View>
|
|
||||||
</TouchableOpacity>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const StationNumberMaker = (props) => {
|
const StationNumberMaker = (props) => {
|
||||||
return props.currentStation
|
const getTop = (array, index) => {
|
||||||
.filter((d) => (d.StationNumber ? true : false))
|
|
||||||
.map((d, index, array) => (
|
|
||||||
<View
|
|
||||||
key={d + index}
|
|
||||||
style={{
|
|
||||||
position: "absolute",
|
|
||||||
alignContent: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
top:
|
|
||||||
(() => {
|
|
||||||
if (array.length == 1) return 20;
|
if (array.length == 1) return 20;
|
||||||
else if (index == 0) return 5;
|
else if (index == 0) return 5;
|
||||||
else if (index == 1) return 35;
|
else if (index == 1) return 35;
|
||||||
else return 20;
|
else return 20;
|
||||||
})() + "%",
|
};
|
||||||
|
return props.currentStation
|
||||||
|
.filter((d) => (d.StationNumber ? true : false))
|
||||||
|
.map((d, index, array) => (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
alignContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
top: getTop(array, index) + "%",
|
||||||
right: "10%",
|
right: "10%",
|
||||||
width: wp("10%"),
|
width: wp("10%"),
|
||||||
height: wp("10%"),
|
height: wp("10%"),
|
||||||
@@ -185,8 +294,7 @@ const styleSheet = {
|
|||||||
height: (wp("80%") / 20) * 9,
|
height: (wp("80%") / 20) * 9,
|
||||||
borderColor: "#2E94BB",
|
borderColor: "#2E94BB",
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
margin: 10,
|
backgroundColor: "white",
|
||||||
marginHorizontal: wp("10%"),
|
|
||||||
},
|
},
|
||||||
下帯: {
|
下帯: {
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
@@ -232,6 +340,7 @@ const styleSheet = {
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
alignContent: "center",
|
alignContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
},
|
},
|
||||||
下枠左右マーク: {
|
下枠左右マーク: {
|
||||||
fontWeight: "bold",
|
fontWeight: "bold",
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
export const news = "2022-9-30";
|
export const news = "2023-7-16";
|
||||||
|
|||||||
6
eas.json
6
eas.json
@@ -15,6 +15,12 @@
|
|||||||
},
|
},
|
||||||
"production": {
|
"production": {
|
||||||
"releaseChannel": "aliexpress"
|
"releaseChannel": "aliexpress"
|
||||||
|
},
|
||||||
|
"beta4.5": {
|
||||||
|
"releaseChannel": "base"
|
||||||
|
},
|
||||||
|
"production4.5": {
|
||||||
|
"releaseChannel": "buyma"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"submit": {
|
"submit": {
|
||||||
|
|||||||
38
howto.js
38
howto.js
@@ -2,24 +2,13 @@ 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 }, route }) => {
|
||||||
<View style={{ height: "100%", backgroundColor: "#0099CC" }}>
|
const { info, onExit = () => navigate("Apps") } = route.params;
|
||||||
<WebView
|
|
||||||
useWebKit={true}
|
return (
|
||||||
source={{ uri: "https://train.jr-shikoku.co.jp/usage.htm" }}
|
<View style={styles.View}>
|
||||||
/>
|
<WebView useWebKit source={{ uri: info }} />
|
||||||
<TouchableOpacity
|
<TouchableOpacity style={styles.touch} onPress={onExit}>
|
||||||
style={{
|
|
||||||
padding: 10,
|
|
||||||
flexDirection: "row",
|
|
||||||
borderColor: "white",
|
|
||||||
borderWidth: 1,
|
|
||||||
margin: 10,
|
|
||||||
borderRadius: 5,
|
|
||||||
alignItems: "center",
|
|
||||||
}}
|
|
||||||
onPress={() => navigate("Apps")}
|
|
||||||
>
|
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
<Text style={{ fontSize: 25, fontWeight: "bold", color: "white" }}>
|
<Text style={{ fontSize: 25, fontWeight: "bold", color: "white" }}>
|
||||||
閉じる
|
閉じる
|
||||||
@@ -28,3 +17,16 @@ export default ({ navigation: { navigate } }) => (
|
|||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
const styles = {
|
||||||
|
View: { height: "100%", backgroundColor: "#0099CC" },
|
||||||
|
touch: {
|
||||||
|
padding: 10,
|
||||||
|
flexDirection: "row",
|
||||||
|
borderColor: "white",
|
||||||
|
borderWidth: 1,
|
||||||
|
margin: 10,
|
||||||
|
borderRadius: 5,
|
||||||
|
alignItems: "center",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|||||||
5
lib/HeaderConfig.js
Normal file
5
lib/HeaderConfig.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export const HeaderConfig = {
|
||||||
|
headers: {
|
||||||
|
referer: "https://train.jr-shikoku.co.jp/sp.html",
|
||||||
|
},
|
||||||
|
};
|
||||||
6
lib/checkDuplicateTrainData.js
Normal file
6
lib/checkDuplicateTrainData.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export const checkDuplicateTrainData = (currentTrainArray) => {
|
||||||
|
const notNyujoData = currentTrainArray.filter((d) => d.delay !== "入線");
|
||||||
|
if (currentTrainArray.length == 1) return currentTrainArray[0];
|
||||||
|
if (notNyujoData.length == 0) return currentTrainArray[0];
|
||||||
|
else return notNyujoData[0];
|
||||||
|
};
|
||||||
7
lib/getPdfViewURL.js
Normal file
7
lib/getPdfViewURL.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { Platform } from "react-native";
|
||||||
|
|
||||||
|
export const getPDFViewURL = (url) => {
|
||||||
|
if (Platform.OS == "ios") return url;
|
||||||
|
else
|
||||||
|
return `https://docs.google.com/viewer?url=${encodeURI(url)}&embedded=true`;
|
||||||
|
};
|
||||||
@@ -18,14 +18,21 @@ import train_lang from "../assets/originData/train_lang";
|
|||||||
|
|
||||||
let status = undefined;
|
let status = undefined;
|
||||||
|
|
||||||
|
export const lineList = [
|
||||||
|
"予讃線(高松-松山間)[Y]",
|
||||||
|
"予讃線(松山-宇和島間)[U]",
|
||||||
|
"予讃線/愛ある伊予灘線(向井原-伊予大洲間)[S]",
|
||||||
|
"土讃線(多度津-高知間)[D]",
|
||||||
|
"土讃線(高知-窪川間)[K]",
|
||||||
|
"高徳線(高松-徳島間)[T]",
|
||||||
|
"徳島線(徳島-阿波池田)[B]",
|
||||||
|
"鳴門線(池谷-鳴門間)[N]",
|
||||||
|
"瀬戸大橋線(宇多津-児島間)[M]",
|
||||||
|
];
|
||||||
|
|
||||||
export const getStationList = async (props) => {
|
export const getStationList = async (props) => {
|
||||||
if (status) return status;
|
if (status) return status;
|
||||||
//駅リストイニシャライズ
|
//駅リストイニシャライズ
|
||||||
const HeaderConfig = {
|
|
||||||
headers: {
|
|
||||||
referer: "https://train.jr-shikoku.co.jp/sp.html",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
return await Promise.all([
|
return await Promise.all([
|
||||||
yosan,
|
yosan,
|
||||||
uwajima,
|
uwajima,
|
||||||
@@ -41,15 +48,15 @@ export const getStationList = async (props) => {
|
|||||||
]).then((values) => {
|
]).then((values) => {
|
||||||
let stationList = {};
|
let stationList = {};
|
||||||
[
|
[
|
||||||
stationList.予讃線,
|
stationList["予讃線(高松-松山間)[Y]"],
|
||||||
stationList.松宇線,
|
stationList["予讃線(松山-宇和島間)[U]"],
|
||||||
stationList.伊予灘線,
|
stationList["予讃線/愛ある伊予灘線(向井原-伊予大洲間)[S]"],
|
||||||
stationList.土讃線,
|
stationList["土讃線(多度津-高知間)[D]"],
|
||||||
stationList.窪川線,
|
stationList["土讃線(高知-窪川間)[K]"],
|
||||||
stationList.高徳線,
|
stationList["高徳線(高松-徳島間)[T]"],
|
||||||
stationList.徳島線,
|
stationList["徳島線(徳島-阿波池田)[B]"],
|
||||||
stationList.鳴門線,
|
stationList["鳴門線(池谷-鳴門間)[N]"],
|
||||||
stationList.瀬戸大橋線,
|
stationList["瀬戸大橋線(宇多津-児島間)[M]"],
|
||||||
stationList.駅間リスト,
|
stationList.駅間リスト,
|
||||||
stationList.日英対応表,
|
stationList.日英対応表,
|
||||||
] = values;
|
] = values;
|
||||||
@@ -103,52 +110,55 @@ export const getStationList = async (props) => {
|
|||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
stationList.予讃線 = addStationPosition(
|
stationList["予讃線(高松-松山間)[Y]"] = addStationPosition(
|
||||||
concatBetweenStations(stationList.予讃線),
|
concatBetweenStations(stationList["予讃線(高松-松山間)[Y]"]),
|
||||||
予讃線,
|
予讃線,
|
||||||
stationList.日英対応表
|
stationList.日英対応表
|
||||||
);
|
);
|
||||||
stationList.松宇線 = addStationPosition(
|
stationList["予讃線(松山-宇和島間)[U]"] = addStationPosition(
|
||||||
concatBetweenStations(stationList.松宇線),
|
concatBetweenStations(stationList["予讃線(松山-宇和島間)[U]"]),
|
||||||
予讃線,
|
予讃線,
|
||||||
stationList.日英対応表
|
stationList.日英対応表
|
||||||
);
|
);
|
||||||
stationList.伊予灘線 = addStationPosition(
|
stationList["予讃線/愛ある伊予灘線(向井原-伊予大洲間)[S]"] =
|
||||||
concatBetweenStations(stationList.伊予灘線),
|
addStationPosition(
|
||||||
|
concatBetweenStations(
|
||||||
|
stationList["予讃線/愛ある伊予灘線(向井原-伊予大洲間)[S]"]
|
||||||
|
),
|
||||||
予讃線,
|
予讃線,
|
||||||
stationList.日英対応表
|
stationList.日英対応表
|
||||||
);
|
);
|
||||||
stationList.土讃線 = addStationPosition(
|
stationList["土讃線(多度津-高知間)[D]"] = addStationPosition(
|
||||||
concatBetweenStations(stationList.土讃線),
|
concatBetweenStations(stationList["土讃線(多度津-高知間)[D]"]),
|
||||||
土讃線,
|
土讃線,
|
||||||
stationList.日英対応表
|
stationList.日英対応表
|
||||||
);
|
);
|
||||||
stationList.窪川線 = addStationPosition(
|
stationList["土讃線(高知-窪川間)[K]"] = addStationPosition(
|
||||||
concatBetweenStations(stationList.窪川線),
|
concatBetweenStations(stationList["土讃線(高知-窪川間)[K]"]),
|
||||||
土讃線,
|
土讃線,
|
||||||
stationList.日英対応表
|
stationList.日英対応表
|
||||||
);
|
);
|
||||||
stationList.高徳線 = addStationPosition(
|
stationList["高徳線(高松-徳島間)[T]"] = addStationPosition(
|
||||||
concatBetweenStations(stationList.高徳線),
|
concatBetweenStations(stationList["高徳線(高松-徳島間)[T]"]),
|
||||||
高徳線,
|
高徳線,
|
||||||
stationList.日英対応表
|
stationList.日英対応表
|
||||||
);
|
);
|
||||||
stationList.鳴門線 = addStationPosition(
|
stationList["鳴門線(池谷-鳴門間)[N]"] = addStationPosition(
|
||||||
concatBetweenStations(stationList.鳴門線),
|
concatBetweenStations(stationList["鳴門線(池谷-鳴門間)[N]"]),
|
||||||
鳴門線,
|
鳴門線,
|
||||||
stationList.日英対応表
|
stationList.日英対応表
|
||||||
);
|
);
|
||||||
const tokushimaCurrent = addStationPosition(
|
const tokushimaCurrent = addStationPosition(
|
||||||
concatBetweenStations(stationList.徳島線),
|
concatBetweenStations(stationList["徳島線(徳島-阿波池田)[B]"]),
|
||||||
徳島線,
|
徳島線,
|
||||||
stationList.日英対応表
|
stationList.日英対応表
|
||||||
);
|
);
|
||||||
stationList.徳島線 = [
|
stationList["徳島線(徳島-阿波池田)[B]"] = [
|
||||||
tokushimaCurrent[tokushimaCurrent.length - 1],
|
tokushimaCurrent[tokushimaCurrent.length - 1],
|
||||||
...tokushimaCurrent,
|
...tokushimaCurrent,
|
||||||
];
|
];
|
||||||
stationList.徳島線.pop();
|
stationList["徳島線(徳島-阿波池田)[B]"].pop();
|
||||||
stationList.瀬戸大橋線 = [
|
stationList["瀬戸大橋線(宇多津-児島間)[M]"] = [
|
||||||
{
|
{
|
||||||
Station_JP: "坂出",
|
Station_JP: "坂出",
|
||||||
Station_EN: "Sakaide",
|
Station_EN: "Sakaide",
|
||||||
|
|||||||
18
lib/getTrainDelayStatus.js
Normal file
18
lib/getTrainDelayStatus.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
export const getTrainDelayStatus = (current, Station_JP) => {
|
||||||
|
if (!current) return () => {};
|
||||||
|
const delay = current.delay;
|
||||||
|
switch (true) {
|
||||||
|
case delay === "入線":
|
||||||
|
if (current.Pos === Station_JP) {
|
||||||
|
return "当駅始発";
|
||||||
|
} else {
|
||||||
|
return "発車前";
|
||||||
|
}
|
||||||
|
case isNaN(delay):
|
||||||
|
return delay;
|
||||||
|
case delay === 0:
|
||||||
|
return "定刻通り";
|
||||||
|
default:
|
||||||
|
return delay + "分遅れ";
|
||||||
|
}
|
||||||
|
};
|
||||||
14
lib/getTrainType.js
Normal file
14
lib/getTrainType.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
export const getTrainType = (nameString) => {
|
||||||
|
switch (nameString) {
|
||||||
|
case "Rapid":
|
||||||
|
return { color: "aqua", name: "快速", data: "rapid" };
|
||||||
|
case "LTDEXP":
|
||||||
|
return { color: "red", name: "特急", data: "express" };
|
||||||
|
case "NightLTDEXP":
|
||||||
|
return { color: "red", name: "寝台特急", data: "express" };
|
||||||
|
case "Normal":
|
||||||
|
return { color: "white", name: "普通列車", data: "normal" };
|
||||||
|
default:
|
||||||
|
return { color: "white", name: "その他", data: "normal" };
|
||||||
|
}
|
||||||
|
};
|
||||||
3
lib/objectIsEmpty.js
Normal file
3
lib/objectIsEmpty.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export const objectIsEmpty = (obj) => {
|
||||||
|
return !Object.keys(obj).length;
|
||||||
|
};
|
||||||
11
lib/parseAllTrainDiagram.js
Normal file
11
lib/parseAllTrainDiagram.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
export const parseAllTrainDiagram = (text) => {
|
||||||
|
const val = text.replace("[\r\n", "").split(",\r\n");
|
||||||
|
let trainDiagram = {};
|
||||||
|
val.forEach((element) => {
|
||||||
|
try {
|
||||||
|
let data = JSON.parse(element);
|
||||||
|
Object.keys(data).forEach((key) => (trainDiagram[key] = data[key]));
|
||||||
|
} catch (e) {}
|
||||||
|
});
|
||||||
|
return trainDiagram;
|
||||||
|
};
|
||||||
@@ -1,22 +1,29 @@
|
|||||||
export const injectJavascriptData = (mapSwitch, iconSetting, stationMenu) => {
|
import { getJRF } from "../components/custom-train-data";
|
||||||
|
|
||||||
|
export const injectJavascriptData = (
|
||||||
|
mapSwitch,
|
||||||
|
iconSetting,
|
||||||
|
stationMenu,
|
||||||
|
trainMenu
|
||||||
|
) => {
|
||||||
|
// 一番上のメニュー非表示 地図スイッチによって切り替え
|
||||||
const topMenu =
|
const topMenu =
|
||||||
mapSwitch != "true"
|
mapSwitch != "true"
|
||||||
? `
|
? `
|
||||||
document.getElementById('header').querySelector('a').style.display = 'none';
|
document.querySelector('#header a').style.display = 'none';
|
||||||
document.getElementById('header').style.height = '50px';
|
document.querySelector('#header').style.height = '50px';
|
||||||
document.getElementById('main').style.paddingTop = '54px';
|
document.querySelector('#main').style.paddingTop = '54px';
|
||||||
|
document.querySelector('#headerStr').style.display = 'none';
|
||||||
document.getElementById('headerStr').style.display = 'none';
|
|
||||||
`
|
`
|
||||||
: `
|
: `
|
||||||
document.getElementsByClassName('accordionClass')[0].style.display = 'none';
|
document.querySelector('.accordionClass').style.display = 'none';
|
||||||
document.getElementById('header').style.display = 'none';
|
document.querySelector('#header').style.display = 'none';
|
||||||
document.getElementById('main').style.paddingTop = '0px';
|
document.querySelector('#main').style.paddingTop = '0px';
|
||||||
document.getElementById('headerStr').style.display = 'none';
|
document.querySelector('#headerStr').style.display = 'none';
|
||||||
`;
|
`;
|
||||||
const bootData =
|
|
||||||
topMenu +
|
// 何これ
|
||||||
`
|
const bootData = `
|
||||||
const setReload = () =>{
|
const setReload = () =>{
|
||||||
try{
|
try{
|
||||||
document.getElementById('refreshIcon').click();
|
document.getElementById('refreshIcon').click();
|
||||||
@@ -28,17 +35,16 @@ const setReload = () =>{
|
|||||||
}
|
}
|
||||||
setReload();
|
setReload();
|
||||||
`;
|
`;
|
||||||
|
// 左か右かを判定してアイコンを設置する
|
||||||
const trainIconMaker = `
|
const trainIconMaker = `
|
||||||
const setStationIcon = (行き先アイコン,img) =>{
|
const setStationIcon = (setIconElem,img) =>{
|
||||||
let newItem = document.createElement("div");
|
if(setIconElem.getAttribute("style").includes("left")){
|
||||||
if(行き先アイコン.getAttribute("style").includes("left")){
|
setIconElem.insertAdjacentHTML('beforebegin', "<img src="+img+" style='float:left;height:20px;'>");
|
||||||
行き先アイコン.insertAdjacentHTML('beforebegin', "<img src="+img+" style='float:left;height:20px;'>");
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
行き先アイコン.insertAdjacentHTML('beforebegin', "<img src="+img+" style='float:right;height:20px;'>");
|
setIconElem.insertAdjacentHTML('beforebegin', "<img src="+img+" style='float:right;height:20px;'>");
|
||||||
}
|
}
|
||||||
行き先アイコン.remove();
|
setIconElem.remove();
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -66,14 +72,14 @@ case "17M":
|
|||||||
case "25M":
|
case "25M":
|
||||||
case "27M":
|
case "27M":
|
||||||
case "29M":
|
case "29M":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s8000nr.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/f/s8000nr.png');
|
||||||
break;
|
break;
|
||||||
//8000 アンパン
|
//8000 アンパン
|
||||||
case "10M":
|
case "10M":
|
||||||
case "22M":
|
case "22M":
|
||||||
case "9M":
|
case "9M":
|
||||||
case "21M":
|
case "21M":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/f/s8000ap.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/f/s8000ap.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
@@ -86,7 +92,7 @@ case "7M":
|
|||||||
case "11M":
|
case "11M":
|
||||||
case "19M":
|
case "19M":
|
||||||
case "23M":
|
case "23M":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s8600.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s8600.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//いしづちメイン
|
//いしづちメイン
|
||||||
@@ -109,7 +115,7 @@ case "1017M":
|
|||||||
case "1025M":
|
case "1025M":
|
||||||
case "1027M":
|
case "1027M":
|
||||||
case "1029M":
|
case "1029M":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s8000no.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/f/s8000nr.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//8000 アンパン
|
//8000 アンパン
|
||||||
@@ -117,7 +123,7 @@ case "1010M":
|
|||||||
case "1022M":
|
case "1022M":
|
||||||
case "1009M":
|
case "1009M":
|
||||||
case "1021M":
|
case "1021M":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/f/s8000ap.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/f/s8000ap.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//8600
|
//8600
|
||||||
@@ -129,29 +135,29 @@ case "1007M":
|
|||||||
case "1011M":
|
case "1011M":
|
||||||
case "1019M":
|
case "1019M":
|
||||||
case "1023M":
|
case "1023M":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s8600_isz.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s8600_isz.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//MEXP
|
//MEXP
|
||||||
//8000
|
//8000
|
||||||
case "1092M":
|
case "1092M":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s8000no.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s8000nr.png');
|
||||||
break;
|
break;
|
||||||
//8600
|
//8600
|
||||||
case "1091M":
|
case "1091M":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s8600_isz.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s8600_isz.png');
|
||||||
break;
|
break;
|
||||||
//三桁いしづち
|
//三桁いしづち
|
||||||
//8000 アンパン
|
//8000 アンパン
|
||||||
case "1041M":
|
case "1041M":
|
||||||
case "1044M":
|
case "1044M":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/f/s8000ap.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/f/s8000ap.png');
|
||||||
break;
|
break;
|
||||||
//8600
|
//8600
|
||||||
case "1043M":
|
case "1043M":
|
||||||
case "1042M":
|
case "1042M":
|
||||||
case "1046M":
|
case "1046M":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s8600_isz.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s8600_isz.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
@@ -174,7 +180,7 @@ case "47D":
|
|||||||
case "51D":
|
case "51D":
|
||||||
case "53D":
|
case "53D":
|
||||||
case "55D":
|
case "55D":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s2700.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s2700.png');
|
||||||
break;
|
break;
|
||||||
//2700アンパン
|
//2700アンパン
|
||||||
case "32D":
|
case "32D":
|
||||||
@@ -187,7 +193,7 @@ case "37D":
|
|||||||
case "45D":
|
case "45D":
|
||||||
case "49D":
|
case "49D":
|
||||||
case "57D":
|
case "57D":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/f/s2700apr.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/f/s2700apr.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
@@ -217,7 +223,7 @@ case "3025D":
|
|||||||
case "3027D":
|
case "3027D":
|
||||||
case "3031D":
|
case "3031D":
|
||||||
case "3033D":
|
case "3033D":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s2700_uzu.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s2700_uzu.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//2600
|
//2600
|
||||||
@@ -229,13 +235,13 @@ case "3001D":
|
|||||||
case "3011D":
|
case "3011D":
|
||||||
case "3017D":
|
case "3017D":
|
||||||
case "3023D":
|
case "3023D":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s2600.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s2600.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//キハ185
|
//キハ185
|
||||||
case "3009D":
|
case "3009D":
|
||||||
case "3032D":
|
case "3032D":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s185tu_uzu.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s185tu_uzu.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//マリンライナー
|
//マリンライナー
|
||||||
@@ -307,14 +313,14 @@ case "3165M":
|
|||||||
case "3167M":
|
case "3167M":
|
||||||
case "3169M":
|
case "3169M":
|
||||||
case "3175M":
|
case "3175M":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s5001.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s5001.png');
|
||||||
break;
|
break;
|
||||||
case "3102M":
|
case "3102M":
|
||||||
case "3101M":
|
case "3101M":
|
||||||
case "3103M":
|
case "3103M":
|
||||||
case "3171M":
|
case "3171M":
|
||||||
case "3173M":
|
case "3173M":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s5001k.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s5001k.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//サンライズ瀬戸
|
//サンライズ瀬戸
|
||||||
@@ -322,7 +328,7 @@ case "5032M":
|
|||||||
case "5031M":
|
case "5031M":
|
||||||
case "8041M": //琴平延長高松迄
|
case "8041M": //琴平延長高松迄
|
||||||
case "8031M": //琴平延長高松以降
|
case "8031M": //琴平延長高松以降
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/w285.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/w285.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//宇和海
|
//宇和海
|
||||||
@@ -330,7 +336,9 @@ case "8031M": //琴平延長高松以降
|
|||||||
case "1052D":
|
case "1052D":
|
||||||
case "1056D":
|
case "1056D":
|
||||||
case "1058D":
|
case "1058D":
|
||||||
|
case "1062D":
|
||||||
case "1064D":
|
case "1064D":
|
||||||
|
case "1068D":
|
||||||
case "1070D":
|
case "1070D":
|
||||||
case "1074D":
|
case "1074D":
|
||||||
case "1076D":
|
case "1076D":
|
||||||
@@ -338,7 +346,10 @@ case "1078D":
|
|||||||
case "1080D":
|
case "1080D":
|
||||||
case "1082D":
|
case "1082D":
|
||||||
case "1051D":
|
case "1051D":
|
||||||
|
case "1053D":
|
||||||
|
case "1057D":
|
||||||
case "1059D":
|
case "1059D":
|
||||||
|
case "1063D":
|
||||||
case "1065D":
|
case "1065D":
|
||||||
case "1069D":
|
case "1069D":
|
||||||
case "1071D":
|
case "1071D":
|
||||||
@@ -346,23 +357,18 @@ case "1073D":
|
|||||||
case "1075D":
|
case "1075D":
|
||||||
case "1077D":
|
case "1077D":
|
||||||
case "1079D":
|
case "1079D":
|
||||||
case "1053D":
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s2000_uwa.png');
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s2000_uwa.png');
|
|
||||||
break;
|
break;
|
||||||
//2000 アンパン込み
|
//2000 アンパン込み
|
||||||
case "1054D":
|
case "1054D":
|
||||||
case "1060D":
|
case "1060D":
|
||||||
case "1062D":
|
|
||||||
case "1066D":
|
case "1066D":
|
||||||
case "1068D":
|
|
||||||
case "1072D":
|
case "1072D":
|
||||||
case "1055D":
|
case "1055D":
|
||||||
case "1057D":
|
|
||||||
case "1061D":
|
case "1061D":
|
||||||
case "1063D":
|
|
||||||
case "1067D":
|
case "1067D":
|
||||||
case "1081D":
|
case "1081D":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/f/s2002a.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/f/s2002a.png');
|
||||||
break;
|
break;
|
||||||
//しまんと
|
//しまんと
|
||||||
case "2002D":
|
case "2002D":
|
||||||
@@ -373,7 +379,7 @@ case "2001D":
|
|||||||
case "2003D":
|
case "2003D":
|
||||||
case "2005D":
|
case "2005D":
|
||||||
case "2007D":
|
case "2007D":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s2700_smn.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s2700_smn.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//あしずり 2000
|
//あしずり 2000
|
||||||
@@ -387,7 +393,7 @@ case "2075D":
|
|||||||
case "2077D":
|
case "2077D":
|
||||||
case "2081D":
|
case "2081D":
|
||||||
case "2083D":
|
case "2083D":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s2000_asi.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s2000_asi.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//あしずり 2700
|
//あしずり 2700
|
||||||
@@ -398,7 +404,7 @@ case "2073D":
|
|||||||
case "2079D":
|
case "2079D":
|
||||||
case "2085D":
|
case "2085D":
|
||||||
case "2072D":
|
case "2072D":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s2700_asi.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s2700_asi.png');
|
||||||
break;
|
break;
|
||||||
//剣山
|
//剣山
|
||||||
case "4002D":
|
case "4002D":
|
||||||
@@ -412,19 +418,19 @@ case "4005D":
|
|||||||
case "4007D":
|
case "4007D":
|
||||||
case "4009D":
|
case "4009D":
|
||||||
case "4011D":
|
case "4011D":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s185tu.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s185tu.png');
|
||||||
break;
|
break;
|
||||||
//むろと
|
//むろと
|
||||||
case "5051D":
|
case "5051D":
|
||||||
case "5052D":
|
case "5052D":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s185_mrt.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s185_mrt.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
//よしのがわトロッコ
|
//よしのがわトロッコ
|
||||||
case "8452D":
|
case "8452D":
|
||||||
case "8451D":
|
case "8451D":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/f/s185to_ai.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/f/s185to_ai.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//岡山高松アントロ
|
//岡山高松アントロ
|
||||||
@@ -433,22 +439,22 @@ case "8179D":
|
|||||||
//岡山琴平アントロ
|
//岡山琴平アントロ
|
||||||
case "8277D":
|
case "8277D":
|
||||||
case "8278D":
|
case "8278D":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/f/s32to4.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/f/s32to4.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//伊予灘ものがたり
|
//伊予灘ものがたり
|
||||||
case "8901D":
|
case "8091D":
|
||||||
case "8903D":
|
case "8093D":
|
||||||
case "8902D":
|
case "8092D":
|
||||||
case "8904D":
|
case "8094D":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s185iyoy.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s185iyoy.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
//千年ものがたり
|
//千年ものがたり
|
||||||
case "8011D":
|
case "8011D":
|
||||||
case "8012D":
|
case "8012D":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s185mm1.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s185mm1.png');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//夜明けものがたり
|
//夜明けものがたり
|
||||||
@@ -456,7 +462,7 @@ case "8053D":
|
|||||||
case "8054D":
|
case "8054D":
|
||||||
case "8062D":
|
case "8062D":
|
||||||
case "8063D":
|
case "8063D":
|
||||||
setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/b/s185ym1.png');
|
setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/b/s185ym1.png');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -466,9 +472,7 @@ default:
|
|||||||
|
|
||||||
const JRF_icon =
|
const JRF_icon =
|
||||||
iconSetting == "true"
|
iconSetting == "true"
|
||||||
? `
|
? `JRF || setStationIcon(element.querySelector("img"),'http://www.trainfrontview.net/f/ef210a.png');`
|
||||||
JRF || setStationIcon(element.getElementsByTagName("img")[0],'http://www.trainfrontview.net/f/ef210a.png');
|
|
||||||
`
|
|
||||||
: ``;
|
: ``;
|
||||||
const normal_train_name = `
|
const normal_train_name = `
|
||||||
if(new RegExp(/^4[1-9]\\d\\d[DM]$/).test(列番データ) || new RegExp(/^5[1-7]\\d\\d[DM]$/).test(列番データ)){
|
if(new RegExp(/^4[1-9]\\d\\d[DM]$/).test(列番データ) || new RegExp(/^5[1-7]\\d\\d[DM]$/).test(列番データ)){
|
||||||
@@ -494,99 +498,93 @@ else if(列番データ.indexOf("S") != -1){
|
|||||||
const JRF_name =
|
const JRF_name =
|
||||||
`
|
`
|
||||||
let JRF = false;
|
let JRF = false;
|
||||||
switch(列番データ){
|
const getJRF = num =>{
|
||||||
|
switch(num){
|
||||||
case "71":
|
case "71":
|
||||||
行き先情報.innerText = "東京(タ)→高松(タ)"+"\\n"+行き先情報.innerText;
|
return "東京(タ)→高松(タ)"+"\\n";
|
||||||
break;
|
|
||||||
case "73":
|
case "73":
|
||||||
case "75":
|
case "75":
|
||||||
行き先情報.innerText = "大阪(タ)→高松(タ)"+"\\n"+行き先情報.innerText;
|
return "大阪(タ)→高松(タ)"+"\\n";
|
||||||
break;
|
|
||||||
case "3079":
|
case "3079":
|
||||||
行き先情報.innerText = "高松(タ)→伊予三島"+"\\n"+行き先情報.innerText;
|
return "高松(タ)→伊予三島"+"\\n";
|
||||||
break;
|
|
||||||
case "3071":
|
case "3071":
|
||||||
case "3077":
|
case "3077":
|
||||||
行き先情報.innerText = "高松(タ)→新居浜"+"\\n"+行き先情報.innerText;
|
return "高松(タ)→新居浜"+"\\n";
|
||||||
break;
|
|
||||||
case "3073":
|
case "3073":
|
||||||
行き先情報.innerText = "高松(タ)→松山貨物"+"\\n"+行き先情報.innerText;
|
return "高松(タ)→松山貨物"+"\\n";
|
||||||
break;
|
|
||||||
case "70":
|
case "70":
|
||||||
行き先情報.innerText = "高松(タ)→東京(タ)"+"\\n"+行き先情報.innerText;
|
return "高松(タ)→東京(タ)"+"\\n";
|
||||||
break;
|
|
||||||
case "74":
|
case "74":
|
||||||
case "76":
|
case "76":
|
||||||
行き先情報.innerText = "高松(タ)→大阪(タ)"+"\\n"+行き先情報.innerText;
|
return "高松(タ)→大阪(タ)"+"\\n";
|
||||||
break;
|
|
||||||
case "3078":
|
case "3078":
|
||||||
行き先情報.innerText = "伊予三島→高松(タ)"+"\\n"+行き先情報.innerText;
|
return "伊予三島→高松(タ)"+"\\n";
|
||||||
break;
|
|
||||||
case "3070":
|
case "3070":
|
||||||
行き先情報.innerText = "新居浜→高松(タ)"+"\\n"+行き先情報.innerText;
|
return "新居浜→高松(タ)"+"\\n";
|
||||||
break;
|
|
||||||
case "3076":
|
case "3076":
|
||||||
行き先情報.innerText = "新居浜→高松(タ)"+"\\n"+行き先情報.innerText;
|
return "新居浜→高松(タ)"+"\\n";
|
||||||
break;
|
|
||||||
case "3072":
|
case "3072":
|
||||||
行き先情報.innerText = "松山貨物→高松(タ)"+"\\n"+行き先情報.innerText;
|
return "松山貨物→高松(タ)"+"\\n";
|
||||||
break;
|
|
||||||
case "9070":
|
case "9070":
|
||||||
行き先情報.innerText = "臨時貨物"+"\\n"+行き先情報.innerText;
|
return "臨時貨物"+"\\n";
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
JRF = true;
|
JRF = true;
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
const data = getJRF(列番データ);
|
||||||
|
行き先情報.innerText = data != null ? data+行き先情報.innerText : 行き先情報.innerText;
|
||||||
|
|
||||||
` + JRF_icon;
|
` + JRF_icon;
|
||||||
|
|
||||||
const TKT_name = `
|
const TKT_name = `
|
||||||
//安芸行と併結列車を個別に表示、それ以外をdefaultで下りなら既定の行き先を、上りなら奈半利行を設定
|
//安芸行と併結列車を個別に表示、それ以外をdefaultで下りなら既定の行き先を、上りなら奈半利行を設定
|
||||||
switch(列番データ){
|
const getTKT = num =>{
|
||||||
|
switch(num){
|
||||||
case "5814D":
|
case "5814D":
|
||||||
case "5816D":
|
case "5816D":
|
||||||
行き先情報.innerText = "ごめん・なはり線直通\\n快速 奈半利行";
|
return "ごめん・なはり線直通\\n快速 奈半利行";
|
||||||
break;
|
|
||||||
case "5812D":
|
case "5812D":
|
||||||
行き先情報.innerText = "ごめん・なはり線直通\\n快速 安芸行";
|
return "ごめん・なはり線直通\\n快速 安芸行";
|
||||||
break;
|
|
||||||
case "5874D":
|
case "5874D":
|
||||||
case "5882D":
|
case "5882D":
|
||||||
行き先情報.innerText = "ごめん・なはり線直通\\n各停 安芸行";
|
return "ごめん・なはり線直通\\n各停 安芸行";
|
||||||
break;
|
|
||||||
case "742D":
|
case "742D":
|
||||||
case "746D":
|
case "746D":
|
||||||
行き先情報.innerText = "土佐山田/奈半利行\\n(後免にて解結)\\nごめん・なはり線快速";
|
return "土佐山田/奈半利行\\n(後免にて解結)\\nごめん・なはり線快速";
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
if(new RegExp(/^58[1-3][1,3,5,7,9][DM]$/).test(列番データ)){
|
if(new RegExp(/^58[1-3][1,3,5,7,9][DM]$/).test(列番データ)){
|
||||||
行き先情報.innerText = "ごめん・なはり線直通\\n快速 "+行き先情報.innerText;
|
return "ごめん・なはり線直通\\n快速 "+行き先情報.innerText;
|
||||||
}
|
}
|
||||||
else if(new RegExp(/^58[4-9][1,3,5,7,9][DM]$/).test(列番データ)){
|
else if(new RegExp(/^58[4-9][1,3,5,7,9][DM]$/).test(列番データ)){
|
||||||
行き先情報.innerText = "ごめん・なはり線直通\\n各停 "+行き先情報.innerText;
|
return "ごめん・なはり線直通\\n各停 "+行き先情報.innerText;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(new RegExp(/^58[3-4][0,2,4,6,8][DM]$/).test(列番データ)){
|
else if(new RegExp(/^58[3-4][0,2,4,6,8][DM]$/).test(列番データ)){
|
||||||
行き先情報.innerText = "ごめん・なはり線直通\\n快速 奈半利行";
|
return "ごめん・なはり線直通\\n快速 奈半利行";
|
||||||
}
|
}
|
||||||
else if(new RegExp(/^58[5-9][0,2,4,6,8][DM]$/).test(列番データ)){
|
else if(new RegExp(/^58[5-9][0,2,4,6,8][DM]$/).test(列番データ)){
|
||||||
行き先情報.innerText = "ごめん・なはり線直通\\n各停 奈半利行";
|
return "ごめん・なはり線直通\\n各停 奈半利行";
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
}}
|
||||||
|
行き先情報.innerText = getTKT(列番データ) || 行き先情報.innerText;
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const textInsert =
|
const textInsert =
|
||||||
`
|
`
|
||||||
|
//列番付与
|
||||||
const setStrings = () =>{
|
const setStrings = () =>{
|
||||||
try {
|
try {
|
||||||
var elements = document.querySelectorAll('[onclick]');
|
const elements = document.querySelectorAll('#disp > div > div > div[onclick]');
|
||||||
for (let element of elements) {
|
for (let element of elements) {
|
||||||
if(element.getAttribute('onclick').indexOf('ShowTrainTimeInfo') == -1) continue;
|
if(!element.getAttribute('offclick')){
|
||||||
|
element.setAttribute('offclick',element.getAttribute('onclick'))
|
||||||
|
}
|
||||||
var 行き先情報 = element.getElementsByTagName("p")[0];
|
var 行き先情報 = element.getElementsByTagName("p")[0];
|
||||||
var 列番データ = element.getAttribute('onclick').split('"')[1];
|
var 列番データ = element.getAttribute('offclick').split('"')[1];
|
||||||
var flag=false;
|
var flag=false;
|
||||||
var TrainType = undefined;
|
var TrainType = undefined;
|
||||||
|
setTrainMenuDialog(element)
|
||||||
if(行き先情報.innerText.includes(列番データ))continue; //回避
|
if(行き先情報.innerText.includes(列番データ))continue; //回避
|
||||||
` +
|
` +
|
||||||
trainIcon +
|
trainIcon +
|
||||||
@@ -668,22 +666,16 @@ document.querySelectorAll('#disp div')[0].style.width = '100vw';
|
|||||||
document.getElementById('disp').style.width = '100vw';
|
document.getElementById('disp').style.width = '100vw';
|
||||||
document.getElementById('disp').style.overflowX = 'hidden';
|
document.getElementById('disp').style.overflowX = 'hidden';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}catch(e){
|
}catch(e){
|
||||||
alert("にゃーん");
|
alert("にゃーん");
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
//setTimeout(setStrings,500);
|
|
||||||
}
|
}
|
||||||
const target = document.getElementById('disp'); // body要素を監視
|
|
||||||
const observer = new MutationObserver( (mutations) => {
|
const textInsert = new MutationObserver( (mutations) => setStrings());
|
||||||
// observer.disconnect(); // 監視を終了
|
|
||||||
setStrings();
|
|
||||||
});
|
|
||||||
|
|
||||||
// 監視を開始
|
// 監視を開始
|
||||||
observer.observe(target, {
|
textInsert.observe(document.getElementById('disp'), {
|
||||||
attributes: true, // 属性変化の監視
|
attributes: true, // 属性変化の監視
|
||||||
//attributeOldValue: true, // 変化前の属性値を matation.oldValue に格納する
|
//attributeOldValue: true, // 変化前の属性値を matation.oldValue に格納する
|
||||||
//characterData: true, // テキストノードの変化を監視
|
//characterData: true, // テキストノードの変化を監視
|
||||||
@@ -695,9 +687,8 @@ observer.observe(target, {
|
|||||||
|
|
||||||
const makeTrainView = `
|
const makeTrainView = `
|
||||||
|
|
||||||
const modal_content = document.getElementById('modal_content'); // body要素を監視
|
const makeTrainView = new MutationObserver( (mutations) => {
|
||||||
const modal_observer = new MutationObserver( (mutations) => {
|
|
||||||
// observer.disconnect(); // 監視を終了
|
|
||||||
for(let d of modal_content.getElementsByTagName("button") ){
|
for(let d of modal_content.getElementsByTagName("button") ){
|
||||||
const data = d.onclick.toString().split("\\"")[1];
|
const data = d.onclick.toString().split("\\"")[1];
|
||||||
d.onclick = () => window.ReactNativeWebView.postMessage(data)
|
d.onclick = () => window.ReactNativeWebView.postMessage(data)
|
||||||
@@ -705,7 +696,7 @@ for(let d of modal_content.getElementsByTagName("button") ){
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 監視を開始
|
// 監視を開始
|
||||||
modal_observer.observe(modal_content, {
|
makeTrainView.observe(document.getElementById('modal_content'), {
|
||||||
//attributes: true, // 属性変化の監視
|
//attributes: true, // 属性変化の監視
|
||||||
//attributeOldValue: true, // 変化前の属性値を matation.oldValue に格納する
|
//attributeOldValue: true, // 変化前の属性値を matation.oldValue に格納する
|
||||||
//characterData: true, // テキストノードの変化を監視
|
//characterData: true, // テキストノードの変化を監視
|
||||||
@@ -714,13 +705,33 @@ modal_observer.observe(modal_content, {
|
|||||||
//subtree: true // 子孫ノードも監視対象に含める
|
//subtree: true // 子孫ノードも監視対象に含める
|
||||||
});
|
});
|
||||||
`;
|
`;
|
||||||
|
const makeTrainMenu =
|
||||||
|
trainMenu == "true"
|
||||||
|
? `
|
||||||
|
// これの中身抽出ShowTrainTimeInfo("1228M","normal")
|
||||||
|
function setTrainMenuDialog(d){
|
||||||
|
try{
|
||||||
|
const offclick = d.getAttribute('offclick');
|
||||||
|
if(!offclick) return;
|
||||||
|
const s = offclick.replace('ShowTrainTimeInfo(','').replaceAll('"','').replace(')','').split(',') ;
|
||||||
|
const returnData = {type:"ShowTrainTimeInfo",trainNum:s[0],limited:s[1]};
|
||||||
|
d.onclick = ()=>window.ReactNativeWebView.postMessage(JSON.stringify(returnData));
|
||||||
|
}catch(e){
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
function ShowTrainTimeInfo(trainNum,limited){
|
||||||
|
window.ReactNativeWebView.postMessage(JSON.stringify({type:"ShowTrainTimeInfo",trainNum,limited}));
|
||||||
|
};
|
||||||
|
`
|
||||||
|
: `function setTrainMenuDialog(d){}`;
|
||||||
|
|
||||||
const makeStationMenu =
|
const makeStationMenu =
|
||||||
stationMenu == "true"
|
stationMenu == "true"
|
||||||
? `
|
? `
|
||||||
const setStationMenuDialog = () =>{
|
//駅メニューダイアログの配置
|
||||||
document.querySelector('#pMENU_2').style.display='none';
|
|
||||||
document.querySelector('#pMENU_3').style.display='none';
|
const setStationMenuDialog = new MutationObserver( (mutations) => {
|
||||||
document.querySelector('#pMENU_2').style.display='none';
|
|
||||||
const data =[];
|
const data =[];
|
||||||
document.querySelectorAll('#disp div div').forEach(d=>d.id.indexOf("st")!= -1 && data.push(d));
|
document.querySelectorAll('#disp div div').forEach(d=>d.id.indexOf("st")!= -1 && data.push(d));
|
||||||
|
|
||||||
@@ -729,19 +740,15 @@ for(let d of data ){
|
|||||||
d.offclick = d.onclick.toString();
|
d.offclick = d.onclick.toString();
|
||||||
}
|
}
|
||||||
d.onclick = () =>{
|
d.onclick = () =>{
|
||||||
window.ReactNativeWebView.postMessage(d.offclick);
|
const s = d.offclick.replace('(event)','').replaceAll("'", "").split('(')[1].split(')')[0].split(',');
|
||||||
|
// これの中身抽出 PopUpMenu(event,'2','端岡','http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/hashioka.pdf','https://www.google.co.jp/maps/place/34.305027,133.967643','','1')
|
||||||
|
window.ReactNativeWebView.postMessage(JSON.stringify({type:"PopUpMenu",event:s[0],id:s[1],name:s[2],pdf:s[3],map:s[4],url:s[5],chk:s[6]}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const observer3 = new MutationObserver( (mutations) => {
|
|
||||||
// observer3.disconnect(); // 監視を終了
|
|
||||||
setStationMenuDialog();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 監視を開始
|
// 監視を開始
|
||||||
observer3.observe(target, {
|
setStationMenuDialog.observe(document.querySelector('#disp'), {
|
||||||
attributes: true, // 属性変化の監視
|
attributes: true, // 属性変化の監視
|
||||||
//attributeOldValue: true, // 変化前の属性値を matation.oldValue に格納する
|
//attributeOldValue: true, // 変化前の属性値を matation.oldValue に格納する
|
||||||
//characterData: true, // テキストノードの変化を監視
|
//characterData: true, // テキストノードの変化を監視
|
||||||
@@ -752,6 +759,12 @@ observer3.observe(target, {
|
|||||||
`
|
`
|
||||||
: ``;
|
: ``;
|
||||||
return (
|
return (
|
||||||
bootData + makeTrainView + trainIconMaker + textInsert + makeStationMenu
|
bootData +
|
||||||
|
topMenu +
|
||||||
|
makeTrainView +
|
||||||
|
trainIconMaker +
|
||||||
|
makeTrainMenu +
|
||||||
|
textInsert +
|
||||||
|
makeStationMenu
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
496
menu.js
496
menu.js
@@ -1,89 +1,82 @@
|
|||||||
import React, { Component, useRef, useState, useEffect } from "react";
|
import React, { useRef, useState, useEffect } from "react";
|
||||||
|
import Carousel from "react-native-snap-carousel";
|
||||||
import {
|
import {
|
||||||
StatusBar,
|
|
||||||
Platform,
|
Platform,
|
||||||
View,
|
View,
|
||||||
LayoutAnimation,
|
|
||||||
ScrollView,
|
ScrollView,
|
||||||
Linking,
|
Linking,
|
||||||
Text,
|
Text,
|
||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
|
ToastAndroid,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import Image from "react-native-remote-svg";
|
|
||||||
import Constants from "expo-constants";
|
import Constants from "expo-constants";
|
||||||
import { List, ListItem } from "native-base";
|
import { ListItem } from "native-base";
|
||||||
import Icon from "react-native-vector-icons/Entypo";
|
import Icon from "react-native-vector-icons/Entypo";
|
||||||
import * as Location from "expo-location";
|
import * as Location from "expo-location";
|
||||||
import StatusbarDetect from "./StatusbarDetect";
|
import StatusbarDetect from "./StatusbarDetect";
|
||||||
import { useNavigation } from "@react-navigation/native";
|
import { useNavigation } from "@react-navigation/native";
|
||||||
import AutoHeightImage from "react-native-auto-height-image";
|
import AutoHeightImage from "react-native-auto-height-image";
|
||||||
import {
|
import { widthPercentageToDP as wp } from "react-native-responsive-screen";
|
||||||
widthPercentageToDP as wp,
|
|
||||||
heightPercentageToDP as hp,
|
|
||||||
} from "react-native-responsive-screen";
|
|
||||||
import {
|
import {
|
||||||
FontAwesome,
|
FontAwesome,
|
||||||
Fontisto,
|
|
||||||
Foundation,
|
Foundation,
|
||||||
Ionicons,
|
Ionicons,
|
||||||
MaterialCommunityIcons,
|
MaterialCommunityIcons,
|
||||||
} from "@expo/vector-icons";
|
} 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 LottieView from "lottie-react-native";
|
||||||
import SvgUri from "react-native-svg-uri";
|
|
||||||
import { StationDeteilView } from "./components/ActionSheetComponents/StationDeteilView";
|
import { StationDeteilView } from "./components/ActionSheetComponents/StationDeteilView";
|
||||||
|
import { parseAllTrainDiagram } from "./lib/parseAllTrainDiagram";
|
||||||
|
import trainList from "./assets/originData/trainList";
|
||||||
|
|
||||||
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 LED_vision from "./components/発車時刻表/LED_vidion";
|
||||||
import Sign from "./components/駅名表/Sign";
|
import Sign from "./components/駅名表/Sign";
|
||||||
|
|
||||||
import { UsefulBox } from "./components/atom/UsefulBox";
|
import { UsefulBox } from "./components/atom/UsefulBox";
|
||||||
import { TicketBox } from "./components/atom/TicketBox";
|
import { TicketBox } from "./components/atom/TicketBox";
|
||||||
import { TextBox } from "./components/atom/TextBox";
|
import { TextBox } from "./components/atom/TextBox";
|
||||||
import { getStationList } from "./lib/getStationList";
|
import { getStationList, lineList } from "./lib/getStationList";
|
||||||
import { JRSTraInfo } from "./components/ActionSheetComponents/JRSTraInfo";
|
import { JRSTraInfo } from "./components/ActionSheetComponents/JRSTraInfo";
|
||||||
|
import { EachTrainInfo } from "./components/ActionSheetComponents/EachTrainInfo";
|
||||||
|
import useInterval from "./lib/useInterval";
|
||||||
|
import { HeaderConfig } from "./lib/HeaderConfig";
|
||||||
|
|
||||||
export default function Menu(props) {
|
export default function Menu(props) {
|
||||||
const {
|
const {
|
||||||
navigation: { navigate },
|
navigation: { navigate },
|
||||||
|
favoriteStation,
|
||||||
|
setFavoriteStation,
|
||||||
|
busAndTrainData,
|
||||||
|
currentTrainState,
|
||||||
|
currentTrainLoadingState,
|
||||||
|
getCurrentTrain,
|
||||||
} = props;
|
} = props;
|
||||||
const JRSTraInfoEXAcSR = useRef(null);
|
const JRSTraInfoEXAcSR = useRef(null);
|
||||||
const StationBoardAcSR = useRef(null);
|
const StationBoardAcSR = useRef(null);
|
||||||
const navigation = useNavigation();
|
const navigation = useNavigation();
|
||||||
|
|
||||||
//位置情報
|
//位置情報
|
||||||
const [location, setLocation] = useState(null);
|
const [locationStatus, setLocationStatus] = useState(null);
|
||||||
const [errorMsg, setErrorMsg] = useState(null);
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Location.requestForegroundPermissionsAsync().then((data) => {
|
Location.requestForegroundPermissionsAsync().then((data) => {
|
||||||
if (data.status !== "granted") {
|
setLocationStatus(data.status);
|
||||||
setErrorMsg("Permission to access location was denied");
|
|
||||||
return () => {};
|
|
||||||
}
|
|
||||||
Location.getCurrentPositionAsync({}).then((location) =>
|
|
||||||
setLocation(location)
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
setInterval(() => {
|
|
||||||
Location.getCurrentPositionAsync({}).then((location) =>
|
|
||||||
setLocation(location)
|
|
||||||
);
|
|
||||||
}, 10000);
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const [originalStationList, setOriginalStationList] = useState();
|
//列車情報表示関連
|
||||||
useEffect(() => getStationList().then(setOriginalStationList), []);
|
const EachTrainInfoAsSR = useRef(null);
|
||||||
|
const [trainInfo, setTrainInfo] = useState({
|
||||||
|
trainNum: undefined,
|
||||||
|
limited: undefined,
|
||||||
|
trainData: undefined,
|
||||||
|
});
|
||||||
|
|
||||||
const [stationName, setStationName] = useState(undefined);
|
const getCurrentPosition = () => {
|
||||||
const [currentStation, setCurrentStation] = useState(undefined);
|
if (locationStatus !== "granted") return () => {};
|
||||||
useEffect(() => {
|
Location.getCurrentPositionAsync({}).then((location) =>
|
||||||
if (!location) return () => {};
|
makeCurrentStation(location)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const makeCurrentStation = (location) => {
|
||||||
if (!originalStationList) return () => {};
|
if (!originalStationList) return () => {};
|
||||||
const findStationEachLine = (selectLine) => {
|
const findStationEachLine = (selectLine) => {
|
||||||
const searchArea = 0.0015;
|
const searchArea = 0.0015;
|
||||||
@@ -102,17 +95,6 @@ export default function Menu(props) {
|
|||||||
return NearStation;
|
return NearStation;
|
||||||
};
|
};
|
||||||
|
|
||||||
const lineList = [
|
|
||||||
"予讃線",
|
|
||||||
"松宇線",
|
|
||||||
"伊予灘線",
|
|
||||||
"土讃線",
|
|
||||||
"窪川線",
|
|
||||||
"高徳線",
|
|
||||||
"徳島線",
|
|
||||||
"鳴門線",
|
|
||||||
"瀬戸大橋線",
|
|
||||||
];
|
|
||||||
let returnDataBase = lineList
|
let returnDataBase = lineList
|
||||||
.map((d) => findStationEachLine(originalStationList[d]))
|
.map((d) => findStationEachLine(originalStationList[d]))
|
||||||
.filter((d) => d.length > 0)
|
.filter((d) => d.length > 0)
|
||||||
@@ -120,7 +102,6 @@ export default function Menu(props) {
|
|||||||
pre.push(...current);
|
pre.push(...current);
|
||||||
return pre;
|
return pre;
|
||||||
}, []);
|
}, []);
|
||||||
LayoutAnimation.spring();
|
|
||||||
if (returnDataBase.length) {
|
if (returnDataBase.length) {
|
||||||
let currentStation = currentStation == undefined ? [] : currentStation;
|
let currentStation = currentStation == undefined ? [] : currentStation;
|
||||||
if (currentStation.toString() != returnDataBase.toString()) {
|
if (currentStation.toString() != returnDataBase.toString()) {
|
||||||
@@ -128,14 +109,23 @@ export default function Menu(props) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setCurrentStation(undefined);
|
setCurrentStation(undefined);
|
||||||
StationBoardAcSR.current?.hide();
|
|
||||||
}
|
}
|
||||||
}, [location, originalStationList]);
|
};
|
||||||
|
|
||||||
|
useEffect(getCurrentPosition, [locationStatus]);
|
||||||
|
useInterval(getCurrentPosition, 5000);
|
||||||
|
|
||||||
|
const [currentStation, setCurrentStation] = useState(undefined); //第三要素
|
||||||
|
|
||||||
|
const [originalStationList, setOriginalStationList] = useState(); // 第一要素
|
||||||
|
useEffect(() => getStationList().then(setOriginalStationList), []);
|
||||||
|
|
||||||
const [count, setCount] = useState(0);
|
const [count, setCount] = useState(0);
|
||||||
const [delayData, setDelayData] = useState(undefined);
|
const [delayData, setDelayData] = useState(undefined);
|
||||||
const [getTime, setGetTime] = useState(new Date());
|
const [getTime, setGetTime] = useState(new Date());
|
||||||
const [loadingDelayData, setLoadingDelayData] = useState(true);
|
const [loadingDelayData, setLoadingDelayData] = useState(true);
|
||||||
|
const carouselRef = useRef();
|
||||||
|
const [selectedCurrentStation, setSelectedCurrentStation] = useState(0);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetch(
|
fetch(
|
||||||
@@ -143,11 +133,72 @@ export default function Menu(props) {
|
|||||||
)
|
)
|
||||||
.then((response) => response.text())
|
.then((response) => response.text())
|
||||||
.then((data) => setDelayData(data !== "" ? data.split("^") : null))
|
.then((data) => setDelayData(data !== "" ? data.split("^") : null))
|
||||||
.then(LayoutAnimation.easeInEaseOut)
|
|
||||||
.then(() => setGetTime(new Date()))
|
.then(() => setGetTime(new Date()))
|
||||||
.finally(() => setLoadingDelayData(false));
|
.finally(() => setLoadingDelayData(false));
|
||||||
}, [loadingDelayData]);
|
}, [loadingDelayData]);
|
||||||
|
const allStationData = [currentStation, ...favoriteStation].filter(
|
||||||
|
(d) => d != undefined
|
||||||
|
);
|
||||||
|
useEffect(() => {
|
||||||
|
if (allStationData.length == 0) {
|
||||||
|
setSelectedCurrentStation(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (allStationData[selectedCurrentStation] == undefined) {
|
||||||
|
const count = selectedCurrentStation - 1;
|
||||||
|
setSelectedCurrentStation(count);
|
||||||
|
}
|
||||||
|
}, [selectedCurrentStation, currentStation, favoriteStation]);
|
||||||
|
useEffect(() => {
|
||||||
|
if (!carouselRef.current) return;
|
||||||
|
if (carouselRef.current?._itemToSnapTo != selectedCurrentStation) {
|
||||||
|
carouselRef.current.snapToItem(0);
|
||||||
|
carouselRef.current.snapToItem(selectedCurrentStation);
|
||||||
|
}
|
||||||
|
}, [selectedCurrentStation]);
|
||||||
|
|
||||||
|
//全列車ダイヤリストを作成するuseEffect
|
||||||
|
const [trainDiagram, setTrainDiagram] = useState(null); // 全列車のダイヤを列番ベースで整理
|
||||||
|
useEffect(() => {
|
||||||
|
//全列車リストを生成する副作用[無条件初回実行]
|
||||||
|
fetch(
|
||||||
|
"https://train.jr-shikoku.co.jp/g?arg1=station&arg2=traintimeinfo&arg3=dia",
|
||||||
|
HeaderConfig
|
||||||
|
)
|
||||||
|
.then((response) => response.text())
|
||||||
|
.then((d) => {
|
||||||
|
if (d.indexOf("<title>404 Not Found</title>") != -1) throw Error;
|
||||||
|
setTrainDiagram(parseAllTrainDiagram(d));
|
||||||
|
})
|
||||||
|
.catch((d) => {
|
||||||
|
console.log("fallback");
|
||||||
|
setTrainDiagram(trainList);
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const openStationACFromEachTrainInfo = (stationName) => {
|
||||||
|
// EachTrainInfoAsSR.current?.hide();
|
||||||
|
// const findStationEachLine = (selectLine) => {
|
||||||
|
// let NearStation = selectLine.filter((d) => d.Station_JP == stationName);
|
||||||
|
// return NearStation;
|
||||||
|
// };
|
||||||
|
// let returnDataBase = lineList
|
||||||
|
// .map((d) => findStationEachLine(originalStationList[d]))
|
||||||
|
// .filter((d) => d.length > 0)
|
||||||
|
// .reduce((pre, current) => {
|
||||||
|
// pre.push(...current);
|
||||||
|
// return pre;
|
||||||
|
// }, []);
|
||||||
|
// if (returnDataBase.length) {
|
||||||
|
// setStationBoardData(returnDataBase);
|
||||||
|
// sleep(30, function () {
|
||||||
|
// StationBoardAcSR.current?.show();
|
||||||
|
// });
|
||||||
|
// } else {
|
||||||
|
// setStationBoardData(undefined);
|
||||||
|
// StationBoardAcSR.current?.hide();
|
||||||
|
// }
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
@@ -157,6 +208,103 @@ export default function Menu(props) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<StatusbarDetect />
|
<StatusbarDetect />
|
||||||
|
<TitleBar />
|
||||||
|
<ScrollView>
|
||||||
|
<FixedContentTop navigate={navigate} />
|
||||||
|
{originalStationList && allStationData.length != 0 && (
|
||||||
|
<Carousel
|
||||||
|
ref={carouselRef}
|
||||||
|
layout={"default"}
|
||||||
|
data={originalStationList && allStationData}
|
||||||
|
sliderWidth={wp("100%")}
|
||||||
|
itemWidth={wp("80%")}
|
||||||
|
enableMomentum
|
||||||
|
callbackOffsetMargin={1000}
|
||||||
|
activeAnimationOptions={0.3}
|
||||||
|
onSnapToItem={(d) => {
|
||||||
|
setSelectedCurrentStation(d);
|
||||||
|
}}
|
||||||
|
renderItem={({ item, index }) => {
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
style={{ marginVertical: 10 }}
|
||||||
|
key={item[0].StationNumber}
|
||||||
|
>
|
||||||
|
<Sign
|
||||||
|
currentStation={item}
|
||||||
|
originalStationList={originalStationList}
|
||||||
|
favoriteStation={favoriteStation}
|
||||||
|
setFavoriteStation={setFavoriteStation}
|
||||||
|
oP={StationBoardAcSR.current?.setModalVisible}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{allStationData.length != 0 &&
|
||||||
|
originalStationList &&
|
||||||
|
allStationData[selectedCurrentStation] && (
|
||||||
|
<LED_vision
|
||||||
|
station={
|
||||||
|
originalStationList && allStationData[selectedCurrentStation][0]
|
||||||
|
}
|
||||||
|
setTrainInfo={setTrainInfo}
|
||||||
|
EachTrainInfoAsSR={EachTrainInfoAsSR}
|
||||||
|
trainDiagram={trainDiagram}
|
||||||
|
currentTrainState={currentTrainState}
|
||||||
|
currentTrainLoadingState={currentTrainLoadingState}
|
||||||
|
getCurrentTrain={getCurrentTrain}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<JRSTraInfoBox
|
||||||
|
JRSTraInfoEXAcSR={JRSTraInfoEXAcSR}
|
||||||
|
getTime={getTime}
|
||||||
|
setLoadingDelayData={setLoadingDelayData}
|
||||||
|
loadingDelayData={loadingDelayData}
|
||||||
|
delayData={delayData}
|
||||||
|
/>
|
||||||
|
<FixedContentBottom navigate={navigate} />
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<StationDeteilView
|
||||||
|
StationBoardAcSR={StationBoardAcSR}
|
||||||
|
currentStation={
|
||||||
|
originalStationList &&
|
||||||
|
allStationData.length != 0 &&
|
||||||
|
allStationData[selectedCurrentStation]
|
||||||
|
}
|
||||||
|
originalStationList={originalStationList}
|
||||||
|
favoriteStation={favoriteStation}
|
||||||
|
setFavoriteStation={setFavoriteStation}
|
||||||
|
busAndTrainData={busAndTrainData}
|
||||||
|
navigate={navigate}
|
||||||
|
onExit={() => {
|
||||||
|
StationBoardAcSR.current?.setModalVisible();
|
||||||
|
navigate("menu");
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<JRSTraInfo
|
||||||
|
JRSTraInfoEXAcSR={JRSTraInfoEXAcSR}
|
||||||
|
getTime={getTime}
|
||||||
|
loadingDelayData={loadingDelayData}
|
||||||
|
setLoadingDelayData={setLoadingDelayData}
|
||||||
|
delayData={delayData}
|
||||||
|
/>
|
||||||
|
<EachTrainInfo
|
||||||
|
setRef={EachTrainInfoAsSR}
|
||||||
|
data={trainInfo}
|
||||||
|
navigate={navigate}
|
||||||
|
originalStationList={originalStationList}
|
||||||
|
openStationACFromEachTrainInfo={openStationACFromEachTrainInfo}
|
||||||
|
from="LED"
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const TitleBar = () => {
|
||||||
|
return (
|
||||||
<View style={{ alignItems: "center" }}>
|
<View style={{ alignItems: "center" }}>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={() => Linking.openURL("https://www.jr-shikoku.co.jp")}
|
onPress={() => Linking.openURL("https://www.jr-shikoku.co.jp")}
|
||||||
@@ -168,102 +316,102 @@ export default function Menu(props) {
|
|||||||
/>
|
/>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
<ScrollView>
|
);
|
||||||
<View style={{ flexDirection: "row" }}>
|
};
|
||||||
<UsefulBox
|
|
||||||
backgroundColor={"#F89038"}
|
const TopMenuButton = () => {
|
||||||
icon="train-car"
|
const buttonList = [
|
||||||
flex={1}
|
{
|
||||||
onPressButton={() =>
|
backgroundColor: "#F89038",
|
||||||
Linking.openURL("https://www.jr-shikoku.co.jp/01_trainbus/sp/")
|
icon: "train-car",
|
||||||
}
|
onPress: () =>
|
||||||
>
|
Linking.openURL("https://www.jr-shikoku.co.jp/01_trainbus/sp/"),
|
||||||
駅・鉄道情報
|
title: "駅・鉄道情報",
|
||||||
</UsefulBox>
|
},
|
||||||
<UsefulBox
|
{
|
||||||
backgroundColor={"#EA4752"}
|
backgroundColor: "#EA4752",
|
||||||
icon="google-spreadsheet"
|
icon: "google-spreadsheet",
|
||||||
flex={1}
|
onPress: () =>
|
||||||
onPressButton={() =>
|
|
||||||
Linking.openURL(
|
Linking.openURL(
|
||||||
"https://www.jr-shikoku.co.jp/01_trainbus/jikoku/sp/#mainprice-box"
|
"https://www.jr-shikoku.co.jp/01_trainbus/jikoku/sp/#mainprice-box"
|
||||||
)
|
),
|
||||||
}
|
title: "運賃表",
|
||||||
>
|
},
|
||||||
運賃表
|
{
|
||||||
</UsefulBox>
|
backgroundColor: "#91C31F",
|
||||||
|
icon: "clipboard-list-outline",
|
||||||
|
onPress: () => Linking.openURL("https://www.jr-shikoku.co.jp/e5489/"),
|
||||||
|
title: "予約",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
return (
|
||||||
|
<View style={{ flexDirection: "row" }}>
|
||||||
|
{buttonList.map((d, index) => (
|
||||||
<UsefulBox
|
<UsefulBox
|
||||||
backgroundColor={"#91C31F"}
|
backgroundColor={d.backgroundColor}
|
||||||
icon="clipboard-list-outline"
|
icon={d.icon}
|
||||||
flex={1}
|
flex={1}
|
||||||
onPressButton={() =>
|
onPressButton={d.onPress}
|
||||||
Linking.openURL("https://www.jr-shikoku.co.jp/e5489/")
|
key={index + d.icon}
|
||||||
}
|
|
||||||
>
|
>
|
||||||
予約
|
{d.title}
|
||||||
</UsefulBox>
|
</UsefulBox>
|
||||||
|
))}
|
||||||
</View>
|
</View>
|
||||||
<TextBox
|
);
|
||||||
backgroundColor="#0099CC"
|
};
|
||||||
flex={1}
|
|
||||||
onPressButton={() =>
|
const JRSTraInfoBox = (props) => {
|
||||||
Linking.openURL(
|
const {
|
||||||
"https://www.jr-shikoku.co.jp/02_information/suspension/sp/"
|
JRSTraInfoEXAcSR,
|
||||||
)
|
getTime,
|
||||||
}
|
setLoadingDelayData,
|
||||||
>
|
loadingDelayData,
|
||||||
<Text style={{ color: "white", fontWeight: "bold", fontSize: 18 }}>
|
delayData,
|
||||||
新型コロナウイルスに関するお知らせ
|
} = props;
|
||||||
</Text>
|
const styles = {
|
||||||
<Text style={{ color: "white", fontSize: 15 }}>
|
touch: {
|
||||||
列車の運行計画・混雑状況・感染症対策への取り組み
|
|
||||||
</Text>
|
|
||||||
</TextBox>
|
|
||||||
{currentStation && (
|
|
||||||
<>
|
|
||||||
<Sign
|
|
||||||
currentStation={currentStation}
|
|
||||||
originalStationList={originalStationList}
|
|
||||||
oP={StationBoardAcSR.current?.setModalVisible}
|
|
||||||
/>
|
|
||||||
<LED_vision station={currentStation[0]} />
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<TouchableOpacity onPress={JRSTraInfoEXAcSR.current?.setModalVisible}>
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
backgroundColor: "#0099CC",
|
backgroundColor: "#0099CC",
|
||||||
borderRadius: 5,
|
borderRadius: 5,
|
||||||
margin: 10,
|
margin: 10,
|
||||||
borderColor: "black",
|
borderColor: "black",
|
||||||
borderWidth: 2,
|
borderWidth: 2,
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
}}
|
},
|
||||||
>
|
scroll: {
|
||||||
<ScrollView
|
|
||||||
scrollEnabled={false}
|
|
||||||
style={{
|
|
||||||
backgroundColor: "#0099CC",
|
backgroundColor: "#0099CC",
|
||||||
borderRadius: 5,
|
borderRadius: 5,
|
||||||
maxHeight: 300,
|
maxHeight: 300,
|
||||||
}}
|
},
|
||||||
>
|
bottom: {
|
||||||
<View
|
position: "absolute",
|
||||||
style={{
|
top: 250,
|
||||||
padding: 10,
|
|
||||||
flexDirection: "row",
|
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
}}
|
width: "100%",
|
||||||
|
height: 50,
|
||||||
|
backgroundColor: "#007FCC88",
|
||||||
|
},
|
||||||
|
box: {
|
||||||
|
padding: 10,
|
||||||
|
backgroundColor: "white",
|
||||||
|
borderBottomLeftRadius: 5,
|
||||||
|
borderBottomRightRadius: 5,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={JRSTraInfoEXAcSR.current?.setModalVisible}
|
||||||
|
style={styles.touch}
|
||||||
>
|
>
|
||||||
<Text
|
<ScrollView scrollEnabled={false} style={styles.scroll}>
|
||||||
style={{ fontSize: 30, fontWeight: "bold", color: "white" }}
|
<View
|
||||||
|
style={{ padding: 10, flexDirection: "row", alignItems: "center" }}
|
||||||
>
|
>
|
||||||
|
<Text style={{ fontSize: 30, fontWeight: "bold", color: "white" }}>
|
||||||
列車遅延速報EX
|
列車遅延速報EX
|
||||||
</Text>
|
</Text>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
<Text
|
<Text style={{ fontSize: 30, fontWeight: "bold", color: "white" }}>
|
||||||
style={{ fontSize: 30, fontWeight: "bold", color: "white" }}
|
|
||||||
>
|
|
||||||
{getTime
|
{getTime
|
||||||
? getTime.toLocaleTimeString("ja-JP").split(":")[0] +
|
? getTime.toLocaleTimeString("ja-JP").split(":")[0] +
|
||||||
":" +
|
":" +
|
||||||
@@ -276,37 +424,25 @@ export default function Menu(props) {
|
|||||||
size={30}
|
size={30}
|
||||||
style={{ margin: 5 }}
|
style={{ margin: 5 }}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
LayoutAnimation.easeInEaseOut();
|
|
||||||
setLoadingDelayData(true);
|
setLoadingDelayData(true);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View
|
<View style={styles.box}>
|
||||||
style={{
|
|
||||||
padding: 10,
|
|
||||||
backgroundColor: "white",
|
|
||||||
borderBottomLeftRadius: 5,
|
|
||||||
borderBottomRightRadius: 5,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{loadingDelayData ? (
|
{loadingDelayData ? (
|
||||||
<View style={{ alignItems: "center" }}>
|
<View style={{ alignItems: "center" }}>
|
||||||
<LottieView
|
<LottieView
|
||||||
autoPlay
|
autoPlay
|
||||||
loop
|
loop
|
||||||
style={{
|
style={{ width: 150, height: 150, backgroundColor: "#fff" }}
|
||||||
width: 150,
|
|
||||||
height: 150,
|
|
||||||
backgroundColor: "#fff",
|
|
||||||
}}
|
|
||||||
source={require("./assets/51690-loading-diamonds.json")}
|
source={require("./assets/51690-loading-diamonds.json")}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
) : delayData ? (
|
) : delayData ? (
|
||||||
delayData.map((d) => {
|
delayData.map((d, index) => {
|
||||||
let data = d.split(" ");
|
let data = d.split(" ");
|
||||||
return (
|
return (
|
||||||
<View style={{ flexDirection: "row" }}>
|
<View style={{ flexDirection: "row" }} key={data[1] + "key"}>
|
||||||
<Text style={{ flex: 15, fontSize: 20 }}>
|
<Text style={{ flex: 15, fontSize: 20 }}>
|
||||||
{data[0].replace("\n", "")}
|
{data[0].replace("\n", "")}
|
||||||
</Text>
|
</Text>
|
||||||
@@ -320,26 +456,28 @@ export default function Menu(props) {
|
|||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<View
|
<View style={styles.bottom}>
|
||||||
style={{
|
|
||||||
position: "absolute",
|
|
||||||
top: 250,
|
|
||||||
alignItems: "center",
|
|
||||||
width: "100%",
|
|
||||||
height: 50,
|
|
||||||
backgroundColor: "#007FCC88",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
<Text
|
<Text style={{ color: "white", fontWeight: "bold", fontSize: 20 }}>
|
||||||
style={{ color: "white", fontWeight: "bold", fontSize: 20 }}
|
|
||||||
>
|
|
||||||
詳細を見る
|
詳細を見る
|
||||||
</Text>
|
</Text>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const FixedContentTop = (props) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<TopMenuButton />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const FixedContentBottom = (props) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{props.children}
|
||||||
|
|
||||||
<View style={{ flexDirection: "row" }}>
|
<View style={{ flexDirection: "row" }}>
|
||||||
<TicketBox
|
<TicketBox
|
||||||
@@ -393,9 +531,7 @@ export default function Menu(props) {
|
|||||||
backgroundColor="#0099CC"
|
backgroundColor="#0099CC"
|
||||||
flex={1}
|
flex={1}
|
||||||
onPressButton={() =>
|
onPressButton={() =>
|
||||||
Linking.openURL(
|
Linking.openURL("https://www.jr-shikoku.co.jp/sp/index.html#menu-box")
|
||||||
"https://www.jr-shikoku.co.jp/sp/index.html#menu-box"
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Text style={{ color: "white", fontWeight: "bold", fontSize: 20 }}>
|
<Text style={{ color: "white", fontWeight: "bold", fontSize: 20 }}>
|
||||||
@@ -522,14 +658,7 @@ export default function Menu(props) {
|
|||||||
borderBottomRightRadius: 10,
|
borderBottomRightRadius: 10,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{((data) =>
|
{[
|
||||||
data.map((d) => (
|
|
||||||
<ListItem onPress={() => Linking.openURL(d.url)}>
|
|
||||||
<Text>{d.name}</Text>
|
|
||||||
<View style={{ flex: 1 }} />
|
|
||||||
<Icon name="chevron-right" size={20} />
|
|
||||||
</ListItem>
|
|
||||||
)))([
|
|
||||||
{
|
{
|
||||||
url: "https://twitter.com/JRshikoku_eigyo",
|
url: "https://twitter.com/JRshikoku_eigyo",
|
||||||
name: "JR四国営業部【公式】",
|
name: "JR四国営業部【公式】",
|
||||||
@@ -578,7 +707,13 @@ export default function Menu(props) {
|
|||||||
url: "https://twitter.com/Yoakemonogatari",
|
url: "https://twitter.com/Yoakemonogatari",
|
||||||
name: "志国土佐 時代の夜明けのものがたり【公式】",
|
name: "志国土佐 時代の夜明けのものがたり【公式】",
|
||||||
},
|
},
|
||||||
])}
|
].map((d) => (
|
||||||
|
<ListItem onPress={() => Linking.openURL(d.url)}>
|
||||||
|
<Text>{d.name}</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Icon name="chevron-right" size={20} />
|
||||||
|
</ListItem>
|
||||||
|
))}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<Text style={{ fontWeight: "bold", fontSize: 20 }}>
|
<Text style={{ fontWeight: "bold", fontSize: 20 }}>
|
||||||
@@ -604,7 +739,7 @@ export default function Menu(props) {
|
|||||||
<TextBox
|
<TextBox
|
||||||
backgroundColor="black"
|
backgroundColor="black"
|
||||||
flex={1}
|
flex={1}
|
||||||
onPressButton={() => navigate("setting")}
|
onPressButton={() => props.navigate("setting")}
|
||||||
>
|
>
|
||||||
<Text style={{ color: "white", fontWeight: "bold", fontSize: 20 }}>
|
<Text style={{ color: "white", fontWeight: "bold", fontSize: 20 }}>
|
||||||
アプリの設定
|
アプリの設定
|
||||||
@@ -619,19 +754,6 @@ export default function Menu(props) {
|
|||||||
height="200"
|
height="200"
|
||||||
source={require("./assets/トレインビジョン関係/1.svg")}
|
source={require("./assets/トレインビジョン関係/1.svg")}
|
||||||
/> */}
|
/> */}
|
||||||
</ScrollView>
|
</>
|
||||||
<StationDeteilView
|
|
||||||
StationBoardAcSR={StationBoardAcSR}
|
|
||||||
currentStation={currentStation}
|
|
||||||
originalStationList={originalStationList}
|
|
||||||
/>
|
|
||||||
<JRSTraInfo
|
|
||||||
JRSTraInfoEXAcSR={JRSTraInfoEXAcSR}
|
|
||||||
getTime={getTime}
|
|
||||||
loadingDelayData={loadingDelayData}
|
|
||||||
setLoadingDelayData={setLoadingDelayData}
|
|
||||||
delayData={delayData}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import React, { Component } from "react";
|
import React from "react";
|
||||||
import { StatusBar, View, Linking, Platform, Text } from "react-native";
|
import { View, Platform } 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";
|
|
||||||
export default function tndView() {
|
export default function tndView() {
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
|
|||||||
12485
package-lock.json
generated
12485
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
35
package.json
35
package.json
@@ -8,42 +8,43 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@expo/vector-icons": "^13.0.0",
|
"@expo/vector-icons": "^13.0.0",
|
||||||
"@react-native-async-storage/async-storage": "~1.17.3",
|
"@react-native-async-storage/async-storage": "1.17.11",
|
||||||
"@react-native-community/masked-view": "0.1.10",
|
"@react-native-community/masked-view": "0.1.10",
|
||||||
"@react-navigation/bottom-tabs": "^5.11.11",
|
"@react-navigation/bottom-tabs": "^5.11.11",
|
||||||
"@react-navigation/native": "^5.9.4",
|
"@react-navigation/native": "^5.9.4",
|
||||||
"@react-navigation/stack": "^5.14.5",
|
"@react-navigation/stack": "^5.14.5",
|
||||||
"expo": "^45.0.0",
|
"expo": "^48.0.0",
|
||||||
"expo-font": "~10.1.0",
|
"expo-font": "~11.1.1",
|
||||||
"expo-location": "~14.2.2",
|
"expo-location": "~15.1.1",
|
||||||
"expo-updates": "~0.13.4",
|
"expo-updates": "~0.16.3",
|
||||||
"expo-web-browser": "~10.2.1",
|
"expo-web-browser": "~12.1.1",
|
||||||
"firebase": "8.2.3",
|
"firebase": "8.2.3",
|
||||||
"lottie-react-native": "5.0.1",
|
"lottie-react-native": "5.1.4",
|
||||||
"native-base": "^2.15.2",
|
"native-base": "^2.15.2",
|
||||||
"npm": "^7.18.1",
|
"npm": "^7.18.1",
|
||||||
"pushy-react-native": "^1.0.18",
|
"pushy-react-native": "^1.0.18",
|
||||||
"react": "17.0.2",
|
"react": "18.2.0",
|
||||||
"react-native": "0.68.2",
|
"react-native": "0.71.3",
|
||||||
"react-native-actions-sheet": "^0.4.9",
|
"react-native-actions-sheet": "^0.4.9",
|
||||||
"react-native-auto-height-image": "^3.2.4",
|
"react-native-auto-height-image": "^3.2.4",
|
||||||
"react-native-elements": "^3.4.2",
|
"react-native-elements": "^3.4.2",
|
||||||
"react-native-gesture-handler": "~2.2.1",
|
"react-native-gesture-handler": "~2.9.0",
|
||||||
"react-native-maps": "0.30.2",
|
"react-native-maps": "1.3.2",
|
||||||
"react-native-reanimated": "~2.8.0",
|
"react-native-reanimated": "~2.14.4",
|
||||||
"react-native-remote-svg": "^2.0.6",
|
"react-native-remote-svg": "^2.0.6",
|
||||||
"react-native-responsive-screen": "^1.4.2",
|
"react-native-responsive-screen": "^1.4.2",
|
||||||
"react-native-router-flux": "^4.3.1",
|
"react-native-router-flux": "^4.3.1",
|
||||||
"react-native-safe-area-context": "4.2.4",
|
"react-native-safe-area-context": "4.5.0",
|
||||||
"react-native-screens": "~3.11.1",
|
"react-native-screens": "~3.20.0",
|
||||||
|
"react-native-snap-carousel": "^3.9.1",
|
||||||
"react-native-storage": "^1.0.1",
|
"react-native-storage": "^1.0.1",
|
||||||
"react-native-svg": "12.3.0",
|
"react-native-svg": "13.4.0",
|
||||||
"react-native-svg-uri": "^1.2.3",
|
"react-native-svg-uri": "^1.2.3",
|
||||||
"react-native-vector-icons": "^8.1.0",
|
"react-native-vector-icons": "^8.1.0",
|
||||||
"react-native-webview": "11.18.1"
|
"react-native-webview": "11.26.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-preset-expo": "~9.1.0"
|
"babel-preset-expo": "^9.3.0"
|
||||||
},
|
},
|
||||||
"private": true
|
"private": true
|
||||||
}
|
}
|
||||||
|
|||||||
27
storageConfig.js
Normal file
27
storageConfig.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import Storage from "react-native-storage";
|
||||||
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||||
|
|
||||||
|
const storage = new Storage({
|
||||||
|
// maximum capacity, default 1000 key-ids
|
||||||
|
size: 10000,
|
||||||
|
|
||||||
|
// Use AsyncStorage for RN apps, or window.localStorage for web apps.
|
||||||
|
// If storageBackend is not set, data will be lost after reload.
|
||||||
|
storageBackend: AsyncStorage, // for web: window.localStorage
|
||||||
|
|
||||||
|
// expire time, default: 1 day (1000 * 3600 * 24 milliseconds).
|
||||||
|
// can be null, which means never expire.
|
||||||
|
defaultExpires: null,
|
||||||
|
|
||||||
|
// cache data in the memory. default is true.
|
||||||
|
enableCache: true,
|
||||||
|
|
||||||
|
// if data was not found in storage or expired data was found,
|
||||||
|
// the corresponding sync method will be invoked returning
|
||||||
|
// the latest data.
|
||||||
|
sync: {
|
||||||
|
// we'll talk about the details later.
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default storage;
|
||||||
14
storageControl.js
Normal file
14
storageControl.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import storage from "./storageConfig.js";
|
||||||
|
|
||||||
|
export const AS = {
|
||||||
|
getItem: (key) => storage.load({ key }),
|
||||||
|
setItem: (key, data) =>
|
||||||
|
storage.save({
|
||||||
|
key, // Note: Do not use underscore("_") in key!
|
||||||
|
data,
|
||||||
|
|
||||||
|
// if expires not specified, the defaultExpires will be applied instead.
|
||||||
|
// if set to null, then it will never expire.
|
||||||
|
expires: null,
|
||||||
|
}),
|
||||||
|
};
|
||||||
@@ -1,9 +1,17 @@
|
|||||||
import React, { Component, useRef } from "react";
|
import React, { Component, useRef } from "react";
|
||||||
import { StatusBar, Platform, View } from "react-native";
|
import {
|
||||||
|
StatusBar,
|
||||||
|
Platform,
|
||||||
|
View,
|
||||||
|
TouchableOpacity,
|
||||||
|
Text,
|
||||||
|
} from "react-native";
|
||||||
import { WebView } from "react-native-webview";
|
import { WebView } from "react-native-webview";
|
||||||
|
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
|
|
||||||
export default function TrainBase({ route }) {
|
export default function TrainBase({ route, navigation }) {
|
||||||
const { info } = route.params;
|
const { info, from } = route.params;
|
||||||
|
const { navigate } = navigation;
|
||||||
const webview = useRef();
|
const webview = useRef();
|
||||||
const jss = `document.getElementById('Footer').style.display = 'none';
|
const jss = `document.getElementById('Footer').style.display = 'none';
|
||||||
${
|
${
|
||||||
@@ -28,6 +36,27 @@ export default function TrainBase({ route }) {
|
|||||||
setSupportMultipleWindows={false}
|
setSupportMultipleWindows={false}
|
||||||
onMessage={(event) => {}}
|
onMessage={(event) => {}}
|
||||||
/>
|
/>
|
||||||
|
{from == "LED" && (
|
||||||
|
<TouchableOpacity
|
||||||
|
style={{
|
||||||
|
padding: 10,
|
||||||
|
flexDirection: "row",
|
||||||
|
borderColor: "black",
|
||||||
|
borderWidth: 1,
|
||||||
|
margin: 10,
|
||||||
|
borderRadius: 5,
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
|
onPress={() => navigate("menu")}
|
||||||
|
>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<MaterialCommunityIcons name="close" color="black" size={30} />
|
||||||
|
<Text style={{ fontSize: 25, fontWeight: "bold", color: "black" }}>
|
||||||
|
閉じる
|
||||||
|
</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
</TouchableOpacity>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user