Compare commits

...

62 Commits

Author SHA1 Message Date
harukin-expo-dev-env
2c2e61a2fa Merge commit '6d3e6623a0774cb489efa3b81335db319fad2b2d' 2024-10-31 12:27:16 +00:00
harukin-expo-dev-env
6d3e6623a0 Merge commit '2047df93092fd2f3f3a4c8644b7784cc2906c388' into patch/5.0.x 2024-10-31 12:26:23 +00:00
harukin-expo-dev-env
2047df9309 リリース用封印 2024-10-31 12:26:15 +00:00
harukin-expo-dev-env
4507c0ef2a 5.5 release バージョンコード変更 2024-10-31 12:26:07 +00:00
harukin-expo-dev-env
50c3329793 細かいバグ修正 2024-10-25 14:06:08 +00:00
harukin-expo-dev-env
b302df4664 サンポート表記を追加 2024-10-25 14:05:58 +00:00
harukin-expo-dev-env
5a062351e3 一部状況によって通過駅がしまえなくなるバグを修正 2024-10-25 10:09:25 +00:00
harukin-expo-dev-env
40cb1f3251 優先順位変更 2024-10-24 18:08:33 +00:00
harukin-expo-dev-env
72158d6d33 Merge commit '9a458096a2f5272da870be9d6e45468860733179' into develop 2024-10-24 17:23:33 +00:00
harukin-expo-dev-env
9a458096a2 70,72の運用を追加 2024-10-24 17:23:13 +00:00
harukin-expo-dev-env
8fe24cca7c Merge commit '135bb79bf6f48c00d0465b3bd73e6455f7be64be' into patch/5.0.x 2024-10-24 17:22:39 +00:00
harukin-expo-dev-env
135bb79bf6 Merge commit '681f4d625ffdfedfc99b1d761f9880b908cc9ade' into develop 2024-10-24 17:22:02 +00:00
harukin-expo-dev-env
681f4d625f 設定機能の調整 2024-10-24 17:21:50 +00:00
harukin-expo-dev-env
8dbae5c66b 値調整 2024-10-23 14:30:47 +00:00
harukin-expo-dev-env
17239f3305 Merge commit 'fce255a75d338ccd896b40cdc7ff1893ded781f6' into feature/train-position-jump 2024-10-23 11:51:23 +00:00
harukin-expo-dev-env
fce255a75d Merge commit 'df71333d2cdc1f50d31208fa83d6487c942fe53d' into develop 2024-10-23 11:49:11 +00:00
harukin-expo-dev-env
df71333d2c 545Mがクラッシュするバグを修正 2024-10-23 11:48:54 +00:00
harukin-expo-dev-env
eeb3993c71 cssの調整 2024-10-23 08:00:09 +00:00
harukin-expo-dev-env
6440cff928 動作原理を修正 2024-10-23 07:48:05 +00:00
harukin-expo-dev-env
40b7437c87 アイコン発動条件整理 2024-10-23 07:37:20 +00:00
harukin-expo-dev-env
bd1ea0857c 現在地ジャンプ機能を実装 2024-10-23 07:00:33 +00:00
harukin-expo-dev-env
54f3974527 Merge commit 'c2c23d85fb08c2cf872b195f7f74d0de497430b9' into develop 2024-10-20 13:24:48 +00:00
harukin-expo-dev-env
c2c23d85fb テキスト追加 2024-10-20 13:15:30 +00:00
harukin-expo-dev-env
8726cf35b9 列車位置アイコンを修正 2024-10-20 12:21:35 +00:00
harukin-expo-dev-env
b6ba770a8a 列車アイコンの位置を変更 2024-10-19 15:00:08 +00:00
harukin-expo-dev-env
64d56d3df6 当たり判定を調整 2024-10-19 13:36:17 +00:00
harukin-expo-dev-env
bc8a786db7 通過ボタンのデザイン修正 2024-10-19 13:27:49 +00:00
harukin-expo-dev-env
6a8bdba849 レに変更 2024-10-19 12:57:58 +00:00
harukin-expo-dev-env
a9dddfca2c 通過表示のオンオフを実装 2024-10-19 12:54:32 +00:00
harukin-expo-dev-env
86655f5632 通過駅情報を追加 2024-10-19 12:08:55 +00:00
harukin-expo-dev-env
c224025c52 Merge commit 'ad0fb095951d05c552dd82c443c7cdd5033ca7d8' into develop 2024-10-19 04:06:49 +00:00
harukin-expo-dev-env
ad0fb09595 Merge commit 'ce82d48a7e5aae41d4f38654d5777af1778bb39b' into patch/5.0.x 2024-10-19 04:05:40 +00:00
harukin-expo-dev-env
8519a6d273 お気に入りを操作したときにクラッシュするバグを修正 2024-10-19 04:04:24 +00:00
harukin-expo-dev-env
ce82d48a7e Merge commit 'ddcc5f053b153d24966e44bc0657852eef96534e' into develop 2024-10-19 02:46:14 +00:00
harukin-expo-dev-env
ddcc5f053b fix 2024-10-19 02:46:07 +00:00
harukin-expo-dev-env
9046017df5 Merge commit '84dbd0cc59c8d696abbaa41f1c47a3d9310b9a1c' into develop 2024-10-19 02:41:48 +00:00
harukin-expo-dev-env
84dbd0cc59 Merge commit '5b1b5a029b1680900de0944ec599a8fd65a30913' into patch/5.0.x 2024-10-19 02:41:40 +00:00
harukin-expo-dev-env
5b1b5a029b お気に入り駅のドット表示機能を追加 2024-10-19 02:41:34 +00:00
harukin-expo-dev-env
85e2fa240a Merge commit '199d41fd833010478591628947044f3d9cd096ca' into develop 2024-10-17 16:12:48 +00:00
harukin-expo-dev-env
199d41fd83 クエリの追加 2024-10-17 16:12:36 +00:00
harukin-expo-dev-env
7c6ef56ecb Merge commit 'd119c976eb06857e3965f0762be8acc73c8211d4' into feature/platform-number-view 2024-10-17 11:55:31 +00:00
harukin-expo-dev-env
d119c976eb Merge commit '5c1a23306c458a3cba36d9b05f59b85515c3e34d' into develop 2024-10-17 11:52:33 +00:00
harukin-expo-dev-env
5c1a23306c Merge commit 'b41c02ca76e1ca694a02e23fa2e364c8fb5201d9' into patch/5.0.x 2024-10-17 11:52:25 +00:00
harukin-expo-dev-env
b41c02ca76 現在地テキスト表示関連の機能を統合化 2024-10-17 11:52:17 +00:00
harukin-expo-dev-env
bf7e113862 散歩をLEDに表示できるように修正 2024-10-16 07:32:13 +00:00
harukin-expo-dev-env
e1414eef06 Merge commit '0a14cfc9f7ccf9eaf232a5c7dd1699511b272c28' into patch/5.0.x 2024-10-14 13:19:31 +00:00
harukin-expo-dev-env
0a14cfc9f7 typo 2024-10-04 04:48:51 +00:00
harukin-expo-dev-env
83bfe00ba0 土讃線の普通列車情報を追加 2024-10-03 10:21:55 +00:00
harukin-expo-dev-env
994c99df51 Merge commit '91ebec6040d07454aa1d784e5fb3b1bd4b3ced2c' into feature/platform-number-view 2024-09-30 13:46:08 +00:00
harukin-expo-dev-env
91ebec6040 Merge commit '1346909bb74c80bedf1841aefda66a67adb98443' into develop 2024-09-30 12:59:49 +00:00
harukin-expo-dev-env
8dff8c1510 Merge commit 'bb1d173160570a664d83ccaa057dceb53a717227' into feature/platform-number-view 2024-09-28 20:44:03 +00:00
harukin-expo-dev-env
bb1d173160 Merge commit 'ab2a18b562c5fe18087f3140449fc7764b969df6' into develop 2024-09-28 20:43:54 +00:00
harukin-expo-dev-env
9f4f8eb2c4 Merge commit '540225d04d4fa8fcf27485a2c327f41ff208ef4f' into feature/platform-number-view 2024-09-20 15:19:03 +00:00
harukin-expo-dev-env
540225d04d Merge commit '9b91c4a50e1df914f66c6c5b33007caf4b0c9c32' into develop 2024-09-20 15:14:37 +00:00
harukin-expo-dev-env
2538b49399 Merge commit '248f621605a0fba70b44f8c2c4f0f974bcc6cb77' into feature/platform-number-view 2024-09-16 16:34:23 +00:00
harukin-expo-dev-env
248f621605 Merge commit '63209ac88878f70d0896dca429277d09ef1bf492' into develop 2024-09-16 16:33:57 +00:00
harukin-expo-dev-env
ddd33a8b18 Merge commit 'b2d85e29345653a0240bdb4062c302b3a442be00' into feature/platform-number-view 2024-09-16 16:31:41 +00:00
harukin-expo-dev-env
b2d85e2934 Merge commit 'c9a90809c6b178d5b85d51d47521d2541bbed7f6' into develop 2024-09-16 16:31:25 +00:00
harukin-expo-dev-env
96fa5275fc Merge commit '0c5cc7d27805d19373b7296a1777cd97d8d4e9d2' into feature/platform-number-view 2024-09-16 16:11:02 +00:00
harukin-expo-dev-env
0c5cc7d278 Merge commit '30393c0fd4b6d07cb1e5ef73a02aa320f8f8fbb3' into develop 2024-09-16 16:07:51 +00:00
harukin-expo-dev-env
30393c0fd4 Revert "release向け封印"
This reverts commit c56a1961a7.
2024-09-16 16:07:39 +00:00
harukin-expo-dev-env
6653cbf65a 番線表示機能開発開始 2024-09-16 14:35:46 +00:00
19 changed files with 893 additions and 204 deletions

View File

@ -1,5 +1,5 @@
export default [
{"Station_JP" : "徳島", "Station_EN" : "Tokushima", "MyStation" : "0", "StationNumber" : "T00", "DispNum" : "3", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/tokushima.pdf", "StationMap":"https://www.google.co.jp/maps/place/34.074642,134.550764", "JrHpUrl" : "http://www.jr-shikoku.co.jp/01_trainbus/kakueki/tokushima/"},
{"Station_JP" : "徳島", "Station_EN" : "Tokushima", "MyStation" : "0", "StationNumber" : "B00", "DispNum" : "3", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/tokushima.pdf", "StationMap":"https://www.google.co.jp/maps/place/34.074642,134.550764", "JrHpUrl" : "http://www.jr-shikoku.co.jp/01_trainbus/kakueki/tokushima/"},
{"Station_JP" : "佐古", "Station_EN" : "Sako", "MyStation" : "0", "StationNumber" : "B01", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/sako.pdf", "StationMap":"https://www.google.co.jp/maps/place/34.080616,134.538576", "JrHpUrl" : ""},
{"Station_JP" : "蔵本", "Station_EN" : "Kuramoto", "MyStation" : "1", "StationNumber" : "B02", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/kuramoto.pdf", "StationMap":"https://www.google.co.jp/maps/place/34.079332,134.518705", "JrHpUrl" : ""},
{"Station_JP" : "府中", "Station_EN" : "Kō", "MyStation" : "2", "StationNumber" : "B04", "DispNum" : "2", "StationTimeTable" : "http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/ko.pdf", "StationMap":"https://www.google.co.jp/maps/place/34.074134,134.482939", "JrHpUrl" : ""},

View File

@ -10,7 +10,9 @@ export const EachStopList = ({
points,
currentTrainData,
openStationACFromEachTrainInfo,
showThrew,
}) => {
if (!showThrew && i.split(",")[1] == "通過") return null;
const [station, se, time] = i.split(","); // 阿波池田,発,6:21
const Stations = stationList
.map((a) => a.filter((d) => d.StationName == station))
@ -43,7 +45,7 @@ export const EachStopList = ({
.set("hour", parseInt(time.split(":")[0]))
.set("minute", parseInt(time.split(":")[1]))
.add(isNaN(currentTrainData?.delay) ? 0 : currentTrainData.delay, "minute");
const timeString = dates.format("HH:mm").split(":");
const timeString = se == "通過" ? "" : dates.format("HH:mm").split(":");
return (
<TouchableWithoutFeedback
@ -66,7 +68,9 @@ export const EachStopList = ({
{lineIDs.map((lineID, index) => (
<View
style={{
backgroundColor: lineColorList[lineID],
backgroundColor: `${lineColorList[lineID]}${
se == "通過" ? "80" : ""
}`,
flex: 1,
}}
key={lineID}
@ -97,11 +101,20 @@ export const EachStopList = ({
flex: 1,
}}
>
<Text style={{ fontSize: 20 }}>{station}</Text>
<Text
style={{ fontSize: 20, color: `#000${se == "通過" ? "5" : ""}` }}
>
{station}
</Text>
<View style={{ flex: 1 }} />
{points && points.findIndex((d) => d == index) >= 0 ? (
<Text style={{ fontSize: 20, marginRight: 70 }}>🚊</Text>
<View style={{ position: "relative", width: 0 }}>
{points ? (
<Text style={{ fontSize: 20, position: "absolute", left: -60 }}>
🚊
</Text>
) : null}
</View>
{!isNaN(currentTrainData?.delay) && currentTrainData?.delay != 0 && (
<Text
style={{
@ -128,7 +141,7 @@ export const EachStopList = ({
width: 60,
}}
>
{timeString[0]}:{timeString[1]}
{se == "通過" ? "レ" : `${timeString[0]}:${timeString[1]}`}
</Text>
<Text style={{ fontSize: 18, width: 50 }}>
{se?.replace("発", "出発").replace("着", "到着")}

View File

@ -1,7 +1,8 @@
import React from "react";
import { View, Text } from "react-native";
import { View, Text, LayoutAnimation, TouchableOpacity } from "react-native";
export const ScrollStickyContent = ({ currentTrainData }) => {
export const ScrollStickyContent = (props) => {
const { currentTrainData, showThrew, setShowThrew, haveThrough } = props;
return (
<View
style={{
@ -49,7 +50,32 @@ export const ScrollStickyContent = ({ currentTrainData }) => {
>
見込
</Text>
<Text style={{ fontSize: 20, width: 50 }}></Text>
<TouchableOpacity
onPress={() => {
if (!haveThrough) return;
LayoutAnimation.configureNext({
duration: 200,
update: { type: "easeInEaseOut", springDamping: 0.6 },
});
setShowThrew(!showThrew);
}}
>
<View style={{ flex: 1 }} />
<Text
style={{
fontSize: 12,
width: 50,
paddingBottom: 0,
margin: "auto",
textAlign: "center",
textAlignVertical: "center",
opacity: haveThrough ? 1 : 0,
}}
>
(通過{showThrew ? "▼" : "▶"})
</Text>
<View style={{ flex: 1 }} />
</TouchableOpacity>
</View>
</View>
</View>

View File

@ -5,6 +5,7 @@ import { useDeviceOrientationChange } from "../../../stateBox/useDeviceOrientati
import { getStationList2 } from "../../../lib/getStationList2";
import { useCurrentTrain } from "../../../stateBox/useCurrentTrain";
import { SheetManager } from "react-native-actions-sheet";
import { trainPosition } from "../../../lib/trainPositionTextArray";
export const TrainDataView = ({
currentTrainData,
@ -16,12 +17,17 @@ export const TrainDataView = ({
}) => {
const { width, height } = useWindowDimensions();
const { isLandscape } = useDeviceOrientationChange();
const { webview, getCurrentTrain, inject } = useCurrentTrain();
const { inject } = useCurrentTrain();
const [mapsStationData, setMapsStationData] = useState(undefined);
useEffect(() => {
getStationList2().then(setMapsStationData);
}, []);
const onLine = !!currentPosition?.toString().length;
const trainPositionText = (trainData) => {
const { isBetween, Pos } = trainPosition(trainData);
if (isBetween === true) return `${Pos.from}${Pos.to}`;
else return Pos.Pos == "" ? "" : `${Pos.Pos}`;
};
return (
<View
style={{
@ -60,19 +66,7 @@ export const TrainDataView = ({
<StateBox
mode={mode}
title={`現在地 ${currentPosition?.toString()}${onLine ? "▶️" : ""}`}
text={
currentTrainData?.Pos.match("")
? `${
currentTrainData?.Pos.replace("(下り)", "")
.replace("(上り)", "")
.split("")[currentTrainData?.Direction == 1 ? 0 : 1]
}${
currentTrainData?.Pos.replace("(下り)", "")
.replace("(上り)", "")
.split("")[currentTrainData?.Direction == 1 ? 1 : 0]
}`
: currentTrainData?.Pos
}
text={trainPositionText(currentTrainData)}
style={
onLine
? { borderWidth: 1, borderColor: "red", borderStyle: "solid" }

View File

@ -1,4 +1,4 @@
import React, { useEffect, useMemo, useState } from "react";
import React, { useEffect, useMemo, useRef, useState } from "react";
import {
View,
Text,
@ -7,11 +7,12 @@ import {
useWindowDimensions,
BackHandler,
Linking,
LayoutAnimation,
} from "react-native";
import { SheetManager } from "react-native-actions-sheet";
import { AS } from "../../storageControl";
import trainList from "../../assets/originData/trainList";
import { lineList } from "../../lib/getStationList";
import { lineList, lineListPair } from "../../lib/getStationList";
import { useCurrentTrain } from "../../stateBox/useCurrentTrain";
import { checkDuplicateTrainData } from "../../lib/checkDuplicateTrainData";
import { getTrainType } from "../../lib/getTrainType";
@ -34,6 +35,7 @@ import { ShowSpecialTrain } from "./EachTrainInfo/ShowSpecialTrain";
import { useTrainMenu } from "../../stateBox/useTrainMenu";
import { HeaderText } from "./EachTrainInfoCore/HeaderText";
import { useStationList } from "../../stateBox/useStationList";
import { stationIDPair } from "../../lib/getStationList2";
export const EachTrainInfoCore = ({
actionSheetRef,
@ -80,6 +82,9 @@ export const EachTrainInfoCore = ({
const [trainPositionSwitch, setTrainPositionSwitch] = useState("false");
const [currentPosition, setCurrentPosition] = useState([]);
const [trainData, setTrainData] = useState([]);
const [trainDataWidhThrough, setTrainDataWithThrough] = useState([]);
const [showThrew, setShowThrew] = useState(false);
const [haveThrough, setHaveThrough] = useState(false);
const stationList =
originalStationList &&
@ -91,7 +96,7 @@ export const EachTrainInfoCore = ({
);
// 使用例
const stopStationIDList = trainData.map((i) => {
const stopStationIDList = trainDataWidhThrough.map((i) => {
const [station, se, time] = i.split(",");
const Stations = stationList.map((a) =>
a.filter((d) => d.StationName == station)
@ -100,15 +105,103 @@ export const EachTrainInfoCore = ({
Stations &&
Stations.reduce((newArray, e) => {
return newArray.concat(e);
}, [])
.filter((d) => d.StationNumber)
.map((d) => d.StationNumber);
return StationNumbers[0];
}, []).map((d) => d.StationNumber);
return StationNumbers;
});
useEffect(() => {
const stopStationList = trainData.map((i) => {
const [station, se, time] = i.split(",");
return stationList.map((a) => a.filter((d) => d.StationName == station));
});
const allThroughStationList = stopStationList.map((i, index, array) => {
let allThroughStation = [];
if (index == array.length - 1) return;
const firstItem = array[index];
const secondItem = array[index + 1];
let betweenStationLine = "";
let baseStationNumberFirst = "";
let baseStationNumberSecond = "";
Object.keys(stationIDPair).forEach((d, index2, array) => {
if (!d) return;
const haveFirst = firstItem[index2];
const haveSecond = secondItem[index2];
if (haveFirst.length && haveSecond.length) {
betweenStationLine = d;
baseStationNumberFirst = haveFirst[0].StationNumber;
baseStationNumberSecond = haveSecond[0].StationNumber;
}
});
if (!betweenStationLine) return;
let reverse = false;
originalStationList[
lineListPair[stationIDPair[betweenStationLine]]
].forEach((d) => {
if (
d.StationNumber > baseStationNumberFirst &&
d.StationNumber < baseStationNumberSecond
) {
allThroughStation.push(`${d.Station_JP},通過,`);
setHaveThrough(true);
reverse = false;
} else {
if (
d.StationNumber < baseStationNumberFirst &&
d.StationNumber > baseStationNumberSecond
) {
allThroughStation.push(`${d.Station_JP},通過,`);
setHaveThrough(true);
reverse = true;
}
}
});
if (reverse) allThroughStation.reverse();
return allThroughStation;
});
let mainArray = [...trainData];
let indexs = 0;
trainData.forEach((d, index, array) => {
indexs = indexs + 1;
if (!allThroughStationList[index]) return;
if (allThroughStationList[index].length == 0) return;
mainArray.splice(indexs, 0, ...allThroughStationList[index]);
indexs = indexs + allThroughStationList[index].length;
});
setTrainDataWithThrough(mainArray);
}, [trainData]);
const points =
trainPositionSwitch == "true"
? findReversalPoints(currentPosition, stopStationIDList)
: [];
: stopStationIDList.map(() => false);
const [isJumped, setIsJumped] = useState(false);
useEffect(() => {
if (isJumped) return () => {};
if (!points) return () => {};
if (points.length == 0) return () => {};
const position = points.findIndex((d) => d == true);
let isThrew = false;
if (position == -1) return () => {};
if (trainDataWidhThrough[position].split(",")[1] == "通過") {
LayoutAnimation.configureNext({
duration: 400,
update: { type: "easeInEaseOut", springDamping: 0.6 },
});
setShowThrew(true);
isThrew = true;
}
if (position < 5) {
} // 5駅以内の場合はスクロールしない
else {
const count = position * 44 - 50;
// 0.5秒待機してからスクロール
setTimeout(
() => ScrollViewRef.current?.scrollTo({ y: count, animated: true }),
400
);
}
setIsJumped(true);
}, [points]);
const trainName = useMemo(() => {
if (!data.limited) return "";
const limitedArray = data.limited.split(":");
@ -134,6 +227,7 @@ export const EachTrainInfoCore = ({
const { height } = useWindowDimensions();
const { isLandscape } = useDeviceOrientationChange();
const ScrollViewRef = useRef();
const [trueTrainID, setTrueTrainID] = useState();
useEffect(() => {
@ -193,9 +287,41 @@ export const EachTrainInfoCore = ({
if (currentTrainData?.Pos.match("")) {
const pos = currentTrainData?.Pos.replace("(下り)", "")
.replace("(上り)", "")
.replace("(徳島線)", "")
.replace("(高徳線)", "")
.split("");
const direction = parseInt(currentTrainData?.Direction) || 0;
if (direction == 0) {
if (pos[0] == "児島" && pos[1] == "宇多津") {
setCurrentPosition(["M12", "Y09"]);
return;
} else if (pos[1] == "児島" && pos[0] == "宇多津") {
setCurrentPosition(["Y09", "M12"]);
return;
}
const currentPosID = Object.keys(originalStationList).map((key) => {
let firstStation = false;
let firstStationID = "";
let secondStation = false;
let secondStationID = "";
originalStationList[key].forEach((station) => {
if (station.Station_JP === pos[0]) {
firstStation = true;
firstStationID = station.StationNumber;
}
if (station.Station_JP === pos[1]) {
secondStation = true;
secondStationID = station.StationNumber;
}
});
if (firstStation && secondStation) {
return [firstStationID, secondStationID];
} else return false;
});
const currentPos = currentPosID.filter((d) => d != false)[0];
if (currentPos) {
if (direction == 0) setCurrentPosition(currentPos.reverse());
else setCurrentPosition(currentPos);
} else if (direction == 0) {
setCurrentPosition([
getStationID(pos[1], stationList),
getStationID(pos[0], stationList),
@ -293,6 +419,7 @@ export const EachTrainInfoCore = ({
from={from}
styles={styles}
actionSheetRef={actionSheetRef}
ScrollViewRef={ScrollViewRef}
containerProps={{
style: {
maxHeight: isLandscape ? height - 94 : (height / 100) * 70,
@ -301,7 +428,9 @@ export const EachTrainInfoCore = ({
shortHeader={<ShortHeader {...headerItem} />}
longHeader={<LongHeader {...headerItem} />}
topStickyContent={
<ScrollStickyContent currentTrainData={currentTrainData} />
<ScrollStickyContent
{...{ currentTrainData, showThrew, setShowThrew, haveThrough }}
/>
}
>
{headStation.length != 0 &&
@ -360,17 +489,20 @@ export const EachTrainInfoCore = ({
</Text>
</TouchableOpacity>
)}
{trainData.map((i, index) =>
{trainDataWidhThrough.map((i, index) =>
i.split(",")[1] == "提" ? (
<DataFromButton i={i} />
) : (
<EachStopList
i={i}
index={index}
stationList={stationList}
points={points}
currentTrainData={currentTrainData}
openStationACFromEachTrainInfo={openStationACFromEachTrainInfo}
{...{
i,
index,
stationList,
points: points ? points[index] : false,
currentTrainData,
openStationACFromEachTrainInfo,
showThrew,
}}
/>
)
)}

View File

@ -13,14 +13,13 @@ export const DynamicHeaderScrollView = (props) => {
topStickyContent,
styles,
from,
ScrollViewRef,
} = props;
const [headerSize, setHeaderSize] = useState("default");
useLayoutEffect(() => {
AS.getItem("headerSize")
.then((res) => {
if (res) {
setHeaderSize(res);
}
if (res) setHeaderSize(res);
})
.catch((e) => {
AS.setItem("headerSize", "default");
@ -160,6 +159,7 @@ export const DynamicHeaderScrollView = (props) => {
stickyHeaderIndices={[1]}
scrollEventThrottle={16}
onScroll={onScroll}
ref={ScrollViewRef}
>
<View style={{ height: Scroll_Distance, flexDirection: "column" }} />
{topStickyContent && (

View File

@ -0,0 +1,167 @@
import React, { FC, useState } from "react";
import { View, Text, TouchableOpacity } from "react-native";
import { Pagination } from "react-native-snap-carousel";
import { useInterval } from "../../lib/useInterval";
import lineColorList from "../../assets/originData/lineColorList";
type StationProps = {
DispNum: string;
JrHpUrl: string;
MyStation: string;
StationMap: string;
StationNumber: string | null;
StationTimeTable: string;
Station_EN: string;
Station_JP: string;
jslodApi: string;
lat: number;
lng: number;
};
type StationPaginationProps = {
entries: StationProps[][];
activeSlide: number;
carouselRef: any;
setSelectedCurrentStation: React.Dispatch<React.SetStateAction<number>>;
dotButton: boolean;
};
export const Paginations: FC<StationPaginationProps> = (props) => {
const {
entries,
activeSlide,
carouselRef,
setSelectedCurrentStation,
dotButton,
} = props;
return (
<Pagination
dotsLength={entries.length}
activeDotIndex={activeSlide}
carouselRef={carouselRef}
containerStyle={{ paddingVertical: 0 }}
dotStyle={{
width: 12,
height: 12,
borderRadius: 6,
backgroundColor: "#0099CC",
}}
inactiveDotStyle={
{
// Define styles for inactive dots here
}
}
tappableDots={true}
inactiveDotOpacity={0.4}
inactiveDotScale={0.8}
inactiveDotElement={
dotButton && (
<StationNumberMaker
currentStations={entries}
setSelectedCurrentStation={setSelectedCurrentStation}
/>
)
}
dotElement={
dotButton && (
<StationNumberMaker
currentStations={entries}
setSelectedCurrentStation={setSelectedCurrentStation}
/>
)
}
/>
);
};
type StationNumberMakerProps = {
currentStations: StationProps[][];
setSelectedCurrentStation: React.Dispatch<React.SetStateAction<number>>;
active?: boolean;
index?: number;
};
export const StationNumberMaker: FC<StationNumberMakerProps> = (props) => {
const { currentStations, active, index, setSelectedCurrentStation } = props;
return (
<StationNumber
currentStation={currentStations[index]}
active={active}
onPress={() => setSelectedCurrentStation(index)}
key={currentStations[index][0].StationNumber}
/>
);
};
type StationNumberProps = {
currentStation: StationProps[];
active: boolean;
onPress: () => void;
};
export const StationNumber: FC<StationNumberProps> = (props) => {
const { currentStation, active, onPress } = props;
const [animation, setAnimation] = useState(0);
const data = currentStation.filter((d) => (d.StationNumber ? true : false));
useInterval(() => {
if (!data) return;
setAnimation(animation + 1 < data.length ? animation + 1 : 0);
}, 2000);
const lineID = data[animation].StationNumber.slice(0, 1);
const lineName = data[animation].StationNumber.slice(1);
const size = active ? 24 : 18;
const margin = active ? 3 : 6;
const border = active ? 2 : 1;
return (
<>
{active && (
<View style={{ position: "relative", width: 0, height: 0 }}>
<View
style={{
flex: 1,
position: "absolute",
width: 28,
height: 28,
marginLeft: 1,
marginRight: 1,
borderRadius: 22,
borderColor: "black",
borderWidth: 2,
left: 0,
top: -14,
}}
/>
</View>
)}
<TouchableOpacity
onPress={onPress}
style={{
alignContent: "center",
alignItems: "center",
width: size,
height: size,
marginLeft: margin,
marginRight: margin,
borderColor: lineColorList[lineID],
backgroundColor: "white",
borderWidth: border,
borderRadius: 22,
}}
key={currentStation[0].StationNumber + lineID}
>
<View style={{ flex: 1 }} />
<Text
style={{
fontSize: active ? 8 : 6,
margin: 0,
padding: 0,
textAlign: "center",
color: "black",
fontWeight: active ? "bold" : "normal",
textAlignVertical: "center",
}}
>
{lineID + "\n" + lineName}
</Text>
<View style={{ flex: 1 }} />
</TouchableOpacity>
</>
);
};

View File

@ -131,7 +131,7 @@ export const LayoutSettings = ({
bool={trainPosition}
setBool={setTrainPosition}
color="red"
str="列車の現在位置をアイコン表示"
str="列車の現在地表示/ジャンプ"
/>
</SwitchArea>
</View>

View File

@ -12,7 +12,7 @@ import * as Updates from "expo-updates";
import { useWindowDimensions } from "react-native";
import { ListItem } from "native-base";
const versionCode = "5.4.1";
const versionCode = "5.5";
export const SettingTopPage = ({ navigate, testNFC, updateAndReload }) => {
const { width } = useWindowDimensions();

View File

@ -10,6 +10,8 @@ import { DependTime } from "./LED_inside_Component/DependTime";
import { LastStation } from "./LED_inside_Component/LastStation";
import { StatusAndDelay } from "./LED_inside_Component/StatusAndDelay";
import { TrainName } from "./LED_inside_Component/TrainName";
import { customTrainDataDetector } from "../custom-train-data";
import { trainDataType, trainPosition } from "../../lib/trainPositionTextArray";
type Props = {
d: {
@ -22,12 +24,6 @@ type Props = {
station: {
Station_JP: string;
};
customTrainDataDetector: (trainID: string) => {
trainName: string;
trainNumDistance?: number;
type: string;
info: string;
};
navigate: (screen: string, data?: any) => void;
openStationACFromEachTrainInfo: (station: string) => void;
};
@ -37,7 +33,6 @@ export const EachData: FC<Props> = (props) => {
trainIDSwitch,
trainDescriptionSwitch,
station,
customTrainDataDetector,
navigate,
openStationACFromEachTrainInfo,
} = props;
@ -69,9 +64,28 @@ export const EachData: FC<Props> = (props) => {
payload,
});
};
const [train, setTrain] = useState(customTrainDataDetector(d.train));
const getTrainDataFromCurrentTrain = (trainNum: string) => {
const customTrainData = customTrainDataDetector(d.train);
if (customTrainData.type != "Normal") return customTrainData;
const currentTrainData = currentTrain.filter((a) => a.num == trainNum);
if (currentTrainData.length == 0) return customTrainData;
else if (currentTrainData[0].Type.includes("rapid:")) {
const typeText = currentTrainData[0].Type.split(":");
const returnData = {
type: "Rapid",
trainName: typeText[1].replace("\r", ""),
trainIcon: null,
trainNumDistance: null,
info: "",
};
return returnData;
}
return customTrainData;
};
const [train, setTrain] = useState(getTrainDataFromCurrentTrain(d.train));
useEffect(() => {
setTrain(customTrainDataDetector(d.train));
setTrain(getTrainDataFromCurrentTrain(d.train));
}, [currentTrain, d.train, trainDescriptionSwitch]);
// 土讃線複数存在対策
const currentTrainData = checkDuplicateTrainData(
@ -81,17 +95,27 @@ export const EachData: FC<Props> = (props) => {
currentTrainData,
station.Station_JP
)}`;
const trainPositionText = currentTrainData?.Pos.match("")
? `現在地:${
currentTrainData?.Pos.replace("(下り)", "")
.replace("(上り)", "")
.split("")[currentTrainData?.Direction == 1 ? 0 : 1]
}${
currentTrainData?.Pos.replace("(下り)", "")
.replace("(上り)", "")
.split("")[currentTrainData?.Direction == 1 ? 1 : 0]
}`
: `現在地:${currentTrainData?.Pos}`;
const trainPositionText = (trainData: trainDataType) => {
const { isBetween, Pos } = trainPosition(trainData);
if (isBetween === true) return `現在地:${Pos.from}${Pos.to}間を走行中`;
else return Pos.Pos == "" ? "" : `現在地:${Pos.Pos}`;
};
const [platformNumber, setPlatformNumber] = useState<number>();
const [platformDescription, setPlatformDescription] = useState<string>();
useEffect(() => {
fetch(
`https://n8n.haruk.in/webhook/JR-shikoku-PosID?PosNum=${currentTrainData?.PosNum}&Line=${currentTrainData?.Line}`
)
.then((res) => res.json())
.then((data) => {
setPlatformNumber(data?.type == "Station" ? data?.platform : undefined);
setPlatformDescription(
data?.type == "Station" ? data?.description : undefined
);
});
}, [currentTrainData, currentTrain]);
return (
<>
<TouchableOpacity
@ -120,7 +144,11 @@ export const EachData: FC<Props> = (props) => {
{trainDescriptionSwitch && (
<Description
info={`${
trainIDSwitch ? currentTrainData?.PosNum : trainPositionText
trainIDSwitch
? currentTrainData?.PosNum + currentTrainData?.Line
: trainPositionText(currentTrainData)
} ${platformNumber ? platformNumber + "番線" : ""} ${
platformDescription ? "("+platformDescription+")" : ""
}`}
onLongClick={() => {
Linking.openURL(

View File

@ -1,7 +1,6 @@
import React, { useState, useEffect } from "react";
import { View } from "react-native";
import { widthPercentageToDP as wp } from "react-native-responsive-screen";
import { customTrainDataDetector } from "../custom-train-data";
import { useInterval } from "../../lib/useInterval";
import { objectIsEmpty } from "../../lib/objectIsEmpty";
import { useCurrentTrain } from "../../stateBox/useCurrentTrain";
@ -203,7 +202,6 @@ export default function LED_vision(props) {
d,
trainIDSwitch,
trainDescriptionSwitch,
customTrainDataDetector,
navigate,
openStationACFromEachTrainInfo,
}}

View File

@ -1 +1 @@
export const news = "2024-9-29";
export const news = "2024-11-01";

View File

@ -1,4 +1,6 @@
export const checkDuplicateTrainData = (currentTrainArray) => {
import { trainDataType } from "./trainPositionTextArray";
export const checkDuplicateTrainData = (currentTrainArray: trainDataType[]) => {
const notNyujoData = currentTrainArray.filter((d) => d.delay !== "入線");
if (currentTrainArray.length == 1) return currentTrainArray[0];
if (notNyujoData.length == 0) return currentTrainArray[0];

View File

@ -7,105 +7,43 @@ export const findReversalPoints = (array, stopStationIDList) => {
if (!array instanceof Array) return [];
if (!array) return [];
if (array[0] instanceof Array) 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];
}
}
}
const index = stopStationIDList.map((d) => {
let a = false;
d.forEach((x) => {
if (x == array[0]) a = true;
});
return a;
});
if (index != -1) return index;
}
// 駅間の場合
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];
}
const allThroughStation = stopStationIDList.map((d) => {
if (
(array[0] == "M12" && array[1] == "Y09") ||
(array[0] == "Y09" && array[1] == "M12")
)
return d[0] == "M12" ? true : false;
// 通過駅の場合
let returndata = false;
d.forEach((x) => {
if (array[0] < x && x < array[1]) {
returndata = true;
} else if (array[0] < x && x == array[1]) {
returndata = true;
} else if (array[1] == x && x < array[0]) {
returndata = true;
} else if (array[1] < x && x < array[0]) {
returndata = true;
}
});
return [];
return returndata;
});
return allThroughStation;
}
} catch (e) {
console.log(e);

View File

@ -1,5 +1,7 @@
import { trainDataType } from "./trainPositionTextArray";
type getTrainDelayStatus = (
current: { delay: number | "入線" | string; Pos: string },
current: trainDataType,
Station_JP: string
) => string | number;
export const getTrainDelayStatus: getTrainDelayStatus = (

View File

@ -0,0 +1,39 @@
type returnBetweenType = {
isBetween: true;
Pos: {
from: string;
to: string;
};
};
type returnCurrentType = {
isBetween: false;
Pos: {
Pos: string;
};
};
export type trainDataType = {
Pos?: string;
Direction?: number;
Index?: number;
Line?: string;
PosNum?: number;
Type?: string;
delay?: string | number;
num?: string;
};
type trainData = (
trainData: trainDataType
) => returnBetweenType | returnCurrentType;
export const trainPosition: trainData = (trainData) => {
if (!trainData?.Pos) return { isBetween: false, Pos: { Pos: "" } };
const { Pos, Direction } = trainData;
if (Pos.match("")) {
const [topST, downST] = Pos.replace("(下り)", "")
.replace("(上り)", "")
.split("");
const from = Direction == 1 ? topST : downST;
const to = Direction == 1 ? downST : topST;
return { isBetween: true, Pos: { from, to } };
} else return { isBetween: false, Pos: { Pos } };
};

View File

@ -516,13 +516,341 @@ export const injectJavascriptData: InjectJavascriptData = (
case "114M":
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s6000p.png');
break;
default:
// 土讃線普通列車系統(include ごな線)
// ごな線
case "5851D": //219D併結 [ToDo: 219Dとの分割対策]
case "5854D":
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/tosa9640jgr.png');
break;
//JR車両乗り入れ運用
case "5858D":
case "5869D":
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s1000.png');
break;
//併結運用の併結される側 [ToDo: 分割対策]
case "5845D":
case "5851D":
case "5818D":
case "5820D":
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/tosa9640.png');
break;
// 土讃線単体列車のキハ32運用
case "715D":
case "718D":
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s32ns.png');
break;
// サンライズに伴う気動車代走
case "6219D":
case "6222D":
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s1000.png');
break;
// それ以外の土讃線ごな線直通列車
case "5811D":
case "5813D":
case "5815D":
case "5817D":
case "5843D":
case "5853D":
case "5855D":
case "5859D":
case "5861D":
case "5865D":
case "5881D":
case "5885D":
case "5889D":
case "5812D":
case "5814D":
case "5816D":
case "5852D":
case "5856D":
case "5860D":
case "5862D":
case "5872D":
case "5874D":
case "5876D":
case "5880D":
case "5882D":
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/tosa9640.png');
break;
// それ以外の土讃線普通列車(1000)
case "4210D":
case "4212D":
case "4214D":
case "4218D":
case "4220D":
case "4222D":
case "4224D":
case "4226D":
case "4228D":
case "4230D":
case "4232D":
case "4234D":
case "4236D":
case "4238D":
case "4240D":
case "4242D":
case "4244D":
case "4250D":
case "4252D":
case "4254D":
case "4256D":
case "4211D":
case "4221D":
case "4223D":
case "4225D":
case "4227D":
case "4229D":
case "4231D":
case "4235D":
case "4237D":
case "4239D":
case "4241D":
case "4245D":
case "4247D":
case "4249D":
case "4251D":
case "4253D":
case "4255D":
case "4257D":
case "4259D":
case "4261D":
case "4710D":
case "4726D":
case "4730D":
case "4732D":
case "4734D":
case "4738D":
case "4740D":
case "4742D":
case "4744D":
case "4746D":
case "4752D":
case "4756D":
case "4762D":
case "4764D":
case "4766D":
case "4711D":
case "4713D":
case "4723D":
case "4725D":
case "4727D":
case "4729D":
case "4731D":
case "4737D":
case "4739D":
case "4745D":
case "4753D":
case "4755D":
case "4759D":
case "4761D":
case "4763D":
case "216D":
case "238D":
case "246D":
case "248D":
case "213D":
case "215D":
case "217D":
case "219D":
case "233D":
case "243D":
case "710D":
case "712D":
case "714D":
case "716D":
case "720D":
case "722D":
case "724D":
case "728D":
case "736D":
case "748D":
case "750D":
case "754D":
case "758D":
case "760D":
case "768D":
case "717D":
case "719D":
case "721D":
case "733D":
case "735D":
case "737D":
case "741D":
case "743D":
case "747D":
case "749D":
case "751D":
case "755D":
case "757D":
case "761D":
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s1000.png');
break;
// 予讃線/土讃線普通列車運用(7000,7200)
// 下り列車(伊予西条-松山は全て7000系)
case "5519M":
case "5525M":
case "5215M":
case "5103M":
case "107M":
case "1219M":
case "5109M":
case "6109M":
case "5531M":
case "1221M":
case "5225M":
case "5111M":
case "1227M":
case "115M":
case "5229M":
case "5117M":
case "5119M":
case "119M":
case "5231M":
case "4537M":
case "5233M":
case "123M":
case "125M":
case "5235M":
case "5239M":
case "5547M":
case "129M":
case "131M":
case "5241M":
case "5133M":
case "135M":
case "1243M":
case "137M":
case "5139M":
case "4559M":
case "1245M":
case "141M":
case "1247M":
case "5249M":
case "145M":
case "5253M":
case "5149M":
case "5255M":
case "151M":
case "5257M":
case "153M":
case "5259M":
case "155M":
case "1263M":
case "157M":
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7200.png');
break;
// 下り7000系
case "101M":
case "4601M":
case "4113M":
case "121M":
case "127M":
case "555M":
case "4565M":
case "159M":
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7000.png');
break;
// 上り列車 7200系
case "5102M":
case "104M":
case "5210M":
case "5108M":
case "110M":
case "112M":
case "118M":
case "5218M":
case "5120M":
case "5220M":
case "5512M":
case "1602M":
case "1224M":
case "5124M":
case "5226M":
case "5126M":
case "1230M":
case "4128M":
case "130M":
case "4522M":
case "5232M":
case "132M":
case "5234M":
case "134M":
case "136M":
case "5236M":
case "5140M":
case "5238M":
case "5240M":
case "142M":
case "4530M":
case "144M":
case "5242M":
case "146M":
case "5244M":
case "4148M":
case "1246M":
case "150M":
case "5538M":
case "5152M":
case "154M":
case "156M":
case "1252M":
case "158M":
case "4604M":
case "548M":
case "5254M":
case "1606M":
case "5160M":
case "5256M":
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7200.png');
break;
// 上り7000系
case "114M":
case "122M":
case "4138M":
case "138M":
case "4542M":
case "162M":
case "4166M":
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7000.png');
break;
default: //指定車両でなく、Regexでの指定に移動
// 琴平直通系普通電車
if(new RegExp(/^(1|4|5)2\\d\\dM$/).test()){
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7200.png');
break;
}
else if(new RegExp(/^(1|4|5)(1|5|6)\\d\\dM$/).test()){
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7000.png');
break;
}
else if(new RegExp(/^(1|5|6)\\d\\dM$/).test()){
setStationIcon(element.querySelector("img"),'https://storage.haruk.in/s7000.png');
break;
}
break;
}
`
: ``;
const normal_train_name = `
if(.match("サンポート")){
const textBase = .split(":")[1];
.innerText = textBase+.innerText;
}
if(new RegExp(/^4[1-9]\\d\\d[DM]$/).test() || new RegExp(/^5[1-7]\\d\\d[DM]$/).test() || ==="3621D"){
.innerText = "ワンマン\\n"+.innerText;
flag=true;
@ -630,6 +958,7 @@ const setStrings = () =>{
}
var = element.getElementsByTagName("p")[0];
var = element.getAttribute('offclick').split('"')[1];
var = element.getAttribute('offclick').split('"')[3];
var flag=false;
var TrainType = undefined;
setTrainMenuDialog(element)
@ -762,6 +1091,7 @@ makeTrainView.observe(document.getElementById('modal_content'), {
trainMenu == "true"
? `
// これの中身抽出ShowTrainTimeInfo("1228M","normal")
// ShowTrainTimeInfo("142M","rapid:サンポート南風リレー")
function setTrainMenuDialog(d){
try{
const offclick = d.getAttribute('offclick');

34
menu.js
View File

@ -1,5 +1,5 @@
import React, { useRef, useState, useEffect } from "react";
import Carousel from "react-native-snap-carousel";
import Carousel, { Pagination } from "react-native-snap-carousel";
import {
Platform,
View,
@ -7,6 +7,7 @@ import {
Linking,
Text,
TouchableOpacity,
LayoutAnimation,
} from "react-native";
import Constants from "expo-constants";
import * as Location from "expo-location";
@ -31,6 +32,9 @@ import { SheetManager } from "react-native-actions-sheet";
import { useTrainDelayData } from "./stateBox/useTrainDelayData";
import { useNavigation } from "@react-navigation/native";
import { useStationList } from "./stateBox/useStationList";
import { Paginations } from "./components/Menu/StationPagination";
import lineColorList from "./assets/originData/lineColorList";
import { AS } from "./storageControl";
export default function Menu({ getCurrentTrain }) {
const { navigate } = useNavigation();
@ -156,6 +160,24 @@ export default function Menu({ getCurrentTrain }) {
SheetManager.show("StationDetailView", { payload });
};
const [dotButton, setDotButton] = useState(false);
useEffect(() => {
AS.getItem("CarouselSettings/activeDotSettings").then((data) => {
setDotButton(data === "true");
});
}, []);
const oLPSign = () => {
LayoutAnimation.configureNext({
duration: 600,
update: { type: "spring", springDamping: 0.5 },
});
AS.setItem(
"CarouselSettings/activeDotSettings",
!dotButton ? "true": "false"
);
setDotButton(!dotButton);
}
return (
<View
style={{
@ -169,6 +191,7 @@ export default function Menu({ getCurrentTrain }) {
<ScrollView>
<TopMenuButton />
{originalStationList.length != 0 && allStationData.length != 0 && (
<>
<Carousel
ref={carouselRef}
layout={"default"}
@ -189,11 +212,20 @@ export default function Menu({ getCurrentTrain }) {
currentStation={item}
isCurrentStation={item == currentStation}
oP={oPSign}
oLP={oLPSign}
/>
</View>
);
}}
/>
<Paginations
entries={allStationData}
activeSlide={selectedCurrentStation}
carouselRef={carouselRef}
setSelectedCurrentStation={setSelectedCurrentStation}
dotButton={dotButton}
/>
</>
)}
{allStationData.length != 0 &&
originalStationList.length != 0 &&

View File

@ -81,24 +81,12 @@ export const BusAndTrainDataProvider = ({ children }) => {
returnArray.push(Object.keys(trainPairList[trainNum])[0]);
}
switch (trainNum) {
case "4125M":
returnArray.push("545M");
break;
case "545M":
returnArray.push("4125M");
break;
case "143M":
returnArray.push("147M");
break;
case "147M":
returnArray.push("143M");
break;
case "1261M":
returnArray.push("4261M");
break;
case "4261M":
returnArray.push("1261M");
break;
case new RegExp(/^4[1-9]\d\d[DM]$/).test(trainNum):
if (trainList["5" + trainNum.substring(1)])
returnArray.push("5" + trainNum.substring(1));