tooot/src/components/Header/Center.tsx

33 lines
785 B
TypeScript
Raw Normal View History

import CustomText from '@components/Text'
2021-01-14 00:43:35 +01:00
import { useTheme } from '@utils/styles/ThemeManager'
import React from 'react'
2022-08-14 22:18:41 +02:00
import { View } from 'react-native'
2021-01-14 00:43:35 +01:00
export interface Props {
2022-08-14 22:18:41 +02:00
content?: string
2021-02-10 00:40:44 +01:00
inverted?: boolean
2022-08-13 00:48:20 +02:00
onPress?: () => void
2021-01-14 00:43:35 +01:00
}
// Used for Android mostly
2022-12-14 23:37:41 +01:00
const HeaderCenter: React.FC<Props> = ({ content, inverted = false, onPress }) => {
2022-08-13 00:48:20 +02:00
const { colors } = useTheme()
2021-01-14 00:43:35 +01:00
2022-08-13 00:48:20 +02:00
return (
2022-08-19 12:22:30 +02:00
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
2022-08-14 22:18:41 +02:00
<CustomText
style={{
color: inverted ? colors.primaryOverlay : colors.primaryDefault
}}
fontSize='L'
fontWeight='Bold'
numberOfLines={1}
children={content}
{...(onPress && { onPress })}
/>
</View>
2022-08-13 00:48:20 +02:00
)
}
2021-01-14 00:43:35 +01:00
export default HeaderCenter