topとobject

This commit is contained in:
harukin-expo-dev-env 2024-06-07 08:01:26 +00:00
parent 0528ec6c2d
commit 801b3dc3b0
2 changed files with 40 additions and 64 deletions

View File

@ -28,6 +28,8 @@ import { AppsWebView } from "./Apps/WebView";
import StatusbarDetect from '../StatusbarDetect';
var Status = StatusbarDetect(); */
const top = Platform.OS == "ios" ? Constants.statusBarHeight : 0;
export default function Apps() {
const { webview } = useCurrentTrain();
const { height, width } = useWindowDimensions();
@ -52,9 +54,7 @@ export default function Apps() {
//駅情報画面用
const [originalStationList, setOriginalStationList] = useState();
const [trainMenu, setTrainMenu] = useState("true");
useEffect(() => {
getStationList().then(setOriginalStationList);
}, []);
useEffect(() => getStationList().then(setOriginalStationList), []);
//地図表示テキスト
const injectJavascript = injectJavascriptData(
@ -119,7 +119,7 @@ export default function Apps() {
<View
style={{
height: "100%",
paddingTop: Platform.OS == "ios" ? Constants.statusBarHeight : 0,
paddingTop: top,
flexDirection: isLandscape ? "row" : "column",
}}
onLayout={handleLayout}
@ -172,7 +172,6 @@ export default function Apps() {
setInjectJavaScript("");
navigate("trainMenu", { webview });
}}
top={Platform.OS == "ios" ? Constants.statusBarHeight : 0}
mapSwitch={mapSwitch == "true" ? "flex" : "none"}
/>
)}
@ -186,13 +185,11 @@ export default function Apps() {
trainData: undefined,
});
}}
top={Platform.OS == "ios" ? Constants.statusBarHeight : 0}
/>
)}
{mapSwitch == "true" ? (
<ReloadButton
onPress={() => Updates.reloadAsync()}
top={Platform.OS == "ios" ? Constants.statusBarHeight : 0}
right={isLandscape && trainInfo.trainNum ? (width / 100) * 40 : 0}
LoadError={LoadError}
/>
@ -207,15 +204,14 @@ export default function Apps() {
</View>
);
}
const NewMenu = ({ webview, LoadError }) => {
const { width } = useWindowDimensions();
return (
<View
style={{
position: "absolute",
top: Platform.OS == "ios" ? Constants.statusBarHeight : 0,
width: width,
top,
width,
height: 54,
backgroundColor: "#0099CC",
borderColor: "white",
@ -291,7 +287,7 @@ const NewMenu = ({ webview, LoadError }) => {
</View>
);
};
const MapsButton = ({ onPress, top, mapSwitch }) => {
const MapsButton = ({ onPress, mapSwitch }) => {
const styles = {
touch: {
position: "absolute",
@ -328,11 +324,10 @@ const MapsButton = ({ onPress, top, mapSwitch }) => {
);
};
const LandscapeBackButton = ({ onPress, top }) => {
const LandscapeBackButton = ({ onPress }) => {
const styles = {
touch: {
position: "absolute",
top,
left: 10,
width: 50,
height: 50,
@ -364,13 +359,7 @@ const LandscapeBackButton = ({ onPress, top }) => {
);
};
const ReloadButton = ({
onPress,
top,
mapSwitch,
LoadError = false,
right,
}) => {
const ReloadButton = ({ onPress, mapSwitch, LoadError = false, right }) => {
const styles = {
touch: {
position: "absolute",

View File

@ -27,23 +27,21 @@ export const AppsWebView = ({
var urlcache = "";
let once = false;
const onNavigationStateChange = (event) => {
if (event.url != urlcache) {
const onNavigationStateChange = ({ url }) => {
if (url == urlcache) return;
//URL
urlcache = event.url;
if (event.url.includes("https://train.jr-shikoku.co.jp/usage.htm")) {
if (Platform.OS === "android") navigate("howto", { info: event.url });
urlcache = url;
switch (true) {
case url.includes("https://train.jr-shikoku.co.jp/usage.htm"):
if (Platform.OS === "android") navigate("howto", { info: url });
webview?.current.goBack();
//Actions.howto();
} else if (
event.url.includes("https://train.jr-shikoku.co.jp/train.html")
) {
//Actions.trainbase({info: event.url});
if (Platform.OS === "android")
navigate("trainbase", { info: event.url });
break;
case url.includes("https://train.jr-shikoku.co.jp/train.html"):
//Actions.trainbase({info: url});
if (Platform.OS === "android") navigate("trainbase", { info: url });
webview?.current.goBack();
}
break;
}
};
@ -65,11 +63,8 @@ export const AppsWebView = ({
}
case "PopUpMenu":
{
const selectedStationPDFAddress = dataSet.pdf;
const findStationEachLine = (selectLine) =>
selectLine.filter(
(d) => d.StationTimeTable == selectedStationPDFAddress
);
selectLine.filter((d) => d.StationTimeTable == dataSet.pdf);
let returnDataBase = lineList
.map((d) => findStationEachLine(originalStationList[d]))
.filter((d) => d.length > 0)
@ -85,9 +80,7 @@ export const AppsWebView = ({
navigate: navigate,
goTo: "Apps",
useShow: () =>
SheetManager.show("StationDetailView", {
payload,
}),
SheetManager.show("StationDetailView", { payload }),
onExit: () => SheetManager.hide("StationDetailView"),
};
SheetManager.show("StationDetailView", { payload });
@ -107,17 +100,12 @@ export const AppsWebView = ({
}); //
if (isLandscape) return;
const payload = {
data: {
trainNum,
limited,
},
data: { trainNum, limited },
navigate,
originalStationList,
openStationACFromEachTrainInfo,
};
SheetManager.show("EachTrainInfo", {
payload,
});
SheetManager.show("EachTrainInfo", { payload });
return;
}
case "currentLines": {
@ -136,7 +124,7 @@ export const AppsWebView = ({
const onLoadEnd = () => {
if (once) return () => {};
if (!stationData) return () => {};
if (favoriteStation.length > 0) {
if (favoriteStation.length < 1) return () => {};
const getStationLine = (now) => {
const returnData = Object.keys(stationData).filter((d) => {
const cache = stationData[d].findIndex(
@ -151,7 +139,6 @@ export const AppsWebView = ({
`MoveDisplayStation('${lineName}_${favoriteStation[0][0].MyStation}_${favoriteStation[0][0].Station_JP}')`
);
once = true;
}
};
return (