Merge commit '18e046dc33da0b27fdfae244e390e0b7ddeffabf' into develop

This commit is contained in:
harukin-DeskMini 2023-01-26 06:36:00 +09:00
commit 1ef8870153
9 changed files with 1413 additions and 365 deletions

16
App.js
View File

@ -25,7 +25,9 @@ if (Platform.OS === "android") {
} }
export default function App() { export default function App() {
const navigationRef = useRef(); const navigationRef = useRef();
useEffect(UpdateAsync, []); useEffect(() => {
UpdateAsync();
}, []);
return ( return (
<NavigationContainer name="Root" ref={navigationRef} style={{ flex: 1 }}> <NavigationContainer name="Root" ref={navigationRef} style={{ flex: 1 }}>
<Tab.Navigator> <Tab.Navigator>
@ -63,8 +65,7 @@ export default function App() {
</NavigationContainer> </NavigationContainer>
); );
} }
function top() { const top = () => (
return (
<Stack.Navigator> <Stack.Navigator>
<Stack.Screen <Stack.Screen
name="Apps" name="Apps"
@ -93,14 +94,9 @@ function top() {
}} }}
/> />
<Stack.Screen name="news" component={News} options={optionData} /> <Stack.Screen name="news" component={News} options={optionData} />
<Stack.Screen <Stack.Screen name="trainMenu" component={trainMenu} options={optionData} />
name="trainMenu"
component={trainMenu}
options={optionData}
/>
</Stack.Navigator> </Stack.Navigator>
); );
}
function menuPage() { function menuPage() {
return ( return (
<Stack.Navigator> <Stack.Navigator>

193
Apps.js
View File

@ -10,7 +10,7 @@ import { WebView } from "react-native-webview";
import Constants from "expo-constants"; import Constants from "expo-constants";
import AsyncStorage from "@react-native-async-storage/async-storage"; import AsyncStorage from "@react-native-async-storage/async-storage";
import { news } from "./config/newsUpdate"; import { news } from "./config/newsUpdate";
import { getStationList } from "./lib/getStationList"; import { getStationList, lineList } from "./lib/getStationList";
import { StationDeteilView } from "./components/ActionSheetComponents/StationDeteilView"; import { StationDeteilView } from "./components/ActionSheetComponents/StationDeteilView";
import { injectJavascriptData } from "./lib/webViewInjectjavascript"; import { injectJavascriptData } from "./lib/webViewInjectjavascript";
import { getStationList2 } from "./lib/getStationList2"; import { getStationList2 } from "./lib/getStationList2";
@ -32,10 +32,7 @@ export default function Apps(props) {
//地図用 //地図用
const [mapsStationData, setMapsStationData] = useState(undefined); const [mapsStationData, setMapsStationData] = useState(undefined);
useEffect(() => { useEffect(() => {
getStationList2().then((data) => { getStationList2().then(setMapsStationData);
console.log(data);
setMapsStationData(data);
});
}, []); }, []);
//駅情報画面用 //駅情報画面用
@ -43,7 +40,9 @@ export default function Apps(props) {
const [stationBoardData, setStationBoardData] = useState(undefined); const [stationBoardData, setStationBoardData] = useState(undefined);
const [originalStationList, setOriginalStationList] = useState(); const [originalStationList, setOriginalStationList] = useState();
const [selectedStation, setSelectedStation] = useState(undefined); const [selectedStation, setSelectedStation] = useState(undefined);
useEffect(() => getStationList().then(setOriginalStationList), []); useEffect(() => {
getStationList().then(setOriginalStationList);
}, []);
//地図表示テキスト //地図表示テキスト
const injectJavascript = injectJavascriptData( const injectJavascript = injectJavascriptData(
@ -59,105 +58,64 @@ export default function Apps(props) {
if (d != news) navigate("news"); if (d != news) navigate("news");
}) })
.catch((e) => navigate("news")); .catch((e) => navigate("news"));
}, []);
useEffect(() => {
//列車アイコンスイッチ //列車アイコンスイッチ
AsyncStorage.getItem("iconSwitch") AsyncStorage.getItem("iconSwitch")
.then((d) => { .then((d) => {
if (d) { if (d) {
setIconSetting(d); setIconSetting(d);
} else { } else {
AsyncStorage.setItem("iconSwitch", "true").then(() => AsyncStorage.setItem("iconSwitch", "true").then(Updates.reloadAsync);
Updates.reloadAsync()
);
} }
}) })
.catch((d) => .catch((d) =>
AsyncStorage.setItem("iconSwitch", "true").then(() => AsyncStorage.setItem("iconSwitch", "true").then(Updates.reloadAsync)
Updates.reloadAsync()
)
); );
}, []);
useEffect(() => {
//地図スイッチ //地図スイッチ
AsyncStorage.getItem("mapSwitch") AsyncStorage.getItem("mapSwitch")
.then((d) => { .then((d) => {
if (d) { if (d) {
setMapSwitch(d); setMapSwitch(d);
} else { } else {
AsyncStorage.setItem("mapSwitch", "false").then(() => AsyncStorage.setItem("mapSwitch", "false").then(Updates.reloadAsync);
Updates.reloadAsync()
);
} }
}) })
.catch((d) => .catch((d) =>
AsyncStorage.setItem("mapSwitch", "false").then(() => AsyncStorage.setItem("mapSwitch", "false").then(Updates.reloadAsync)
Updates.reloadAsync()
)
); );
}, []);
useEffect(() => {
//駅メニュースイッチ //駅メニュースイッチ
AsyncStorage.getItem("stationSwitch") AsyncStorage.getItem("stationSwitch")
.then((d) => { .then((d) => {
if (d) { if (d) {
setStationMenu(d); setStationMenu(d);
} else { } else {
AsyncStorage.setItem("stationSwitch", "true").then(() => AsyncStorage.setItem("stationSwitch", "true").then(
Updates.reloadAsync() Updates.reloadAsync
); );
} }
}) })
.catch((d) => .catch((d) =>
AsyncStorage.setItem("stationSwitch", "true").then(() => AsyncStorage.setItem("stationSwitch", "true").then(Updates.reloadAsync)
Updates.reloadAsync()
)
); );
}, []); }, []);
return ( const onMessage = (event) => {
<View if (!event.nativeEvent.data.includes("PopUpMenu")) {
style={{ navigate("trainbase", { info: event.nativeEvent.data });
height: "100%", return;
paddingTop: Platform.OS == "ios" ? Constants.statusBarHeight : 0,
}}
>
{/* {Status} */}
<WebView
useWebKit={true}
ref={webview}
source={{ uri: "https://train.jr-shikoku.co.jp/sp.html" }}
originWhitelist={[
"https://train.jr-shikoku.co.jp",
"https://train.jr-shikoku.co.jp/sp.html",
]}
mixedContentMode={"compatibility"}
javaScriptEnabled={true}
allowsBackForwardNavigationGestures={true}
setSupportMultipleWindows={true}
onNavigationStateChange={(event) => {
if (event.url != urlcache) {
//URL二重判定回避
urlcache = event.url;
if (
event.url.includes("https://train.jr-shikoku.co.jp/usage.htm")
) {
if (Platform.OS === "android") navigate("howto");
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 });
webview?.current.goBack();
} }
}
}}
onMessage={(event) => {
if (!originalStationList) { if (!originalStationList) {
alert("駅名標データを取得中..."); alert("駅名標データを取得中...");
return; return;
} }
if (event.nativeEvent.data.includes("PopUpMenu")) {
const selectedStationPDFAddress = event.nativeEvent.data const selectedStationPDFAddress = event.nativeEvent.data
.split(",")[3] .split(",")[3]
.replace("'", "") .replace("'", "")
@ -170,17 +128,6 @@ export default function Apps(props) {
return NearStation; return NearStation;
}; };
const lineList = [
"予讃線",
"松宇線",
"伊予灘線",
"土讃線",
"窪川線",
"高徳線",
"徳島線",
"鳴門線",
"瀬戸大橋線",
];
let returnDataBase = lineList let returnDataBase = lineList
.map((d) => findStationEachLine(originalStationList[d])) .map((d) => findStationEachLine(originalStationList[d]))
.filter((d) => d.length > 0) .filter((d) => d.length > 0)
@ -189,8 +136,6 @@ export default function Apps(props) {
return pre; return pre;
}, []); }, []);
if (returnDataBase.length) { if (returnDataBase.length) {
let currentStation =
currentStation == undefined ? [] : currentStation;
setStationBoardData(returnDataBase); setStationBoardData(returnDataBase);
StationBoardAcSR.current?.setModalVisible(); StationBoardAcSR.current?.setModalVisible();
} else { } else {
@ -199,19 +144,75 @@ export default function Apps(props) {
} }
return; return;
};
const onNavigationStateChange = (event) => {
if (event.url != urlcache) {
//URL二重判定回避
urlcache = event.url;
if (event.url.includes("https://train.jr-shikoku.co.jp/usage.htm")) {
if (Platform.OS === "android") navigate("howto");
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 });
webview?.current.goBack();
} }
navigate("trainbase", { info: event.nativeEvent.data }); }
};
return (
<View
style={{
height: "100%",
paddingTop: Platform.OS == "ios" ? Constants.statusBarHeight : 0,
}} }}
>
{/* {Status} */}
<WebView
useWebKit
ref={webview}
source={{ uri: "https://train.jr-shikoku.co.jp/sp.html" }}
originWhitelist={[
"https://train.jr-shikoku.co.jp",
"https://train.jr-shikoku.co.jp/sp.html",
]}
mixedContentMode={"compatibility"}
javaScriptEnabled
allowsBackForwardNavigationGestures
setSupportMultipleWindows
onNavigationStateChange={onNavigationStateChange}
onMessage={onMessage}
injectedJavaScript={injectJavascript} injectedJavaScript={injectJavascript}
onTouchMove={() => StationBoardAcSR.current?.hide()} onTouchMove={() => StationBoardAcSR.current?.hide()}
/> />
<TouchableOpacity <MapsButton
onPress={() => onPress={() =>
navigate("trainMenu", { webview, stationData: mapsStationData }) navigate("trainMenu", { webview, stationData: mapsStationData })
} }
style={{ top={Platform.OS == "ios" ? Constants.statusBarHeight : 0}
mapSwitch={mapSwitch == "true" ? "flex" : "none"}
/>
<StationDeteilView
StationBoardAcSR={StationBoardAcSR}
currentStation={stationBoardData}
originalStationList={originalStationList}
/>
</View>
);
}
const MapsButton = ({ onPress, top, mapSwitch }) => {
const styles = {
touch: {
position: "absolute", position: "absolute",
top: Platform.OS == "ios" ? Constants.statusBarHeight : 0, top,
left: 10, left: 10,
width: 50, width: 50,
height: 50, height: 50,
@ -223,30 +224,22 @@ export default function Apps(props) {
alignContent: "center", alignContent: "center",
alignSelf: "center", alignSelf: "center",
alignItems: "center", alignItems: "center",
display: mapSwitch == "true" ? "flex" : "none", display: mapSwitch,
}} },
> text: {
<View style={{ flex: 1 }} />
<Text
style={{
textAlign: "center", textAlign: "center",
width: "auto", width: "auto",
height: "auto", height: "auto",
textAlignVertical: "center", textAlignVertical: "center",
fontWeight: "bold", fontWeight: "bold",
color: "white", color: "white",
}} },
> };
return (
</Text> <TouchableOpacity onPress={onPress} style={styles.touch}>
<View style={{ flex: 1 }} />
<Text style={styles.text}></Text>
<View style={{ flex: 1 }} /> <View style={{ flex: 1 }} />
</TouchableOpacity> </TouchableOpacity>
<StationDeteilView
StationBoardAcSR={StationBoardAcSR}
currentStation={stationBoardData}
originalStationList={originalStationList}
/>
</View>
); );
} };

View File

@ -1,7 +1,7 @@
import { ToastAndroid } from "react-native"; import { ToastAndroid } from "react-native";
import * as Updates from "expo-updates"; import * as Updates from "expo-updates";
export const UpdateAsync = () => export const UpdateAsync = () => {
Updates.checkForUpdateAsync() Updates.checkForUpdateAsync()
.then((update) => { .then((update) => {
if (!update.isAvailable) return; if (!update.isAvailable) return;
@ -34,3 +34,4 @@ export const UpdateAsync = () =>
.finally(() => { .finally(() => {
return; return;
}); });
};

View File

@ -17,7 +17,7 @@
}, },
"assetBundlePatterns": ["**/*"], "assetBundlePatterns": ["**/*"],
"ios": { "ios": {
"buildNumber": "22", "buildNumber": "23",
"supportsTablet": true, "supportsTablet": true,
"bundleIdentifier": "jrshikokuinfo.xprocess.hrkn", "bundleIdentifier": "jrshikokuinfo.xprocess.hrkn",
"config": { "config": {

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@ export const JRSTraInfo = (props) => {
<ActionSheet <ActionSheet
ref={JRSTraInfoEXAcSR} ref={JRSTraInfoEXAcSR}
gestureEnabled gestureEnabled
CustomHeaderComponent={() => {}} CustomHeaderComponent={(props) => <></>}
> >
<View <View
style={{ style={{

View File

@ -13,7 +13,7 @@ export const StationDeteilView = (props) => {
<ActionSheet <ActionSheet
ref={StationBoardAcSR} ref={StationBoardAcSR}
gestureEnabled gestureEnabled
CustomHeaderComponent={() => {}} CustomHeaderComponent={(props) => <></>}
> >
<View <View
key={currentStation} key={currentStation}

View File

@ -3,23 +3,12 @@ import React, { Component } from "react";
import { StatusBar, View, TouchableOpacity, Text } from "react-native"; import { StatusBar, View, TouchableOpacity, Text } from "react-native";
import { WebView } from "react-native-webview"; import { WebView } from "react-native-webview";
export default ({ navigation: { navigate } }) => ( export default ({ navigation: { navigate } }) => (
<View style={{ height: "100%", backgroundColor: "#0099CC" }}> <View style={styles.View}>
<WebView <WebView
useWebKit={true} useWebKit
source={{ uri: "https://train.jr-shikoku.co.jp/usage.htm" }} source={{ uri: "https://train.jr-shikoku.co.jp/usage.htm" }}
/> />
<TouchableOpacity <TouchableOpacity style={styles.touch} onPress={() => navigate("Apps")}>
style={{
padding: 10,
flexDirection: "row",
borderColor: "white",
borderWidth: 1,
margin: 10,
borderRadius: 5,
alignItems: "center",
}}
onPress={() => navigate("Apps")}
>
<View style={{ flex: 1 }} /> <View style={{ flex: 1 }} />
<Text style={{ fontSize: 25, fontWeight: "bold", color: "white" }}> <Text style={{ fontSize: 25, fontWeight: "bold", color: "white" }}>
閉じる 閉じる
@ -28,3 +17,15 @@ export default ({ navigation: { navigate } }) => (
</TouchableOpacity> </TouchableOpacity>
</View> </View>
); );
const styles = {
View: { height: "100%", backgroundColor: "#0099CC" },
touch: {
padding: 10,
flexDirection: "row",
borderColor: "white",
borderWidth: 1,
margin: 10,
borderRadius: 5,
alignItems: "center",
},
};

358
menu.js
View File

@ -15,9 +15,7 @@ import * as Location from "expo-location";
import StatusbarDetect from "./StatusbarDetect"; import StatusbarDetect from "./StatusbarDetect";
import { useNavigation } from "@react-navigation/native"; import { useNavigation } from "@react-navigation/native";
import AutoHeightImage from "react-native-auto-height-image"; import AutoHeightImage from "react-native-auto-height-image";
import { import { widthPercentageToDP as wp } from "react-native-responsive-screen";
widthPercentageToDP as wp,
} from "react-native-responsive-screen";
import { import {
FontAwesome, FontAwesome,
Foundation, Foundation,
@ -33,8 +31,9 @@ import Sign from "./components/駅名表/Sign";
import { UsefulBox } from "./components/atom/UsefulBox"; import { UsefulBox } from "./components/atom/UsefulBox";
import { TicketBox } from "./components/atom/TicketBox"; import { TicketBox } from "./components/atom/TicketBox";
import { TextBox } from "./components/atom/TextBox"; import { TextBox } from "./components/atom/TextBox";
import { getStationList } from "./lib/getStationList"; import { getStationList, lineList } from "./lib/getStationList";
import { JRSTraInfo } from "./components/ActionSheetComponents/JRSTraInfo"; import { JRSTraInfo } from "./components/ActionSheetComponents/JRSTraInfo";
import useInterval from "./lib/useInterval";
export default function Menu(props) { export default function Menu(props) {
const { const {
@ -57,15 +56,17 @@ export default function Menu(props) {
setLocation(location) setLocation(location)
); );
}); });
setInterval(() => { }, []);
useInterval(() => {
Location.getCurrentPositionAsync({}).then((location) => Location.getCurrentPositionAsync({}).then((location) =>
setLocation(location) setLocation(location)
); );
}, 10000); }, 5000);
}, []);
const [originalStationList, setOriginalStationList] = useState(); const [originalStationList, setOriginalStationList] = useState();
useEffect(() => getStationList().then(setOriginalStationList), []); useEffect(() => {
getStationList().then(setOriginalStationList);
}, []);
const [stationName, setStationName] = useState(undefined); const [stationName, setStationName] = useState(undefined);
const [currentStation, setCurrentStation] = useState(undefined); const [currentStation, setCurrentStation] = useState(undefined);
@ -89,17 +90,6 @@ export default function Menu(props) {
return NearStation; return NearStation;
}; };
const lineList = [
"予讃線",
"松宇線",
"伊予灘線",
"土讃線",
"窪川線",
"高徳線",
"徳島線",
"鳴門線",
"瀬戸大橋線",
];
let returnDataBase = lineList let returnDataBase = lineList
.map((d) => findStationEachLine(originalStationList[d])) .map((d) => findStationEachLine(originalStationList[d]))
.filter((d) => d.length > 0) .filter((d) => d.length > 0)
@ -144,52 +134,9 @@ export default function Menu(props) {
}} }}
> >
<StatusbarDetect /> <StatusbarDetect />
<View style={{ alignItems: "center" }}> <TitleBar />
<TouchableOpacity
onPress={() => Linking.openURL("https://www.jr-shikoku.co.jp")}
>
<AutoHeightImage
source={require("./assets/Header.png")}
resizeMode="contain"
width={wp("100%")}
/>
</TouchableOpacity>
</View>
<ScrollView> <ScrollView>
<View style={{ flexDirection: "row" }}> <TopMenuButton />
<UsefulBox
backgroundColor={"#F89038"}
icon="train-car"
flex={1}
onPressButton={() =>
Linking.openURL("https://www.jr-shikoku.co.jp/01_trainbus/sp/")
}
>
鉄道情報
</UsefulBox>
<UsefulBox
backgroundColor={"#EA4752"}
icon="google-spreadsheet"
flex={1}
onPressButton={() =>
Linking.openURL(
"https://www.jr-shikoku.co.jp/01_trainbus/jikoku/sp/#mainprice-box"
)
}
>
運賃表
</UsefulBox>
<UsefulBox
backgroundColor={"#91C31F"}
icon="clipboard-list-outline"
flex={1}
onPressButton={() =>
Linking.openURL("https://www.jr-shikoku.co.jp/e5489/")
}
>
予約
</UsefulBox>
</View>
<TextBox <TextBox
backgroundColor="#0099CC" backgroundColor="#0099CC"
flex={1} flex={1}
@ -216,117 +163,13 @@ export default function Menu(props) {
<LED_vision station={currentStation[0]} /> <LED_vision station={currentStation[0]} />
</> </>
)} )}
<TouchableOpacity onPress={JRSTraInfoEXAcSR.current?.setModalVisible}> <JRSTraInfoBox
<View JRSTraInfoEXAcSR={JRSTraInfoEXAcSR}
style={{ getTime={getTime}
backgroundColor: "#0099CC", setLoadingDelayData={setLoadingDelayData}
borderRadius: 5, loadingDelayData={loadingDelayData}
margin: 10, delayData={delayData}
borderColor: "black",
borderWidth: 2,
overflow: "hidden",
}}
>
<ScrollView
scrollEnabled={false}
style={{
backgroundColor: "#0099CC",
borderRadius: 5,
maxHeight: 300,
}}
>
<View
style={{
padding: 10,
flexDirection: "row",
alignItems: "center",
}}
>
<Text
style={{ fontSize: 30, fontWeight: "bold", color: "white" }}
>
列車遅延速報EX
</Text>
<View style={{ flex: 1 }} />
<Text
style={{ fontSize: 30, fontWeight: "bold", color: "white" }}
>
{getTime
? getTime.toLocaleTimeString("ja-JP").split(":")[0] +
":" +
getTime.toLocaleTimeString("ja-JP").split(":")[1]
: NaN}
</Text>
<Ionicons
name="reload"
color="white"
size={30}
style={{ margin: 5 }}
onPress={() => {
LayoutAnimation.easeInEaseOut();
setLoadingDelayData(true);
}}
/> />
</View>
<View
style={{
padding: 10,
backgroundColor: "white",
borderBottomLeftRadius: 5,
borderBottomRightRadius: 5,
}}
>
{loadingDelayData ? (
<View style={{ alignItems: "center" }}>
<LottieView
autoPlay
loop
style={{
width: 150,
height: 150,
backgroundColor: "#fff",
}}
source={require("./assets/51690-loading-diamonds.json")}
/>
</View>
) : delayData ? (
delayData.map((d) => {
let data = d.split(" ");
return (
<View style={{ flexDirection: "row" }}>
<Text style={{ flex: 15, fontSize: 20 }}>
{data[0].replace("\n", "")}
</Text>
<Text style={{ flex: 5, fontSize: 20 }}>{data[1]}</Text>
<Text style={{ flex: 6, fontSize: 20 }}>{data[3]}</Text>
</View>
);
})
) : (
<Text>現在5分以上の遅れはありません</Text>
)}
</View>
</ScrollView>
<View
style={{
position: "absolute",
top: 250,
alignItems: "center",
width: "100%",
height: 50,
backgroundColor: "#007FCC88",
}}
>
<View style={{ flex: 1 }} />
<Text
style={{ color: "white", fontWeight: "bold", fontSize: 20 }}
>
詳細を見る
</Text>
<View style={{ flex: 1 }} />
</View>
</View>
</TouchableOpacity>
<View style={{ flexDirection: "row" }}> <View style={{ flexDirection: "row" }}>
<TicketBox <TicketBox
@ -622,3 +465,168 @@ export default function Menu(props) {
</View> </View>
); );
} }
const TitleBar = () => {
return (
<View style={{ alignItems: "center" }}>
<TouchableOpacity
onPress={() => Linking.openURL("https://www.jr-shikoku.co.jp")}
>
<AutoHeightImage
source={require("./assets/Header.png")}
resizeMode="contain"
width={wp("100%")}
/>
</TouchableOpacity>
</View>
);
};
const TopMenuButton = () => {
const buttonList = [
{
backgroundColor: "#F89038",
icon: "train-car",
onPress: () =>
Linking.openURL("https://www.jr-shikoku.co.jp/01_trainbus/sp/"),
title: "駅・鉄道情報",
},
{
backgroundColor: "#EA4752",
icon: "google-spreadsheet",
onPress: () =>
Linking.openURL(
"https://www.jr-shikoku.co.jp/01_trainbus/jikoku/sp/#mainprice-box"
),
title: "運賃表",
},
{
backgroundColor: "#91C31F",
icon: "clipboard-list-outline",
onPress: () => Linking.openURL("https://www.jr-shikoku.co.jp/e5489/"),
title: "予約",
},
];
return (
<View style={{ flexDirection: "row" }}>
{buttonList.map((d, index) => (
<UsefulBox
backgroundColor={d.backgroundColor}
icon={d.icon}
flex={1}
onPressButton={d.onPress}
key={index + d.icon}
>
{d.title}
</UsefulBox>
))}
</View>
);
};
const JRSTraInfoBox = (props) => {
const {
JRSTraInfoEXAcSR,
getTime,
setLoadingDelayData,
loadingDelayData,
delayData,
} = props;
const styles = {
touch: {
backgroundColor: "#0099CC",
borderRadius: 5,
margin: 10,
borderColor: "black",
borderWidth: 2,
overflow: "hidden",
},
scroll: {
backgroundColor: "#0099CC",
borderRadius: 5,
maxHeight: 300,
},
bottom: {
position: "absolute",
top: 250,
alignItems: "center",
width: "100%",
height: 50,
backgroundColor: "#007FCC88",
},
box: {
padding: 10,
backgroundColor: "white",
borderBottomLeftRadius: 5,
borderBottomRightRadius: 5,
},
};
return (
<TouchableOpacity
onPress={JRSTraInfoEXAcSR.current?.setModalVisible}
style={styles.touch}
>
<ScrollView scrollEnabled={false} style={styles.scroll}>
<View
style={{ padding: 10, flexDirection: "row", alignItems: "center" }}
>
<Text style={{ fontSize: 30, fontWeight: "bold", color: "white" }}>
列車遅延速報EX
</Text>
<View style={{ flex: 1 }} />
<Text style={{ fontSize: 30, fontWeight: "bold", color: "white" }}>
{getTime
? getTime.toLocaleTimeString("ja-JP").split(":")[0] +
":" +
getTime.toLocaleTimeString("ja-JP").split(":")[1]
: NaN}
</Text>
<Ionicons
name="reload"
color="white"
size={30}
style={{ margin: 5 }}
onPress={() => {
LayoutAnimation.easeInEaseOut();
setLoadingDelayData(true);
}}
/>
</View>
<View style={styles.box}>
{loadingDelayData ? (
<View style={{ alignItems: "center" }}>
<LottieView
autoPlay
loop
style={{ width: 150, height: 150, backgroundColor: "#fff" }}
source={require("./assets/51690-loading-diamonds.json")}
/>
</View>
) : delayData ? (
delayData.map((d, index) => {
let data = d.split(" ");
return (
<View style={{ flexDirection: "row" }} key={index}>
<Text style={{ flex: 15, fontSize: 20 }}>
{data[0].replace("\n", "")}
</Text>
<Text style={{ flex: 5, fontSize: 20 }}>{data[1]}</Text>
<Text style={{ flex: 6, fontSize: 20 }}>{data[3]}</Text>
</View>
);
})
) : (
<Text>現在5分以上の遅れはありません</Text>
)}
</View>
</ScrollView>
<View style={styles.bottom}>
<View style={{ flex: 1 }} />
<Text style={{ color: "white", fontWeight: "bold", fontSize: 20 }}>
詳細を見る
</Text>
<View style={{ flex: 1 }} />
</View>
</TouchableOpacity>
);
};