Merge commit 'e5c80d713ec607dccab1ceda4f6b1b55599f9b88' into develop
This commit is contained in:
commit
63a7c8fcf6
@ -1,10 +1,11 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { View, Text, TouchableOpacity, ScrollView } from "react-native";
|
import { View, Text, TouchableOpacity, ScrollView } from "react-native";
|
||||||
import { ListItem } from "native-base";
|
|
||||||
import Icon from "react-native-vector-icons/Entypo";
|
import Icon from "react-native-vector-icons/Entypo";
|
||||||
import { useFavoriteStation } from "../stateBox/useFavoriteStation";
|
import { useFavoriteStation } from "../stateBox/useFavoriteStation";
|
||||||
import { useCurrentTrain } from "../stateBox/useCurrentTrain";
|
import { useCurrentTrain } from "../stateBox/useCurrentTrain";
|
||||||
import { useNavigation } from "@react-navigation/native";
|
import { useNavigation } from "@react-navigation/native";
|
||||||
|
import { FavoriteListItem } from "./atom/FavoriteListItem";
|
||||||
export default function FavoriteList({ stationData }) {
|
export default function FavoriteList({ stationData }) {
|
||||||
const { favoriteStation } = useFavoriteStation();
|
const { favoriteStation } = useFavoriteStation();
|
||||||
const { webview } = useCurrentTrain();
|
const { webview } = useCurrentTrain();
|
||||||
@ -15,7 +16,7 @@ export default function FavoriteList({ stationData }) {
|
|||||||
<Text
|
<Text
|
||||||
style={{
|
style={{
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
fontSize: 25,
|
fontSize: 20,
|
||||||
color: "white",
|
color: "white",
|
||||||
fontWeight: "bold",
|
fontWeight: "bold",
|
||||||
paddingVertical: 10,
|
paddingVertical: 10,
|
||||||
@ -28,7 +29,8 @@ export default function FavoriteList({ stationData }) {
|
|||||||
.filter((d) => d[0].StationMap)
|
.filter((d) => d[0].StationMap)
|
||||||
.map((currentStation) => {
|
.map((currentStation) => {
|
||||||
return (
|
return (
|
||||||
<ListItem
|
<FavoriteListItem
|
||||||
|
currentStation={currentStation}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
const getStationLine = (now) => {
|
const getStationLine = (now) => {
|
||||||
const returnData = Object.keys(stationData).filter((d) => {
|
const returnData = Object.keys(stationData).filter((d) => {
|
||||||
@ -48,28 +50,20 @@ export default function FavoriteList({ stationData }) {
|
|||||||
navigate("Apps");
|
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
|
<View
|
||||||
style={{
|
style={{
|
||||||
flex: 2,
|
flex: 2,
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
alignContent: "center",
|
alignContent: "center",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
|
marginVertical: 4,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
<Text style={{ fontSize: 20 }}>移動する</Text>
|
<Text style={{ fontSize: 20 }}>移動する</Text>
|
||||||
<Icon name="chevron-right" size={20} />
|
<Icon name="chevron-right" size={20} />
|
||||||
</View>
|
</View>
|
||||||
</ListItem>
|
</FavoriteListItem>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
72
components/atom/FavoriteListItem.js
Normal file
72
components/atom/FavoriteListItem.js
Normal 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>
|
||||||
|
);
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user