tooot/src/screens/Compose/Root/Header/PostingAs.tsx

42 lines
1.0 KiB
TypeScript
Raw Normal View History

2021-02-20 19:12:44 +01:00
import {
getInstanceAccount,
getInstanceUri
} from '@utils/slices/instancesSlice'
2021-01-19 01:13:45 +01:00
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React from 'react'
import { useTranslation } from 'react-i18next'
import { StyleSheet, Text } from 'react-native'
2021-01-24 02:25:43 +01:00
import { useSelector } from 'react-redux'
2021-01-19 01:13:45 +01:00
2021-01-24 02:25:43 +01:00
const ComposePostingAs = React.memo(
() => {
const { t } = useTranslation('sharedCompose')
const { theme } = useTheme()
2021-01-19 01:13:45 +01:00
2021-02-20 19:12:44 +01:00
const instanceAccount = useSelector(
getInstanceAccount,
2021-02-10 00:40:44 +01:00
(prev, next) => prev?.acct === next?.acct
)
2021-02-20 19:12:44 +01:00
const instanceUri = useSelector(getInstanceUri)
2021-01-19 01:13:45 +01:00
2021-01-24 02:25:43 +01:00
return (
<Text style={[styles.text, { color: theme.secondary }]}>
{t('content.root.header.postingAs', {
2021-02-20 19:12:44 +01:00
acct: instanceAccount?.acct,
domain: instanceUri
2021-01-24 02:25:43 +01:00
})}
</Text>
)
},
() => true
)
2021-01-19 01:13:45 +01:00
const styles = StyleSheet.create({
text: {
...StyleConstants.FontStyle.S
}
})
export default ComposePostingAs