tooot/src/components/Header/Left.tsx

42 lines
951 B
TypeScript
Raw Normal View History

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
2020-12-12 12:49:29 +01:00
icon?: any
2020-11-30 00:24:53 +01:00
}
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: {
2020-12-03 01:28:56 +01:00
fontSize: StyleConstants.Font.Size.M
2020-11-30 00:24:53 +01:00
}
})
2020-12-12 12:49:29 +01:00
export default HeaderLeft