1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00
Files
tooot/src/components/AccountButton.tsx
xmflsct 6ce78e94f8 Fix #271
Added follow as menu option
2023-01-08 16:59:35 +01:00

38 lines
929 B
TypeScript

import { useNavigation } from '@react-navigation/native'
import { ReadableAccountType, setAccount } from '@utils/storage/actions'
import { StyleConstants } from '@utils/styles/constants'
import React from 'react'
import Button from './Button'
import haptics from './haptics'
interface Props {
account: ReadableAccountType
additionalActions?: () => void
}
const AccountButton: React.FC<Props> = ({ account, additionalActions }) => {
const navigation = useNavigation()
return (
<Button
type='text'
selected={account.active}
style={{
marginBottom: StyleConstants.Spacing.M,
marginRight: StyleConstants.Spacing.M
}}
content={account.acct}
onPress={() => {
haptics('Light')
setAccount(account.key)
navigation.goBack()
if (additionalActions) {
additionalActions()
}
}}
/>
)
}
export default AccountButton