タブバーのロング押し実装に伴うnavigation手法の変更とふぁぼ画面へのクイックアクセス機能整備
This commit is contained in:
30
App.js
30
App.js
@@ -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,6 +8,7 @@ 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";
|
||||
@@ -67,16 +68,21 @@ export default function App() {
|
||||
);
|
||||
}
|
||||
const top = ({ navigation }) => {
|
||||
const webview = useRef();
|
||||
|
||||
//地図用
|
||||
const [mapsStationData, setMapsStationData] = useState(undefined);
|
||||
useEffect(() => {
|
||||
getStationList2().then(setMapsStationData);
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
const unsubscribe = navigation.addListener("tabLongPress", (e) => {
|
||||
alert("longPress!");
|
||||
navigation.navigate("favoriteList", { webview, stationData });
|
||||
navigation.navigate("favoriteList");
|
||||
});
|
||||
|
||||
return unsubscribe;
|
||||
}, [navigation]);
|
||||
|
||||
const webview = useRef();
|
||||
return (
|
||||
<Stack.Navigator>
|
||||
<Stack.Screen
|
||||
@@ -112,13 +118,25 @@ const top = ({ navigation }) => {
|
||||
{(props) => <News {...props} />}
|
||||
</Stack.Screen>
|
||||
<Stack.Screen name="trainMenu" options={optionData}>
|
||||
{(props) => <TrainMenu {...props} webview={webview} />}
|
||||
{(props) => (
|
||||
<TrainMenu
|
||||
{...props}
|
||||
webview={webview}
|
||||
stationData={mapsStationData}
|
||||
/>
|
||||
)}
|
||||
</Stack.Screen>
|
||||
<Stack.Screen
|
||||
name="favoriteList"
|
||||
options={{ ...optionData, gestureEnabled: false }}
|
||||
>
|
||||
{(props) => <FavoriteList {...props} webview={webview} />}
|
||||
{(props) => (
|
||||
<FavoriteList
|
||||
{...props}
|
||||
webview={webview}
|
||||
stationData={mapsStationData}
|
||||
/>
|
||||
)}
|
||||
</Stack.Screen>
|
||||
</Stack.Navigator>
|
||||
);
|
||||
|
Reference in New Issue
Block a user