Files
jrshikoku/components/Menu/TopMenuButton.tsx
T
harukin-expo-dev-envandClaude Opus 5.5 8f6633fc1b fix: 外部URLを開く失敗とAndroidウィジェットの取得失敗を処理する
- Linking.openURLをopenExternalUrlに置き換え、失敗時は未処理rejectにせずAlertで伝える
- Androidの運行情報・遅延情報ウィジェットで、取得失敗時に「通常運行」と誤表示しないようにする

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-03 00:14:41 +09:00

53 lines
1.4 KiB
TypeScript

import React from "react";
import { View } from "react-native";
import { UsefulBox } from "@/components/TrainMenu/UsefulBox";
import { MaterialCommunityIcons } from "@expo/vector-icons";
import { openExternalUrl } from "@/lib/openExternalUrl";
export const TopMenuButton = () => {
const buttonList:{
backgroundColor: string;
icon: keyof typeof MaterialCommunityIcons.glyphMap;
onPress: () => void;
title: string;
}[] = [
{
backgroundColor: "#F89038",
icon: "train-car",
onPress: () =>
openExternalUrl("https://www.jr-shikoku.co.jp/01_trainbus/sp/"),
title: "駅・鉄道情報",
},
{
backgroundColor: "#EA4752",
icon: "google-spreadsheet",
onPress: () =>
openExternalUrl(
"https://www.jr-shikoku.co.jp/01_trainbus/jikoku/sp/#mainprice-box"
),
title: "運賃表",
},
{
backgroundColor: "#91C31F",
icon: "clipboard-list-outline",
onPress: () => openExternalUrl("https://www.jr-shikoku.co.jp/e5489/"),
title: "予約",
},
];
return (
<View style={{ flexDirection: "row" }}>
{buttonList.map((d, index) => (
<UsefulBox
backgroundColor={d.backgroundColor}
icon={d.icon}
flex={1}
onPressButton={d.onPress}
key={index + d.icon}
>
{d.title}
</UsefulBox>
))}
</View>
);
};