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