import React, { useContext } from 'react'; import { StyleSheet, Text, View, StyleProp, TextProps, TextStyle } from 'react-native'; import { Typography } from '@app/theme'; import { AppContext } from '@app/context'; import { ThemeColors } from '@app/types/theme'; import Entypo from 'react-native-vector-icons/Entypo'; import { useNavigation } from 'react-navigation-hooks'; const { FontWeights, FontSizes } = Typography; interface GoBackHeaderProps { title?: string, onTitlePress?: () => void, ContentLeft?: React.FC, IconRight?: React.FC, iconSize: number, titleStyle?: StyleProp }; const GoBackHeader: React.FC = ({ title, onTitlePress, ContentLeft, IconRight, iconSize, titleStyle }) => { const { theme } = useContext(AppContext); const { goBack } = useNavigation(); const navigateBack = () => goBack(); return ( {ContentLeft && } {title && {title}} {IconRight && } ); }; const styles = (theme = {} as ThemeColors) => StyleSheet.create({ container: { flexDirection: 'row', alignItems: 'center', padding: 10 }, title: { ...FontWeights.Bold, ...FontSizes.Label, color: theme.text01, marginLeft: 20 }, underline: { marginTop: 16, height: 2, width: 20, borderRadius: 10, backgroundColor: theme.text01 } }); export default GoBackHeader;