Files
jrshikoku/components/TrainMenu/UsefulBox.tsx
harukin-expo-dev-env 3ca109edee feat: メイン画面のレスポンシブ対応 - Menu/atom/TrainMenuコンポーネントにスケーリング適用
- TitleBar: ヘッダー高さをverticalScaleに
- UsefulBox: アイコン50→moderateScale、フォント16→fontScale
- TicketBox: フォント18→fontScale
- TextBox: minHeight 70→verticalScale
- FixedContentBottom: 全fontSize(20/18)→fontScale、全アイコンsize(50/40)→moderateScale
- JRSTraInfoBox: 全fontSize(30/20/18)、アイコン、maxHeight、ローディングサイズをスケーリング
- SpecialTrainInfoBox: fontSize(30/20)→fontScale
- CarouselTypeChanger: height 40→verticalScale
2026-03-29 15:41:06 +00:00

37 lines
1.1 KiB
TypeScript

import React, { FC } from "react";
import { Text, TouchableOpacity } from "react-native";
import { MaterialCommunityIcons } from "@expo/vector-icons";
import { useThemeColors } from "@/lib/theme";
import { useResponsive } from "@/lib/responsive";
type Props = {
icon: keyof typeof MaterialCommunityIcons.glyphMap;
backgroundColor: string;
flex: number;
onPressButton: () => void;
children: string;
};
export const UsefulBox: FC<Props> = (props) => {
const { icon, backgroundColor, flex, onPressButton, children } = props;
const { fixed } = useThemeColors();
const { fontScale, moderateScale } = useResponsive();
return (
<TouchableOpacity
style={{
flex: flex,
backgroundColor: backgroundColor,
padding: 5,
alignItems: "center",
margin: 2,
}}
onPress={onPressButton}
>
<MaterialCommunityIcons name={icon} color={fixed.textOnPrimary} size={moderateScale(50)} />
<Text style={{ color: fixed.textOnPrimary, fontWeight: "bold", fontSize: fontScale(16) }}>
{children}
</Text>
</TouchableOpacity>
);
};