diff --git a/components/ActionSheetComponents/SpecialTrainInfo.tsx b/components/ActionSheetComponents/SpecialTrainInfo.tsx
new file mode 100644
index 0000000..590f0d9
--- /dev/null
+++ b/components/ActionSheetComponents/SpecialTrainInfo.tsx
@@ -0,0 +1,51 @@
+import React, { useRef } from "react";
+import { View, Platform } from "react-native";
+import ActionSheet from "react-native-actions-sheet";
+import { useSafeAreaInsets } from "react-native-safe-area-context";
+
+import { SpecialTrainInfoBox } from "../Menu/SpecialTrainInfoBox";
+export const SpecialTrainInfo = ({ payload }) => {
+ const { navigate } = payload;
+ const actionSheetRef = useRef(null);
+ const insets = useSafeAreaInsets();
+
+ return (
+ >}
+ ref={actionSheetRef}
+ isModal={Platform.OS == "ios"}
+ containerStyle={
+ Platform.OS == "android"
+ ? {
+ paddingBottom: insets.bottom,
+ }
+ : {}
+ }
+ useBottomSafeAreaPadding={Platform.OS == "android"}
+ >
+
+
+
+
+
+
+
+ );
+};
diff --git a/components/ActionSheetComponents/sheets.ts b/components/ActionSheetComponents/sheets.ts
index 2f4ba52..e33daa7 100644
--- a/components/ActionSheetComponents/sheets.ts
+++ b/components/ActionSheetComponents/sheets.ts
@@ -4,11 +4,13 @@ import { JRSTraInfo } from "./JRSTraInfo";
import { StationDeteilView } from "./StationDeteilView";
import { TrainMenuLineSelector } from "./TrainMenuLineSelector";
import { TrainIconUpdate } from "./TrainIconUpdate";
+import { SpecialTrainInfo } from "./SpecialTrainInfo";
registerSheet("EachTrainInfo", EachTrainInfo);
registerSheet("JRSTraInfo", JRSTraInfo);
registerSheet("StationDetailView", StationDeteilView);
registerSheet("TrainMenuLineSelector", TrainMenuLineSelector);
registerSheet("TrainIconUpdate", TrainIconUpdate);
+registerSheet("SpecialTrainInfo", SpecialTrainInfo);
export {};
diff --git a/components/Menu/FixedContentBottom.js b/components/Menu/FixedContentBottom.js
index 0144a79..923a8cc 100644
--- a/components/Menu/FixedContentBottom.js
+++ b/components/Menu/FixedContentBottom.js
@@ -11,6 +11,7 @@ import Icon from "react-native-vector-icons/Entypo";
import { TextBox } from "../atom/TextBox";
import { TicketBox } from "../atom/TicketBox";
import { SpecialTrainInfoBox } from "./SpecialTrainInfoBox";
+import { SheetManager } from "react-native-actions-sheet";
export const FixedContentBottom = (props) => {
return (
@@ -51,7 +52,6 @@ export const FixedContentBottom = (props) => {
旅行ツアー
-
{
backgroundColor="#0099CC"
flex={1}
onPressButton={() =>
- Linking.openURL("https://www.jr-shikoku.co.jp/sp/index.html#menu-box")
+ SheetManager.show("SpecialTrainInfo", {
+ payload: { navigate: props.navigate },
+ })
}
>
diff --git a/components/Menu/SpecialTrainInfoBox.tsx b/components/Menu/SpecialTrainInfoBox.tsx
index 71751e2..c24bb95 100644
--- a/components/Menu/SpecialTrainInfoBox.tsx
+++ b/components/Menu/SpecialTrainInfoBox.tsx
@@ -1,13 +1,14 @@
-import { FC, useEffect, useState } from "react";
+import { FC, useEffect, useLayoutEffect, useState } from "react";
import { View, Text, TouchableOpacity } from "react-native";
import { getPDFViewURL } from "@/lib/getPdfViewURL";
+import { ScrollView, SheetManager } from "react-native-actions-sheet";
type props = {
navigate: (screen: string, params?: object) => void;
};
export const SpecialTrainInfoBox: FC = ({ navigate }) => {
const [specialData, setSpecialData] = useState([]);
- useEffect(() => {
+ useLayoutEffect(() => {
fetch("https://n8n.haruk.in/webhook/sptrainfo")
.then((res) => res.json())
.then((data) => setSpecialData(data.data))
@@ -17,10 +18,6 @@ export const SpecialTrainInfoBox: FC = ({ navigate }) => {
@@ -29,17 +26,16 @@ export const SpecialTrainInfoBox: FC = ({ navigate }) => {
fontSize: 30,
fontWeight: "bold",
color: "white",
- padding: 10,
+ paddingHorizontal: 10,
+ paddingVertical: 5,
}}
>
臨時列車情報
-
{specialData.map((d) => (
@@ -49,6 +45,7 @@ export const SpecialTrainInfoBox: FC = ({ navigate }) => {
info: getPDFViewURL("https://www.jr-shikoku.co.jp" + d.address),
goTo: "menu",
});
+ SheetManager.hide("SpecialTrainInfo");
}}
onLongPress={() => alert(d.description)}
key={d.address}
@@ -63,7 +60,7 @@ export const SpecialTrainInfoBox: FC = ({ navigate }) => {
{d.text}
))}
-
+
);
};