Merge commit '3ff585a577d45227ec7bfa473eb658fea0853f9c' into develop

This commit is contained in:
harukin-DeskMini 2023-01-30 01:19:06 +09:00
commit 67f9b8b698
4 changed files with 108 additions and 82 deletions

76
App.js
View File

@ -1,4 +1,4 @@
import React, { useEffect, useRef } from "react"; import React, { useEffect, useRef, useState } from "react";
import { NavigationContainer } from "@react-navigation/native"; import { NavigationContainer } from "@react-navigation/native";
import { import {
createStackNavigator, createStackNavigator,
@ -8,14 +8,15 @@ import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { AntDesign, Ionicons } from "@expo/vector-icons"; import { AntDesign, Ionicons } from "@expo/vector-icons";
import { Platform, UIManager } from "react-native"; import { Platform, UIManager } from "react-native";
import { UpdateAsync } from "./UpdateAsync.js"; import { UpdateAsync } from "./UpdateAsync.js";
import { getStationList2 } from "./lib/getStationList2";
import Apps from "./Apps"; import Apps from "./Apps";
import tndView from "./ndView"; import tndView from "./ndView";
import trainbase from "./trainbaseview"; import TrainBase from "./trainbaseview";
import howto from "./howto"; import HowTo from "./howto";
import menu from "./menu"; import menu from "./menu";
import News from "./components/news.js"; import News from "./components/news.js";
import Setting from "./components/settings.js"; import Setting from "./components/settings.js";
import trainMenu from "./components/trainMenu.js"; import TrainMenu from "./components/trainMenu.js";
import FavoriteList from "./components/FavoriteList.js"; import FavoriteList from "./components/FavoriteList.js";
const Stack = createStackNavigator(); const Stack = createStackNavigator();
const Tab = createBottomTabNavigator(); const Tab = createBottomTabNavigator();
@ -25,14 +26,14 @@ if (Platform.OS === "android") {
} }
} }
export default function App() { export default function App() {
const navigationRef = useRef();
useEffect(() => { useEffect(() => {
UpdateAsync(); UpdateAsync();
}, []); }, []);
return ( return (
<NavigationContainer name="Root" ref={navigationRef} style={{ flex: 1 }}> <NavigationContainer name="Root" style={{ flex: 1 }}>
<Tab.Navigator> <Tab.Navigator>
<Stack.Screen <Tab.Screen
name="login" name="login"
component={top} component={top}
options={{ options={{
@ -42,7 +43,7 @@ export default function App() {
tabBarIcon: () => <AntDesign name="barchart" size={32} />, tabBarIcon: () => <AntDesign name="barchart" size={32} />,
}} }}
/> />
<Stack.Screen <Tab.Screen
name="menuPage" name="menuPage"
component={menuPage} component={menuPage}
options={{ options={{
@ -52,7 +53,7 @@ export default function App() {
tabBarIcon: () => <Ionicons name="ios-radio" size={32} />, tabBarIcon: () => <Ionicons name="ios-radio" size={32} />,
}} }}
/> />
<Stack.Screen <Tab.Screen
name="home" name="home"
component={tndView} component={tndView}
options={{ options={{
@ -66,43 +67,80 @@ export default function App() {
</NavigationContainer> </NavigationContainer>
); );
} }
const top = () => ( const top = ({ navigation }) => {
const webview = useRef();
//地図用
const [mapsStationData, setMapsStationData] = useState(undefined);
useEffect(() => {
getStationList2().then(setMapsStationData);
}, []);
useEffect(() => {
const unsubscribe = navigation.addListener("tabLongPress", (e) => {
navigation.navigate("favoriteList");
});
return unsubscribe;
}, [navigation]);
return (
<Stack.Navigator> <Stack.Navigator>
<Stack.Screen <Stack.Screen
name="Apps" name="Apps"
component={Apps}
options={{ options={{
headerShown: false, headerShown: false,
gestureEnabled: true, gestureEnabled: true,
headerTransparent: true, headerTransparent: true,
}} }}
/> >
{(props) => <Apps {...props} webview={webview} />}
</Stack.Screen>
<Stack.Screen <Stack.Screen
name="trainbase" name="trainbase"
component={trainbase}
options={{ options={{
title: "トレインビジョン", title: "トレインビジョン",
gestureEnabled: true, gestureEnabled: true,
...TransitionPresets.SlideFromRightIOS, ...TransitionPresets.SlideFromRightIOS,
}} }}
/> >
{(props) => <TrainBase {...props} webview={webview} />}
</Stack.Screen>
<Stack.Screen <Stack.Screen
name="howto" name="howto"
component={howto}
options={{ options={{
title: "使い方", title: "使い方",
...optionData, ...optionData,
}} }}
>
{(props) => <HowTo {...props} />}
</Stack.Screen>
<Stack.Screen name="news" options={optionData}>
{(props) => <News {...props} />}
</Stack.Screen>
<Stack.Screen name="trainMenu" options={optionData}>
{(props) => (
<TrainMenu
{...props}
webview={webview}
stationData={mapsStationData}
/> />
<Stack.Screen name="news" component={News} options={optionData} /> )}
<Stack.Screen name="trainMenu" component={trainMenu} options={optionData} /> </Stack.Screen>
<Stack.Screen <Stack.Screen
name="favoriteList" name="favoriteList"
component={FavoriteList}
options={{ ...optionData, gestureEnabled: false }} options={{ ...optionData, gestureEnabled: false }}
>
{(props) => (
<FavoriteList
{...props}
webview={webview}
stationData={mapsStationData}
/> />
)}
</Stack.Screen>
</Stack.Navigator> </Stack.Navigator>
); );
};
function menuPage() { function menuPage() {
return ( return (
<Stack.Navigator> <Stack.Navigator>
@ -118,7 +156,7 @@ function menuPage() {
<Stack.Screen name="setting" component={Setting} options={optionData} /> <Stack.Screen name="setting" component={Setting} options={optionData} />
<Stack.Screen <Stack.Screen
name="trainbase" name="trainbase"
component={trainbase} component={TrainBase}
options={{ options={{
...TransitionPresets.ModalPresentationIOS, ...TransitionPresets.ModalPresentationIOS,
cardOverlayEnabled: true, cardOverlayEnabled: true,

18
Apps.js
View File

@ -19,23 +19,15 @@ import { getStationList2 } from "./lib/getStationList2";
import StatusbarDetect from './StatusbarDetect'; import StatusbarDetect from './StatusbarDetect';
var Status = StatusbarDetect(); */ var Status = StatusbarDetect(); */
export default function Apps(props) { export default function Apps({ navigation, webview }) {
const { const { navigate } = navigation;
navigation: { navigate },
} = props;
var urlcache = ""; var urlcache = "";
const webview = useRef();
//画面表示関連 //画面表示関連
const [iconSetting, setIconSetting] = useState(undefined); const [iconSetting, setIconSetting] = useState(undefined);
const [mapSwitch, setMapSwitch] = useState(undefined); const [mapSwitch, setMapSwitch] = useState(undefined);
const [stationMenu, setStationMenu] = useState(undefined); const [stationMenu, setStationMenu] = useState(undefined);
//地図用
const [mapsStationData, setMapsStationData] = useState(undefined);
useEffect(() => {
getStationList2().then(setMapsStationData);
}, []);
//駅情報画面用 //駅情報画面用
const StationBoardAcSR = useRef(null); const StationBoardAcSR = useRef(null);
const [stationBoardData, setStationBoardData] = useState(undefined); const [stationBoardData, setStationBoardData] = useState(undefined);
@ -187,9 +179,7 @@ export default function Apps(props) {
onTouchMove={() => StationBoardAcSR.current?.hide()} onTouchMove={() => StationBoardAcSR.current?.hide()}
/> />
<MapsButton <MapsButton
onPress={() => onPress={() => navigate("trainMenu", { webview })}
navigate("trainMenu", { webview, stationData: mapsStationData })
}
top={Platform.OS == "ios" ? Constants.statusBarHeight : 0} top={Platform.OS == "ios" ? Constants.statusBarHeight : 0}
mapSwitch={mapSwitch == "true" ? "flex" : "none"} mapSwitch={mapSwitch == "true" ? "flex" : "none"}
/> />

View File

@ -8,14 +8,8 @@ import { AS } from "../storageControl";
import { news } from "../config/newsUpdate"; import { news } from "../config/newsUpdate";
import { getStationList, lineList } from "../lib/getStationList"; import { getStationList, lineList } from "../lib/getStationList";
var Status = StatusbarDetect(); var Status = StatusbarDetect();
export default function FavoriteList(props) { export default function FavoriteList({ navigation, webview, stationData }) {
const { const { navigate } = navigation;
route: {
params: { webview, stationData },
},
navigation: { navigate },
} = props;
const [favoriteStation, setFavoriteStation] = useState([]); const [favoriteStation, setFavoriteStation] = useState([]);
useEffect(() => { useEffect(() => {
@ -31,6 +25,17 @@ export default function FavoriteList(props) {
return ( return (
<View style={{ height: "100%", backgroundColor: "#0099CC" }}> <View style={{ height: "100%", backgroundColor: "#0099CC" }}>
<Text
style={{
textAlign: "center",
fontSize: 25,
color: "white",
fontWeight: "bold",
paddingVertical: 10,
}}
>
位置情報クイック移動メニュー
</Text>
<ScrollView style={{ height: "100%", backgroundColor: "white" }}> <ScrollView style={{ height: "100%", backgroundColor: "white" }}>
{favoriteStation {favoriteStation
.filter((d) => d[0].StationMap) .filter((d) => d[0].StationMap)
@ -100,9 +105,7 @@ export default function FavoriteList(props) {
borderRadius: 5, borderRadius: 5,
alignItems: "center", alignItems: "center",
}} }}
onPress={() => { onPress={() => navigation.goBack()}
navigate("trainMenu");
}}
> >
<View style={{ flex: 1 }} /> <View style={{ flex: 1 }} />
<Text style={{ fontSize: 25, fontWeight: "bold", color: "white" }}> <Text style={{ fontSize: 25, fontWeight: "bold", color: "white" }}>

View File

@ -2,11 +2,10 @@ import React, { useRef } from "react";
import { View, Text, TouchableOpacity, Linking } from "react-native"; import { View, Text, TouchableOpacity, Linking } from "react-native";
import MapView, { Marker } from "react-native-maps"; import MapView, { Marker } from "react-native-maps";
import { MaterialCommunityIcons } from "@expo/vector-icons"; import { MaterialCommunityIcons } from "@expo/vector-icons";
export default function trainMenu({ export default function TrainMenu({
route: {
params: { webview, stationData },
},
navigation: { navigate }, navigation: { navigate },
webview,
stationData,
}) { }) {
const mapRef = useRef(); const mapRef = useRef();
return ( return (
@ -67,9 +66,7 @@ export default function trainMenu({
backgroundColor={"#EA4752"} backgroundColor={"#EA4752"}
icon="star" icon="star"
flex={1} flex={1}
onPressButton={() => onPressButton={() => navigate("favoriteList")}
navigate("favoriteList", { webview, stationData })
}
> >
お気に入り お気に入り
</UsefulBox> </UsefulBox>
@ -96,9 +93,7 @@ export default function trainMenu({
borderRadius: 5, borderRadius: 5,
alignItems: "center", alignItems: "center",
}} }}
onPress={() => { onPress={() => navigate("Apps")}
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" }}>