From e62ae0fc2dbf1479b322333f1fa81122e0f1985d Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Sat, 31 Aug 2024 05:32:15 +0000 Subject: [PATCH] =?UTF-8?q?StationNumberMaker=E3=82=92=E7=A7=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/駅名表/Sign.js | 45 +------------------ components/駅名表/StationNumberMaker.tsx | 50 +++++++++++++++++++++ 2 files changed, 51 insertions(+), 44 deletions(-) create mode 100644 components/駅名表/StationNumberMaker.tsx diff --git a/components/駅名表/Sign.js b/components/駅名表/Sign.js index e612455..e65f7db 100644 --- a/components/駅名表/Sign.js +++ b/components/駅名表/Sign.js @@ -9,6 +9,7 @@ import { useFavoriteStation } from "../../stateBox/useFavoriteStation"; import { StationName } from "./StationName"; import { StationNameArea } from "./StationNameArea"; +import { StationNumberMaker } from "./StationNumberMaker"; import lineColorList from "../../assets/originData/lineColorList"; @@ -246,50 +247,6 @@ const NexPreStationLine = ({ nexStation, preStation }) => { ); }; -const StationNumberMaker = (props) => { - const getTop = (array, index) => { - if (array.length == 1) return 20; - else if (index == 0) return 5; - else if (index == 1) return 35; - else return 20; - }; - return props.currentStation - .filter((d) => (d.StationNumber ? true : false)) - .map((d, index, array) => { - const lineID = d.StationNumber.slice(0, 1); - const lineName = d.StationNumber.slice(1); - return ( - - - - {lineID + "\n" + lineName} - - - - ); - }); -}; diff --git a/components/駅名表/StationNumberMaker.tsx b/components/駅名表/StationNumberMaker.tsx new file mode 100644 index 0000000..52a6ef3 --- /dev/null +++ b/components/駅名表/StationNumberMaker.tsx @@ -0,0 +1,50 @@ + +import React from "react"; +import { Text, View } from "react-native"; +import { widthPercentageToDP as wp } from "react-native-responsive-screen"; +import lineColorList from "../../assets/originData/lineColorList"; + +export const StationNumberMaker = (props) => { + const getTop = (array:number[], index:number) => { + if (array.length == 1) return 20; + else if (index == 0) return 5; + else if (index == 1) return 35; + else return 20; + }; + return props.currentStation + .filter((d) => (d.StationNumber ? true : false)) + .map((d, index, array) => { + const lineID = d.StationNumber.slice(0, 1); + const lineName = d.StationNumber.slice(1); + return ( + + + + {lineID + "\n" + lineName} + + + + ); + }); +}; \ No newline at end of file