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

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

18
Apps.js
View File

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

View File

@ -8,14 +8,8 @@ import { AS } from "../storageControl";
import { news } from "../config/newsUpdate";
import { getStationList, lineList } from "../lib/getStationList";
var Status = StatusbarDetect();
export default function FavoriteList(props) {
const {
route: {
params: { webview, stationData },
},
navigation: { navigate },
} = props;
export default function FavoriteList({ navigation, webview, stationData }) {
const { navigate } = navigation;
const [favoriteStation, setFavoriteStation] = useState([]);
useEffect(() => {
@ -31,6 +25,17 @@ export default function FavoriteList(props) {
return (
<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" }}>
{favoriteStation
.filter((d) => d[0].StationMap)
@ -100,9 +105,7 @@ export default function FavoriteList(props) {
borderRadius: 5,
alignItems: "center",
}}
onPress={() => {
navigate("trainMenu");
}}
onPress={() => navigation.goBack()}
>
<View style={{ flex: 1 }} />
<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 MapView, { Marker } from "react-native-maps";
import { MaterialCommunityIcons } from "@expo/vector-icons";
export default function trainMenu({
route: {
params: { webview, stationData },
},
export default function TrainMenu({
navigation: { navigate },
webview,
stationData,
}) {
const mapRef = useRef();
return (
@ -67,9 +66,7 @@ export default function trainMenu({
backgroundColor={"#EA4752"}
icon="star"
flex={1}
onPressButton={() =>
navigate("favoriteList", { webview, stationData })
}
onPressButton={() => navigate("favoriteList")}
>
お気に入り
</UsefulBox>
@ -96,9 +93,7 @@ export default function trainMenu({
borderRadius: 5,
alignItems: "center",
}}
onPress={() => {
navigate("Apps");
}}
onPress={() => navigate("Apps")}
>
<View style={{ flex: 1 }} />
<Text style={{ fontSize: 25, fontWeight: "bold", color: "white" }}>