- 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
35 lines
982 B
TypeScript
35 lines
982 B
TypeScript
import React, { FC } from "react";
|
|
import { Text, TouchableOpacity } from "react-native";
|
|
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
|
import { useThemeColors } from "@/lib/theme";
|
|
|
|
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();
|
|
return (
|
|
<TouchableOpacity
|
|
style={{
|
|
flex: flex,
|
|
backgroundColor: backgroundColor,
|
|
padding: 5,
|
|
alignItems: "center",
|
|
margin: 2,
|
|
}}
|
|
onPress={onPressButton}
|
|
>
|
|
<MaterialCommunityIcons name={icon} color={fixed.textOnPrimary} size={50} />
|
|
<Text style={{ color: fixed.textOnPrimary, fontWeight: "bold", fontSize: 16 }}>
|
|
{children}
|
|
</Text>
|
|
</TouchableOpacity>
|
|
);
|
|
};
|