Merge commit 'e5c80d713ec607dccab1ceda4f6b1b55599f9b88' into develop

This commit is contained in:
harukin-expo-dev-env 2024-04-02 11:52:59 +00:00
commit 63a7c8fcf6
2 changed files with 79 additions and 13 deletions

View File

@ -1,10 +1,11 @@
import React from "react";
import { View, Text, TouchableOpacity, ScrollView } from "react-native";
import { ListItem } from "native-base";
import Icon from "react-native-vector-icons/Entypo";
import { useFavoriteStation } from "../stateBox/useFavoriteStation";
import { useCurrentTrain } from "../stateBox/useCurrentTrain";
import { useNavigation } from "@react-navigation/native";
import { FavoriteListItem } from "./atom/FavoriteListItem";
export default function FavoriteList({ stationData }) {
const { favoriteStation } = useFavoriteStation();
const { webview } = useCurrentTrain();
@ -15,7 +16,7 @@ export default function FavoriteList({ stationData }) {
<Text
style={{
textAlign: "center",
fontSize: 25,
fontSize: 20,
color: "white",
fontWeight: "bold",
paddingVertical: 10,
@ -28,7 +29,8 @@ export default function FavoriteList({ stationData }) {
.filter((d) => d[0].StationMap)
.map((currentStation) => {
return (
<ListItem
<FavoriteListItem
currentStation={currentStation}
onPress={() => {
const getStationLine = (now) => {
const returnData = Object.keys(stationData).filter((d) => {
@ -48,28 +50,20 @@ export default function FavoriteList({ stationData }) {
navigate("Apps");
}}
>
<Text style={{ fontSize: 20, flex: 2 }}>
{currentStation
.map((d) => d.StationNumber)
.filter((d) => d !== null)
.join("/")}
</Text>
<Text style={{ fontSize: 20, flex: 3 }}>
{currentStation[0].Station_JP}
</Text>
<View
style={{
flex: 2,
flexDirection: "row",
alignContent: "center",
alignItems: "center",
marginVertical: 4,
}}
>
<View style={{ flex: 1 }} />
<Text style={{ fontSize: 20 }}>移動する</Text>
<Icon name="chevron-right" size={20} />
</View>
</ListItem>
</FavoriteListItem>
);
})}
</ScrollView>

View File

@ -0,0 +1,72 @@
import React from "react";
import { View, Text, TouchableOpacity } from "react-native";
import lineColorList from "../../assets/originData/lineColorList";
export const FavoriteListItem = ({ currentStation, children, onPress }) => {
const lineIDs = [];
const EachIDs = [];
currentStation.forEach((d) => {
if (!d.StationNumber) return;
const textArray = d.StationNumber.split("");
lineIDs.push(textArray.filter((s) => "A" < s && s < "Z").join(""));
EachIDs.push(textArray.filter((s) => "0" <= s && s <= "9").join(""));
});
return (
<TouchableOpacity
style={{ flexDirection: "row", backgroundColor: "white" }}
onPress={onPress}
>
<View
style={{
width: 35,
position: "relative",
marginHorizontal: 15,
flexDirection: "row",
height: "101%",
}}
>
{lineIDs.map((lineID, index) => (
<View
style={{
backgroundColor: lineColorList[lineID],
flex: 1,
}}
key={lineID}
>
<View style={{ flex: 1 }} />
<Text
style={{
color: "white",
textAlign: "center",
fontSize: 12,
fontWeight: "bold",
}}
>
{lineIDs[index]}
{"\n"}
{EachIDs[index]}
</Text>
<View style={{ flex: 1 }} />
</View>
))}
</View>
<View
style={{
padding: 8,
flexDirection: "row",
borderBottomWidth: 1,
borderBottomColor: "#f0f0f0",
flex: 1,
alignContent: "center",
alignItems: "center",
}}
>
<Text style={{ fontSize: 20 }}>{currentStation[0].Station_JP}</Text>
<View style={{ flex: 1 }} />
{children}
</View>
</TouchableOpacity>
);
};