Merge commit '33435c004b8cbb78d29b199b7021e4551e819944' into patch/6.x
This commit is contained in:
commit
dc7cc555c9
@ -84,11 +84,15 @@ export function MenuPage() {
|
|||||||
setFavoriteStation(returnData);
|
setFavoriteStation(returnData);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((d) => console.log(d));
|
.catch((error) => {
|
||||||
|
if (__DEV__) {
|
||||||
|
console.warn('お気に入り駅の読み込みに失敗しました:', error);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return unsubscribe;
|
return unsubscribe;
|
||||||
}, [navigation, mapHeight]);
|
}, [navigation, mapHeight, favoriteStation, setFavoriteStation]);
|
||||||
return (
|
return (
|
||||||
<Stack.Navigator>
|
<Stack.Navigator>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
|
@ -21,7 +21,6 @@ export const LandscapeTrainInfo = (props) => {
|
|||||||
width: width / 2,
|
width: width / 2,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text>{width / 2}</Text>
|
|
||||||
{leftContent}
|
{leftContent}
|
||||||
</View>
|
</View>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
|
@ -11,14 +11,8 @@ export const LongHeader = ({
|
|||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<ScrollView
|
<ScrollView
|
||||||
//onTouchStart={() => setActionSheetHorizonalScroll(true)}
|
|
||||||
//onScrollEndDrag={() => setActionSheetHorizonalScroll(false)}
|
|
||||||
//onScrollBeginDrag={() => console.log("onScrollBeginDrag")}
|
|
||||||
style={{
|
style={{
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
//width: widthPercentageToDP("200%"),
|
|
||||||
// minHeight: 200,
|
|
||||||
//height: heightPercentageToDP("20%"),
|
|
||||||
}}
|
}}
|
||||||
horizontal
|
horizontal
|
||||||
pagingEnabled
|
pagingEnabled
|
||||||
|
@ -11,15 +11,9 @@ export const ShortHeader = ({
|
|||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<ScrollView
|
<ScrollView
|
||||||
//onTouchStart={() => setActionSheetHorizonalScroll(true)}
|
|
||||||
//onScrollEndDrag={() => setActionSheetHorizonalScroll(false)}
|
|
||||||
//onScrollBeginDrag={() => console.log("onScrollBeginDrag")}
|
|
||||||
style={{
|
style={{
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
flex: 1,
|
flex: 1,
|
||||||
//width: widthPercentageToDP("200%"),
|
|
||||||
// minHeight: 200,
|
|
||||||
//height: heightPercentageToDP("20%"),
|
|
||||||
}}
|
}}
|
||||||
horizontal
|
horizontal
|
||||||
pagingEnabled
|
pagingEnabled
|
||||||
|
@ -36,7 +36,7 @@ export const StationDeteilView = (props) => {
|
|||||||
setTrainBus();
|
setTrainBus();
|
||||||
}
|
}
|
||||||
setTrainBus(data[0]);
|
setTrainBus(data[0]);
|
||||||
}, [currentStation]);
|
}, [currentStation, busAndTrainData]);
|
||||||
|
|
||||||
const [usePDFView, setUsePDFView] = useState(undefined);
|
const [usePDFView, setUsePDFView] = useState(undefined);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -104,7 +104,7 @@ export const CarouselBox = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text style={{ color: "#0099CC", fontSize: 20 }}>
|
<Text style={{ color: "#0099CC", fontSize: 20 }}>
|
||||||
{!!isSearchMode ? "路線検索モードです。上に並んでいる路線を選んでみましょう!" :stationListMode == "position"
|
{!!isSearchMode ? "路線検索モードです。入力欄に駅名やナンバリングを入力したり、上に並んでいる路線を選んでみましょう!" :stationListMode == "position"
|
||||||
? "現在地の近くに駅がありません。"
|
? "現在地の近くに駅がありません。"
|
||||||
: "お気に入りリストがありません。お気に入りの駅を追加しよう!"}
|
: "お気に入りリストがありません。お気に入りの駅を追加しよう!"}
|
||||||
</Text>
|
</Text>
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
import { AS } from "@/storageControl";
|
import { AS } from "@/storageControl";
|
||||||
import { useBottomTabBarHeight } from "@react-navigation/bottom-tabs";
|
import React from "react";
|
||||||
import React, { useEffect, useRef } from "react";
|
|
||||||
import { useWindowDimensions } from "react-native";
|
|
||||||
import {
|
import {
|
||||||
View,
|
|
||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
Text,
|
Text,
|
||||||
LayoutAnimation,
|
LayoutAnimation,
|
||||||
@ -16,8 +13,6 @@ import { SearchUnitBox } from "@/components/Menu/RailScope/SearchUnitBox";
|
|||||||
export const CarouselTypeChanger = ({
|
export const CarouselTypeChanger = ({
|
||||||
locationStatus,
|
locationStatus,
|
||||||
position,
|
position,
|
||||||
mapsRef,
|
|
||||||
scrollRef,
|
|
||||||
stationListMode,
|
stationListMode,
|
||||||
setStationListMode,
|
setStationListMode,
|
||||||
setSelectedCurrentStation,
|
setSelectedCurrentStation,
|
||||||
@ -25,9 +20,9 @@ export const CarouselTypeChanger = ({
|
|||||||
setMapMode,
|
setMapMode,
|
||||||
isSearchMode,
|
isSearchMode,
|
||||||
setisSearchMode,
|
setisSearchMode,
|
||||||
|
input,
|
||||||
|
setInput,
|
||||||
}) => {
|
}) => {
|
||||||
const tabBarHeight = useBottomTabBarHeight();
|
|
||||||
const { height, width } = useWindowDimensions();
|
|
||||||
const returnToDefaultMode = () => {
|
const returnToDefaultMode = () => {
|
||||||
LayoutAnimation.configureNext({
|
LayoutAnimation.configureNext({
|
||||||
duration: 300,
|
duration: 300,
|
||||||
@ -44,8 +39,9 @@ export const CarouselTypeChanger = ({
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<KeyboardAvoidingView
|
<KeyboardAvoidingView
|
||||||
behavior="padding"
|
behavior="position"
|
||||||
keyboardVerticalOffset={80}
|
contentContainerStyle={{ flex: 1, flexDirection: "row" }}
|
||||||
|
keyboardVerticalOffset={mapMode ? 0 : 45}
|
||||||
enabled={Platform.OS === "ios"}
|
enabled={Platform.OS === "ios"}
|
||||||
style={{
|
style={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
@ -61,6 +57,8 @@ export const CarouselTypeChanger = ({
|
|||||||
<SearchUnitBox
|
<SearchUnitBox
|
||||||
isSearchMode={isSearchMode}
|
isSearchMode={isSearchMode}
|
||||||
setisSearchMode={setisSearchMode}
|
setisSearchMode={setisSearchMode}
|
||||||
|
input={input}
|
||||||
|
setInput={setInput}
|
||||||
/>
|
/>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={{
|
style={{
|
||||||
|
@ -12,7 +12,12 @@ import Ionicons from "react-native-vector-icons/Ionicons";
|
|||||||
import { useWindowDimensions } from "react-native";
|
import { useWindowDimensions } from "react-native";
|
||||||
import lineColorList from "@/assets/originData/lineColorList";
|
import lineColorList from "@/assets/originData/lineColorList";
|
||||||
import { lineList_LineWebID, stationIDPair } from "@/lib/getStationList";
|
import { lineList_LineWebID, stationIDPair } from "@/lib/getStationList";
|
||||||
export const SearchUnitBox = ({ isSearchMode, setisSearchMode }) => {
|
export const SearchUnitBox = ({
|
||||||
|
isSearchMode,
|
||||||
|
setisSearchMode,
|
||||||
|
input,
|
||||||
|
setInput,
|
||||||
|
}) => {
|
||||||
const { height, width } = useWindowDimensions();
|
const { height, width } = useWindowDimensions();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -39,16 +44,26 @@ export const SearchUnitBox = ({ isSearchMode, setisSearchMode }) => {
|
|||||||
>
|
>
|
||||||
{!isSearchMode && <Ionicons name="search" size={30} color="white" />}
|
{!isSearchMode && <Ionicons name="search" size={30} color="white" />}
|
||||||
{!!isSearchMode && (
|
{!!isSearchMode && (
|
||||||
<View style={{ backgroundColor: "#0099CC" }}>
|
<View
|
||||||
|
style={{
|
||||||
|
backgroundColor: "#0099CC",
|
||||||
|
flexDirection: "column",
|
||||||
|
display: "flex",
|
||||||
|
flex: 1,
|
||||||
|
alignContent: "center",
|
||||||
|
justifyContent: "flex-end",
|
||||||
|
}}
|
||||||
|
>
|
||||||
<View style={{ flexDirection: "row", alignItems: "center" }}>
|
<View style={{ flexDirection: "row", alignItems: "center" }}>
|
||||||
<TouchableOpacity onPress={() => {
|
<TouchableOpacity
|
||||||
LayoutAnimation.configureNext({
|
onPress={() => {
|
||||||
duration: 100,
|
LayoutAnimation.configureNext({
|
||||||
update: { type: "easeInEaseOut", springDamping: 0.6 },
|
duration: 100,
|
||||||
});
|
update: { type: "easeInEaseOut", springDamping: 0.6 },
|
||||||
setisSearchMode(false);
|
});
|
||||||
}}>
|
setisSearchMode(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Ionicons
|
<Ionicons
|
||||||
name="arrow-back"
|
name="arrow-back"
|
||||||
size={20}
|
size={20}
|
||||||
@ -56,56 +71,88 @@ export const SearchUnitBox = ({ isSearchMode, setisSearchMode }) => {
|
|||||||
style={{ marginRight: 10 }}
|
style={{ marginRight: 10 }}
|
||||||
/>
|
/>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
{Object.keys(lineList_LineWebID).map((d) => (
|
<View
|
||||||
<TouchableOpacity
|
style={{
|
||||||
style={{
|
backgroundColor: "white",
|
||||||
flex: 1,
|
borderRadius: 25,
|
||||||
backgroundColor: lineColorList[stationIDPair[lineList_LineWebID[d]]],
|
height: 30,
|
||||||
padding: 5,
|
paddingRight: 10,
|
||||||
marginHorizontal: 2,
|
paddingLeft: 10,
|
||||||
borderRadius: 10,
|
flex: 1,
|
||||||
borderColor: "white",
|
flexDirection: "row",
|
||||||
borderWidth: 1,
|
alignItems: "center",
|
||||||
borderStyle: "solid",
|
justifyContent: "center",
|
||||||
alignItems: "center",
|
}}
|
||||||
opacity: isSearchMode == stationIDPair[lineList_LineWebID[d]] ? 1 : !isSearchMode ? 1 : 0.5,
|
>
|
||||||
zIndex: 10,
|
<TextInput
|
||||||
}}
|
placeholder="駅名や駅ナンバリングを入力してフィルタリングします。"
|
||||||
onPress={() => {
|
onEndEditing={() => {}}
|
||||||
const id = stationIDPair[lineList_LineWebID[d]];
|
onChange={(ret) => setInput(ret.nativeEvent.text)}
|
||||||
const s = isSearchMode == id ? undefined : id;
|
value={input}
|
||||||
if (!s) return;
|
style={{ flex: 1 }}
|
||||||
setisSearchMode(s);
|
/>
|
||||||
}}
|
{input && (
|
||||||
key={stationIDPair[lineList_LineWebID[d]]}
|
<TouchableOpacity
|
||||||
>
|
onPress={() => setInput("") }
|
||||||
<Text
|
style={{
|
||||||
style={{ color: "white", fontWeight: "bold", fontSize: 20 }}
|
padding: 3,
|
||||||
|
borderRadius: 15,
|
||||||
|
backgroundColor: "lightgray",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{stationIDPair[lineList_LineWebID[d]]}
|
<Ionicons
|
||||||
</Text>
|
name="close"
|
||||||
</TouchableOpacity>
|
size={20}
|
||||||
))}
|
color="white"
|
||||||
{/* <View
|
/>
|
||||||
style={{
|
</TouchableOpacity>
|
||||||
backgroundColor: "white",
|
)}
|
||||||
borderRadius: 25,
|
</View>
|
||||||
height: 30,
|
|
||||||
paddingRight: 10,
|
|
||||||
paddingLeft: 10,
|
|
||||||
flex: 1,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<TextInput
|
|
||||||
placeholder="駅名を入力してフィルタリングします。"
|
|
||||||
//onFocus={() => setKeyBoardVisible(true)}
|
|
||||||
onEndEditing={() => {}}
|
|
||||||
//onChange={(ret) => setInput(ret.nativeEvent.text)}
|
|
||||||
//value={input}
|
|
||||||
style={{ flex: 1 }}
|
|
||||||
/>
|
|
||||||
</View> */}
|
|
||||||
</View>
|
</View>
|
||||||
|
{!input && (
|
||||||
|
<View style={{ flexDirection: "row", alignItems: "center" }}>
|
||||||
|
{Object.keys(lineList_LineWebID).map((d) => (
|
||||||
|
<TouchableOpacity
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor:
|
||||||
|
lineColorList[stationIDPair[lineList_LineWebID[d]]],
|
||||||
|
padding: 5,
|
||||||
|
marginHorizontal: 2,
|
||||||
|
borderRadius: 10,
|
||||||
|
borderColor: "white",
|
||||||
|
borderWidth: 1,
|
||||||
|
borderStyle: "solid",
|
||||||
|
alignItems: "center",
|
||||||
|
opacity:
|
||||||
|
isSearchMode == stationIDPair[lineList_LineWebID[d]]
|
||||||
|
? 1
|
||||||
|
: !isSearchMode
|
||||||
|
? 1
|
||||||
|
: 0.5,
|
||||||
|
zIndex: 10,
|
||||||
|
}}
|
||||||
|
onPress={() => {
|
||||||
|
const id = stationIDPair[lineList_LineWebID[d]];
|
||||||
|
const s = isSearchMode == id ? undefined : id;
|
||||||
|
if (!s) return;
|
||||||
|
setisSearchMode(s);
|
||||||
|
}}
|
||||||
|
key={stationIDPair[lineList_LineWebID[d]]}
|
||||||
|
>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
color: "white",
|
||||||
|
fontWeight: "bold",
|
||||||
|
fontSize: 20,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{stationIDPair[lineList_LineWebID[d]]}
|
||||||
|
</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
@ -17,7 +17,7 @@ import { SwitchArea } from "../atom/SwitchArea";
|
|||||||
import { useNotification } from "../../stateBox/useNotifications";
|
import { useNotification } from "../../stateBox/useNotifications";
|
||||||
import { SheetHeaderItem } from "@/components/atom/SheetHeaderItem";
|
import { SheetHeaderItem } from "@/components/atom/SheetHeaderItem";
|
||||||
|
|
||||||
const versionCode = "6.1.0"; // Update this version code as needed
|
const versionCode = "6.1.1"; // Update this version code as needed
|
||||||
|
|
||||||
export const SettingTopPage = ({
|
export const SettingTopPage = ({
|
||||||
testNFC,
|
testNFC,
|
||||||
|
@ -14,9 +14,7 @@ import { createStackNavigator } from "@react-navigation/stack";
|
|||||||
import { TransitionPresets } from "@react-navigation/stack";
|
import { TransitionPresets } from "@react-navigation/stack";
|
||||||
//import * as ExpoFelicaReader from "../../modules/expo-felica-reader/src";
|
//import * as ExpoFelicaReader from "../../modules/expo-felica-reader/src";
|
||||||
import * as Updates from "expo-updates";
|
import * as Updates from "expo-updates";
|
||||||
import StatusbarDetect from "../../StatusbarDetect";
|
|
||||||
import { AS } from "../../storageControl";
|
import { AS } from "../../storageControl";
|
||||||
var Status = StatusbarDetect();
|
|
||||||
import { Switch } from "react-native-elements";
|
import { Switch } from "react-native-elements";
|
||||||
import AutoHeightImage from "react-native-auto-height-image";
|
import AutoHeightImage from "react-native-auto-height-image";
|
||||||
import { SettingTopPage } from "./SettingTopPage";
|
import { SettingTopPage } from "./SettingTopPage";
|
||||||
|
@ -29,7 +29,9 @@ export default function TrainBase({ route }) {
|
|||||||
"https://train.jr-shikoku.co.jp",
|
"https://train.jr-shikoku.co.jp",
|
||||||
"https://train.jr-shikoku.co.jp/sp.html",
|
"https://train.jr-shikoku.co.jp/sp.html",
|
||||||
]}
|
]}
|
||||||
onMessage={(event) => {}}
|
onMessage={() => {
|
||||||
|
// 必要に応じてメッセージ処理を実装
|
||||||
|
}}
|
||||||
mixedContentMode={"compatibility"}
|
mixedContentMode={"compatibility"}
|
||||||
javaScriptEnabled
|
javaScriptEnabled
|
||||||
injectedJavaScript={jss}
|
injectedJavaScript={jss}
|
||||||
|
1
index.js
1
index.js
@ -1,4 +1,3 @@
|
|||||||
import 'babel-polyfill';
|
|
||||||
import { registerRootComponent } from "expo";
|
import { registerRootComponent } from "expo";
|
||||||
import { registerWidgetTaskHandler } from "react-native-android-widget";
|
import { registerWidgetTaskHandler } from "react-native-android-widget";
|
||||||
import { Platform } from "react-native";
|
import { Platform } from "react-native";
|
||||||
|
@ -46,6 +46,6 @@ export const findReversalPoints = (array, stopStationIDList) => {
|
|||||||
return allThroughStation;
|
return allThroughStation;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
// エラーが発生した場合は空の配列を返す
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -73,7 +73,8 @@ export const injectJavascriptData: InjectJavascriptData = (
|
|||||||
const trainIcon = `
|
const trainIcon = `
|
||||||
const setStationIcon = (setIconElem,img,hasProblem) =>{
|
const setStationIcon = (setIconElem,img,hasProblem) =>{
|
||||||
const position = setIconElem.getAttribute("style").includes("left");
|
const position = setIconElem.getAttribute("style").includes("left");
|
||||||
setIconElem.insertAdjacentHTML('beforebegin', "<img src="+img+" style='float:"+(position ? 'left' : 'right')+";height:22px;margin: 2px;'>");
|
const marginData = ${uiSetting === "tokyo" ? `"5px"`: `"2px"`}
|
||||||
|
setIconElem.insertAdjacentHTML('beforebegin', "<img src="+img+" style='float:"+(position ? 'left' : 'right')+";height:22px;margin: "+marginData+";'>");
|
||||||
setIconElem.remove();
|
setIconElem.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1052,7 +1053,7 @@ export const injectJavascriptData: InjectJavascriptData = (
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const nameReplace = (列車名データ,列番データ,行き先情報,hasProblem) =>{
|
const nameReplace = (列車名データ,列番データ,行き先情報,hasProblem,isLeft) =>{
|
||||||
let isWanman = false;
|
let isWanman = false;
|
||||||
let trainName = "";
|
let trainName = "";
|
||||||
let trainType = "";
|
let trainType = "";
|
||||||
@ -1344,14 +1345,9 @@ export const injectJavascriptData: InjectJavascriptData = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
const gradient = getColors.length > 1 ? "linear-gradient(130deg, " + getColors[0] + " 0%, "+ getColors[0]+"50%, "+ getColors[1]+"50%, " + getColors[1] + " 100%)" : getColors[0];
|
const gradient = getColors.length > 1 ? "linear-gradient(130deg, " + getColors[0] + " 0%, "+ getColors[0]+"50%, "+ getColors[1]+"50%, " + getColors[1] + " 100%)" : getColors[0];
|
||||||
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:6px;padding:0;color:black;text-align:center;'>" + TrainNumber + (JRF ? "":"レ") + "</p>");
|
|
||||||
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:8px;font-weight:bold;padding:0;color: black;text-align:center;'>" + (isWanman ? "ワンマン " : "") + "</p>");
|
行き先情報.insertAdjacentHTML('beforebegin', "<div style='width:100%;display:flex;flex:1;flex-direction:"+(isLeft ? "column-reverse" : "column") + ";'><p style='font-size:6px;padding:0;color:black;text-align:center;'>" + TrainNumber + (JRF ? "":"レ") + "</p><div style='flex:1;'></div><p style='font-size:8px;font-weight:bold;padding:0;color: black;text-align:center;'>" + (isWanman ? "ワンマン " : "") + "</p><p style='font-size:6px;font-weight:bold;padding:0;color: black;text-align:center;border-style:solid;border-width: "+(!!yosan2Color ? "2px" : "0px")+";border-color:" + yosan2Color + "'>" + viaData + "</p><p style='font-size:8px;font-weight:bold;padding:0;color: black;text-align:center;'>" + trainName + "</p><div style='width:100%;background:" + gradient + ";'><p style='font-size:10px;font-weight:bold;padding:0;margin:0;color:white;align-items:center;align-content:center;text-align:center;text-shadow:1px 1px 0px #00000030, -1px -1px 0px #00000030,-1px 1px 0px #00000030, 1px -1px 0px #00000030,1px 0px 0px #00000030, -1px 0px 0px #00000030,0px 1px 0px #00000030, 0px -1px 0px #00000030;'>" + (ToData ? ToData + "行" : ToData) + "</p></div><div style='width:100%;background:" + trainTypeColor + ";border-radius:"+(isLeft ? "4px 4px 0 0" : "0 0 4px 4px")+";'><p style='font-size:10px;font-weight:bold;font-style:italic;padding:0;color: white;text-align:center;'>" + trainType + "</p></div><p style='font-size:8px;font-weight:bold;padding:0;text-align:center;color: "+(hasProblem ? "red":"black")+";'>" + (hasProblem ? "‼️停止中‼️" : "") + "</p></div>");
|
||||||
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:6px;font-weight:bold;padding:0;color: black;text-align:center;border-bottom-style:solid;border-bottom-width: "+(!!yosan2Color ? "2px" : "0px")+";border-color:" + yosan2Color + "'>" + viaData + "</p>");
|
`: `
|
||||||
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:8px;font-weight:bold;padding:0;color: black;text-align:center;'>" + trainName + "</p>");
|
|
||||||
行き先情報.insertAdjacentHTML('beforebegin', "<div style='width:100%;background:" + gradient + ";'><p style='font-size:10px;font-weight:bold;padding:0;margin:0;color:white;align-items:center;align-content:center;text-align:center;text-shadow:1px 1px 0px #00000030, -1px -1px 0px #00000030,-1px 1px 0px #00000030, 1px -1px 0px #00000030,1px 0px 0px #00000030, -1px 0px 0px #00000030,0px 1px 0px #00000030, 0px -1px 0px #00000030;'>" + (ToData ? ToData + "行" : ToData) + "</p></div>");
|
|
||||||
行き先情報.insertAdjacentHTML('beforebegin', "<div style='width:100%;background:" + trainTypeColor + ";'><p style='font-size:10px;font-weight:bold;font-style:italic;padding:0;color: white;text-align:center;'>" + trainType + "</p></div>");
|
|
||||||
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:8px;font-weight:bold;padding:0;text-align:center;color: "+(hasProblem ? "red":"black")+";'>" + (hasProblem ? "‼️停止中‼️" : "") + "</p>");
|
|
||||||
`: `
|
|
||||||
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:10px;font-weight:bold;padding:0;color: black;'>" + returnText1 + "</p>");
|
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:10px;font-weight:bold;padding:0;color: black;'>" + returnText1 + "</p>");
|
||||||
行き先情報.insertAdjacentHTML('beforebegin', "<div style='display:inline-flex;flex-direction:row;'><p style='font-size:10px;font-weight: bold;padding:0;color:black;'>" + (ToData ? ToData + "行 " : ToData) + "</p><p style='font-size:10px;padding:0;color:black;'>" + TrainNumber + (JRF ? "":"レ") + "</p></div>");
|
行き先情報.insertAdjacentHTML('beforebegin', "<div style='display:inline-flex;flex-direction:row;'><p style='font-size:10px;font-weight: bold;padding:0;color:black;'>" + (ToData ? ToData + "行 " : ToData) + "</p><p style='font-size:10px;padding:0;color:black;'>" + TrainNumber + (JRF ? "":"レ") + "</p></div>");
|
||||||
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:10px;font-weight:bold;padding:0;color: "+(hasProblem ? "red":"black")+";'>" + (hasProblem ? "‼️停止中‼️" : "") + "</p>");
|
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:10px;font-weight:bold;padding:0;color: "+(hasProblem ? "red":"black")+";'>" + (hasProblem ? "‼️停止中‼️" : "") + "</p>");
|
||||||
@ -1373,7 +1369,7 @@ const setNewTrainItem = (element,hasProblem)=>{
|
|||||||
}else if(JRFTemp){
|
}else if(JRFTemp){
|
||||||
element.style.borderColor = 'rgba(0, 134, 158, 0.8)';
|
element.style.borderColor = 'rgba(0, 134, 158, 0.8)';
|
||||||
}else{
|
}else{
|
||||||
element.style.borderColor = 'white';
|
element.style.borderColor = 'black';
|
||||||
}
|
}
|
||||||
element.style.borderWidth = '2px';
|
element.style.borderWidth = '2px';
|
||||||
element.style.borderStyle = 'solid';
|
element.style.borderStyle = 'solid';
|
||||||
@ -1410,12 +1406,12 @@ const setNewTrainItem = (element,hasProblem)=>{
|
|||||||
element.addEventListener('touchend', () => element.style.transform = 'scale(1)');
|
element.addEventListener('touchend', () => element.style.transform = 'scale(1)');
|
||||||
if(element.getAttribute("style").includes("left")){
|
if(element.getAttribute("style").includes("left")){
|
||||||
// borderを使って五角形を生成 下り
|
// borderを使って五角形を生成 下り
|
||||||
element.style.borderRadius = '10% 10% 40% 40%';
|
element.style.borderRadius = '30px 30px 120px 120px';
|
||||||
element.style.flexDirection = 'column-reverse';
|
element.style.flexDirection = 'column-reverse';
|
||||||
}
|
}
|
||||||
else if(element.getAttribute("style").includes("right")){
|
else if(element.getAttribute("style").includes("right")){
|
||||||
// borderを使って五角形を生成 上り
|
// borderを使って五角形を生成 上り
|
||||||
element.style.borderRadius = '40% 40% 10% 10%';
|
element.style.borderRadius = '120px 120px 30px 30px';
|
||||||
element.style.flexDirection = 'column';
|
element.style.flexDirection = 'column';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1425,57 +1421,70 @@ const setStrings = () =>{
|
|||||||
try {
|
try {
|
||||||
const elements = document.querySelectorAll('#disp > div > div > div[onclick]');
|
const elements = document.querySelectorAll('#disp > div > div > div[onclick]');
|
||||||
const setNewTrainItemUI = ()=>{
|
const setNewTrainItemUI = ()=>{
|
||||||
const elementBaseBase = document.querySelectorAll('[id^="stationBlock"]');
|
const aaa = (x2,pos) => {
|
||||||
elementBaseBase.forEach(e=>{ //それぞれの駅ブロック横一列
|
x2.style.display = 'flex';
|
||||||
|
x2.style.flexDirection = 'row';
|
||||||
|
if(pos == "right"){
|
||||||
|
x2.style.alignItems = 'flex-start';
|
||||||
|
x2.style.justifyContent = 'flex-start';
|
||||||
|
}else if(pos == "left"){
|
||||||
|
x2.style.alignItems = 'flex-end';
|
||||||
|
x2.style.justifyContent = 'flex-end';
|
||||||
|
}
|
||||||
|
x2.style.flexWrap = 'wrap';
|
||||||
|
x2.style.width = '100%';
|
||||||
|
x2.style.height = "100%";
|
||||||
|
|
||||||
|
}
|
||||||
|
const aaa2 = (x2) => {
|
||||||
|
x2.style.display = 'flex';
|
||||||
|
x2.style.flexDirection = 'row';
|
||||||
|
x2.style.alignItems = 'center';
|
||||||
|
x2.style.justifyContent = 'center';
|
||||||
|
x2.style.flexWrap = 'wrap';
|
||||||
|
x2.style.width = '100%';
|
||||||
|
x2.style.height = "unset";
|
||||||
|
const x3 = x2.querySelectorAll(":scope > div");
|
||||||
|
x3.forEach(i=>{
|
||||||
|
i.style.position = "unset";
|
||||||
|
i.style.display = "flex";
|
||||||
|
i.style.flexDirection = "column";
|
||||||
|
i.style.flex = "1";
|
||||||
|
i.style.backgroundColor = "#00000000";
|
||||||
|
i.querySelectorAll(":scope > *").forEach(j=>{
|
||||||
|
j.style.width = "100%";
|
||||||
|
j.style.textAlign = "center";
|
||||||
|
j.style.margin = "5px";
|
||||||
|
j.style.padding = "5px";
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const layoutBase = (e)=>{
|
||||||
e.style.display = 'flex';
|
e.style.display = 'flex';
|
||||||
e.style.height = "unset";
|
e.style.height = "unset";
|
||||||
e.style.flexDirection = 'row';
|
e.style.flexDirection = 'row';
|
||||||
//e.style.alignItems = "left";
|
|
||||||
e.style.justifyContent = 'center';
|
e.style.justifyContent = 'center';
|
||||||
const x = e.querySelectorAll(':scope > div');//配下のdiv要素を選択
|
}
|
||||||
//x[0] 登りブロック x[2] 下りブロック x[1] 駅ブロック
|
const elementBaseBase = document.querySelectorAll('[id^="stationBlock"]');
|
||||||
const aaa = (x2,pos) => {
|
const elementNotBase = document.querySelectorAll('#disp > [id*="~"]');
|
||||||
x2.style.display = 'flex';
|
elementNotBase.forEach(e=>{
|
||||||
x2.style.flexDirection = 'row';
|
layoutBase(e);
|
||||||
if(pos == "right"){
|
const x = e.querySelectorAll(':scope > [id^="Up"], :scope > [id^="Id"], :scope > [id^="Down"]');//配下のdiv要素を選択
|
||||||
x2.style.alignItems = 'flex-start';
|
aaa(x[0],"left");
|
||||||
x2.style.justifyContent = 'flex-start';
|
aaa2(x[1]);
|
||||||
}else if(pos == "left"){
|
aaa(x[2],"right");
|
||||||
x2.style.alignItems = 'flex-end';
|
const upTrainCrossBarElement = e.querySelector(':scope > [id="upTrainCrossBar"]');
|
||||||
x2.style.justifyContent = 'flex-end';
|
if (upTrainCrossBarElement) {
|
||||||
}
|
upTrainCrossBarElement.style.left = '0px';
|
||||||
x2.style.flexWrap = 'wrap';
|
}
|
||||||
x2.style.width = '100%';
|
});
|
||||||
x2.style.height = "100%";
|
elementBaseBase.forEach(e=>{ //それぞれの駅ブロック横一列
|
||||||
|
layoutBase(e);
|
||||||
}
|
const x = e.querySelectorAll(':scope > div');//配下のdiv要素を選択
|
||||||
const aaa2 = (x2) => {
|
//x[0] 登りブロック x[2] 下りブロック x[1] 駅ブロック
|
||||||
x2.style.display = 'flex';
|
|
||||||
x2.style.flexDirection = 'row';
|
|
||||||
x2.style.alignItems = 'center';
|
|
||||||
x2.style.justifyContent = 'center';
|
|
||||||
x2.style.flexWrap = 'wrap';
|
|
||||||
x2.style.width = '100%';
|
|
||||||
x2.style.height = "unset";
|
|
||||||
const x3 = x2.querySelectorAll(":scope > div");
|
|
||||||
x3.forEach(i=>{
|
|
||||||
i.style.position = "unset";
|
|
||||||
i.style.display = "flex";
|
|
||||||
i.style.flexDirection = "column";
|
|
||||||
i.style.flex = "1";
|
|
||||||
i.style.backgroundColor = "#00000000";
|
|
||||||
i.querySelectorAll(":scope > *").forEach(j=>{
|
|
||||||
j.style.width = "100%";
|
|
||||||
j.style.textAlign = "center";
|
|
||||||
j.style.margin = "5px";
|
|
||||||
j.style.padding = "5px";
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
aaa(x[0],"left");
|
aaa(x[0],"left");
|
||||||
aaa2(x[1]);
|
aaa2(x[1]);
|
||||||
aaa(x[2],"right");
|
aaa(x[2],"right");
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1485,6 +1494,31 @@ const setStrings = () =>{
|
|||||||
element.setAttribute('offclick',element.getAttribute('onclick'))
|
element.setAttribute('offclick',element.getAttribute('onclick'))
|
||||||
|
|
||||||
var 行き先情報 = element.getElementsByTagName("p")[0];
|
var 行き先情報 = element.getElementsByTagName("p")[0];
|
||||||
|
${uiSetting === "tokyo" ? `
|
||||||
|
element.querySelector("img").insertAdjacentHTML('beforebegin',"<div style='flex:1;'></div>");
|
||||||
|
element.querySelector("img").insertAdjacentHTML('afterend',"<div style='flex:1;'></div>");
|
||||||
|
element.querySelector("img").style.padding = '5px';
|
||||||
|
element.style.position = 'relative';
|
||||||
|
if(element.getElementsByTagName("p")[1] != undefined){
|
||||||
|
element.getElementsByTagName("p")[1].innerText = element.getElementsByTagName("p")[1].innerText.replace("(","").replace(")","");
|
||||||
|
element.getElementsByTagName("p")[1].style.position = 'absolute';
|
||||||
|
element.getElementsByTagName("p")[1].style.backgroundColor = 'red';
|
||||||
|
element.getElementsByTagName("p")[1].style.color = 'white';
|
||||||
|
element.getElementsByTagName("p")[1].style.fontSize = '10px';
|
||||||
|
element.getElementsByTagName("p")[1].style.fontWeight = 'bold';
|
||||||
|
element.getElementsByTagName("p")[1].style.padding = '2px';
|
||||||
|
element.getElementsByTagName("p")[1].style.textAlign = 'center';
|
||||||
|
element.getElementsByTagName("p")[1].style.borderRadius = '10px';
|
||||||
|
if(element.getAttribute("style").includes("left")){
|
||||||
|
element.getElementsByTagName("p")[1].style.bottom = '0px';
|
||||||
|
element.getElementsByTagName("p")[1].style.left = '0px';
|
||||||
|
}
|
||||||
|
else if(element.getAttribute("style").includes("right")){
|
||||||
|
element.getElementsByTagName("p")[1].style.right = '0px';
|
||||||
|
element.getElementsByTagName("p")[1].style.top = '0px';
|
||||||
|
}
|
||||||
|
}`: ``}
|
||||||
|
const isLeft = element.getAttribute("style").includes("left");
|
||||||
var 列番データ = element.getAttribute('offclick').split('"')[1];
|
var 列番データ = element.getAttribute('offclick').split('"')[1];
|
||||||
var 列車名データ = element.getAttribute('offclick').split('"')[3];
|
var 列車名データ = element.getAttribute('offclick').split('"')[3];
|
||||||
const trainData = trainPositionDatas.filter(e=>!(e.Pos && e.Pos.includes("予告窓"))).find(e => e.TrainNum == 列番データ);
|
const trainData = trainPositionDatas.filter(e=>!(e.Pos && e.Pos.includes("予告窓"))).find(e => e.TrainNum == 列番データ);
|
||||||
@ -1509,7 +1543,7 @@ const setStrings = () =>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
` : ""}
|
` : ""}
|
||||||
nameReplace(列車名データ,列番データ,行き先情報,hasProblem);
|
nameReplace(列車名データ,列番データ,行き先情報,hasProblem,isLeft);
|
||||||
${uiSetting === "tokyo" ? `setNewTrainItem(element,hasProblem);`: ``}
|
${uiSetting === "tokyo" ? `setNewTrainItem(element,hasProblem);`: ``}
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
|
57
menu.js
57
menu.js
@ -34,7 +34,6 @@ import { useUserPosition } from "./stateBox/useUserPosition";
|
|||||||
import { AS } from "./storageControl";
|
import { AS } from "./storageControl";
|
||||||
import { lineList_LineWebID } from "./lib/getStationList";
|
import { lineList_LineWebID } from "./lib/getStationList";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
import { SearchUnitBox } from "./components/Menu/RailScope/SearchUnitBox";
|
|
||||||
configureReanimatedLogger({
|
configureReanimatedLogger({
|
||||||
level: ReanimatedLogLevel.error, // Set the log level to error
|
level: ReanimatedLogLevel.error, // Set the log level to error
|
||||||
strict: true, // Reanimated runs in strict mode by default
|
strict: true, // Reanimated runs in strict mode by default
|
||||||
@ -43,7 +42,7 @@ export default function Menu(props) {
|
|||||||
const { scrollRef, mapHeight, MapFullHeight, mapMode, setMapMode } = props;
|
const { scrollRef, mapHeight, MapFullHeight, mapMode, setMapMode } = props;
|
||||||
const { navigate, addListener, isFocused } = useNavigation();
|
const { navigate, addListener, isFocused } = useNavigation();
|
||||||
const { favoriteStation } = useFavoriteStation();
|
const { favoriteStation } = useFavoriteStation();
|
||||||
const { originalStationList } = useStationList();
|
const { originalStationList, getStationDataFromNameBase } = useStationList();
|
||||||
const { height, width } = useWindowDimensions();
|
const { height, width } = useWindowDimensions();
|
||||||
const { bottom, left, right, top } = useSafeAreaInsets();
|
const { bottom, left, right, top } = useSafeAreaInsets();
|
||||||
const tabBarHeight = useBottomTabBarHeight();
|
const tabBarHeight = useBottomTabBarHeight();
|
||||||
@ -173,24 +172,35 @@ export default function Menu(props) {
|
|||||||
|
|
||||||
const [listUpStation, setListUpStation] = useState([]);
|
const [listUpStation, setListUpStation] = useState([]);
|
||||||
const [isSearchMode, setisSearchMode] = useState(false);
|
const [isSearchMode, setisSearchMode] = useState(false);
|
||||||
|
const [input, setInput] = React.useState("");
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (!!isSearchMode) {
|
if (!!isSearchMode) {
|
||||||
const returnData = [];
|
const returnData = [];
|
||||||
Object.keys(lineList_LineWebID).forEach((d, indexBase) => {
|
if (!input || input == "") {
|
||||||
originalStationList[d].forEach((D, index) => {
|
Object.keys(lineList_LineWebID).forEach((d, indexBase) => {
|
||||||
if (
|
originalStationList[d].forEach((D, index) => {
|
||||||
isSearchMode &&
|
if (
|
||||||
isSearchMode != stationIDPair[lineList_LineWebID[d]]
|
isSearchMode &&
|
||||||
)
|
isSearchMode != stationIDPair[lineList_LineWebID[d]]
|
||||||
return;
|
)
|
||||||
const latlng = [D.lat, D.lng];
|
return;
|
||||||
if (latlng.length == 0) return null;
|
const latlng = [D.lat, D.lng];
|
||||||
if (D.StationNumber == undefined) {
|
if (latlng.length == 0) return null;
|
||||||
return null;
|
if (D.StationNumber == undefined) {
|
||||||
}
|
return null;
|
||||||
returnData.push([D]);
|
}
|
||||||
|
returnData.push([D]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
} else {
|
||||||
|
const hoge = getStationDataFromNameBase(input);
|
||||||
|
hoge.forEach((d, index, array) => {
|
||||||
|
const stationName = d.Station_JP;
|
||||||
|
if (returnData.findIndex((d1) => d1[0].Station_JP == stationName) != -1)
|
||||||
|
return;
|
||||||
|
returnData.push(array.filter((d2) => d2.Station_JP == stationName));
|
||||||
|
});
|
||||||
|
}
|
||||||
if (JSON.stringify(returnData) == JSON.stringify(listUpStation)) return;
|
if (JSON.stringify(returnData) == JSON.stringify(listUpStation)) return;
|
||||||
setListUpStation(returnData);
|
setListUpStation(returnData);
|
||||||
} else if (stationListMode == "position") {
|
} else if (stationListMode == "position") {
|
||||||
@ -275,9 +285,9 @@ export default function Menu(props) {
|
|||||||
snapToEnd={false}
|
snapToEnd={false}
|
||||||
decelerationRate={"normal"}
|
decelerationRate={"normal"}
|
||||||
snapToOffsets={[mapHeight - 80]}
|
snapToOffsets={[mapHeight - 80]}
|
||||||
contentContainerStyle={{
|
// contentContainerStyle={{
|
||||||
position: "relative",
|
// position: "relative",
|
||||||
}}
|
// }}
|
||||||
onScrollBeginDrag={onScrollBeginDrag}
|
onScrollBeginDrag={onScrollBeginDrag}
|
||||||
onScrollEndDrag={(e) => {
|
onScrollEndDrag={(e) => {
|
||||||
if (e.nativeEvent.contentOffset.y < mapHeight - 80) {
|
if (e.nativeEvent.contentOffset.y < mapHeight - 80) {
|
||||||
@ -363,8 +373,6 @@ export default function Menu(props) {
|
|||||||
{...{
|
{...{
|
||||||
locationStatus,
|
locationStatus,
|
||||||
position,
|
position,
|
||||||
mapsRef,
|
|
||||||
scrollRef,
|
|
||||||
stationListMode,
|
stationListMode,
|
||||||
setStationListMode,
|
setStationListMode,
|
||||||
setSelectedCurrentStation: setListIndex,
|
setSelectedCurrentStation: setListIndex,
|
||||||
@ -372,6 +380,8 @@ export default function Menu(props) {
|
|||||||
setMapMode,
|
setMapMode,
|
||||||
isSearchMode,
|
isSearchMode,
|
||||||
setisSearchMode,
|
setisSearchMode,
|
||||||
|
input,
|
||||||
|
setInput,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@ -387,7 +397,7 @@ export default function Menu(props) {
|
|||||||
listIndex,
|
listIndex,
|
||||||
navigate,
|
navigate,
|
||||||
stationListMode,
|
stationListMode,
|
||||||
isSearchMode
|
isSearchMode,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{listUpStation[listIndex] && (
|
{listUpStation[listIndex] && (
|
||||||
@ -409,7 +419,6 @@ export default function Menu(props) {
|
|||||||
{...{
|
{...{
|
||||||
locationStatus,
|
locationStatus,
|
||||||
position,
|
position,
|
||||||
mapsRef,
|
|
||||||
stationListMode,
|
stationListMode,
|
||||||
setStationListMode,
|
setStationListMode,
|
||||||
setSelectedCurrentStation: setListIndex,
|
setSelectedCurrentStation: setListIndex,
|
||||||
@ -417,6 +426,8 @@ export default function Menu(props) {
|
|||||||
setMapMode,
|
setMapMode,
|
||||||
isSearchMode,
|
isSearchMode,
|
||||||
setisSearchMode,
|
setisSearchMode,
|
||||||
|
input,
|
||||||
|
setInput,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -119,8 +119,10 @@ setInterval(() => {
|
|||||||
javaScriptEnabled={true}
|
javaScriptEnabled={true}
|
||||||
injectedJavaScript={jsa}
|
injectedJavaScript={jsa}
|
||||||
pullToRefreshEnabled
|
pullToRefreshEnabled
|
||||||
onError={() => this.webView?.reload()}
|
onError={() => webview.current?.reload()}
|
||||||
onMessage={()=>{}}
|
onMessage={() => {
|
||||||
|
// 必要に応じてメッセージ処理を実装
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<ReloadButton
|
<ReloadButton
|
||||||
onPress={() => webview.current.reload()}
|
onPress={() => webview.current.reload()}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"android": "expo start --android",
|
"android": "expo start --android",
|
||||||
"ios": "expo start --ios",
|
"ios": "expo start --ios",
|
||||||
"eject": "expo eject",
|
"eject": "expo eject",
|
||||||
"pushWeb":"npx expo export -p web && netlify deploy --dir dist --prod",
|
"pushWeb": "npx expo export -p web && netlify deploy --dir dist --prod",
|
||||||
"checkDiagram": "bash ./check.sh"
|
"checkDiagram": "bash ./check.sh"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -62,7 +62,7 @@ export const CurrentTrainProvider = ({ children }) => {
|
|||||||
setCurrentTrainLoading("success");
|
setCurrentTrainLoading("success");
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
console.log("えらー");
|
// エラー時の処理
|
||||||
setCurrentTrainLoading("error");
|
setCurrentTrainLoading("error");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -42,7 +42,12 @@ export const FavoriteStationProvider:FC<Props> = ({ children }) => {
|
|||||||
const returnData = JSON.parse(d);
|
const returnData = JSON.parse(d);
|
||||||
setFavoriteStation(returnData);
|
setFavoriteStation(returnData);
|
||||||
})
|
})
|
||||||
.catch((d) => console.log(d));
|
.catch((error) => {
|
||||||
|
// エラーログを記録(開発時のみ)
|
||||||
|
if (__DEV__) {
|
||||||
|
console.warn('お気に入り駅の読み込みに失敗しました:', error);
|
||||||
|
}
|
||||||
|
});
|
||||||
}, []);
|
}, []);
|
||||||
return (
|
return (
|
||||||
<FavoriteStationContext.Provider
|
<FavoriteStationContext.Provider
|
||||||
|
@ -26,7 +26,7 @@ Notifications.setNotificationHandler({
|
|||||||
});
|
});
|
||||||
|
|
||||||
function handleRegistrationError(errorMessage: string) {
|
function handleRegistrationError(errorMessage: string) {
|
||||||
console.log(errorMessage);
|
// エラーを適切に処理(必要に応じてユーザーに通知)
|
||||||
//throw new Error(errorMessage);
|
//throw new Error(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,12 +117,10 @@ export const NotificationProvider: FC<Props> = ({ children }) => {
|
|||||||
notificationListener.current =
|
notificationListener.current =
|
||||||
Notifications.addNotificationReceivedListener((notification) => {
|
Notifications.addNotificationReceivedListener((notification) => {
|
||||||
setNotification(notification);
|
setNotification(notification);
|
||||||
});
|
}); responseListener.current =
|
||||||
|
Notifications.addNotificationResponseReceivedListener((response) => {
|
||||||
responseListener.current =
|
// 通知レスポンスの処理
|
||||||
Notifications.addNotificationResponseReceivedListener((response) => {
|
});
|
||||||
console.log(response);
|
|
||||||
});
|
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
notificationListener.current &&
|
notificationListener.current &&
|
||||||
|
@ -16,6 +16,7 @@ type initialStateType = {
|
|||||||
setOriginalStationList: React.Dispatch<React.SetStateAction<any[]>>;
|
setOriginalStationList: React.Dispatch<React.SetStateAction<any[]>>;
|
||||||
getStationDataFromName: (id: string) => any[];
|
getStationDataFromName: (id: string) => any[];
|
||||||
getStationDataFromId: (id: string) => any[];
|
getStationDataFromId: (id: string) => any[];
|
||||||
|
getStationDataFromNameBase: (name: string) => any[];
|
||||||
stationList: any[];
|
stationList: any[];
|
||||||
getInjectJavascriptAddress: (StationNumber: string) => string;
|
getInjectJavascriptAddress: (StationNumber: string) => string;
|
||||||
};
|
};
|
||||||
@ -24,6 +25,7 @@ const initialState = {
|
|||||||
setOriginalStationList: () => {},
|
setOriginalStationList: () => {},
|
||||||
getStationDataFromName: () => [],
|
getStationDataFromName: () => [],
|
||||||
getStationDataFromId: () => [],
|
getStationDataFromId: () => [],
|
||||||
|
getStationDataFromNameBase: () => [],
|
||||||
stationList: [],
|
stationList: [],
|
||||||
getInjectJavascriptAddress: (StationNumber: string) => "",
|
getInjectJavascriptAddress: (StationNumber: string) => "",
|
||||||
};
|
};
|
||||||
@ -66,6 +68,23 @@ export const StationListProvider: FC<Props> = ({ children }) => {
|
|||||||
});
|
});
|
||||||
return returnArray;
|
return returnArray;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getStationDataFromNameBase: (name: string) => any[] = (name) => {
|
||||||
|
const returnArray = [];
|
||||||
|
Object.keys(originalStationList).forEach((key) => {
|
||||||
|
originalStationList[key].forEach((station) => {
|
||||||
|
if (!station.StationNumber) return;
|
||||||
|
if (typeof station.StationNumber === "string" && station.StationNumber.includes(name)) {
|
||||||
|
if (!!station.jslodApi) returnArray.push(station);
|
||||||
|
}
|
||||||
|
else if (typeof station.Station_JP === "string" && station.Station_JP.includes(name)) {
|
||||||
|
if (!!station.jslodApi) returnArray.push(station);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return returnArray;
|
||||||
|
};
|
||||||
|
|
||||||
const [stationList, setStationList] = useState<any[][]>([[]]);
|
const [stationList, setStationList] = useState<any[][]>([[]]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (originalStationList.length === 0) return;
|
if (originalStationList.length === 0) return;
|
||||||
@ -113,6 +132,7 @@ export const StationListProvider: FC<Props> = ({ children }) => {
|
|||||||
setOriginalStationList,
|
setOriginalStationList,
|
||||||
getStationDataFromName,
|
getStationDataFromName,
|
||||||
getStationDataFromId,
|
getStationDataFromId,
|
||||||
|
getStationDataFromNameBase,
|
||||||
stationList,
|
stationList,
|
||||||
getInjectJavascriptAddress,
|
getInjectJavascriptAddress,
|
||||||
}}
|
}}
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"plugins": [
|
"plugins": [
|
||||||
{
|
{
|
||||||
"@/*": ["./*"] //追加
|
"@/*": ["./*"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./*"] //修正
|
"@/*": ["./*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extends": "expo/tsconfig.base"
|
"extends": "expo/tsconfig.base"
|
||||||
|
Loading…
Reference in New Issue
Block a user