40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
import { View, Text, TouchableOpacity } from 'react-native';
|
|
import { useAppTheme } from '@theme';
|
|
import { BackIcon } from '@icons/backIcon';
|
|
import { getStyles } from './screenHeader.styles';
|
|
|
|
interface ScreenHeaderProps {
|
|
title: string;
|
|
onBack?: () => void;
|
|
showBack?: boolean;
|
|
rightElement?: React.ReactNode;
|
|
}
|
|
|
|
export const ScreenHeader: React.FC<ScreenHeaderProps> = ({
|
|
title,
|
|
onBack,
|
|
showBack = true,
|
|
rightElement,
|
|
}) => {
|
|
const { colors } = useAppTheme();
|
|
const styles = getStyles(colors);
|
|
|
|
return (
|
|
<View style={styles.container}>
|
|
<View style={styles.leftContainer}>
|
|
{showBack && onBack && (
|
|
<TouchableOpacity style={styles.backButton} onPress={onBack} activeOpacity={0.7}>
|
|
<BackIcon size={24} color={colors.text} />
|
|
</TouchableOpacity>
|
|
)}
|
|
<Text style={styles.title} numberOfLines={1}>
|
|
{title}
|
|
</Text>
|
|
</View>
|
|
{rightElement && <View style={styles.rightContainer}>{rightElement}</View>}
|
|
</View>
|
|
);
|
|
};
|
|
export default ScreenHeader;
|