1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

iOS almost working

This commit is contained in:
Zhiyuan Zheng
2021-01-30 01:29:15 +01:00
parent 9c36052c2a
commit 247f7a7982
126 changed files with 1829 additions and 1341 deletions

View File

@ -0,0 +1,50 @@
import Button from '@components/Button'
import haptics from '@root/components/haptics'
import { localRemoveInstance } from '@utils/slices/instancesSlice'
import { StyleConstants } from '@utils/styles/constants'
import React from 'react'
import { useTranslation } from 'react-i18next'
import { Alert } from 'react-native'
import { useQueryClient } from 'react-query'
import { useDispatch } from 'react-redux'
const Logout: React.FC = () => {
const { t } = useTranslation('meRoot')
const dispatch = useDispatch()
const queryClient = useQueryClient()
return (
<Button
type='text'
content={t('content.logout.button')}
style={{
marginHorizontal: StyleConstants.Spacing.Global.PagePadding * 2,
marginBottom: StyleConstants.Spacing.Global.PagePadding * 2
}}
destructive
onPress={() =>
Alert.alert(
t('content.logout.alert.title'),
t('content.logout.alert.message'),
[
{
text: t('content.logout.alert.buttons.logout'),
style: 'destructive' as const,
onPress: () => {
haptics('Success')
queryClient.clear()
dispatch(localRemoveInstance())
}
},
{
text: t('content.logout.alert.buttons.cancel'),
style: 'cancel' as const
}
]
)
}
/>
)
}
export default Logout