2020-11-30 00:24:53 +01:00
|
|
|
import { Feather } from '@expo/vector-icons'
|
|
|
|
import React from 'react'
|
|
|
|
import { Pressable, StyleSheet, Text } from 'react-native'
|
|
|
|
|
|
|
|
import { useTheme } from 'src/utils/styles/ThemeManager'
|
|
|
|
import { StyleConstants } from 'src/utils/styles/constants'
|
|
|
|
|
|
|
|
export interface Props {
|
|
|
|
onPress: () => void
|
|
|
|
text?: string
|
|
|
|
icon?: string
|
|
|
|
}
|
|
|
|
|
|
|
|
const HeaderLeft: React.FC<Props> = ({ onPress, text, icon }) => {
|
|
|
|
const { theme } = useTheme()
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Pressable onPress={onPress} style={styles.base}>
|
|
|
|
{text ? (
|
2020-12-01 00:44:28 +01:00
|
|
|
<Text style={[styles.text, { color: theme.primary }]}>{text}</Text>
|
2020-11-30 00:24:53 +01:00
|
|
|
) : (
|
|
|
|
<Feather
|
|
|
|
name={icon || 'chevron-left'}
|
2020-12-01 00:44:28 +01:00
|
|
|
color={theme.primary}
|
2020-11-30 00:24:53 +01:00
|
|
|
size={StyleConstants.Font.Size.L}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</Pressable>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
base: {
|
|
|
|
paddingRight: StyleConstants.Spacing.S
|
|
|
|
},
|
|
|
|
text: {
|
|
|
|
fontSize: StyleConstants.Font.Size.L
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
export default HeaderLeft
|