index.tsx 826 B

123456789101112131415161718192021222324252627282930
  1. import React, { FC, ReactNode } from 'react';
  2. import { Text, TouchableOpacity, View } from 'react-native';
  3. import { useNavigation } from '@react-navigation/native';
  4. import { styles } from './style';
  5. import ChevronLeft from '../../../assets/icons/chevron-left.svg';
  6. type Props = {
  7. label: string;
  8. rightElement?: ReactNode;
  9. };
  10. export const Header: FC<Props> = ({ label, rightElement }) => {
  11. const navigation = useNavigation();
  12. // navigation.setOptions() TODO
  13. return (
  14. <View style={styles.wrapper}>
  15. <TouchableOpacity onPress={() => navigation.goBack()}>
  16. <View style={styles.chevronWrapper}>
  17. <ChevronLeft />
  18. </View>
  19. </TouchableOpacity>
  20. <Text style={styles.label}>{label}</Text>
  21. <View>{rightElement ? rightElement : <Text>Text</Text>}</View>
  22. </View>
  23. );
  24. };