Merge commit '681f4d625ffdfedfc99b1d761f9880b908cc9ade' into develop
This commit is contained in:
commit
135bb79bf6
@ -107,9 +107,14 @@ export const EachStopList = ({
|
|||||||
{station}
|
{station}
|
||||||
</Text>
|
</Text>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
|
<View style={{ position: "relative", width: 0 }}>
|
||||||
{points ? (
|
{points ? (
|
||||||
<Text style={{ fontSize: 20, marginRight: 70 }}>🚊</Text>
|
<Text style={{ fontSize: 20, position: "absolute", left: -60 }}>
|
||||||
|
🚊
|
||||||
|
</Text>
|
||||||
) : null}
|
) : null}
|
||||||
|
</View>
|
||||||
|
|
||||||
{!isNaN(currentTrainData?.delay) && currentTrainData?.delay != 0 && (
|
{!isNaN(currentTrainData?.delay) && currentTrainData?.delay != 0 && (
|
||||||
<Text
|
<Text
|
||||||
style={{
|
style={{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useMemo, useState } from "react";
|
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||||
import {
|
import {
|
||||||
View,
|
View,
|
||||||
Text,
|
Text,
|
||||||
@ -7,6 +7,7 @@ import {
|
|||||||
useWindowDimensions,
|
useWindowDimensions,
|
||||||
BackHandler,
|
BackHandler,
|
||||||
Linking,
|
Linking,
|
||||||
|
LayoutAnimation,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import { SheetManager } from "react-native-actions-sheet";
|
import { SheetManager } from "react-native-actions-sheet";
|
||||||
import { AS } from "../../storageControl";
|
import { AS } from "../../storageControl";
|
||||||
@ -173,6 +174,29 @@ export const EachTrainInfoCore = ({
|
|||||||
trainPositionSwitch == "true"
|
trainPositionSwitch == "true"
|
||||||
? findReversalPoints(currentPosition, stopStationIDList)
|
? findReversalPoints(currentPosition, stopStationIDList)
|
||||||
: stopStationIDList.map(() => false);
|
: 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);
|
||||||
|
if (position == -1) return () => {};
|
||||||
|
if (trainDataWidhThrough[position].split(",")[1] == "通過") {
|
||||||
|
LayoutAnimation.configureNext({
|
||||||
|
duration: 400,
|
||||||
|
update: { type: "easeInEaseOut", springDamping: 0.6 },
|
||||||
|
});
|
||||||
|
setShowThrew(true);
|
||||||
|
}
|
||||||
|
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(() => {
|
const trainName = useMemo(() => {
|
||||||
if (!data.limited) return "";
|
if (!data.limited) return "";
|
||||||
const limitedArray = data.limited.split(":");
|
const limitedArray = data.limited.split(":");
|
||||||
@ -198,6 +222,7 @@ export const EachTrainInfoCore = ({
|
|||||||
|
|
||||||
const { height } = useWindowDimensions();
|
const { height } = useWindowDimensions();
|
||||||
const { isLandscape } = useDeviceOrientationChange();
|
const { isLandscape } = useDeviceOrientationChange();
|
||||||
|
const ScrollViewRef = useRef();
|
||||||
|
|
||||||
const [trueTrainID, setTrueTrainID] = useState();
|
const [trueTrainID, setTrueTrainID] = useState();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -389,6 +414,7 @@ export const EachTrainInfoCore = ({
|
|||||||
from={from}
|
from={from}
|
||||||
styles={styles}
|
styles={styles}
|
||||||
actionSheetRef={actionSheetRef}
|
actionSheetRef={actionSheetRef}
|
||||||
|
ScrollViewRef={ScrollViewRef}
|
||||||
containerProps={{
|
containerProps={{
|
||||||
style: {
|
style: {
|
||||||
maxHeight: isLandscape ? height - 94 : (height / 100) * 70,
|
maxHeight: isLandscape ? height - 94 : (height / 100) * 70,
|
||||||
|
@ -13,14 +13,13 @@ export const DynamicHeaderScrollView = (props) => {
|
|||||||
topStickyContent,
|
topStickyContent,
|
||||||
styles,
|
styles,
|
||||||
from,
|
from,
|
||||||
|
ScrollViewRef,
|
||||||
} = props;
|
} = props;
|
||||||
const [headerSize, setHeaderSize] = useState("default");
|
const [headerSize, setHeaderSize] = useState("default");
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
AS.getItem("headerSize")
|
AS.getItem("headerSize")
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res) {
|
if (res) setHeaderSize(res);
|
||||||
setHeaderSize(res);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
AS.setItem("headerSize", "default");
|
AS.setItem("headerSize", "default");
|
||||||
@ -160,6 +159,7 @@ export const DynamicHeaderScrollView = (props) => {
|
|||||||
stickyHeaderIndices={[1]}
|
stickyHeaderIndices={[1]}
|
||||||
scrollEventThrottle={16}
|
scrollEventThrottle={16}
|
||||||
onScroll={onScroll}
|
onScroll={onScroll}
|
||||||
|
ref={ScrollViewRef}
|
||||||
>
|
>
|
||||||
<View style={{ height: Scroll_Distance, flexDirection: "column" }} />
|
<View style={{ height: Scroll_Distance, flexDirection: "column" }} />
|
||||||
{topStickyContent && (
|
{topStickyContent && (
|
||||||
|
@ -131,7 +131,7 @@ export const LayoutSettings = ({
|
|||||||
bool={trainPosition}
|
bool={trainPosition}
|
||||||
setBool={setTrainPosition}
|
setBool={setTrainPosition}
|
||||||
color="red"
|
color="red"
|
||||||
str="列車の現在位置をアイコン表示"
|
str="列車の現在地表示/ジャンプ"
|
||||||
/>
|
/>
|
||||||
</SwitchArea>
|
</SwitchArea>
|
||||||
</View>
|
</View>
|
||||||
|
@ -17,31 +17,31 @@ export const findReversalPoints = (array, stopStationIDList) => {
|
|||||||
});
|
});
|
||||||
return a;
|
return a;
|
||||||
});
|
});
|
||||||
if (index != -1) {
|
if (index != -1) return index;
|
||||||
return index;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// 駅間の場合
|
// 駅間の場合
|
||||||
if (array.length == 2) {
|
if (array.length == 2) {
|
||||||
|
|
||||||
const allThroughStation = stopStationIDList.map((d) => {
|
const allThroughStation = stopStationIDList.map((d) => {
|
||||||
if(array[0] == "M12" && array[1] == "Y09" || array[0] == "Y09" && array[1] == "M12"){
|
if (
|
||||||
if(d[0] == "M12"){
|
(array[0] == "M12" && array[1] == "Y09") ||
|
||||||
return true;
|
(array[0] == "Y09" && array[1] == "M12")
|
||||||
}
|
)
|
||||||
else return false;
|
return d[0] == "M12" ? true : false;
|
||||||
}
|
|
||||||
if (d[0] < array[0] && d[0] > array[1]) {
|
|
||||||
return true;
|
|
||||||
} else if (d[0] < array[1] && d[0] > array[0]) {
|
|
||||||
return true;
|
|
||||||
}else if (d[0] < array[0] && d[0] == array[1]) {
|
|
||||||
return true;
|
|
||||||
} else if (d[0] == array[1] && d[0] > array[0]) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 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 returndata;
|
||||||
});
|
});
|
||||||
return allThroughStation;
|
return allThroughStation;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user