- 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
64 lines
1.7 KiB
TypeScript
64 lines
1.7 KiB
TypeScript
import React, { FC } from "react";
|
|
import {
|
|
View,
|
|
TouchableOpacity,
|
|
TouchableOpacityProps,
|
|
TextStyle,
|
|
} from "react-native";
|
|
import { Ionicons } from "@expo/vector-icons";
|
|
import { useThemeColors } from "@/lib/theme";
|
|
import { useTrainMenu } from "../../stateBox/useTrainMenu";
|
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
import { useResponsive } from "@/lib/responsive";
|
|
|
|
type stylesType = {
|
|
touch: TouchableOpacityProps["style"];
|
|
text: TextStyle;
|
|
};
|
|
type ReloadButton = {
|
|
onPress: () => void;
|
|
right: number;
|
|
|
|
}
|
|
export const ReloadButton:FC<ReloadButton> = ({ onPress, right }) => {
|
|
const { fixed } = useThemeColors();
|
|
const { mapSwitch, LoadError = false } = useTrainMenu();
|
|
const { top } = useSafeAreaInsets();
|
|
const { moderateScale } = useResponsive();
|
|
const buttonSize = moderateScale(50);
|
|
const styles: stylesType = {
|
|
touch: {
|
|
position: "absolute",
|
|
top,
|
|
right: 10 + right,
|
|
width: buttonSize,
|
|
height: buttonSize,
|
|
backgroundColor: LoadError ? "red" : fixed.primary,
|
|
borderColor: fixed.textOnPrimary,
|
|
borderStyle: "solid",
|
|
borderWidth: 1,
|
|
borderRadius: 50,
|
|
alignContent: "center",
|
|
alignSelf: "center",
|
|
alignItems: "center",
|
|
display: mapSwitch,
|
|
zIndex: 1000,
|
|
},
|
|
text: {
|
|
textAlign: "center",
|
|
width: "auto",
|
|
height: "auto",
|
|
textAlignVertical: "center",
|
|
fontWeight: "bold",
|
|
color: fixed.textOnPrimary,
|
|
},
|
|
};
|
|
return (
|
|
<TouchableOpacity onPress={onPress} style={styles.touch}>
|
|
<View style={{ flex: 1 }} />
|
|
<Ionicons name="reload" color={fixed.textOnPrimary} size={moderateScale(30)} />
|
|
<View style={{ flex: 1 }} />
|
|
</TouchableOpacity>
|
|
);
|
|
};
|