COMPONENT
import { View, Text, Image } from 'react-native';
import { BorderlessButton } from 'react-native-gesture-handler';
import { useNavigation } from '@react-navigation/native';
import { Archivo_400Regular, Archivo_700Bold, useFonts } from '@expo-google-fonts/archivo';
import { Poppins_400Regular, Poppins_600SemiBold } from '@expo-google-fonts/poppins';
import backIcon from '../../assets/images/icons/back.png';
import logoImg from '../../assets/images/logo.png';
import styles from './styles';
interface PageHeaderProps {
title: string;
headerRight?: ReactNode;
children?: ReactNode;
}
const PageHeader: React.FC<PageHeaderProps> = ({ title, headerRight, children }: PageHeaderProps) => {
const { navigate } = useNavigation();
function handleGoBack() {
navigate('Landing');
}
return (
<View style={styles.container}>
<View style={styles.topBar}>
<BorderlessButton onPress={handleGoBack}>
<Image source={backIcon} resizeMode="contain" />
</BorderlessButton>
<Image source={logoImg} resizeMode="contain" />
</View>
<View style={styles.header}>
<Text style={styles.title}>{title}</Text>
{headerRight}
</View>`enter code here`
{children}
</View>
);
}
export default PageHeader; ```
_____________________________________________________________________________________________________
**STYLE.CSS**
``` import { StyleSheet } from "react-native";
const styles = StyleSheet.create({
container: {
padding: 40,
backgroundColor: '#8257e5',
},
topBar: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between'
},
header: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
},
title: {
fontFamily: 'Archivo_700Bold',
color: '#FFF',
fontSize: 24,
lineHeight: 32,
maxWidth: 160,
marginVertical: 40,
},
});
export default styles; ```