tooot/src/components/Header/Center.tsx

37 lines
790 B
TypeScript
Raw Normal View History

2021-01-14 00:43:35 +01:00
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React from 'react'
import { StyleSheet, Text } from 'react-native'
export interface Props {
content: string
2021-02-10 00:40:44 +01:00
inverted?: boolean
2021-01-14 00:43:35 +01:00
}
// Used for Android mostly
const HeaderCenter = React.memo(
2021-02-10 00:40:44 +01:00
({ content, inverted = false }: Props) => {
2021-01-14 00:43:35 +01:00
const { theme } = useTheme()
return (
<Text
2021-02-10 00:40:44 +01:00
style={[
styles.text,
{ color: inverted ? theme.primaryOverlay : theme.primaryDefault }
2021-02-10 00:40:44 +01:00
]}
2021-01-14 00:43:35 +01:00
children={content}
/>
)
},
2021-03-18 23:32:31 +01:00
(prev, next) => prev.content === next.content
2021-01-14 00:43:35 +01:00
)
const styles = StyleSheet.create({
text: {
fontSize: 18,
fontWeight: StyleConstants.Font.Weight.Bold
2021-01-14 00:43:35 +01:00
}
})
export default HeaderCenter