回転判定の移動、コードの部分共通化

This commit is contained in:
harukin-expo-dev-env
2024-03-09 11:02:52 +00:00
parent d4c9bdae75
commit e1e35168d6
8 changed files with 139 additions and 132 deletions

View File

@@ -1,9 +1,16 @@
import React, { useState, useEffect } from "react";
import { View, Linking, Text, TouchableOpacity, Platform } from "react-native";
import {
View,
Linking,
Text,
TouchableOpacity,
BackHandler,
Platform,
} from "react-native";
import AutoHeightImage from "react-native-auto-height-image";
import { FontAwesome, Foundation, Ionicons } from "@expo/vector-icons";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import ActionSheet from "react-native-actions-sheet";
import ActionSheet, { SheetManager } from "react-native-actions-sheet";
import Sign from "../../components/駅名表/Sign";
import { TicketBox } from "../atom/TicketBox";
@@ -25,6 +32,7 @@ export const StationDeteilView = (props) => {
} = props.payload;
const { busAndTrainData } = useBusAndTrainData();
const [trainBus, setTrainBus] = useState();
useEffect(() => {
if (!currentStation) return () => {};
const data = busAndTrainData.filter((d) => {
@@ -60,6 +68,7 @@ export const StationDeteilView = (props) => {
}
useBottomSafeAreaPadding={Platform.OS == "android"}
>
<Handler />
<View
key={currentStation}
style={{
@@ -417,6 +426,20 @@ const 駅構内図 = (props) => {
);
};
const Handler = () => {
useEffect(() => {
const backAction = () => {
SheetManager.hide("StationDetailView");
return true;
};
const backHandler = BackHandler.addEventListener(
"hardwareBackPress",
backAction
);
return () => backHandler.remove();
}, []);
return <></>;
};
const styleSheet = {
外枠: {
width: wp("80%"),