列車走行位置へのジャンプ機能をuseCurrentTrainへ移動
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { FC } from "react";
|
||||
import { TouchableOpacity, View, Text, Linking } from "react-native";
|
||||
import { useStationList } from "@/stateBox/useStationList";
|
||||
import { useCurrentTrain } from "@/stateBox/useCurrentTrain";
|
||||
import AntDesign from "react-native-vector-icons/AntDesign";
|
||||
type Props = {
|
||||
@@ -10,10 +9,7 @@ type Props = {
|
||||
};
|
||||
export const StationTrainPositionButton: FC<Props> = (props) => {
|
||||
const { stationNumber, onExit, navigate } = props;
|
||||
const {
|
||||
inject,
|
||||
} = useCurrentTrain();
|
||||
const { getInjectJavascriptAddress } = useStationList();
|
||||
const { setInjectData } = useCurrentTrain();
|
||||
return (
|
||||
<TouchableOpacity
|
||||
style={{
|
||||
@@ -23,12 +19,16 @@ export const StationTrainPositionButton: FC<Props> = (props) => {
|
||||
alignContent: "center",
|
||||
alignItems: "center",
|
||||
margin: 2,
|
||||
flex: 1
|
||||
flex: 1,
|
||||
}}
|
||||
onLongPress={() => {
|
||||
navigate("positions", { screen: "Apps" });
|
||||
setInjectData({ type: "station", stationNumber, fixed: true });
|
||||
onExit();
|
||||
}}
|
||||
onPress={() => {
|
||||
navigate("positions", { screen: "Apps" });
|
||||
const script = getInjectJavascriptAddress(stationNumber);
|
||||
inject(script);
|
||||
setInjectData({ type: "station", stationNumber, fixed: false });
|
||||
onExit();
|
||||
}}
|
||||
>
|
||||
|
Reference in New Issue
Block a user