import React from 'react'; import { View, Pressable, Platform, StatusBar } from 'react-native'; import { router } from 'expo-router'; import { Icon } from './Icon'; import { Text } from './Text'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { useTheme } from '~/hooks/useTheme'; interface HeaderProps { title?: string; showBackButton?: boolean; rightComponent?: React.ReactNode; onBackPress?: () => void; backgroundColor?: string; textColor?: string; } export const Header: React.FC = ({ title, showBackButton = true, rightComponent, onBackPress, backgroundColor, textColor, }) => { const insets = useSafeAreaInsets(); const { isDark, colors } = useTheme(); const handleBackPress = () => { if (onBackPress) { onBackPress(); } else { router.back(); } }; // Use theme colors if not explicitly provided const headerBackgroundColor = backgroundColor || (isDark ? colors.tabBarBackground : '#ffffff'); const headerTextColor = textColor || (isDark ? '#ffffff' : '#000000'); const borderColor = isDark ? colors.tabBarBorder : '#e5e7eb'; return ( {/* Left side - Back button */} {showBackButton && ( )} {/* Center - Title */} {title && ( {title} )} {/* Right side - Custom component */} {rightComponent} ); };