ts化
This commit is contained in:
parent
294b95967f
commit
892d567991
@ -1,4 +1,4 @@
|
|||||||
import { ToastAndroid } from "react-native";
|
import { Platform, ToastAndroid } from "react-native";
|
||||||
import * as Updates from "expo-updates";
|
import * as Updates from "expo-updates";
|
||||||
|
|
||||||
export const UpdateAsync = () => {
|
export const UpdateAsync = () => {
|
@ -1,5 +1,5 @@
|
|||||||
// 種別判定
|
// 種別判定
|
||||||
export const getType = (string) => {
|
export const getType = (string:string) => {
|
||||||
switch (string) {
|
switch (string) {
|
||||||
case "express":
|
case "express":
|
||||||
return "特急";
|
return "特急";
|
@ -1,6 +1,6 @@
|
|||||||
// Description: 電車名の変換を行う。
|
// Description: 電車名の変換を行う。
|
||||||
// マリンライナーやマリン表記をマリンライナーに変換する。
|
// マリンライナーやマリン表記をマリンライナーに変換する。
|
||||||
export const migrateTrainName = (string) => {
|
export const migrateTrainName = (string:string) => {
|
||||||
return string
|
return string
|
||||||
.replace("マリン", "マリンライナー")
|
.replace("マリン", "マリンライナー")
|
||||||
.replace("ライナーライナー", "ライナー");
|
.replace("ライナーライナー", "ライナー");
|
@ -1,7 +1,7 @@
|
|||||||
// S列番の列車からDやMの列車を検索する
|
// S列番の列車からDやMの列車を検索する
|
||||||
export const searchSpecialTrain = (trainNum, trainList) => {
|
export const searchSpecialTrain = (trainNum: string, trainList: any[]) => {
|
||||||
const searchBase = trainNum.replace("S", "").replace("X", "");
|
const searchBase = trainNum.replace("S", "").replace("X", "");
|
||||||
const search = (text) => {
|
const search = (text: string) => {
|
||||||
const TD = trainList[searchBase + text];
|
const TD = trainList[searchBase + text];
|
||||||
if (TD) {
|
if (TD) {
|
||||||
return true;
|
return true;
|
@ -1,6 +1,6 @@
|
|||||||
import { Platform } from "react-native";
|
import { Platform } from "react-native";
|
||||||
|
|
||||||
export const getPDFViewURL = (url) => {
|
export const getPDFViewURL = (url:string) => {
|
||||||
if (Platform.OS == "ios") return url;
|
if (Platform.OS == "ios") return url;
|
||||||
else
|
else
|
||||||
return `https://mozilla.github.io/pdf.js/web/viewer.html?file=${encodeURI(url)}`;
|
return `https://mozilla.github.io/pdf.js/web/viewer.html?file=${encodeURI(url)}`;
|
@ -41,7 +41,7 @@ export const lineListPair = {
|
|||||||
M: "瀬戸大橋線(児島-宇多津間)[M]",
|
M: "瀬戸大橋線(児島-宇多津間)[M]",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getStationList = async (props) => {
|
export const getStationList = async () => {
|
||||||
if (status) return status;
|
if (status) return status;
|
||||||
//駅リストイニシャライズ
|
//駅リストイニシャライズ
|
||||||
return await Promise.all([
|
return await Promise.all([
|
||||||
@ -68,8 +68,8 @@ export const getStationList = async (props) => {
|
|||||||
stationList["徳島線(徳島-阿波池田間)[B]"],
|
stationList["徳島線(徳島-阿波池田間)[B]"],
|
||||||
stationList["鳴門線(池谷-鳴門間)[N]"],
|
stationList["鳴門線(池谷-鳴門間)[N]"],
|
||||||
stationList["瀬戸大橋線(児島-宇多津間)[M]"],
|
stationList["瀬戸大橋線(児島-宇多津間)[M]"],
|
||||||
stationList.駅間リスト,
|
stationList["駅間リスト"],
|
||||||
stationList.日英対応表,
|
stationList["日英対応表"],
|
||||||
] = values;
|
] = values;
|
||||||
const concatBetweenStations = (eachRouteData) => {
|
const concatBetweenStations = (eachRouteData) => {
|
||||||
let additional = [];
|
let additional = [];
|
||||||
@ -82,7 +82,7 @@ export const getStationList = async (props) => {
|
|||||||
eachRouteData[routeIndex + 1].StationNumber.replace(/[A-Z]/g, "")
|
eachRouteData[routeIndex + 1].StationNumber.replace(/[A-Z]/g, "")
|
||||||
);
|
);
|
||||||
if (nextStationID - currentStationID != 1) {
|
if (nextStationID - currentStationID != 1) {
|
||||||
stationList.駅間リスト.forEach((betweenList) => {
|
stationList["駅間リスト"].forEach((betweenList) => {
|
||||||
if (
|
if (
|
||||||
betweenList.BetweenStation ==
|
betweenList.BetweenStation ==
|
||||||
routeData.Station_JP +
|
routeData.Station_JP +
|
||||||
@ -125,12 +125,12 @@ export const getStationList = async (props) => {
|
|||||||
stationList["予讃線(高松-松山間)[Y]"] = addStationPosition(
|
stationList["予讃線(高松-松山間)[Y]"] = addStationPosition(
|
||||||
concatBetweenStations(stationList["予讃線(高松-松山間)[Y]"]),
|
concatBetweenStations(stationList["予讃線(高松-松山間)[Y]"]),
|
||||||
予讃線,
|
予讃線,
|
||||||
stationList.日英対応表
|
stationList["日英対応表"]
|
||||||
);
|
);
|
||||||
stationList["予讃線(松山-宇和島間)[U]"] = addStationPosition(
|
stationList["予讃線(松山-宇和島間)[U]"] = addStationPosition(
|
||||||
concatBetweenStations(stationList["予讃線(松山-宇和島間)[U]"]),
|
concatBetweenStations(stationList["予讃線(松山-宇和島間)[U]"]),
|
||||||
予讃線,
|
予讃線,
|
||||||
stationList.日英対応表
|
stationList["日英対応表"]
|
||||||
);
|
);
|
||||||
stationList["予讃線/愛ある伊予灘線(向井原-伊予大洲間)[S]"] =
|
stationList["予讃線/愛ある伊予灘線(向井原-伊予大洲間)[S]"] =
|
||||||
addStationPosition(
|
addStationPosition(
|
||||||
@ -138,32 +138,32 @@ export const getStationList = async (props) => {
|
|||||||
stationList["予讃線/愛ある伊予灘線(向井原-伊予大洲間)[S]"]
|
stationList["予讃線/愛ある伊予灘線(向井原-伊予大洲間)[S]"]
|
||||||
),
|
),
|
||||||
予讃線,
|
予讃線,
|
||||||
stationList.日英対応表
|
stationList["日英対応表"]
|
||||||
);
|
);
|
||||||
stationList["土讃線(多度津-高知間)[D]"] = addStationPosition(
|
stationList["土讃線(多度津-高知間)[D]"] = addStationPosition(
|
||||||
concatBetweenStations(stationList["土讃線(多度津-高知間)[D]"]),
|
concatBetweenStations(stationList["土讃線(多度津-高知間)[D]"]),
|
||||||
土讃線,
|
土讃線,
|
||||||
stationList.日英対応表
|
stationList["日英対応表"]
|
||||||
);
|
);
|
||||||
stationList["土讃線(高知-窪川間)[K]"] = addStationPosition(
|
stationList["土讃線(高知-窪川間)[K]"] = addStationPosition(
|
||||||
concatBetweenStations(stationList["土讃線(高知-窪川間)[K]"]),
|
concatBetweenStations(stationList["土讃線(高知-窪川間)[K]"]),
|
||||||
土讃線,
|
土讃線,
|
||||||
stationList.日英対応表
|
stationList["日英対応表"]
|
||||||
);
|
);
|
||||||
stationList["高徳線(高松-徳島間)[T]"] = addStationPosition(
|
stationList["高徳線(高松-徳島間)[T]"] = addStationPosition(
|
||||||
concatBetweenStations(stationList["高徳線(高松-徳島間)[T]"]),
|
concatBetweenStations(stationList["高徳線(高松-徳島間)[T]"]),
|
||||||
高徳線,
|
高徳線,
|
||||||
stationList.日英対応表
|
stationList["日英対応表"]
|
||||||
);
|
);
|
||||||
stationList["鳴門線(池谷-鳴門間)[N]"] = addStationPosition(
|
stationList["鳴門線(池谷-鳴門間)[N]"] = addStationPosition(
|
||||||
concatBetweenStations(stationList["鳴門線(池谷-鳴門間)[N]"]),
|
concatBetweenStations(stationList["鳴門線(池谷-鳴門間)[N]"]),
|
||||||
鳴門線,
|
鳴門線,
|
||||||
stationList.日英対応表
|
stationList["日英対応表"]
|
||||||
);
|
);
|
||||||
const tokushimaCurrent = addStationPosition(
|
const tokushimaCurrent = addStationPosition(
|
||||||
concatBetweenStations(stationList["徳島線(徳島-阿波池田間)[B]"]),
|
concatBetweenStations(stationList["徳島線(徳島-阿波池田間)[B]"]),
|
||||||
徳島線,
|
徳島線,
|
||||||
stationList.日英対応表
|
stationList["日英対応表"]
|
||||||
);
|
);
|
||||||
stationList["徳島線(徳島-阿波池田間)[B]"] = [
|
stationList["徳島線(徳島-阿波池田間)[B]"] = [
|
||||||
tokushimaCurrent[tokushimaCurrent.length - 1],
|
tokushimaCurrent[tokushimaCurrent.length - 1],
|
@ -1,4 +1,5 @@
|
|||||||
export const buildProvidersTree = (providers) => {
|
import React, { FC } from "react";
|
||||||
|
export const buildProvidersTree:FC<any> = (providers) => {
|
||||||
// 基本ケース:ContextProviderが1つしか残っていない場合、それを返して終了する
|
// 基本ケース:ContextProviderが1つしか残っていない場合、それを返して終了する
|
||||||
if (providers.length === 1) {
|
if (providers.length === 1) {
|
||||||
return providers[0];
|
return providers[0];
|
@ -1,10 +1,10 @@
|
|||||||
import React, { useRef, useState } from "react";
|
import React, { Ref, useRef, useState } from "react";
|
||||||
import { View, Platform, TouchableOpacity } from "react-native";
|
import { View, Platform, TouchableOpacity, StyleProp, ViewStyle } from "react-native";
|
||||||
import { WebView } from "react-native-webview";
|
import { WebView } from "react-native-webview";
|
||||||
import Constants from "expo-constants";
|
import Constants from "expo-constants";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
export default function tndView() {
|
export default function tndView() {
|
||||||
const webview = useRef();
|
const webview = useRef<WebView>(null);
|
||||||
const jsa = `
|
const jsa = `
|
||||||
document.querySelector('.sitettl').style.display = 'none';
|
document.querySelector('.sitettl').style.display = 'none';
|
||||||
document.querySelector('.attention').style.display = 'none';
|
document.querySelector('.attention').style.display = 'none';
|
||||||
@ -18,7 +18,6 @@ export default function tndView() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<WebView
|
<WebView
|
||||||
useWebKit={true}
|
|
||||||
ref={webview}
|
ref={webview}
|
||||||
source={{ uri: "https://www.jr-shikoku.co.jp/info/" }}
|
source={{ uri: "https://www.jr-shikoku.co.jp/info/" }}
|
||||||
originWhitelist={["https://www.jr-shikoku.co.jp"]}
|
originWhitelist={["https://www.jr-shikoku.co.jp"]}
|
||||||
@ -29,15 +28,15 @@ export default function tndView() {
|
|||||||
onError={() => this.webView?.reload()}
|
onError={() => this.webView?.reload()}
|
||||||
/>
|
/>
|
||||||
<ReloadButton
|
<ReloadButton
|
||||||
onPress={() => webview.current?.reload()}
|
onPress={() => webview.current.reload()}
|
||||||
top={Platform.OS == "ios" ? Constants.statusBarHeight : 0}
|
top={Platform.OS == "ios" ? Constants.statusBarHeight : 0}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ReloadButton = ({ onPress, top, mapSwitch, LoadError = false }) => {
|
const ReloadButton = ({ onPress, top, LoadError = false }) => {
|
||||||
const styles = {
|
const styles:StyleProp<ViewStyle> = {
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
top,
|
top,
|
||||||
right: 10,
|
right: 10,
|
||||||
@ -51,7 +50,6 @@ const ReloadButton = ({ onPress, top, mapSwitch, LoadError = false }) => {
|
|||||||
alignContent: "center",
|
alignContent: "center",
|
||||||
alignSelf: "center",
|
alignSelf: "center",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
display: mapSwitch,
|
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity onPress={onPress} style={styles}>
|
<TouchableOpacity onPress={onPress} style={styles}>
|
Loading…
Reference in New Issue
Block a user