細かいバグ修正

This commit is contained in:
harukin-expo-dev-env 2024-10-25 14:06:08 +00:00
parent b302df4664
commit 50c3329793
2 changed files with 23 additions and 13 deletions

View File

@ -177,10 +177,10 @@ export const EachTrainInfoCore = ({
const [isJumped, setIsJumped] = useState(false);
useEffect(() => {
if (isJumped) return () => {};
setShowThrew(true);
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({
@ -188,14 +188,18 @@ export const EachTrainInfoCore = ({
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
);
}
if(position < 5) return() => {}; // 5駅以内の場合はスクロールしない
const count = position * 44-50;
// 0.5秒待機してからスクロール
setTimeout(
() => ScrollViewRef.current?.scrollTo({ y: count, animated: true }),
400
);
setIsJumped(true);
}, [points]);
const trainName = useMemo(() => {

View File

@ -102,14 +102,18 @@ export const EachData: FC<Props> = (props) => {
};
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)
);
.then((data) => {
setPlatformNumber(data?.type == "Station" ? data?.platform : undefined);
setPlatformDescription(
data?.type == "Station" ? data?.description : undefined
);
});
}, [currentTrainData, currentTrain]);
return (
@ -141,9 +145,11 @@ export const EachData: FC<Props> = (props) => {
<Description
info={`${
trainIDSwitch
? currentTrainData?.PosNum+currentTrainData?.Line
? currentTrainData?.PosNum + currentTrainData?.Line
: trainPositionText(currentTrainData)
} ${platformNumber ? platformNumber + "番線" : ""}`}
} ${platformNumber ? platformNumber + "番線" : ""} ${
platformDescription ? "("+platformDescription+")" : ""
}`}
onLongClick={() => {
Linking.openURL(
"https://nexcloud.haruk.in/apps/forms/s/TEkBQW5WLcYjLyAzGxncQLtw"