Files
jrshikoku/components/Apps/MapsButton.tsx
harukin-expo-dev-env fc88bd52f7 feat: Samsung DeXレスポンシブ対応 - lib/responsive.ts追加、主要コンポーネントにスケーリング適用
- useResponsive()フックを作成(fontScale/verticalScale/moderateScale)
- ベースデザイン: iPhone 14 Pro (393x852)、スケールダウンのみ(最大1.0)
- DynamicHeaderScrollView: ヘッダー高さにverticalScale適用
- EachTrainInfoCore: maxHeight緩和(70→80%)、ハンドラーサイズスケーリング
- StateBox/PositionBox/ScrollStickyContent/HeaderText: fontScale適用
- DataConnectedButton/EachStopList: fontScale+moderateScale適用
- JRSTraInfo/StationDeteilView: ハンドラー+フォントスケーリング
- ReloadButton/MapsButton/NewMenu: ボタンサイズ+フォントスケーリング
- useDeviceOrientationChange: 全Android端末でisLandscape=false
2026-03-29 15:23:28 +00:00

64 lines
1.6 KiB
TypeScript

import React, { FC } from "react";
import {
View,
Text,
TouchableOpacity,
TouchableOpacityProps,
TextStyle,
} from "react-native";
import { useThemeColors } from "@/lib/theme";
import { useTrainMenu } from "../../stateBox/useTrainMenu";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { useResponsive } from "@/lib/responsive";
type MapsButtonProps = {
onPress: () => void;
};
type stylesType = {
touch: TouchableOpacityProps["style"];
text: TextStyle;
};
export const MapsButton: FC<MapsButtonProps> = ({ onPress }) => {
const { fixed } = useThemeColors();
const { mapSwitch } = useTrainMenu();
const { top } = useSafeAreaInsets();
const { moderateScale, fontScale } = useResponsive();
const buttonSize = moderateScale(50);
const styles: stylesType = {
touch: {
position: "absolute",
top,
left: 10,
width: buttonSize,
height: buttonSize,
backgroundColor: fixed.primary,
borderColor: fixed.textOnPrimary,
borderStyle: "solid",
borderWidth: 1,
borderRadius: 50,
alignContent: "center",
alignSelf: "center",
alignItems: "center",
display: mapSwitch == "true" ? "flex" : "none",
zIndex: 1000,
},
text: {
textAlign: "center",
width: "auto",
height: "auto",
textAlignVertical: "center",
fontWeight: "bold",
color: fixed.textOnPrimary,
fontSize: fontScale(20),
},
};
return (
<TouchableOpacity onPress={onPress} style={styles.touch}>
<View style={{ flex: 1 }} />
<Text style={styles.text}></Text>
<View style={{ flex: 1 }} />
</TouchableOpacity>
);
};