From 892d56799150cffc4050096acb98331d2642021a Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 22 Jan 2025 12:03:50 +0000 Subject: [PATCH] =?UTF-8?q?ts=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UpdateAsync.js => UpdateAsync.ts | 2 +- .../{getType.js => getType.ts} | 2 +- ...igrateTrainName.js => migrateTrainName.ts} | 2 +- ...hSpecialTrain.js => searchSpecialTrain.ts} | 4 ++-- lib/{getPdfViewURL.js => getPdfViewURL.ts} | 2 +- lib/{getStationList.js => getStationList.ts} | 24 +++++++++---------- ...eeProvider.js => providerTreeProvider.tsx} | 3 ++- ndView.js => ndView.tsx | 14 +++++------ 8 files changed, 26 insertions(+), 27 deletions(-) rename UpdateAsync.js => UpdateAsync.ts (94%) rename lib/eachTrainInfoCoreLib/{getType.js => getType.ts} (78%) rename lib/eachTrainInfoCoreLib/{migrateTrainName.js => migrateTrainName.ts} (83%) rename lib/eachTrainInfoCoreLib/{searchSpecialTrain.js => searchSpecialTrain.ts} (86%) rename lib/{getPdfViewURL.js => getPdfViewURL.ts} (79%) rename lib/{getStationList.js => getStationList.ts} (94%) rename lib/{providerTreeProvider.js => providerTreeProvider.tsx} (89%) rename ndView.js => ndView.tsx (81%) diff --git a/UpdateAsync.js b/UpdateAsync.ts similarity index 94% rename from UpdateAsync.js rename to UpdateAsync.ts index c961da7..8d93c3a 100644 --- a/UpdateAsync.js +++ b/UpdateAsync.ts @@ -1,4 +1,4 @@ -import { ToastAndroid } from "react-native"; +import { Platform, ToastAndroid } from "react-native"; import * as Updates from "expo-updates"; export const UpdateAsync = () => { diff --git a/lib/eachTrainInfoCoreLib/getType.js b/lib/eachTrainInfoCoreLib/getType.ts similarity index 78% rename from lib/eachTrainInfoCoreLib/getType.js rename to lib/eachTrainInfoCoreLib/getType.ts index d989461..8d54c69 100644 --- a/lib/eachTrainInfoCoreLib/getType.js +++ b/lib/eachTrainInfoCoreLib/getType.ts @@ -1,5 +1,5 @@ // 種別判定 -export const getType = (string) => { +export const getType = (string:string) => { switch (string) { case "express": return "特急"; diff --git a/lib/eachTrainInfoCoreLib/migrateTrainName.js b/lib/eachTrainInfoCoreLib/migrateTrainName.ts similarity index 83% rename from lib/eachTrainInfoCoreLib/migrateTrainName.js rename to lib/eachTrainInfoCoreLib/migrateTrainName.ts index 88e0a26..ace291a 100644 --- a/lib/eachTrainInfoCoreLib/migrateTrainName.js +++ b/lib/eachTrainInfoCoreLib/migrateTrainName.ts @@ -1,6 +1,6 @@ // Description: 電車名の変換を行う。 // マリンライナーやマリン表記をマリンライナーに変換する。 -export const migrateTrainName = (string) => { +export const migrateTrainName = (string:string) => { return string .replace("マリン", "マリンライナー") .replace("ライナーライナー", "ライナー"); diff --git a/lib/eachTrainInfoCoreLib/searchSpecialTrain.js b/lib/eachTrainInfoCoreLib/searchSpecialTrain.ts similarity index 86% rename from lib/eachTrainInfoCoreLib/searchSpecialTrain.js rename to lib/eachTrainInfoCoreLib/searchSpecialTrain.ts index 39804cf..535f68d 100644 --- a/lib/eachTrainInfoCoreLib/searchSpecialTrain.js +++ b/lib/eachTrainInfoCoreLib/searchSpecialTrain.ts @@ -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; diff --git a/lib/getPdfViewURL.js b/lib/getPdfViewURL.ts similarity index 79% rename from lib/getPdfViewURL.js rename to lib/getPdfViewURL.ts index 92d3af0..28bfbad 100644 --- a/lib/getPdfViewURL.js +++ b/lib/getPdfViewURL.ts @@ -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)}`; diff --git a/lib/getStationList.js b/lib/getStationList.ts similarity index 94% rename from lib/getStationList.js rename to lib/getStationList.ts index 8603396..76a3bf5 100644 --- a/lib/getStationList.js +++ b/lib/getStationList.ts @@ -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], diff --git a/lib/providerTreeProvider.js b/lib/providerTreeProvider.tsx similarity index 89% rename from lib/providerTreeProvider.js rename to lib/providerTreeProvider.tsx index f759cc7..43fb21a 100644 --- a/lib/providerTreeProvider.js +++ b/lib/providerTreeProvider.tsx @@ -1,4 +1,5 @@ -export const buildProvidersTree = (providers) => { +import React, { FC } from "react"; +export const buildProvidersTree:FC = (providers) => { // 基本ケース:ContextProviderが1つしか残っていない場合、それを返して終了する if (providers.length === 1) { return providers[0]; diff --git a/ndView.js b/ndView.tsx similarity index 81% rename from ndView.js rename to ndView.tsx index a492387..8858e34 100644 --- a/ndView.js +++ b/ndView.tsx @@ -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(null); const jsa = ` document.querySelector('.sitettl').style.display = 'none'; document.querySelector('.attention').style.display = 'none'; @@ -18,7 +18,6 @@ export default function tndView() { }} > this.webView?.reload()} /> webview.current?.reload()} + onPress={() => webview.current.reload()} top={Platform.OS == "ios" ? Constants.statusBarHeight : 0} /> ); } -const ReloadButton = ({ onPress, top, mapSwitch, LoadError = false }) => { - const styles = { +const ReloadButton = ({ onPress, top, LoadError = false }) => { + const styles:StyleProp = { 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 (