import { Ionicons } from "@expo/vector-icons";
import { router } from "expo-router";
import { Pressable, Text, View } from "react-native";
import { IoniconsType } from "../lib/types";
export interface ICustomHeader {
title: string;
onBackPress?: () => void;
showBackButton?: boolean;
rightIcon?: IoniconsType;
onRightPress?: () => void;
}
export function CustomHeader({
title,
onBackPress,
showBackButton,
rightIcon,
onRightPress,
}: ICustomHeader) {
function handleBackPress() {
if (onBackPress) {
onBackPress();
return;
}
router.back();
}
return (
{showBackButton && (
)}
{title}
{rightIcon && (
)}
);
}
export interface ModalTemplateProps extends ICustomHeader {
children?: React.ReactNode;
}
export function ModalTemplate({
children,
...headerProps
}: ModalTemplateProps) {
return (
{children}
);
}