58 lines
1.7 KiB
TypeScript
58 lines
1.7 KiB
TypeScript
import { FC } from "react";
|
|
import { TouchableOpacity, View, Text, Linking } from "react-native";
|
|
import { useCurrentTrain } from "@/stateBox/useCurrentTrain";
|
|
import { useThemeColors } from "@/lib/theme";
|
|
import AntDesign from "react-native-vector-icons/AntDesign";
|
|
import { stackAwareNavigate } from "@/lib/rootNavigation";
|
|
type Props = {
|
|
stationNumber: string;
|
|
onExit: () => void;
|
|
navigate?: (screen: string, params: { screen: string }) => void;
|
|
};
|
|
export const StationTrainPositionButton: FC<Props> = (props) => {
|
|
const { stationNumber, onExit, navigate } = props;
|
|
const { setInjectData } = useCurrentTrain();
|
|
const { fixed } = useThemeColors();
|
|
return (
|
|
<TouchableOpacity
|
|
style={{
|
|
height: 50,
|
|
backgroundColor: fixed.primary,
|
|
flexDirection: "row",
|
|
alignContent: "center",
|
|
alignItems: "center",
|
|
margin: 2,
|
|
flex: 1,
|
|
}}
|
|
onLongPress={() => {
|
|
stackAwareNavigate("positions");
|
|
setInjectData({ type: "station", value:stationNumber, fixed: true });
|
|
onExit();
|
|
}}
|
|
onPress={() => {
|
|
stackAwareNavigate("positions");
|
|
setInjectData({ type: "station", value: stationNumber, fixed: false });
|
|
onExit();
|
|
}}
|
|
>
|
|
<View style={{ flex: 1 }} />
|
|
<AntDesign
|
|
name={"bar-chart"}
|
|
size={20}
|
|
color={fixed.textOnPrimary}
|
|
style={{ marginHorizontal: 5, marginVertical: 5 }}
|
|
/>
|
|
<Text
|
|
style={{
|
|
color: fixed.textOnPrimary,
|
|
textAlign: "center",
|
|
textAlignVertical: "center",
|
|
}}
|
|
>
|
|
走行位置に移動
|
|
</Text>
|
|
<View style={{ flex: 1 }} />
|
|
</TouchableOpacity>
|
|
);
|
|
};
|