メニューデフォルト表示に変更

This commit is contained in:
harukin-expo-dev-env 2024-05-15 10:12:49 +00:00
parent 59e2ea32d8
commit 6a15decadd
4 changed files with 22 additions and 27 deletions

2
App.js
View File

@ -63,6 +63,8 @@ export function AppContainer() {
<NavigationContainer name="Root" style={{ flex: 1 }} ref={navigationRef}>
<Tab.Navigator
tabBarOptions={{ keyboardHidesTabBar: Platform.OS === "android" }}
initialRouteName="menuPage"
lazy={false}
>
<Tab.Screen
name="login"

View File

@ -17,7 +17,7 @@ export const TrainDataView = ({
}) => {
const { width, height } = useWindowDimensions();
const { isLandscape } = useDeviceOrientationChange();
const { webview, getCurrentTrain } = useCurrentTrain();
const { webview, getCurrentTrain, inject } = useCurrentTrain();
const [mapsStationData, setMapsStationData] = useState(undefined);
useEffect(() => {
getStationList2().then(setMapsStationData);
@ -51,10 +51,10 @@ export const TrainDataView = ({
}
});
if (!test.length) return;
webview.current?.injectJavaScript(
navigate("Apps");
inject(
`MoveDisplayStation('${test[0].line}_${test[0].station.MyStation}_${test[0].station.Station_JP}');setStrings();`
);
navigate("Apps");
SheetManager.hide("EachTrainInfo");
}}
>

View File

@ -235,12 +235,17 @@ export const EachTrainInfoCore = ({
} else {
SheetManager.hide("EachTrainInfo").then(() => {
//0.1秒待機してから開く
setTimeout(() => {
SheetManager.show("EachTrainInfo", { payload });
}, 2);
setTimeout(() => SheetManager.show("EachTrainInfo", { payload }), 2);
});
}
};
const headerItem = {
currentTrainData,
currentPosition,
nearTrainIDList,
openTrainInfo,
navigate,
};
return (
<View
style={{
@ -303,24 +308,8 @@ export const EachTrainInfoCore = ({
maxHeight: isLandscape ? height - 94 : (height / 100) * 70,
},
}}
shortHeader={
<ShortHeader
currentTrainData={currentTrainData}
currentPosition={currentPosition}
nearTrainIDList={nearTrainIDList}
openTrainInfo={openTrainInfo}
navigate={navigate}
/>
}
longHeader={
<LongHeader
currentTrainData={currentTrainData}
currentPosition={currentPosition}
nearTrainIDList={nearTrainIDList}
openTrainInfo={openTrainInfo}
navigate={navigate}
/>
}
shortHeader={<ShortHeader {...headerItem} />}
longHeader={<LongHeader {...headerItem} />}
topStickyContent={
<ScrollStickyContent currentTrainData={currentTrainData} />
}
@ -376,11 +365,11 @@ export const EachTrainInfoCore = ({
)
)}
{tailStation.length != 0 &&
tailStation.map((i, index) =>
tailStation.map(({ station, dia }, index) =>
showTailStation.findIndex((d) => d == index) == -1 ? (
<TouchableOpacity
onPress={() => {
const array = openBackTrainInfo(i.station, trainData, i.dia);
const array = openBackTrainInfo(station, trainData, dia);
if (!array) return;
setTrainData(array);

View File

@ -38,7 +38,7 @@ export const CurrentTrainProvider = ({ children }) => {
setCurrentTrainLoading("success");
})
.catch(() => {
alert("現在の全在線列車取得エラー/再取得します");
//alert("現在の全在線列車取得エラー/再取得します");
fetch(
"https://script.google.com/macros/s/AKfycby9Y2-Bm75J_WkbZimi7iS8v5r9wMa9wtzpdwES9sOGF4i6HIYEJOM60W6gM1gXzt1o/exec",
HeaderConfig
@ -57,6 +57,9 @@ export const CurrentTrainProvider = ({ children }) => {
});
});
};
const inject = (i) => {
webview.current?.injectJavaScript(i);
};
useEffect(getCurrentTrain, []); //初回だけ現在の全在線列車取得
@ -72,6 +75,7 @@ export const CurrentTrainProvider = ({ children }) => {
currentTrainLoading,
setCurrentTrainLoading,
getCurrentTrain,
inject,
}}
>
{children}