tooot/src/screens/Tabs/Shared/Attachments.tsx

56 lines
1.6 KiB
TypeScript
Raw Normal View History

2022-12-03 16:50:54 +01:00
import { HeaderLeft } from '@components/Header'
import { ParseEmojis } from '@components/Parse'
import CustomText from '@components/Text'
2021-02-08 23:47:20 +01:00
import Timeline from '@components/Timeline'
2021-08-29 15:25:38 +02:00
import { TabSharedStackScreenProps } from '@utils/navigation/navigators'
2021-02-27 16:33:54 +01:00
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
2022-12-03 16:50:54 +01:00
import { useTheme } from '@utils/styles/ThemeManager'
import React, { useEffect } from 'react'
import { Trans } from 'react-i18next'
2021-01-16 00:00:31 +01:00
2022-12-03 16:50:54 +01:00
const TabSharedAttachments: React.FC<TabSharedStackScreenProps<'Tab-Shared-Attachments'>> = ({
navigation,
2021-01-16 00:00:31 +01:00
route: {
params: { account }
}
}) => {
2022-12-03 16:50:54 +01:00
const { colors } = useTheme()
useEffect(() => {
navigation.setOptions({
headerLeft: () => <HeaderLeft onPress={() => navigation.goBack()} background />,
headerTitle: () => (
<CustomText numberOfLines={1}>
<Trans
2022-12-23 15:53:40 +01:00
ns='screenTabs'
i18nKey='shared.attachments.name'
2022-12-03 16:50:54 +01:00
components={[
<ParseEmojis
content={account.display_name || account.username}
emojis={account.emojis}
fontBold
/>,
<CustomText
fontStyle='M'
style={{ color: colors.primaryDefault }}
fontWeight='Bold'
/>
]}
/>
</CustomText>
2023-01-26 23:35:52 +01:00
),
headerBackVisible: false
2022-12-03 16:50:54 +01:00
})
2023-01-04 22:39:29 +01:00
navigation.setParams({ queryKey })
2022-12-03 16:50:54 +01:00
}, [])
2021-02-27 16:33:54 +01:00
const queryKey: QueryKeyTimeline = [
'Timeline',
2023-01-02 02:08:12 +01:00
{ page: 'Account', id: account.id, exclude_reblogs: true, only_media: true }
2021-02-27 16:33:54 +01:00
]
2022-12-03 16:50:54 +01:00
return <Timeline queryKey={queryKey} />
2021-01-16 00:00:31 +01:00
}
2021-01-30 01:29:15 +01:00
export default TabSharedAttachments