差分調整7
This commit is contained in:
parent
1bed97db82
commit
c6fc53f976
8
Top.js
8
Top.js
@ -21,12 +21,8 @@ export const Top = ({ navigationRef }) => {
|
|||||||
const { navigate, addListener } = useNavigation();
|
const { navigate, addListener } = useNavigation();
|
||||||
|
|
||||||
//地図用
|
//地図用
|
||||||
const { setMapsStationData, injectJavaScript, setInjectJavaScript } =
|
const { injectJavaScript, setInjectJavaScript } = useTrainMenu();
|
||||||
useTrainMenu();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getStationList2().then(setMapsStationData);
|
|
||||||
}, []);
|
|
||||||
const [mapSwitch, setMapSwitch] = React.useState("false");
|
const [mapSwitch, setMapSwitch] = React.useState("false");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -34,7 +30,6 @@ export const Top = ({ navigationRef }) => {
|
|||||||
ASCore({ k: "mapSwitch", s: setMapSwitch, d: "false" });
|
ASCore({ k: "mapSwitch", s: setMapSwitch, d: "false" });
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
const goToFavoriteList = () => navigate("favoriteList");
|
const goToFavoriteList = () => navigate("favoriteList");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -42,7 +37,6 @@ export const Top = ({ navigationRef }) => {
|
|||||||
return unsubscribe;
|
return unsubscribe;
|
||||||
}, [{ navigate, addListener }]);
|
}, [{ navigate, addListener }]);
|
||||||
|
|
||||||
|
|
||||||
const goToTrainMenu = () => {
|
const goToTrainMenu = () => {
|
||||||
if (navigationRef.current?.getCurrentRoute().name == "Apps") {
|
if (navigationRef.current?.getCurrentRoute().name == "Apps") {
|
||||||
if (mapSwitch == "true") {
|
if (mapSwitch == "true") {
|
||||||
|
@ -34,6 +34,7 @@ import { searchSpecialTrain } from "../../lib/eachTrainInfoCoreLib/searchSpecial
|
|||||||
import { openBackTrainInfo } from "../../lib/eachTrainInfoCoreLib/openBackTrainInfo";
|
import { openBackTrainInfo } from "../../lib/eachTrainInfoCoreLib/openBackTrainInfo";
|
||||||
import { ShowSpecialTrain } from "./EachTrainInfo/ShowSpecialTrain";
|
import { ShowSpecialTrain } from "./EachTrainInfo/ShowSpecialTrain";
|
||||||
import { useStationList } from "../../stateBox/useStationList";
|
import { useStationList } from "../../stateBox/useStationList";
|
||||||
|
import { HeaderText } from "./EachTrainInfoCore/HeaderText";
|
||||||
|
|
||||||
export const EachTrainInfoCore = ({
|
export const EachTrainInfoCore = ({
|
||||||
actionSheetRef,
|
actionSheetRef,
|
||||||
@ -278,36 +279,16 @@ export const EachTrainInfoCore = ({
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
<View style={{ padding: 10, flexDirection: "row", alignItems: "center" }}>
|
<HeaderText
|
||||||
<Text style={{ fontSize: 20, fontWeight: "bold", color: "white" }}>
|
data={data}
|
||||||
{trainName}
|
trainData={trainData}
|
||||||
</Text>
|
showHeadStation={showHeadStation}
|
||||||
<View style={{ flex: 1 }} />
|
showTailStation={showTailStation}
|
||||||
<Text style={{ fontSize: 20, fontWeight: "bold", color: "white" }}>
|
headStation={headStation}
|
||||||
{showHeadStation.map((d) => `${headStation[d].id} + `)}
|
tailStation={tailStation}
|
||||||
{data.trainNum}
|
navigate={navigate}
|
||||||
{showTailStation.map((d) => ` + ${tailStation[d].id}`)}
|
from={from}
|
||||||
</Text>
|
/>
|
||||||
|
|
||||||
{data.limited != undefined &&
|
|
||||||
getType(data.limited.split(":")[0]) &&
|
|
||||||
!data.limited.split(":")[1].match("サンポート") && (
|
|
||||||
<Ionicons
|
|
||||||
name="subway"
|
|
||||||
color="white"
|
|
||||||
size={30}
|
|
||||||
style={{ margin: 5 }}
|
|
||||||
onPress={() => {
|
|
||||||
LayoutAnimation.easeInEaseOut(); //setLoadingDelayData(true);
|
|
||||||
navigate("trainbase", {
|
|
||||||
info: "train.html?tn=" + data.trainNum,
|
|
||||||
from,
|
|
||||||
});
|
|
||||||
SheetManager.hide("EachTrainInfo");
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</View>
|
|
||||||
<DynamicHeaderScrollView
|
<DynamicHeaderScrollView
|
||||||
from={from}
|
from={from}
|
||||||
styles={styles}
|
styles={styles}
|
||||||
|
@ -24,6 +24,10 @@ import { EachTrainInfoCore } from "../components/ActionSheetComponents/EachTrain
|
|||||||
import { useNavigation } from "@react-navigation/native";
|
import { useNavigation } from "@react-navigation/native";
|
||||||
import { useTrainMenu } from "../stateBox/useTrainMenu";
|
import { useTrainMenu } from "../stateBox/useTrainMenu";
|
||||||
import { AppsWebView } from "./Apps/WebView";
|
import { AppsWebView } from "./Apps/WebView";
|
||||||
|
import { NewMenu } from "./Apps/NewMenu";
|
||||||
|
import { MapsButton } from "./Apps/MapsButton";
|
||||||
|
import { ReloadButton } from "./Apps/ReloadButton";
|
||||||
|
import { LandscapeBackButton } from "./Apps/LandscapeBackButton";
|
||||||
import { useStationList } from "../stateBox/useStationList";
|
import { useStationList } from "../stateBox/useStationList";
|
||||||
/*
|
/*
|
||||||
import StatusbarDetect from '../StatusbarDetect';
|
import StatusbarDetect from '../StatusbarDetect';
|
||||||
@ -186,194 +190,3 @@ export default function Apps() {
|
|||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const NewMenu = ({ LoadError }) => {
|
|
||||||
const { webview } = useCurrentTrain();
|
|
||||||
const { width } = useWindowDimensions();
|
|
||||||
return (
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
position: "absolute",
|
|
||||||
top,
|
|
||||||
width,
|
|
||||||
height: 54,
|
|
||||||
backgroundColor: "#0099CC",
|
|
||||||
borderColor: "white",
|
|
||||||
borderStyle: "solid",
|
|
||||||
borderWidth: 1,
|
|
||||||
alignContent: "center",
|
|
||||||
alignSelf: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
flexDirection: "row",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<TouchableOpacity
|
|
||||||
activeOpacity={1}
|
|
||||||
style={{
|
|
||||||
flex: 1,
|
|
||||||
height: 54,
|
|
||||||
backgroundColor: "#0099CC",
|
|
||||||
borderColor: "white",
|
|
||||||
borderStyle: "solid",
|
|
||||||
borderWidth: 1,
|
|
||||||
borderRightWidth: 0,
|
|
||||||
alignContent: "center",
|
|
||||||
alignSelf: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
flexDirection: "row",
|
|
||||||
}}
|
|
||||||
onPress={() => {
|
|
||||||
webview.current?.injectJavaScript(`AccordionClassEvent()`);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<>
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
width: 54,
|
|
||||||
height: 54,
|
|
||||||
backgroundColor: "#0099CC",
|
|
||||||
borderColor: "white",
|
|
||||||
borderStyle: "solid",
|
|
||||||
borderWidth: 1,
|
|
||||||
alignContent: "center",
|
|
||||||
alignSelf: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<View style={{ flex: 1 }} />
|
|
||||||
<Ionicons name="menu" color="white" size={30} />
|
|
||||||
<View style={{ flex: 1 }} />
|
|
||||||
</View>
|
|
||||||
<View style={{ flex: 1 }} />
|
|
||||||
<Text style={{ color: "white", fontSize: 20 }}>メニュー</Text>
|
|
||||||
<View style={{ flex: 1 }}></View>
|
|
||||||
</>
|
|
||||||
</TouchableOpacity>
|
|
||||||
|
|
||||||
<TouchableOpacity
|
|
||||||
onPress={() => Updates.reloadAsync()}
|
|
||||||
style={{
|
|
||||||
width: 54,
|
|
||||||
height: 54,
|
|
||||||
backgroundColor: LoadError ? "red" : "#0099CC",
|
|
||||||
borderColor: "white",
|
|
||||||
borderStyle: "solid",
|
|
||||||
borderWidth: 1,
|
|
||||||
alignContent: "center",
|
|
||||||
alignSelf: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<View style={{ flex: 1 }} />
|
|
||||||
<Ionicons name="reload" color="white" size={30} />
|
|
||||||
<View style={{ flex: 1 }} />
|
|
||||||
</TouchableOpacity>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
const MapsButton = ({ onPress, mapSwitch }) => {
|
|
||||||
const styles = {
|
|
||||||
touch: {
|
|
||||||
position: "absolute",
|
|
||||||
top,
|
|
||||||
left: 10,
|
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
backgroundColor: "#0099CC",
|
|
||||||
borderColor: "white",
|
|
||||||
borderStyle: "solid",
|
|
||||||
borderWidth: 1,
|
|
||||||
borderRadius: 50,
|
|
||||||
alignContent: "center",
|
|
||||||
alignSelf: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
display: mapSwitch,
|
|
||||||
},
|
|
||||||
text: {
|
|
||||||
textAlign: "center",
|
|
||||||
width: "auto",
|
|
||||||
height: "auto",
|
|
||||||
textAlignVertical: "center",
|
|
||||||
fontWeight: "bold",
|
|
||||||
color: "white",
|
|
||||||
fontSize: 20,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<TouchableOpacity onPress={onPress} style={styles.touch}>
|
|
||||||
<View style={{ flex: 1 }} />
|
|
||||||
<Text style={styles.text}>≡</Text>
|
|
||||||
<View style={{ flex: 1 }} />
|
|
||||||
</TouchableOpacity>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const LandscapeBackButton = ({ onPress }) => {
|
|
||||||
const styles = {
|
|
||||||
touch: {
|
|
||||||
position: "absolute",
|
|
||||||
left: 10,
|
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
backgroundColor: "#0099CC",
|
|
||||||
borderColor: "white",
|
|
||||||
borderStyle: "solid",
|
|
||||||
borderWidth: 1,
|
|
||||||
borderRadius: 50,
|
|
||||||
alignContent: "center",
|
|
||||||
alignSelf: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
display: "flex",
|
|
||||||
},
|
|
||||||
text: {
|
|
||||||
textAlign: "center",
|
|
||||||
width: "auto",
|
|
||||||
height: "auto",
|
|
||||||
textAlignVertical: "center",
|
|
||||||
fontWeight: "bold",
|
|
||||||
color: "white",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<TouchableOpacity onPress={onPress} style={styles.touch}>
|
|
||||||
<View style={{ flex: 1 }} />
|
|
||||||
<Ionicons name="arrow-back" color="white" size={30} />
|
|
||||||
<View style={{ flex: 1 }} />
|
|
||||||
</TouchableOpacity>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const ReloadButton = ({ onPress, mapSwitch, LoadError = false, right }) => {
|
|
||||||
const styles = {
|
|
||||||
touch: {
|
|
||||||
position: "absolute",
|
|
||||||
top,
|
|
||||||
right: 10 + right,
|
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
backgroundColor: LoadError ? "red" : "#0099CC",
|
|
||||||
borderColor: "white",
|
|
||||||
borderStyle: "solid",
|
|
||||||
borderWidth: 1,
|
|
||||||
borderRadius: 50,
|
|
||||||
alignContent: "center",
|
|
||||||
alignSelf: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
display: mapSwitch,
|
|
||||||
},
|
|
||||||
text: {
|
|
||||||
textAlign: "center",
|
|
||||||
width: "auto",
|
|
||||||
height: "auto",
|
|
||||||
textAlignVertical: "center",
|
|
||||||
fontWeight: "bold",
|
|
||||||
color: "white",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<TouchableOpacity onPress={onPress} style={styles.touch}>
|
|
||||||
<View style={{ flex: 1 }} />
|
|
||||||
<Ionicons name="reload" color="white" size={30} />
|
|
||||||
<View style={{ flex: 1 }} />
|
|
||||||
</TouchableOpacity>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React, { createContext, useContext, useState } from "react";
|
import React, { createContext, useContext, useState, useEffect } from "react";
|
||||||
|
import { getStationList2 } from "../lib/getStationList2";
|
||||||
const initialState = {
|
const initialState = {
|
||||||
selectedLine: undefined,
|
selectedLine: undefined,
|
||||||
setSelectedLine: () => {},
|
setSelectedLine: () => {},
|
||||||
@ -18,6 +19,10 @@ export const TrainMenuProvider = ({ children }) => {
|
|||||||
const [selectedLine, setSelectedLine] = useState(undefined);
|
const [selectedLine, setSelectedLine] = useState(undefined);
|
||||||
const [mapsStationData, setMapsStationData] = useState(undefined);
|
const [mapsStationData, setMapsStationData] = useState(undefined);
|
||||||
const [injectJavaScript, setInjectJavaScript] = useState();
|
const [injectJavaScript, setInjectJavaScript] = useState();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getStationList2().then(setMapsStationData);
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TrainMenuContext.Provider
|
<TrainMenuContext.Provider
|
||||||
|
Loading…
Reference in New Issue
Block a user