細かいバグ修正
This commit is contained in:
parent
b302df4664
commit
50c3329793
@ -177,10 +177,10 @@ export const EachTrainInfoCore = ({
|
|||||||
const [isJumped, setIsJumped] = useState(false);
|
const [isJumped, setIsJumped] = useState(false);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isJumped) return () => {};
|
if (isJumped) return () => {};
|
||||||
setShowThrew(true);
|
|
||||||
if (!points) return () => {};
|
if (!points) return () => {};
|
||||||
if (points.length == 0) return () => {};
|
if (points.length == 0) return () => {};
|
||||||
const position = points.findIndex((d) => d == true);
|
const position = points.findIndex((d) => d == true);
|
||||||
|
let isThrew = false;
|
||||||
if (position == -1) return () => {};
|
if (position == -1) return () => {};
|
||||||
if (trainDataWidhThrough[position].split(",")[1] == "通過") {
|
if (trainDataWidhThrough[position].split(",")[1] == "通過") {
|
||||||
LayoutAnimation.configureNext({
|
LayoutAnimation.configureNext({
|
||||||
@ -188,14 +188,18 @@ export const EachTrainInfoCore = ({
|
|||||||
update: { type: "easeInEaseOut", springDamping: 0.6 },
|
update: { type: "easeInEaseOut", springDamping: 0.6 },
|
||||||
});
|
});
|
||||||
setShowThrew(true);
|
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);
|
setIsJumped(true);
|
||||||
}, [points]);
|
}, [points]);
|
||||||
const trainName = useMemo(() => {
|
const trainName = useMemo(() => {
|
||||||
|
@ -102,14 +102,18 @@ export const EachData: FC<Props> = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const [platformNumber, setPlatformNumber] = useState<number>();
|
const [platformNumber, setPlatformNumber] = useState<number>();
|
||||||
|
const [platformDescription, setPlatformDescription] = useState<string>();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetch(
|
fetch(
|
||||||
`https://n8n.haruk.in/webhook/JR-shikoku-PosID?PosNum=${currentTrainData?.PosNum}&Line=${currentTrainData?.Line}`
|
`https://n8n.haruk.in/webhook/JR-shikoku-PosID?PosNum=${currentTrainData?.PosNum}&Line=${currentTrainData?.Line}`
|
||||||
)
|
)
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
.then((data) =>
|
.then((data) => {
|
||||||
setPlatformNumber(data?.type == "Station" ? data?.platform : undefined)
|
setPlatformNumber(data?.type == "Station" ? data?.platform : undefined);
|
||||||
);
|
setPlatformDescription(
|
||||||
|
data?.type == "Station" ? data?.description : undefined
|
||||||
|
);
|
||||||
|
});
|
||||||
}, [currentTrainData, currentTrain]);
|
}, [currentTrainData, currentTrain]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -141,9 +145,11 @@ export const EachData: FC<Props> = (props) => {
|
|||||||
<Description
|
<Description
|
||||||
info={`${
|
info={`${
|
||||||
trainIDSwitch
|
trainIDSwitch
|
||||||
? currentTrainData?.PosNum+currentTrainData?.Line
|
? currentTrainData?.PosNum + currentTrainData?.Line
|
||||||
: trainPositionText(currentTrainData)
|
: trainPositionText(currentTrainData)
|
||||||
} ${platformNumber ? platformNumber + "番線" : ""}`}
|
} ${platformNumber ? platformNumber + "番線" : ""} ${
|
||||||
|
platformDescription ? "("+platformDescription+")" : ""
|
||||||
|
}`}
|
||||||
onLongClick={() => {
|
onLongClick={() => {
|
||||||
Linking.openURL(
|
Linking.openURL(
|
||||||
"https://nexcloud.haruk.in/apps/forms/s/TEkBQW5WLcYjLyAzGxncQLtw"
|
"https://nexcloud.haruk.in/apps/forms/s/TEkBQW5WLcYjLyAzGxncQLtw"
|
||||||
|
Loading…
Reference in New Issue
Block a user