Files
jrshikoku/components/Apps/ReloadButton.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

62 lines
1.6 KiB
TypeScript

import React, { FC } from "react";
import {
View,
TouchableOpacity,
Platform,
TouchableOpacityProps,
TextStyle,
} from "react-native";
import { Ionicons } from "@expo/vector-icons";
import Constants from "expo-constants";
import { useThemeColors } from "@/lib/theme";
import { useTrainMenu } from "../../stateBox/useTrainMenu";
const top = Platform.OS == "ios" ? Constants.statusBarHeight : 0;
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 styles: stylesType = {
touch: {
position: "absolute",
top,
right: 10 + right,
width: 50,
height: 50,
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={30} />
<View style={{ flex: 1 }} />
</TouchableOpacity>
);
};