40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import Styles from '@/constants/Styles';
|
|
import { useTheme } from "@/providers/ThemeProvider";
|
|
import { useRouter } from 'expo-router';
|
|
import { Platform, Text, View } from 'react-native';
|
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
import ButtonBackHeader from './buttonBackHeader';
|
|
|
|
type Props = {
|
|
title: string;
|
|
right?: React.ReactNode;
|
|
showBack?: boolean;
|
|
onPressLeft?: () => void
|
|
left?: React.ReactNode
|
|
};
|
|
|
|
export default function AppHeader({ title, right, showBack = true, onPressLeft, left }: Props) {
|
|
const insets = useSafeAreaInsets();
|
|
const router = useRouter();
|
|
const { colors } = useTheme();
|
|
|
|
return (
|
|
<View style={[Styles.headerContainer, Platform.OS === 'ios' ? Styles.pb05 : Styles.pb13, { backgroundColor: colors.header, paddingTop: Platform.OS === 'ios' ? insets.top : 10 }]}>
|
|
<View style={Styles.headerApp}>
|
|
<View style={[Styles.rowItemsCenter]}>
|
|
{showBack ? (
|
|
<ButtonBackHeader onPress={onPressLeft} />
|
|
) :
|
|
left ? left :
|
|
(
|
|
<View style={Styles.headerSide} />
|
|
)}
|
|
|
|
<Text style={[Styles.headerTitle, Styles.ml05]}>{title}</Text>
|
|
</View>
|
|
<View style={Styles.headerSide}>{right}</View>
|
|
</View>
|
|
</View>
|
|
);
|
|
}
|