駅メニューの機能準備完了
This commit is contained in:
parent
9135ad3504
commit
dd78cdd3c7
51
Apps.js
51
Apps.js
@ -38,15 +38,47 @@ export default function Apps(props) {
|
||||
|
||||
//駅情報画面用
|
||||
const StationBoardAcSR = useRef(null);
|
||||
const [currentStation, setCurrentStation] = useState(undefined);
|
||||
const [stationBoardData, setStationBoardData] = useState(undefined);
|
||||
const [originalStationList, setOriginalStationList] = useState();
|
||||
const [selectedStation, setSelectedStation] = useState(undefined);
|
||||
useEffect(() => {
|
||||
getStationList().then((stationList) => {
|
||||
console.log(stationList);
|
||||
setOriginalStationList(stationList);
|
||||
});
|
||||
getStationList().then(setOriginalStationList);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!originalStationList) return () => {};
|
||||
const findStationEachLine = (selectLine) =>
|
||||
selectLine.filter((d) => d.Station_JP == selectedStation);
|
||||
|
||||
const lineList = [
|
||||
"予讃線",
|
||||
"松宇線",
|
||||
"伊予灘線",
|
||||
"土讃線",
|
||||
"窪川線",
|
||||
"高徳線",
|
||||
"徳島線",
|
||||
"鳴門線",
|
||||
];
|
||||
let returnDataBase = lineList
|
||||
.map((d) => findStationEachLine(originalStationList[d]))
|
||||
.filter((d) => d.length > 0)
|
||||
.reduce((pre, current) => {
|
||||
pre.push(...current);
|
||||
return pre;
|
||||
}, []);
|
||||
if (returnDataBase.length) {
|
||||
let currentStation = currentStation == undefined ? [] : currentStation;
|
||||
if (currentStation.toString() != returnDataBase.toString()) {
|
||||
setStationBoardData(returnDataBase);
|
||||
StationBoardAcSR.current?.setModalVisible();
|
||||
}
|
||||
} else {
|
||||
setStationBoardData(undefined);
|
||||
StationBoardAcSR.current?.hide();
|
||||
}
|
||||
}, [originalStationList, selectedStation]);
|
||||
|
||||
//地図表示テキスト
|
||||
const injectJavascript = injectJavascriptData(mapSwitch, iconSetting);
|
||||
|
||||
@ -142,8 +174,11 @@ export default function Apps(props) {
|
||||
injectedJavaScript={injectJavascript}
|
||||
/>
|
||||
<TouchableOpacity
|
||||
onPress={() =>
|
||||
navigate("trainMenu", { webview, stationData: mapsStationData })
|
||||
onPress={
|
||||
() => navigate("trainMenu", { webview, stationData: mapsStationData })
|
||||
/* {
|
||||
setSelectedStation("松山");
|
||||
} */
|
||||
}
|
||||
style={{
|
||||
position: "absolute",
|
||||
@ -180,7 +215,7 @@ export default function Apps(props) {
|
||||
|
||||
<StationDeteilView
|
||||
StationBoardAcSR={StationBoardAcSR}
|
||||
currentStation={currentStation}
|
||||
currentStation={stationBoardData}
|
||||
originalStationList={originalStationList}
|
||||
/>
|
||||
</View>
|
||||
|
9
menu.js
9
menu.js
@ -117,15 +117,6 @@ export default function Menu(props) {
|
||||
"徳島線",
|
||||
"鳴門線",
|
||||
];
|
||||
console.log(
|
||||
lineList
|
||||
.map((d) => findStationEachLine(originalStationList[d]))
|
||||
.filter((d) => d.length > 0)
|
||||
.reduce((pre, current) => {
|
||||
pre.push(...current);
|
||||
return pre;
|
||||
}, [])
|
||||
);
|
||||
let returnDataBase = lineList
|
||||
.map((d) => findStationEachLine(originalStationList[d]))
|
||||
.filter((d) => d.length > 0)
|
||||
|
Loading…
Reference in New Issue
Block a user