import React from "react"; import { View, StyleSheet, Pressable, Platform } from "react-native"; import { Ionicons } from "@expo/vector-icons"; import { useColorScheme } from "@/hooks/useColorScheme"; import { Colors } from "@/constants/Colors"; import { ThemedText } from "./ThemedText"; import { useRouter } from "expo-router"; import { useSafeAreaInsets } from "react-native-safe-area-context"; type BackNavigationHeaderProps = { title?: string; onBackPress?: () => void; rightElement?: React.ReactNode; style?: any; }; export function BackNavigationHeader({ title, onBackPress, rightElement, style, }: BackNavigationHeaderProps) { const colorScheme = useColorScheme(); const colors = Colors[colorScheme ?? "light"]; const { top } = useSafeAreaInsets(); const router = useRouter(); const handleBackPress = () => { if (onBackPress) { onBackPress(); } else { router.back(); } }; return ( {title && ( {title} )} {rightElement ? {rightElement} : null} ); } const styles = StyleSheet.create({ container: { zIndex: 1000, }, content: { flexDirection: "row", alignItems: "center", paddingHorizontal: 16, paddingVertical: 4, }, backButton: { width: 32, height: 32, borderRadius: 16, alignItems: "center", justifyContent: "center", marginRight: 8, zIndex: 10, }, titleContainer: { flex: 1, alignItems: "center", }, titlePill: { flexShrink: 1, backgroundColor: "rgba(0, 0, 0, 0.4)", paddingHorizontal: 12, paddingVertical: 6, borderRadius: 16, overflow: "hidden", }, title: { fontSize: 18, fontWeight: "600", }, rightContainer: { minWidth: 40, alignItems: "flex-end", }, });