diff --git a/components/ActionSheetComponents/SocialMenu.tsx b/components/ActionSheetComponents/SocialMenu.tsx new file mode 100644 index 0000000..d2d1890 --- /dev/null +++ b/components/ActionSheetComponents/SocialMenu.tsx @@ -0,0 +1,146 @@ +import React, { useRef } from "react"; +import { View, Platform, Text } from "react-native"; +import ActionSheet ,{ ScrollView } from "react-native-actions-sheet"; +import { useSafeAreaInsets } from "react-native-safe-area-context"; +import { ListItem } from "@rneui/themed"; +import { MaterialCommunityIcons } from "@expo/vector-icons"; +import { Linking } from "react-native"; +import TouchableScale from "react-native-touchable-scale"; +export const Social = () => { + 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"} + > + + + + + + + + + JR四国公式SNS一族 + + + + {[ + { + url: "https://twitter.com/jr_shikoku_info", + name: "JR四国列車運行情報", + }, + + { + url: "https://twitter.com/JRshikoku_eigyo", + name: "JR四国営業部【公式】", + }, + { + url: "https://twitter.com/JRshikoku_tokyo", + name: "JR四国 東京営業情報【公式】", + }, + { + url: "https://twitter.com/JRshikoku_osaka", + name: "JR四国 大阪営業部【公式】", + }, + { + url: "https://twitter.com/jrs_matsuyama", + name: "JR四国 松山駅 【公式】", + }, + { + url: "https://twitter.com/jrshikoku_kochi", + name: "JR四国 高知駅【公式】", + }, + { + url: "https://twitter.com/jr_tokust", + name: "JR四国 徳島駅【公式】", + }, + { + url: "https://twitter.com/jrshikoku_uwjm", + name: "JR四国 宇和島駅【公式】", + }, + { + url: "https://twitter.com/jrshikoku_wkama", + name: "JR四国 ワープ高松支店【公式】", + }, + { + url: "https://twitter.com/JRshikoku_wkoch", + name: "JR四国 ワープ高知支店【公式】", + }, + { + url: "https://twitter.com/Yoakemonogatari", + name: "志国土佐 時代の夜明けのものがたり【公式】", + }, + { + url: "https://twitter.com/Smile_Eki_Chan", + name: "すまいるえきちゃん♡JR四国【公式】", + }, + { + url: "https://twitter.com/sper_ponchan", + name: "しこくたぬきのぽんちゃん 【四国家サポーターズクラブ】", + }, + ].map((d) => ( + Linking.openURL(d.url)} + key={d.url} + friction={90} // + tension={100} // These props are passed to the parent component (here TouchableScale) + activeScale={0.95} // + Component={TouchableScale} + > + + {d.name} + + + + ))} + + + + ); +}; 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..71d9912 100644 --- a/components/ActionSheetComponents/sheets.ts +++ b/components/ActionSheetComponents/sheets.ts @@ -4,11 +4,15 @@ import { JRSTraInfo } from "./JRSTraInfo"; import { StationDeteilView } from "./StationDeteilView"; import { TrainMenuLineSelector } from "./TrainMenuLineSelector"; import { TrainIconUpdate } from "./TrainIconUpdate"; +import { SpecialTrainInfo } from "./SpecialTrainInfo"; +import { Social } from "./SocialMenu"; registerSheet("EachTrainInfo", EachTrainInfo); registerSheet("JRSTraInfo", JRSTraInfo); registerSheet("StationDetailView", StationDeteilView); registerSheet("TrainMenuLineSelector", TrainMenuLineSelector); registerSheet("TrainIconUpdate", TrainIconUpdate); +registerSheet("SpecialTrainInfo", SpecialTrainInfo); +registerSheet("Social", Social); export {}; diff --git a/components/Menu/FixedContentBottom.js b/components/Menu/FixedContentBottom.js index 2ae1aaf..de78d59 100644 --- a/components/Menu/FixedContentBottom.js +++ b/components/Menu/FixedContentBottom.js @@ -6,10 +6,12 @@ import { MaterialCommunityIcons, } from "@expo/vector-icons"; import { ListItem } from "@rneui/themed"; -import TouchableScale from 'react-native-touchable-scale'; +import TouchableScale from "react-native-touchable-scale"; 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 ( @@ -54,7 +56,9 @@ export const FixedContentBottom = (props) => { backgroundColor="red" flex={1} onPressButton={() => - Linking.openURL("https://xprocess.haruk.in/JR-shikoku-Apps-Common/2025-update-status") + Linking.openURL( + "https://xprocess.haruk.in/JR-shikoku-Apps-Common/2025-update-status" + ) } > @@ -82,7 +86,9 @@ 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 }, + }) } > @@ -179,105 +185,20 @@ export const FixedContentBottom = (props) => { (通話料がかかります) - + SheetManager.show("Social") + } > - - - - JR四国公式Twitter一族 - - - - {[ - { - url: "https://twitter.com/jr_shikoku_info", - name: "JR四国列車運行情報", - }, - - { - url: "https://twitter.com/JRshikoku_eigyo", - name: "JR四国営業部【公式】", - }, - { - url: "https://twitter.com/JRshikoku_tokyo", - name: "JR四国 東京営業情報【公式】", - }, - { - url: "https://twitter.com/JRshikoku_osaka", - name: "JR四国 大阪営業部【公式】", - }, - { - url: "https://twitter.com/jrs_matsuyama", - name: "JR四国 松山駅 【公式】", - }, - { - url: "https://twitter.com/jrshikoku_kochi", - name: "JR四国 高知駅【公式】", - }, - { - url: "https://twitter.com/jr_tokust", - name: "JR四国 徳島駅【公式】", - }, - { - url: "https://twitter.com/jrshikoku_uwjm", - name: "JR四国 宇和島駅【公式】", - }, - { - url: "https://twitter.com/jrshikoku_wkama", - name: "JR四国 ワープ高松支店【公式】", - }, - { - url: "https://twitter.com/JRshikoku_wkoch", - name: "JR四国 ワープ高知支店【公式】", - }, - { - url: "https://twitter.com/Yoakemonogatari", - name: "志国土佐 時代の夜明けのものがたり【公式】", - }, - { - url: "https://twitter.com/Smile_Eki_Chan", - name: "すまいるえきちゃん♡JR四国【公式】", - }, - { - url: "https://twitter.com/sper_ponchan", - name: "しこくたぬきのぽんちゃん 【四国家サポーターズクラブ】", - }, - ].map((d) => ( - Linking.openURL(d.url)} - key={d.url}friction={90} // - tension={100} // These props are passed to the parent component (here TouchableScale) - activeScale={0.95} // - Component={TouchableScale} - > - - {d.name} - - - - ))} - - + + ソーシャルメディア + + + JR四国のSNS一覧です。 + + 上級者向け機能 void; +}; +export const SpecialTrainInfoBox: FC = ({ navigate }) => { + const [specialData, setSpecialData] = useState([]); + useLayoutEffect(() => { + fetch("https://n8n.haruk.in/webhook/sptrainfo") + .then((res) => res.json()) + .then((data) => setSpecialData(data.data)) + .catch((err) => console.log(err)); + }, []); + return ( + + + + 臨時列車情報 + + + + {specialData.map((d) => ( + { + navigate("howto", { + info: getPDFViewURL("https://www.jr-shikoku.co.jp" + d.address), + goTo: "menu", + }); + SheetManager.hide("SpecialTrainInfo"); + }} + onLongPress={() => alert(d.description)} + key={d.address} + style={{ + padding: 10, + borderBottomWidth: 1, + borderBottomColor: "#ccc", + flexDirection: "row", + alignItems: "center", + }} + > + {d.text} + + ))} + + + ); +};