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,
|
2021-03-21 14:14:10 +01:00
|
|
|
{ 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: {
|
2021-02-27 17:25:01 +01:00
|
|
|
fontSize: 18,
|
|
|
|
fontWeight: StyleConstants.Font.Weight.Bold
|
2021-01-14 00:43:35 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
export default HeaderCenter
|