Files
jrshikoku/components/ActionSheetComponents/EachTrainInfoCore/trainViewIcon.tsx
harukin-expo-dev-env 10df37d0a2 feat: Expo SDK 52→53 upgrade + full dark mode support
- Upgrade Expo SDK 52→53 (React 18→19, RN 0.76→0.79)
- Remove deprecated packages (native-base, react-native-elements)
- Migrate to @rneui/themed 5.0.0 + modular vector icons
- Fix breaking changes: defaultProps, BackHandler, notifications, key props
- Add Babel plugin for font scaling (replaces Text.defaultProps)
- Configure expo-font for native font preloading
- Add complete dark mode theme system (lib/theme/)
  - AppThemeProvider + useThemeColors hook
  - Light/dark/fixed color token definitions
  - Migrate ~60 files across all screens to use theme colors
- Set userInterfaceStyle to "automatic" for system dark mode
2026-03-17 22:19:46 +00:00

45 lines
1.3 KiB
TypeScript

import React, { FC, useEffect, useState } from "react";
import { Ionicons } from "@expo/vector-icons";
import { LayoutAnimation } from "react-native";
import { SheetManager } from "react-native-actions-sheet";
import { getType } from "../../../lib/eachTrainInfoCoreLib/getType";
import { useThemeColors } from "@/lib/theme";
import type { NavigateFunction } from "@/types";
type Props = {
data: { trainNum: string; limited: string };
navigate: NavigateFunction;
from: string;
};
export const TrainViewIcon: FC<Props> = ({ data, navigate, from }) => {
const { fixed } = useThemeColors();
const [isTrainView, setIsTrainView] = useState(false);
//トレインビュー表示対象(特急、マリン)かを判定
useEffect(() => {
if (!data.limited) return () => {};
setIsTrainView(
getType(data.limited.split(":")[0]) &&
!data.limited.split(":")[1].match("サンポート")
);
}, [data.limited]);
const onPressTrainView = () => {
LayoutAnimation.easeInEaseOut(); //setLoadingDelayData(true);
navigate("trainbase", {
info: "train.html?tn=" + data.trainNum,
from,
});
SheetManager.hide("EachTrainInfo");
};
return isTrainView ? (
<Ionicons
name="subway"
color={fixed.textOnPrimary}
size={30}
style={{ margin: 5 }}
onPress={onPressTrainView}
/>
) : (
<></>
);
};